Run profiling tests on zulu8

This commit is contained in:
Nikolay Martynov 2020-03-23 08:04:15 -04:00
parent a5a5743f7c
commit 6574c6f8b6
3 changed files with 15 additions and 6 deletions

View File

@ -1,6 +1,11 @@
// Set properties before any plugins get loaded // Set properties before any plugins get loaded
ext { ext {
minJavaVersionForTests = JavaVersion.VERSION_11 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" 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 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 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 force IDEA to treat this as Java11 project with 'idea' plugin below.
* We run tests only on Java11+.
*/ */
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

View File

@ -5,7 +5,7 @@ plugins {
ext { ext {
minJavaVersionForTests = JavaVersion.VERSION_11 minJavaVersionForTests = JavaVersion.VERSION_11
// Zulu has backported profiling support // Zulu has backported profiling support
forceJdk = ['ZULU8', 'ZULU11', '12'] forceJdk = ['ZULU8']
jmcVersion = '8.0.0-SNAPSHOT' jmcVersion = '8.0.0-SNAPSHOT'
} }

View File

@ -48,12 +48,17 @@ if (project.hasProperty('minJavaVersionForTests') && project.getProperty('minJav
from sourceSets."main_$name".output from sourceSets."main_$name".output
} }
// 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 { tasks.withType(JavaCompile).configureEach {
if (it.name.toLowerCase().contains("test")) { if (it.name.toLowerCase().contains("test")) {
sourceCompatibility = version sourceCompatibility = version
targetCompatibility = version targetCompatibility = version
} }
} }
}
} }
java { java {