Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple gradle JDK from compile/test JDK #7506

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.continue.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ jobs:
{% if is_nightly %}
./gradlew resolveAndLockAll --write-locks &&
{% endif %}
JAVA_HOME="$JAVA_11_HOME"
MAVEN_OPTS="-Xms64M -Xmx256M"
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2560M -Xms2560M -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
./gradlew clean
Expand Down Expand Up @@ -566,6 +567,7 @@ jobs:
fi

<< parameters.environment >>
JAVA_HOME="$JAVA_11_HOME"
MAVEN_OPTS="-Xms64M -Xmx512M"
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xms<< parameters.maxDaemonHeapSize >> -Xmx<< parameters.maxDaemonHeapSize >> $PROFILER_COMMAND -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp' -Ddatadog.forkedMaxHeapSize=768M -Ddatadog.forkedMinHeapSize=128M"
./gradlew
Expand Down Expand Up @@ -726,6 +728,7 @@ jobs:
mvn_local_repo=$(./mvnw help:evaluate -Dexpression=settings.localRepository -q -DforceStdout)
rm -rf "${mvn_local_repo}/com/datadoghq"
export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2G -Xms2G -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
export JAVA_HOME="$JAVA_11_HOME"
./gradlew publishToMavenLocal << pipeline.parameters.gradle_flags >> --max-workers=3

- run:
Expand Down
4 changes: 2 additions & 2 deletions dd-java-agent/agent-bootstrap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

ext {
// need access to sun.* packages
skipSettingCompilerRelease = true
defaultJdkVersion = 8
}

apply from: "$rootDir/gradle/java.gradle"
Expand Down Expand Up @@ -36,7 +36,7 @@ sourceSets {
}
}

