forked from DataDog/dd-trace-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
58 lines (48 loc) · 1.71 KB
/
build.gradle
File metadata and controls
58 lines (48 loc) · 1.71 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
52
53
54
55
56
57
58
ext {
minJavaVersionForTests = JavaVersion.VERSION_11
}
apply from: "$rootDir/gradle/java.gradle"
jar {
manifest {
attributes('Main-Class': 'datadog.smoketest.moduleapp.ModuleApplication')
}
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
[JavaCompile, GroovyCompile].each {
tasks.withType(it).configureEach { AbstractCompile ac ->
setJavaVersion(ac, 11)
// read up classpath lazily to avoid early locking of gradle settings
ac.options.compilerArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
{ return ['--module-path', ac.classpath.asPath]}
}
})
}
}
tasks.withType(Test).configureEach {
dependsOn "jar"
}
tasks.withType(Test).forEach {
it.doFirst {
JavaInstallationMetadata metadata = it.getJavaLauncher().get().metadata
// We can safely assume that the general configuration has disabled this test if
// the JVM version is not 11+
Directory specificJDKHome = metadata.installationPath
def jlinkExecutable = specificJDKHome.file("bin/jlink")
def jdkModulesPath = specificJDKHome.dir("jmods")
def generatedImageDir = "${buildDir}/${it.name}image"
delete generatedImageDir
// Run the jlink command to create the image
exec {
commandLine jlinkExecutable, '--no-man-pages', '--no-header-files',
'--add-modules', 'java.instrument,datadog.smoketest.moduleapp',
"--module-path", "${jdkModulesPath}:" + jar.archiveFile.get().toString(), "--output", generatedImageDir
}
it.jvmArgs "-Ddatadog.smoketest.module.image=${generatedImageDir}"
}
}
dependencies {
testImplementation project(':dd-smoke-tests')
}