diff --git a/dd-java-agent/agent-profiling/profiling-controller-openjdk/profiling-controller-openjdk.gradle b/dd-java-agent/agent-profiling/profiling-controller-openjdk/profiling-controller-openjdk.gradle index 91e84d65bf..2239d135ce 100644 --- a/dd-java-agent/agent-profiling/profiling-controller-openjdk/profiling-controller-openjdk.gradle +++ b/dd-java-agent/agent-profiling/profiling-controller-openjdk/profiling-controller-openjdk.gradle @@ -1,6 +1,11 @@ // Set properties before any plugins get loaded ext { minJavaVersionForTests = JavaVersion.VERSION_11 + // Zulu has backported profiling support + forceJdk = ['ZULU8'] + // 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 } apply from: "${rootDir}/gradle/java.gradle" @@ -26,7 +31,6 @@ Setup here is as following: * We compile with Java11 compiler to get JFR definitions. * We specify source/target as Java8 to get code that is loadable on Java8 - JFR defs are Java8 compatible. * We force IDEA to treat this as Java11 project with 'idea' plugin below. -* We run tests only on Java11+. */ sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 diff --git a/dd-smoke-tests/profiling-integration-tests/profiling-integration-tests.gradle b/dd-smoke-tests/profiling-integration-tests/profiling-integration-tests.gradle index 4f7db66147..54c9990c9d 100644 --- a/dd-smoke-tests/profiling-integration-tests/profiling-integration-tests.gradle +++ b/dd-smoke-tests/profiling-integration-tests/profiling-integration-tests.gradle @@ -5,7 +5,7 @@ plugins { ext { minJavaVersionForTests = JavaVersion.VERSION_11 // Zulu has backported profiling support - forceJdk = ['ZULU8', 'ZULU11', '12'] + forceJdk = ['ZULU8'] jmcVersion = '8.0.0-SNAPSHOT' } diff --git a/gradle/java.gradle b/gradle/java.gradle index a75a67f345..d2ab140903 100644 --- a/gradle/java.gradle +++ b/gradle/java.gradle @@ -48,10 +48,15 @@ if (project.hasProperty('minJavaVersionForTests') && project.getProperty('minJav from sourceSets."main_$name".output } - tasks.withType(JavaCompile).configureEach { - if (it.name.toLowerCase().contains("test")) { - sourceCompatibility = version - targetCompatibility = version + // In some cases we would like to avoid setting java version to `minJavaVersionForTests`. + // For example we would like to be able to run profiling tests with ZULU8, but we cannot run it with other JDK8 implementations at the moment + def skipSettingTestJavaVersion = project.hasProperty('skipSettingTestJavaVersion') && project.getProperty('skipSettingTestJavaVersion') + if (!skipSettingTestJavaVersion) { + tasks.withType(JavaCompile).configureEach { + if (it.name.toLowerCase().contains("test")) { + sourceCompatibility = version + targetCompatibility = version + } } } }