diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Buildpacks.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Buildpacks.java index bf04b62399..6657dcd074 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Buildpacks.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Buildpacks.java @@ -63,6 +63,7 @@ final class Buildpacks { private String getOrderToml() { StringBuilder builder = new StringBuilder(); + builder.append("[[order]]\n\n"); for (Buildpack buildpack : this.buildpacks) { appendToOrderToml(builder, buildpack.getCoordinates()); } @@ -70,15 +71,12 @@ final class Buildpacks { } private void appendToOrderToml(StringBuilder builder, BuildpackCoordinates coordinates) { - builder.append("[[order]]\n"); - builder.append("group = [\n"); - builder.append(" { "); - builder.append("id = \"" + coordinates.getId() + "\""); + builder.append(" [[order.group]]\n"); + builder.append(" id = \"" + coordinates.getId() + "\"\n"); if (StringUtils.hasText(coordinates.getVersion())) { - builder.append(", version = \"" + coordinates.getVersion() + "\""); + builder.append(" version = \"" + coordinates.getVersion() + "\"\n"); } - builder.append(" }\n"); - builder.append("]\n\n"); + builder.append("\n"); } static Buildpacks of(List buildpacks) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpacksTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpacksTests.java index a45b2a7247..0d13924f83 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpacksTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpacksTests.java @@ -94,17 +94,18 @@ class BuildpacksTests { private String getExpectedToml() { StringBuilder toml = new StringBuilder(); toml.append("[[order]]\n"); - toml.append("group = [\n"); - toml.append(" { id = \"example/buildpack1\", version = \"0.0.1\" }\n"); - toml.append("]\n\n"); - toml.append("[[order]]\n"); - toml.append("group = [\n"); - toml.append(" { id = \"example/buildpack2\", version = \"0.0.2\" }\n"); - toml.append("]\n\n"); - toml.append("[[order]]\n"); - toml.append("group = [\n"); - toml.append(" { id = \"example/buildpack3\" }\n"); - toml.append("]\n\n"); + toml.append("\n"); + toml.append(" [[order.group]]\n"); + toml.append(" id = \"example/buildpack1\"\n"); + toml.append(" version = \"0.0.1\"\n"); + toml.append("\n"); + toml.append(" [[order.group]]\n"); + toml.append(" id = \"example/buildpack2\"\n"); + toml.append(" version = \"0.0.2\"\n"); + toml.append("\n"); + toml.append(" [[order.group]]\n"); + toml.append(" id = \"example/buildpack3\"\n"); + toml.append("\n"); return toml.toString(); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/EphemeralBuilderTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/EphemeralBuilderTests.java index 2452003b4f..b0b5b3e792 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/EphemeralBuilderTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/EphemeralBuilderTests.java @@ -146,7 +146,7 @@ class EphemeralBuilderTests extends AbstractJsonTests { assertBuildpackLayerContent(builder, 2, "/cnb/buildpacks/example_buildpack3/0.0.3/buildpack.toml"); File orderDirectory = unpack(getLayer(builder.getArchive(), 3), "order"); assertThat(new File(orderDirectory, "cnb/order.toml")).usingCharset(StandardCharsets.UTF_8) - .hasContent(content("order-versions.toml")); + .hasContent(content("order.toml")); } private void assertBuildpackLayerContent(EphemeralBuilder builder, int index, String s) throws Exception { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/build/order-versions.toml b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/build/order-versions.toml deleted file mode 100644 index 365b2c4952..0000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/build/order-versions.toml +++ /dev/null @@ -1,15 +0,0 @@ -[[order]] -group = [ - { id = "example/buildpack1", version = "0.0.1" } -] - -[[order]] -group = [ - { id = "example/buildpack2", version = "0.0.2" } -] - -[[order]] -group = [ - { id = "example/buildpack3", version = "0.0.3" } -] - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/build/order.toml b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/build/order.toml index 90415774d6..f317035450 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/build/order.toml +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/build/order.toml @@ -1,15 +1,14 @@ [[order]] -group = [ - { id = "example/buildpack1" } -] -[[order]] -group = [ - { id = "example/buildpack2" } -] + [[order.group]] + id = "example/buildpack1" + version = "0.0.1" -[[order]] -group = [ - { id = "example/buildpack3" } -] + [[order.group]] + id = "example/buildpack2" + version = "0.0.2" + + [[order.group]] + id = "example/buildpack3" + version = "0.0.3" diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java index e1f9f03c97..b433d743f7 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java @@ -203,7 +203,7 @@ class BootBuildImageIntegrationTests { } @TestTemplate - void buildsImageWithBuildpackFromImage() throws IOException { + void buildsImageWithBuildpacksFromImages() throws IOException { writeMainClass(); writeLongNameResource(); BuildResult result = this.gradleBuild.build("bootBuildImage", "--pullPolicy=IF_NOT_PRESENT"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests-buildsImageWithBuildpackFromImage.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests-buildsImageWithBuildpackFromImage.gradle deleted file mode 100644 index 5890a4fc65..0000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests-buildsImageWithBuildpackFromImage.gradle +++ /dev/null @@ -1,11 +0,0 @@ -plugins { - id 'java' - id 'org.springframework.boot' version '{version}' -} - -sourceCompatibility = '1.8' -targetCompatibility = '1.8' - -bootBuildImage { - buildpacks = [ "gcr.io/paketo-buildpacks/java:latest" ] -} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests-buildsImageWithBuildpacksFromImages.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests-buildsImageWithBuildpacksFromImages.gradle new file mode 100644 index 0000000000..b6546bc6aa --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests-buildsImageWithBuildpacksFromImages.gradle @@ -0,0 +1,13 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +bootBuildImage { + buildpacks = ["gcr.io/paketo-buildpacks/bellsoft-liberica:latest", + "gcr.io/paketo-buildpacks/executable-jar:latest", + "gcr.io/paketo-buildpacks/spring-boot:latest"] +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-image-custom-buildpacks/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-image-custom-buildpacks/pom.xml index 360d426dd6..4d7308ea20 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-image-custom-buildpacks/pom.xml +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-image-custom-buildpacks/pom.xml @@ -24,7 +24,9 @@ - paketo-buildpacks/java + gcr.io/paketo-buildpacks/bellsoft-liberica:latest + gcr.io/paketo-buildpacks/executable-jar:latest + gcr.io/paketo-buildpacks/spring-boot:latest