Skip to content

Commit 3773c0d

Browse files
committed
GH-31 - Fix build resource file detection for test execution optimizations.
1 parent a391e86 commit 3773c0d

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

spring-modulith-junit/src/main/java/org/springframework/modulith/junit/Changes.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,13 @@ record JavaTestSourceChange(String fullyQualifiedClassName) implements SourceCha
255255
record OtherFileChange(String path) implements Change {
256256

257257
private static final Collection<String> CLASSPATH_RESOURCES = Set.of("src/main/resources", "src/test/resources");
258-
private static final Collection<String> BUILD_FILES = Set.of("build.gradle", "build.kt", "pom.xml");
258+
private static final Collection<String> BUILD_FILES = Set.of(
259+
260+
// Gradle
261+
"build.gradle", "build.gradle.kts", "gradle.properties", "settings.gradle", "settings.gradle.kts",
262+
263+
// Maven
264+
"pom.xml");
259265

260266
/**
261267
* Returns whether the change affects a build resource.

spring-modulith-junit/src/test/java/org/springframework/modulith/junit/ChangesUnitTests.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ Stream<DynamicTest> detectsClasspathFileChange() {
4949
@TestFactory // GH-31
5050
Stream<DynamicTest> detectsNonClasspathFileChange() {
5151

52-
var files = Stream.of("pom.xml", "build.gradle", "build.kt");
52+
var files = Stream.of(
53+
54+
// Maven
55+
"pom.xml",
56+
57+
// Gradle
58+
"build.gradle", "build.gradle.kts", "gradle.properties", "settings.gradle", "settings.gradle.kts");
5359

5460
return DynamicTest.stream(files, it -> it + " is considered build resource", it -> {
5561

src/docs/antora/modules/ROOT/pages/testing.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ Tests will be selected for execution if they reside in either a root module, a m
395395
The optimization will back off optimizing the execution under the following circumstances:
396396

397397
* The test execution originates from an IDE as we assume the execution is triggered explicitly.
398-
* The set of changes contains a change to a resource related to a build system (`pom.xml`, `build.gradle`, `gradle.properties`).
398+
* The set of changes contains a change to a resource related to a build system (`pom.xml`, `build.gradle(.kts)`, `gradle.properties`, and `settings.gradle(.kts)`).
399399
* The set of changes contains a change to any classpath resource.
400400
* The project does not contain a change at all (typical in a CI build).
401401

0 commit comments

Comments
 (0)