-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
96 lines (85 loc) · 3.58 KB
/
build.gradle
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
plugins {
id 'java-library'
id 'eclipse'
id 'org.gradlex.extra-java-module-info' version '1.5'
id 'com.github.ben-manes.versions' version '0.49.0'
id 'net.minecraftforge.gradleutils' version '[2.3,2.4)'
id 'net.minecraftforge.licenser' version '1.0.1'
}
repositories {
mavenCentral()
maven gradleutils.forgeMaven
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
license {
header = rootProject.file("LICENSE-header.txt")
}
test {
useJUnitPlatform()
reports.html.destination = rootProject.file("build/reports/")
reports.junitXml.destination = rootProject.file("build/test-results/")
}
dependencies {
implementation(rootProject)
testImplementation(libs.junit.api)
testImplementation(libs.unsafe)
testImplementation(libs.securemodules)
testImplementation(libs.jopt.simple)
testImplementation(project(':ml-test-jar'))
testImplementation(libs.bundles.powermock)
testImplementation(libs.bundles.log4j.runtime)
testCompileOnly(libs.nulls)
testRuntimeOnly(libs.bundles.junit.runtime)
}
extraJavaModuleInfo {
failOnMissingModuleInfo = false
automaticModule('net.sf.jopt-simple:jopt-simple', 'jopt.simple')
automaticModule('org.openjdk.jmh:jmh-core', 'jmh.core')
automaticModule('org.powermock:powermock-core', 'powermock.core')
automaticModule('org.powermock:powermock-reflect', 'powermock.reflect')
}
// If we are being told a specific vendor then we are probably being run in parallel
if (project.hasProperty('javaVendor') && project.hasProperty('javaVersion')) {
test.javaLauncher.set(javaToolchains.launcherFor {
it.vendor.set(JvmVendorSpec."${project.property('javaVendor').toUpperCase(Locale.ROOT)}" as JvmVendorSpec)
it.languageVersion.set(JavaLanguageVersion.of(project.property('javaVersion') as int))
it.implementation.set(JvmImplementation.VENDOR_SPECIFIC)
})
} else if (!project.hasProperty('disable_bulk_tests')) {
configurations {
groovyScript
}
dependencies {
groovyScript 'org.apache.ivy:ivy:2.4.0'
groovyScript 'org.codehaus.groovy:groovy-all:3.0.19'
}
tasks.register('collectTests', JavaExec) {
classpath = configurations.groovyScript
main = 'groovy.ui.GroovyMain'
args '.github/workflows/aggregate-junit-tests.groovy'
workingDir rootProject.projectDir
}
VALID_VMS.each { javaVendor, javaVersions ->
javaVersions.each { javaVersion ->
def task = tasks.register("test${javaVendor}${javaVersion}", Test) {
useJUnitPlatform()
javaLauncher.set(javaToolchains.launcherFor {
it.vendor.set(JvmVendorSpec."${javaVendor.toUpperCase(Locale.ROOT)}" as JvmVendorSpec)
it.languageVersion.set(JavaLanguageVersion.of(javaVersion))
it.implementation.set(JvmImplementation.VENDOR_SPECIFIC)
})
reports.html.destination = rootProject.file("build/test_artifacts/test-reports-${javaVendor}-${javaVersion}/")
reports.junitXml.destination = rootProject.file("build/test_artifacts/test-results-${javaVendor}-${javaVersion}/")
}
test.dependsOn(task)
collectTests.mustRunAfter(task)
}
}
}
// Hack eclipse into knowing that the gradle deps are modules
eclipse.classpath {
containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
file.whenMerged { entries.findAll { it.kind == 'lib' || it.path == 'org.eclipse.buildship.core.gradleclasspathcontainer' }.each { it.entryAttributes['module'] = 'true' } }
}