Skip to content

Commit

Permalink
Align Gradle test version with minimum supported version
Browse files Browse the repository at this point in the history
Closes gh-97
  • Loading branch information
wilkinsona committed Sep 17, 2024
1 parent 17b319d commit 331ce26
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ class DevelocityConventionsPluginIntegrationTests {
@Test
void whenThePluginIsAppliedThenBuildScanConventionsAreApplied(@TempDir File projectDir) {
prepareProject(projectDir);
BuildResult result = build(projectDir, "6.0.1", "verifyBuildScanConfig");
BuildResult result = build(projectDir, "verifyBuildScanConfig");
assertThat(result.getOutput()).contains("Build scan server: https://ge.spring.io");
assertThat(result.getOutput()).contains("Capture task input files: true");
}

@Test
void whenThePluginIsAppliedThenBuildCacheConventionsAreApplied(@TempDir File projectDir) {
prepareProject(projectDir);
BuildResult result = build(projectDir, "6.0.1", "verifyBuildCacheConfig");
BuildResult result = build(projectDir, "verifyBuildCacheConfig");
assertThat(result.getOutput()).contains("Build cache server: https://ge.spring.io");
}

@Test
void whenThePluginIsAppliedAndBuildScansAreDisabledThenBuildScanConventionsAreNotApplied(@TempDir File projectDir) {
prepareProject(projectDir);
BuildResult result = build(projectDir, "6.0.1", "verifyBuildScanConfig", "--no-scan");
BuildResult result = build(projectDir, "verifyBuildScanConfig", "--no-scan");
assertThat(result.getOutput()).contains("Build scan server: null");
assertThat(result.getOutput()).contains("Capture task input files: false");
}
Expand All @@ -72,7 +72,7 @@ void whenThePluginIsAppliedAndTheSpringBuildTypeIsNotOssThenBuildScanConventions
@TempDir File projectDir) {
prepareProject(projectDir);
write(new File(projectDir, "gradle.properties"), (writer) -> writer.println("spring.build-type=other"));
BuildResult result = build(projectDir, "6.0.1", "verifyBuildScanConfig");
BuildResult result = build(projectDir, "verifyBuildScanConfig");
assertThat(result.getOutput()).contains("Build scan server: null");
assertThat(result.getOutput()).contains("Capture task input files: false");
}
Expand All @@ -81,7 +81,7 @@ void whenThePluginIsAppliedAndTheSpringBuildTypeIsNotOssThenBuildScanConventions
void whenThePluginIsAppliedAndTheSpringBuildTypeIsOssThenBuildScanConventionsAreApplied(@TempDir File projectDir) {
prepareProject(projectDir);
write(new File(projectDir, "gradle.properties"), (writer) -> writer.println("spring.build-type=oss"));
BuildResult result = build(projectDir, "6.0.1", "verifyBuildScanConfig");
BuildResult result = build(projectDir, "verifyBuildScanConfig");
assertThat(result.getOutput()).contains("Build scan server: https://ge.spring.io");
assertThat(result.getOutput()).contains("Capture task input files: true");
}
Expand All @@ -90,7 +90,7 @@ void whenThePluginIsAppliedAndTheSpringBuildTypeIsOssThenBuildScanConventionsAre
void whenThePluginIsAppliedAndPropertiesTaskIsExecutedThenBuildScanConventionsAreNotApplied(
@TempDir File projectDir) {
prepareProject(projectDir);
BuildResult result = build(projectDir, "6.0.1", "properties", "verifyBuildScanConfig", "--no-scan");
BuildResult result = build(projectDir, "properties", "verifyBuildScanConfig", "--no-scan");
assertThat(result.getOutput()).contains("Build scan server: null");
assertThat(result.getOutput()).contains("Capture task input files: false");
}
Expand All @@ -99,23 +99,23 @@ void whenThePluginIsAppliedAndPropertiesTaskIsExecutedThenBuildScanConventionsAr
void givenMultiProjectBuildWhenThePluginIsAppliedAndPropertiesTaskIsExecutedThenBuildScanConventionsAreNotApplied(
@TempDir File projectDir) {
prepareMultiModuleProject(projectDir);
BuildResult result = build(projectDir, "6.0.1", "sub:properties", "sub:verifyBuildScanConfig", "--no-scan");
BuildResult result = build(projectDir, "sub:properties", "sub:verifyBuildScanConfig", "--no-scan");
assertThat(result.getOutput()).contains("Build scan server: null");
assertThat(result.getOutput()).contains("Capture task input files: false");
}

@Test
void whenThePluginIsAppliedAndScanIsSpecifiedThenServerIsNotCustomized(@TempDir File projectDir) {
prepareProject(projectDir);
BuildResult result = build(projectDir, "6.0.1", "verifyBuildScanConfig", "--scan");
BuildResult result = build(projectDir, "verifyBuildScanConfig", "--scan");
assertThat(result.getOutput()).contains("Build scan server: null");
assertThat(result.getOutput()).contains("Capture task input files: true");
}

@Test
void whenThePluginIsAppliedAndBuildCacheIsDisabledThenBuildCacheConventionsAreNotApplied(@TempDir File projectDir) {
prepareProject(projectDir);
BuildResult result = build(projectDir, "6.0.1", "verifyBuildCacheConfig", "--no-build-cache");
BuildResult result = build(projectDir, "verifyBuildCacheConfig", "--no-build-cache");
assertThat(result.getOutput()).contains("Build cache server: null");
}

Expand All @@ -124,15 +124,15 @@ void whenThePluginIsAppliedAndTheSpringBuildTypeIsNotOssThenBuildCacheConvention
@TempDir File projectDir) {
prepareProject(projectDir);
write(new File(projectDir, "gradle.properties"), (writer) -> writer.println("spring.build-type=other"));
BuildResult result = build(projectDir, "6.0.1", "verifyBuildCacheConfig");
BuildResult result = build(projectDir, "verifyBuildCacheConfig");
assertThat(result.getOutput()).contains("Build cache server: null");
}

@Test
void whenThePluginIsAppliedAndTheSpringBuildTypeIsOssThenBuildCacheConventionsAreApplied(@TempDir File projectDir) {
prepareProject(projectDir);
write(new File(projectDir, "gradle.properties"), (writer) -> writer.println("spring.build-type=oss"));
BuildResult result = build(projectDir, "6.0.1", "verifyBuildCacheConfig");
BuildResult result = build(projectDir, "verifyBuildCacheConfig");
assertThat(result.getOutput()).contains("Build cache server: https://ge.spring.io");
}

Expand Down Expand Up @@ -206,15 +206,14 @@ private String version() {
}
}

private BuildResult build(File projectDir, String gradleVersion, String... arguments) {
private BuildResult build(File projectDir, String... arguments) {
List<File> classpath = Arrays.asList(new File("bin/main"), new File("build/classes/java/main"),
new File("build/resources/main"),
new File(DevelocityPlugin.class.getProtectionDomain().getCodeSource().getLocation().getFile()),
new File(ConfigurableBuildScan.class.getProtectionDomain().getCodeSource().getLocation().getFile()));
List<String> augmentedArguments = new ArrayList<>(Arrays.asList(arguments));
augmentedArguments.add("--stacktrace");
return GradleRunner.create()
.withGradleVersion(gradleVersion)
.withProjectDir(projectDir)
.withPluginClasspath(classpath)
.withArguments(augmentedArguments)
Expand Down

0 comments on commit 331ce26

Please sign in to comment.