Skip to content

Commit 29dfb49

Browse files
committed
Unify tasks and complete infra testing
1 parent 2e0f280 commit 29dfb49

21 files changed

+693
-304
lines changed

.github/workflows/test-changed-infrastructure.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,13 @@ jobs:
8282
run: |
8383
./gradlew pullAllowedDockerImages -Pcoordinates=${{ matrix.coordinates }}
8484
85-
- name: "Disable docker networking"
86-
run: bash ./.github/workflows/scripts/disable-docker.sh
87-
8885
- name: "🔎 Check metadata files content"
8986
run: |
9087
./gradlew checkMetadataFiles -Pcoordinates=${{ matrix.coordinates }}
9188
9289
- name: "🧪 Run '${{ matrix.coordinates }}' tests"
9390
run: |
94-
./gradlew test -Pcoordinates=${{ matrix.coordinates }}
91+
./gradlew testInfra -Pcoordinates=${{ matrix.coordinates }} -Pparallelism=1 --stacktrace
9592
9693
all-infrastructure-passed:
9794
name: "🧪 All build-logic triggered tests have passed"

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
- Windows: gradlew.bat <task> [options]
1212
- Tip: add --stacktrace for debugging
1313

14-
## One command for complete testing (use at the end of the task to verify)
15-
./gradlew testAllParallel -Pparallelism=4
14+
## One command for complete infrastructure testing
15+
./gradlew testAllInfra -Pparallelism=4 --stacktrace
1616

1717
## Code Style
1818
- Always try to reuse existing code.

build.gradle

Lines changed: 304 additions & 135 deletions
Large diffs are not rendered by default.

docs/DEVELOPING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Tip: When debugging locally, add `--stacktrace` for better error output.
2323

2424
### End-to-end testing before the commit
2525
```console
26-
./gradlew testAllParallel --stacktrace
26+
./gradlew testAllInfra --stacktrace
2727
```
2828

2929
### Style and formatting

