Skip to content

Commit

Permalink
HHH-16261 - Change Gradle build script to allow separate builds using…
Browse files Browse the repository at this point in the history
… JDK 11 and JDK 17
  • Loading branch information
cigaly authored and beikov committed Apr 25, 2023
1 parent 0b1d1a1 commit 01161e6
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tooling/metamodel-generator/hibernate-jpamodelgen.gradle
Expand Up @@ -43,6 +43,40 @@ compileTestJava {
}


// Tests with records
if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolchainEnabled ) {
// We need to configure the source and target version to 17
//compileTestJava17Java {
compileTestJava {
javaCompiler = javaToolchains.compilerFor {
languageVersion = gradle.ext.javaVersions.test.compiler
}
sourceCompatibility = 17
targetCompatibility = 17
}

test {
javaLauncher = javaToolchains.launcherFor {
languageVersion = gradle.ext.javaVersions.test.launcher
}

if ( gradle.ext.javaVersions.test.launcher.asInt() >= 19 ) {
logger.warn( "The version of Java bytecode that will be tested is not supported by Bytebuddy by default. " +
" Setting 'net.bytebuddy.experimental=true'." )
systemProperty 'net.bytebuddy.experimental', true
}
}
} else {
sourceSets {
test {
java {
exclude '**/records/*.java'
}
}
}
}


task jaxb {
// configure Gradle up-to-date checking
inputs.dir( xsdDir ).withPropertyName("xsdDir" ).withPathSensitivity( PathSensitivity.RELATIVE )
Expand Down

0 comments on commit 01161e6

Please sign in to comment.