compileMain_java11Java.configure {
tasks.named("compileMain_java11Java", JavaCompile).configure {
setJavaVersion(it, 11)
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down
2 changes: 1 addition & 1 deletion dd-java-agent/agent-builder/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sourceSets {
}
}

compileMain_java11Java.configure {
tasks.named("compileMain_java11Java", JavaCompile).configure {
setJavaVersion(it, 11)
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down
19 changes: 6 additions & 13 deletions dd-java-agent/agent-iast/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,14 @@ plugins {
id 'net.ltgt.errorprone' version '3.1.0'
}

apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/version.gradle"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
defaultJdkVersion = 11
defaultJavaVersion = 8
defaultJavaCompilerRelease = 8
}

tasks.withType(AbstractCompile).configureEach {
// ensure no APIs beyond JDK8 are used
options.release = 8
}
apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/version.gradle"

// First version with Mac M1 support
def grpcVersion = '1.42.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ ext {
minJavaVersionForTests = JavaVersion.VERSION_11

// need access to jdk.jfr package
defaultJdkVersion = 11
defaultJavaVersion = 8
skipSettingCompilerRelease = true

excludeJdk = ['SEMERU11', 'SEMERU17']
Expand Down
6 changes: 4 additions & 2 deletions dd-java-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ configurations {
traceShadowInclude
}

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
tasks.named("compileJava", JavaCompile).configure {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}

/*
* Several shadow jars are created
Expand Down
11 changes: 5 additions & 6 deletions dd-java-agent/instrumentation/armeria-jetty/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ muzzle {
}
}

ext {
jetty11TestMinJavaVersionForTests = JavaVersion.VERSION_11
jetty11LatestDepTestMinJavaVersionForTests = JavaVersion.VERSION_11
}

apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/configure_tests.gradle"

Expand All @@ -25,12 +30,6 @@ addTestSuiteForDir("jetty11Test", "test/jetty11")
addTestSuiteExtendingForDir("jetty9LatestDepTest", "latestDepTest", "test/jetty9")
addTestSuiteExtendingForDir("jetty11LatestDepTest", "latestDepTest", "test/jetty11")

[compileJetty11TestGroovy, jetty11Test, compileJetty11LatestDepTestGroovy, jetty11LatestDepTest].each {
it.configure {
javaLauncher = getJavaLauncherFor(11)
}
}

dependencies {
compileOnly group: 'com.linecorp.armeria', name: 'armeria-jetty9', version: '1.24.0'
jetty11TestImplementation group: 'com.linecorp.armeria', name: 'armeria-jetty11', version: '1.24.0', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ ext {
// By default tests with be compiled for `minJavaVersionForTests` version,
// but in this case we would like to avoid this since we would like to run with ZULU8
skipSettingTestJavaVersion = true

defaultJdkVersion = 11
defaultJavaVersion = 8
skipSettingCompilerRelease = true
}

apply from: "$rootDir/gradle/java.gradle"
Expand Down
2 changes: 1 addition & 1 deletion dd-java-agent/instrumentation/jakarta-jms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ compileTestGroovy {

dependencies {
implementation project(':dd-java-agent:instrumentation:jms')

compileOnly 'jakarta.jms:jakarta.jms-api:3.0.0'
testImplementation 'jakarta.jms:jakarta.jms-api:3.0.0'
testImplementation 'jakarta.ejb:jakarta.ejb-api:4.0.0'
testImplementation group: 'org.springframework', name: 'spring-jms', version: '6.0.11'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ muzzle {
}
}

ext {
latestDepJava11TestMinJavaVersionForTests = JavaVersion.VERSION_11
}

apply from: "$rootDir/gradle/java.gradle"

addTestSuiteForDir('latestDepTest', 'test')
Expand All @@ -16,10 +20,7 @@ tasks.named("compileLatestDepJava11TestJava").configure {
setJavaVersion(it, 11)
}
tasks.named("compileLatestDepJava11TestGroovy").configure {
javaLauncher = getJavaLauncherFor(11)
}
tasks.named("latestDepJava11Test").configure {
javaLauncher = getJavaLauncherFor(11)
setJavaVersion(it, 11)
}

dependencies {
Expand Down
8 changes: 4 additions & 4 deletions dd-java-agent/instrumentation/jdbc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ muzzle {
}
}

ext {
latestDepJava11TestMinJavaVersionForTests = JavaVersion.VERSION_11
}

apply from: "$rootDir/gradle/java.gradle"
apply plugin: 'call-site-instrumentation'

Expand Down Expand Up @@ -78,10 +82,6 @@ tasks.named("check").configure {
dependsOn "oldPostgresTest"
}

tasks.named("latestDepJava11Test").configure {
javaLauncher = getJavaLauncherFor(11)
}

tasks.withType(Test).configureEach {
usesService(testcontainersLimit)
}
Expand Down
11 changes: 4 additions & 7 deletions dd-java-agent/instrumentation/jetty-9/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ muzzle {
}
}

ext {
latestDepForkedTestMinJavaVersionForTests = JavaVersion.VERSION_11
}

apply plugin: 'java-test-fixtures'
apply from: "$rootDir/gradle/java.gradle"

Expand Down Expand Up @@ -114,13 +118,6 @@ addTestSuiteForDir('jetty94ForkedTest', 'test')
addTestSuiteForDir('latestDepJetty9ForkedTest', 'test')
addTestSuiteForDir('latestDepForkedTest', 'test')

tasks.named("latestDepForkedTest").configure {
javaLauncher = getJavaLauncherFor(11)
}
tasks.named("compileLatestDepForkedTestGroovy").configure {
setJavaVersion(it, 11)
}

dependencies {
compileOnly group: 'org.eclipse.jetty', name: 'jetty-server', version: '9.0.0.v20130308'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ muzzle {
}
}

ext {
iastLatestDepTest3MinJavaVersionForTests = JavaVersion.VERSION_17
}

apply from: "$rootDir/gradle/java.gradle"

addTestSuite('latestDepTest')
Expand Down Expand Up @@ -71,8 +75,7 @@ configurations.testRuntimeClasspath {
resolutionStrategy.force 'org.assertj:assertj-core:2.9.1'
}

iastLatestDepTest3.configure {
javaLauncher = getJavaLauncherFor(17)
tasks.named("iastLatestDepTest3").configure {
jvmArgs = ['--add-opens', 'java.base/java.util=ALL-UNNAMED']
}

Expand Down
6 changes: 4 additions & 2 deletions dd-java-agent/instrumentation/play-2.6/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ muzzle {
}
}

ext {
latestDepTestMinJavaVersionForTests = JavaVersion.VERSION_11
}

apply from: "$rootDir/gradle/java.gradle"
apply plugin: 'scala'

Expand Down Expand Up @@ -180,7 +184,6 @@ tasks.register('buildLatestDepTestRoutes', JavaExec) {
dependsOn compileRouteGeneratorScala, compileLatestDepTestScala
}
compileLatestDepTestGeneratedScala {
javaLauncher = getJavaLauncherFor(11)
classpath = classpath + files(compileLatestDepTestScala.destinationDirectory)
dependsOn buildLatestDepTestRoutes, compileLatestDepTestScala
}
Expand All @@ -189,7 +192,6 @@ forbiddenApisLatestDepTestGenerated {
}

compileLatestDepTestGroovy {
javaLauncher = getJavaLauncherFor(11)
classpath = classpath +
files(compileLatestDepTestScala.destinationDirectory) +
files(compileBaseTestGroovy.destinationDirectory) +
Expand Down
8 changes: 2 additions & 6 deletions dd-java-agent/instrumentation/vertx-web-5.0/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Set properties before any plugins get loaded
ext {
defaultJdkVersion = 11
defaultJavaVersion = 8
minJavaVersionForTests = JavaVersion.VERSION_11
}

Expand All @@ -22,12 +24,6 @@ configurations {
testArtifacts
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

// Create test artifacts so vertx-rx can reuse the server test instrumentation and base class
artifacts {
testArtifacts testJar
Expand Down
3 changes: 2 additions & 1 deletion dd-smoke-tests/armeria-grpc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
}

ext {
defaultJdkVersion = 17
minJavaVersionForTests = JavaVersion.VERSION_17
}

Expand Down Expand Up @@ -44,8 +45,8 @@ dependencies {

implementation 'io.grpc:grpc-protobuf:1.56.0'
implementation 'io.grpc:grpc-stub:1.56.0'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
testRuntimeOnly 'io.grpc:grpc-netty-shaded:1.56.0'
testCompileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
testImplementation(testFixtures(project(":dd-smoke-tests:iast-util")))
}

Expand Down
4 changes: 4 additions & 0 deletions dd-smoke-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ext {
defaultJdkVersion = 8
}

apply from: "$rootDir/gradle/java.gradle"

description = 'dd-smoke-tests'
Expand Down
4 changes: 4 additions & 0 deletions dd-smoke-tests/iast-util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ plugins {
id 'java-test-fixtures'
}

ext {
defaultJdkVersion = 8
}

apply from: "$rootDir/gradle/java.gradle"

description = 'iast-smoke-tests-utils'
Expand Down
7 changes: 3 additions & 4 deletions dd-smoke-tests/java9-modules/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
ext {
defaultJdkVersion = 11
defaultJavaVersion = 11
defaultJavaCompilerRelease = 11
minJavaVersionForTests = JavaVersion.VERSION_11
}

Expand All @@ -10,12 +13,8 @@ jar {
}
}

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
Expand Down
8 changes: 8 additions & 0 deletions dd-smoke-tests/play-2.4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
}

ext {
defaultJdkVersion = 8
// TODO Java 17: This version of play doesn't support Java 17
maxJavaVersionForTests = JavaVersion.VERSION_15
}
Expand All @@ -12,6 +13,13 @@ apply from: "$rootDir/gradle/java.gradle"
def playVer = "2.4.11"
def scalaVer = System.getProperty("scala.binary.version", /* default = */ "2.11")

java {
toolchain {
// ScalaPlugin won't pick up another JDK unless specified with a toolchain.
languageVersion.set(JavaLanguageVersion.of(8))
}
}

play {
platform {
playVersion = playVer
Expand Down
8 changes: 8 additions & 0 deletions dd-smoke-tests/play-2.5/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
}

ext {
defaultJdkVersion = 8
// TODO Java 17: This version of play doesn't support Java 17
maxJavaVersionForTests = JavaVersion.VERSION_15
}
Expand All @@ -12,6 +13,13 @@ apply from: "$rootDir/gradle/java.gradle"
def playVer = "2.5.19"
def scalaVer = System.getProperty("scala.binary.version", /* default = */ "2.11")

java {
toolchain {
// ScalaPlugin won't pick up another JDK unless specified with a toolchain.
languageVersion.set(JavaLanguageVersion.of(8))
}
}

play {
platform {
playVersion = playVer
Expand Down
3 changes: 3 additions & 0 deletions dd-smoke-tests/quarkus/application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ dependencies {
quarkusBuild {
uberJar = true
}

targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
Loading