From 081ef2d905089b8ecf0e91a119fe87a6e4ef4340 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 1 Oct 2020 15:21:08 +0100 Subject: [PATCH] Update BootJar to support Gradle's configuration cache See gh-22922 --- .../boot/gradle/tasks/bundling/BootJar.java | 21 +++++++++++- .../AbstractBootArchiveIntegrationTests.java | 18 +++++----- .../bundling/BootJarIntegrationTests.java | 33 +++++++++---------- .../bundling/BootWarIntegrationTests.java | 3 ++ .../BootJarIntegrationTests-basicBuild.gradle | 8 +++++ ...hLayerToolsAndThenWithoutLayerTools.gradle | 11 +++++++ ...BuiltWithoutLayersAndThenWithLayers.gradle | 11 +++++++ ...DateWhenLaunchScriptPropertyChanges.gradle | 11 +++++++ ...riptWasIncludedAndThenIsNotIncluded.gradle | 9 +++++ ...riptWasNotIncludedAndThenIsIncluded.gradle | 9 +++++ ...grationTests-upToDateWhenBuiltTwice.gradle | 8 +++++ ...nBuiltTwiceWithLaunchScriptIncluded.gradle | 9 +++++ ...ltLayeredAndThenWithExplicitLayered.gradle | 9 +++++ .../bundling/BootJarIntegrationTests.gradle | 19 ----------- ...DateWhenLaunchScriptPropertyChanges.gradle | 11 +++++++ ...riptWasIncludedAndThenIsNotIncluded.gradle | 9 +++++ ...riptWasNotIncludedAndThenIsIncluded.gradle | 9 +++++ 17 files changed, 160 insertions(+), 48 deletions(-) create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-basicBuild.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenBuiltWithoutLayersAndThenWithLayers.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptPropertyChanges.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltTwice.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltTwiceWithLaunchScriptIncluded.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered.gradle delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptPropertyChanges.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded.gradle create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded.gradle diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java index 4686b4348b..ea483ff099 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java @@ -19,6 +19,7 @@ package org.springframework.boot.gradle.tasks.bundling; import java.io.File; import java.util.Collections; import java.util.concurrent.Callable; +import java.util.function.Function; import org.gradle.api.Action; import org.gradle.api.Project; @@ -72,7 +73,7 @@ public class BootJar extends Jar implements BootArchive { * Creates a new {@code BootJar} task. */ public BootJar() { - this.support = new BootArchiveSupport(LAUNCHER, this::isLibrary, this::resolveZipCompression); + this.support = new BootArchiveSupport(LAUNCHER, new LibrarySpec(), new ZipCompressionResolver()); this.bootInfSpec = getProject().copySpec().into("BOOT-INF"); this.mainClass = getProject().getObjects().property(String.class); configureBootInfSpec(this.bootInfSpec); @@ -325,4 +326,22 @@ public class BootJar extends Jar implements BootArchive { return this.resolvedDependencies; } + private final class LibrarySpec implements Spec { + + @Override + public boolean isSatisfiedBy(FileCopyDetails details) { + return isLibrary(details); + } + + } + + private final class ZipCompressionResolver implements Function { + + @Override + public ZipCompression apply(FileCopyDetails details) { + return resolveZipCompression(details); + } + + } + } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java index 8912a01647..c4e2476281 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java @@ -32,7 +32,6 @@ import org.gradle.testkit.runner.TaskOutcome; import org.gradle.testkit.runner.UnexpectedBuildFailure; import org.junit.jupiter.api.TestTemplate; -import org.springframework.boot.gradle.junit.GradleCompatibility; import org.springframework.boot.gradle.testkit.GradleBuild; import org.springframework.boot.loader.tools.FileUtils; @@ -43,7 +42,6 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Andy Wilkinson */ -@GradleCompatibility abstract class AbstractBootArchiveIntegrationTests { private final String taskName; @@ -99,25 +97,25 @@ abstract class AbstractBootArchiveIntegrationTests { @TestTemplate void notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded() { - assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome()) - .isEqualTo(TaskOutcome.SUCCESS); - assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName) + assertThat(this.gradleBuild.scriptProperty("launchScript", "").build(this.taskName).task(":" + this.taskName) .getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(this.gradleBuild.scriptProperty("launchScript", "launchScript()").build(this.taskName) + .task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS); } @TestTemplate void notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded() { - assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome()) - .isEqualTo(TaskOutcome.SUCCESS); - assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName) + assertThat(this.gradleBuild.scriptProperty("launchScript", "launchScript()").build(this.taskName) + .task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(this.gradleBuild.scriptProperty("launchScript", "").build(this.taskName).task(":" + this.taskName) .getOutcome()).isEqualTo(TaskOutcome.SUCCESS); } @TestTemplate void notUpToDateWhenLaunchScriptPropertyChanges() { - assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", "-PlaunchScriptProperty=foo", this.taskName) + assertThat(this.gradleBuild.scriptProperty("launchScriptProperty", "alpha").build(this.taskName) .task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS); - assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", "-PlaunchScriptProperty=bar", this.taskName) + assertThat(this.gradleBuild.scriptProperty("launchScriptProperty", "bravo").build(this.taskName) .task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.java index 476af25b15..361ca73c7c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.java @@ -43,6 +43,7 @@ import org.gradle.testkit.runner.TaskOutcome; import org.gradle.testkit.runner.UnexpectedBuildFailure; import org.junit.jupiter.api.TestTemplate; +import org.springframework.boot.gradle.junit.GradleCompatibility; import org.springframework.boot.loader.tools.JarModeLibrary; import org.springframework.util.StringUtils; @@ -55,43 +56,39 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Madhura Bhave * @author Paddy Drury */ +@GradleCompatibility(configurationCache = true) class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests { BootJarIntegrationTests() { super("bootJar", "BOOT-INF/lib/", "BOOT-INF/classes/"); } - @TestTemplate - void upToDateWhenBuiltTwiceWithLayers() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure { - assertThat(this.gradleBuild.build("-PcustomizeLayered=true", "bootJar").task(":bootJar").getOutcome()) - .isEqualTo(TaskOutcome.SUCCESS); - assertThat(this.gradleBuild.build("-PcustomizeLayered=true", "bootJar").task(":bootJar").getOutcome()) - .isEqualTo(TaskOutcome.UP_TO_DATE); - } - @TestTemplate void upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure { - assertThat(this.gradleBuild.build("bootJar").task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); - assertThat(this.gradleBuild.build("-PcustomizeLayered=true", "bootJar").task(":bootJar").getOutcome()) - .isEqualTo(TaskOutcome.UP_TO_DATE); + assertThat(this.gradleBuild.scriptProperty("layered", "").build("bootJar").task(":bootJar").getOutcome()) + .isEqualTo(TaskOutcome.SUCCESS); + assertThat( + this.gradleBuild.scriptProperty("layered", "layered {}").build("bootJar").task(":bootJar").getOutcome()) + .isEqualTo(TaskOutcome.UP_TO_DATE); } @TestTemplate void notUpToDateWhenBuiltWithoutLayersAndThenWithLayers() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure { - assertThat(this.gradleBuild.build("-PcustomizeLayered=true", "-PdisableLayers=true", "bootJar").task(":bootJar") - .getOutcome()).isEqualTo(TaskOutcome.SUCCESS); - assertThat(this.gradleBuild.build("-PcustomizeLayered=true", "bootJar").task(":bootJar").getOutcome()) - .isEqualTo(TaskOutcome.SUCCESS); + assertThat(this.gradleBuild.scriptProperty("layerEnablement", "enabled = false").build("bootJar") + .task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(this.gradleBuild.scriptProperty("layerEnablement", "enabled = true").build("bootJar") + .task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); } @TestTemplate void notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure { - assertThat(this.gradleBuild.build("bootJar").task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); - assertThat(this.gradleBuild.build("-PcustomizeLayered=true", "-PexcludeTools=true", "bootJar").task(":bootJar") - .getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(this.gradleBuild.scriptProperty("layerTools", "").build("bootJar").task(":bootJar").getOutcome()) + .isEqualTo(TaskOutcome.SUCCESS); + assertThat(this.gradleBuild.scriptProperty("layerTools", "includeLayerTools = false").build("bootJar") + .task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); } @TestTemplate diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests.java index aa6375bfb2..32bfef20e9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests.java @@ -16,11 +16,14 @@ package org.springframework.boot.gradle.tasks.bundling; +import org.springframework.boot.gradle.junit.GradleCompatibility; + /** * Integration tests for {@link BootJar}. * * @author Andy Wilkinson */ +@GradleCompatibility class BootWarIntegrationTests extends AbstractBootArchiveIntegrationTests { BootWarIntegrationTests() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-basicBuild.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-basicBuild.gradle new file mode 100644 index 0000000000..be0e82ef6d --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-basicBuild.gradle @@ -0,0 +1,8 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +bootJar { + mainClass = 'com.example.Application' +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools.gradle new file mode 100644 index 0000000000..7530a605b9 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools.gradle @@ -0,0 +1,11 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +bootJar { + mainClass = 'com.example.Application' + layered { + {layerTools} + } +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenBuiltWithoutLayersAndThenWithLayers.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenBuiltWithoutLayersAndThenWithLayers.gradle new file mode 100644 index 0000000000..b6b9c39402 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenBuiltWithoutLayersAndThenWithLayers.gradle @@ -0,0 +1,11 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +bootJar { + mainClass = 'com.example.Application' + layered { + {layerEnablement} + } +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptPropertyChanges.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptPropertyChanges.gradle new file mode 100644 index 0000000000..36e7a1e38b --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptPropertyChanges.gradle @@ -0,0 +1,11 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +bootJar { + mainClass = 'com.example.Application' + launchScript { + properties 'prop' : '{launchScriptProperty}' + } +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded.gradle new file mode 100644 index 0000000000..ac286dabae --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded.gradle @@ -0,0 +1,9 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +bootJar { + mainClass = 'com.example.Application' + {launchScript} +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded.gradle new file mode 100644 index 0000000000..ac286dabae --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded.gradle @@ -0,0 +1,9 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +bootJar { + mainClass = 'com.example.Application' + {launchScript} +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltTwice.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltTwice.gradle new file mode 100644 index 0000000000..be0e82ef6d --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltTwice.gradle @@ -0,0 +1,8 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +bootJar { + mainClass = 'com.example.Application' +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltTwiceWithLaunchScriptIncluded.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltTwiceWithLaunchScriptIncluded.gradle new file mode 100644 index 0000000000..4d00e61b2a --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltTwiceWithLaunchScriptIncluded.gradle @@ -0,0 +1,9 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +bootJar { + mainClassName = 'com.example.Application' + launchScript() +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered.gradle new file mode 100644 index 0000000000..30f703228b --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered.gradle @@ -0,0 +1,9 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '{version}' +} + +bootJar { + mainClass = 'com.example.Application' + {layered} +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.gradle deleted file mode 100644 index 21f090f87c..0000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.gradle +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id 'java' - id 'org.springframework.boot' version '{version}' -} - -bootJar { - mainClass = 'com.example.Application' - if (project.hasProperty('includeLaunchScript') ? includeLaunchScript : false) { - launchScript { - properties 'prop' : project.hasProperty('launchScriptProperty') ? launchScriptProperty : 'default' - } - } - if (project.hasProperty('customizeLayered') && project.getProperty('customizeLayered')) { - layered { - includeLayerTools = project.hasProperty('excludeTools') && project.getProperty('excludeTools') ? false : true - enabled = project.hasProperty('disableLayers') && project.getProperty('disableLayers') ? false : true - } - } -} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptPropertyChanges.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptPropertyChanges.gradle new file mode 100644 index 0000000000..dfc1eb0b1f --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptPropertyChanges.gradle @@ -0,0 +1,11 @@ +plugins { + id 'war' + id 'org.springframework.boot' version '{version}' +} + +bootWar { + mainClassName = 'com.example.Application' + launchScript { + properties 'prop' : '{launchScriptProperty}' + } +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded.gradle new file mode 100644 index 0000000000..d9b1148f82 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded.gradle @@ -0,0 +1,9 @@ +plugins { + id 'war' + id 'org.springframework.boot' version '{version}' +} + +bootWar { + mainClassName = 'com.example.Application' + {launchScript} +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded.gradle new file mode 100644 index 0000000000..d9b1148f82 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded.gradle @@ -0,0 +1,9 @@ +plugins { + id 'war' + id 'org.springframework.boot' version '{version}' +} + +bootWar { + mainClassName = 'com.example.Application' + {launchScript} +}