forked from niklas-wortmann/overthinklytics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
51 lines (45 loc) · 1.72 KB
/
Copy pathbuild.gradle
File metadata and controls
51 lines (45 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
plugins {
id 'dev.nx.gradle.project-graph' version '0.1.7'
}
allprojects {
apply plugin: 'dev.nx.gradle.project-graph'
}
// Root build for multi-project; adds aggregate convenience tasks for tests/check
// and supports root-level filtering via -Ptests=pattern (or multiple patterns separated by comma/space).
// Forward root-level -Ptests filter to all subprojects' Test tasks
subprojects {
tasks.withType(Test).configureEach { Test t ->
if (rootProject.hasProperty('tests')) {
def raw = (rootProject.findProperty('tests') as String)?.trim()
if (raw) {
def patterns = raw.split(/[\s,]+/).findAll { it }
t.filter { TestFilter f ->
patterns.each { f.includeTestsMatching(it) }
}
// Ensure JUnit Platform is used (most subprojects already set this explicitly)
t.useJUnitPlatform()
}
}
}
}
// Aggregate task that runs all subprojects' test tasks
tasks.register('allTests') {
group = 'verification'
description = 'Runs all subprojects test tasks. Supports -Ptests forwarding for filtering.'
dependsOn(subprojects.collect { sub ->
sub.tasks.findByName('test')
}.findAll { it != null })
}
// Keep `test` at the root as a friendly alias that supports -Ptests filtering
// Note: This is a lifecycle/aggregate task, not of type Test, so `--tests` is not supported at the root.
tasks.register('test') {
group = 'verification'
description = 'Aggregate alias to run all subprojects tests. Use -Ptests=pattern for filtering.'
dependsOn 'allTests'
}
// Similarly aggregate "check" to run all modules' checks from the root, if they exist.
tasks.register('check') {
dependsOn(subprojects.collect { sub ->
sub.tasks.findByName('check')
}.findAll { it != null })
}