tests/tck-build-logic/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* You should have received a copy of the CC0 legalcode along with this
55
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
66
*/
7-
87
plugins {
98
id 'groovy-gradle-plugin'
109
id 'maven-publish'

tests/tck-build-logic/settings.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* You should have received a copy of the CC0 legalcode along with this
55
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
66
*/
7-
87
pluginManagement {
98
repositories {
109
mavenCentral()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
17
import org.graalvm.internal.tck.harness.TckExtension
28

39
TckExtension testUtils = project.extensions.create("tck", TckExtension, project)

tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck-harness.gradle

Lines changed: 48 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* You should have received a copy of the CC0 legalcode along with this
55
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
66
*/
7-
87
plugins {
98
id 'org.graalvm.internal.tck-base'
109
}
@@ -29,6 +28,7 @@ import org.graalvm.internal.tck.harness.tasks.NativeTestCompileInvocationTask
2928
import org.graalvm.internal.tck.harness.tasks.FetchExistingLibrariesWithNewerVersionsTask
3029
import org.gradle.util.internal.VersionNumber
3130
import org.graalvm.internal.tck.harness.tasks.ComputeAndPullAllowedDockerImagesTask
31+
import org.graalvm.internal.tck.harness.tasks.CheckMetadataFilesAllTask
3232
import org.graalvm.internal.tck.utils.CoordinateUtils
3333
import org.graalvm.internal.tck.utils.MetadataGenerationUtils
3434

@@ -63,83 +63,66 @@ if (CoordinateUtils.isFractionalBatch(coordinateFilter)) {
6363
matchingCoordinates = matchingCoordinates.findAll { !it.startsWith("samples:") }
6464

6565

66-
// gradle checkstyle -Pcoordinates=<maven-coordinates>
67-
Provider<Task> checkstyle = tasks.register("checkstyle") { task ->
66+
// gradle checkstyle -Pcoordinates=<maven-coordinates>
67+
tasks.register("checkstyle", CheckstyleInvocationTask.class) { task ->
6868
task.setDescription("Runs checkstyle on all subprojects")
6969
task.setGroup(JavaBasePlugin.VERIFICATION_GROUP)
70-
} as Provider<Task>
70+
}
7171

7272
// gradle compileTestJava -Pcoordinates=<maven-coordinates>
73-
Provider<Task> compileTestJava = tasks.register("compileTestJava") { task ->
73+
tasks.register("compileTestJava", CompileTestJavaInvocationTask.class) { task ->
7474
task.setDescription("Compiles sources (javac) for all subprojects")
7575
task.setGroup(LifecycleBasePlugin.BUILD_GROUP)
76-
} as Provider<Task>
76+
}
7777

78-
// gradle javaTest -Pcoordinates=<maven-coordinates>
79-
Provider<Task> javaTest = tasks.register("javaTest") { task ->
78+
// gradle javaTest -Pcoordinates=<maven-coordinates>
79+
tasks.register("javaTest", JavaTestInvocationTask.class) { task ->
8080
task.setDescription("Runs JVM tests (Gradle 'test') for all subprojects")
8181
task.setGroup(JavaBasePlugin.VERIFICATION_GROUP)
82-
} as Provider<Task>
82+
}
8383

8484
// gradle nativeTestCompile -Pcoordinates=<maven-coordinates>
85-
Provider<Task> nativeTestCompile = tasks.register("nativeTestCompile") { task ->
85+
tasks.register("nativeTestCompile", NativeTestCompileInvocationTask.class) { task ->
8686
task.setDescription("Compiles native tests (nativeTestCompile) for all subprojects")
8787
task.setGroup(LifecycleBasePlugin.BUILD_GROUP)
88-
} as Provider<Task>
89-
90-
// gradle checkMetadataFiles -Pcoordinates=<maven-coordinates>
91-
Provider<Task> checkMetadataFiles = tasks.register("checkMetadataFiles") { task ->
92-
task.setDescription("Checks content of metadata files for matching coordinates")
93-
task.setGroup(METADATA_GROUP)
94-
} as Provider<Task>
95-
96-
tasks.named("check").configure {
97-
dependsOn(checkstyle)
9888
}
9989

100-
101-
// Here we want to configure all test and checkstyle tasks for all filtered subprojects
102-
// Extracted helper to register per-coordinate tasks and wire them to aggregate tasks.
103-
def registerPerCoordinateTask = { String coordinates, Object aggregate, String baseName, Class taskClass, boolean passCtorArg = true, Closure customConfigure = null ->
104-
String taskName = generateTaskName(baseName, coordinates)
105-
if ((!tasks.getNames().contains(taskName))) {
106-
if (passCtorArg) {
107-
tasks.register(taskName, taskClass, coordinates)
108-
} else {
109-
tasks.register(taskName, taskClass) { t ->
110-
if (customConfigure != null) {
111-
customConfigure.call(t)
112-
}
113-
}
114-
}
90+
// gradle clean -Pcoordinates=<maven-coordinates>
91+
if (tasks.findByName("clean") == null) {
92+
tasks.register("clean", CleanInvocationTask.class) { t ->
93+
t.setDescription("Cleans all matching subprojects")
94+
t.setGroup(LifecycleBasePlugin.BUILD_GROUP)
11595
}
116-
if (aggregate != null) {
117-
if (aggregate instanceof org.gradle.api.provider.Provider) {
118-
aggregate.configure {
119-
dependsOn(taskName)
120-
}
121-
} else {
122-
tasks.named(aggregate.toString()).configure {
123-
dependsOn(taskName)
124-
}
125-
}
96+
} else {
97+
tasks.register("tckClean", CleanInvocationTask.class) { t ->
98+
t.setDescription("Cleans all matching subprojects (TCK)")
99+
t.setGroup(LifecycleBasePlugin.BUILD_GROUP)
126100
}
101+
tasks.named("clean").configure { it.dependsOn("tckClean") }
127102
}
128103

129-
for (String coordinates in matchingCoordinates) {
130-
registerPerCoordinateTask(coordinates, checkstyle, "checkstyle", CheckstyleInvocationTask, true)
131-
registerPerCoordinateTask(coordinates, "clean", "clean", CleanInvocationTask, true)
132-
registerPerCoordinateTask(coordinates, compileTestJava, "compileTestJava", CompileTestJavaInvocationTask, true)
133-
registerPerCoordinateTask(coordinates, javaTest, "javaTest", JavaTestInvocationTask, true)
134-
registerPerCoordinateTask(coordinates, nativeTestCompile, "nativeTestCompile", NativeTestCompileInvocationTask, true)
135-
// No aggregate wiring for per-coordinate docker pulls; they are invoked by dedicated workflows.
136-
registerPerCoordinateTask(coordinates, null, "pullAllowedDockerImages", DockerTask.class, false) { t ->
137-
t.setCoordinates(coordinates)
104+
// gradle test -Pcoordinates=<maven-coordinates>
105+
if (tasks.findByName("test") == null) {
106+
tasks.register("test", TestInvocationTask.class) { t ->
107+
t.setDescription("Runs Native Image tests for all matching coordinates")
108+
t.setGroup(JavaBasePlugin.VERIFICATION_GROUP)
138109
}
139-
registerPerCoordinateTask(coordinates, checkMetadataFiles, "checkMetadataFiles", MetadataFilesCheckerTask.class, false) { t ->
140-
t.setCoordinates(coordinates)
110+
} else {
111+
tasks.register("tckTest", TestInvocationTask.class) { t ->
112+
t.setDescription("Runs Native Image tests for all matching coordinates (TCK)")
113+
t.setGroup(JavaBasePlugin.VERIFICATION_GROUP)
141114
}
142-
registerPerCoordinateTask(coordinates, "test", "test", TestInvocationTask, true)
115+
tasks.named("test").configure { it.dependsOn("tckTest") }
116+
}
117+
118+
// gradle checkMetadataFiles -Pcoordinates=<maven-coordinates>
119+
tasks.register("checkMetadataFiles", CheckMetadataFilesAllTask.class) { task ->
120+
task.setDescription("Checks content of metadata files for matching coordinates")
121+
task.setGroup(METADATA_GROUP)
122+
}
123+
124+
tasks.named("check").configure {
125+
dependsOn("checkstyle")
143126
}
144127

145128
// gradle diff -PbaseCommit=<base-commit> -PnewCommit=<new-commit>
@@ -158,15 +141,12 @@ List<String> diffCoordinates = new ArrayList<>()
158141
if (project.hasProperty("baseCommit")) {
159142
String baseCommit = project.findProperty("baseCommit")
160143
String newCommit = Objects.requireNonNullElse(project.findProperty("newCommit"), "HEAD")
161-
for (def coordinates in tck.diffCoordinates(baseCommit, newCommit)) {
162-
diffCoordinates.add(coordinates)
163-
String taskTaskName = generateTaskName("test", coordinates)
164-
if ((!tasks.getNames().contains(taskTaskName))) {
165-
tasks.register(taskTaskName, TestInvocationTask, coordinates)
166-
}
167-
diff.configure {
168-
dependsOn(taskTaskName)
169-
}
144+
diffCoordinates.addAll(tck.diffCoordinates(baseCommit, newCommit))
145+
tasks.register("testDiff", TestInvocationTask.class) { t ->
146+
t.setCoordinatesOverride(diffCoordinates)
147+
}
148+
diff.configure {
149+
dependsOn("testDiff")
170150
}
171151
}
172152

@@ -251,7 +231,7 @@ Provider<Task> generateInfrastructureChangedCoordinatesMatrix = tasks.register("
251231
List<String> selected = []
252232
boolean infraChanged = true
253233
// Pre-selected modules; keep stable for infra verification
254-
List<String> preselectedModules = [
234+
List<String> preselectedCoordinates = [
255235
'ch.qos.logback:logback-classic',
256236
'org.bouncycastle:bcpkix-jdk18on',
257237
'io.netty:netty-common',
@@ -263,7 +243,7 @@ Provider<Task> generateInfrastructureChangedCoordinatesMatrix = tasks.register("
263243
'io.undertow:undertow-core',
264244
'com.hazelcast:hazelcast'
265245
]
266-
preselectedModules.each { module ->
246+
preselectedCoordinates.each { module ->
267247
List<String> matches = tck.getMatchingCoordinates(module)
268248
if (!matches.isEmpty()) {
269249
def withVersions = matches.collect { c ->

tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck-settings.settings.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* You should have received a copy of the CC0 legalcode along with this
55
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
66
*/
7-
87
pluginManagement {
98
repositories {
109
mavenCentral()

tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* You should have received a copy of the CC0 legalcode along with this
55
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
66
*/
7-
8-
97
import groovy.json.JsonSlurper
108

119
plugins {

0 commit comments

Comments
 (0)