2015-05-19 00:23:35 -04:00
|
|
|
/*
|
|
|
|
* Hibernate, Relational Persistence for Idiomatic Java
|
|
|
|
*
|
|
|
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
|
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
|
|
*/
|
2020-04-02 10:27:06 -04:00
|
|
|
|
|
|
|
plugins {
|
|
|
|
id 'com.gradle.enterprise' version '3.2.1'
|
|
|
|
}
|
|
|
|
|
2015-03-31 14:01:57 -04:00
|
|
|
if ( !JavaVersion.current().java8Compatible ) {
|
2019-10-23 02:45:47 -04:00
|
|
|
throw new GradleException( "Gradle must be run with Java 8 or later" )
|
|
|
|
}
|
|
|
|
|
2020-11-09 04:13:34 -05:00
|
|
|
gradle.ext.baselineJavaVersion = JavaLanguageVersion.of( 8 )
|
2019-10-23 02:45:47 -04:00
|
|
|
|
2020-11-09 04:13:34 -05:00
|
|
|
// Gradle does bytecode transformation on tests.
|
|
|
|
// You can't use bytecode higher than what Gradle supports, even with toolchains.
|
|
|
|
def GRADLE_MAX_SUPPORTED_BYTECODE_VERSION = 15
|
|
|
|
|
|
|
|
// If either 'main.jdk.version' or 'test.jdk.version' is set, enable the toolchain and use the selected jdk.
|
|
|
|
// If only one property is set, the other defaults to the baseline Java version (8).
|
|
|
|
// Note that when toolchain is enabled, you also need to specify
|
|
|
|
// the location of the selected jdks
|
|
|
|
// (auto-download and auto-detect are disabled in gradle.properties).
|
|
|
|
//
|
|
|
|
// Example (with SDKMAN):
|
|
|
|
// ./gradlew build -Ptest.jdk.version=15 \
|
|
|
|
// -Porg.gradle.java.installations.paths=$SDKMAN_CANDIDATES_DIR/java/15.0.1-open,$SDKMAN_CANDIDATES_DIR/java/8
|
|
|
|
if ( hasProperty( 'main.jdk.version' ) || hasProperty( 'test.jdk.version' ) ) {
|
|
|
|
// Testing a particular JDK version
|
|
|
|
// Gradle doesn't support all JDK versions unless we use toolchains
|
|
|
|
gradle.ext.javaToolchainEnabled = true
|
|
|
|
gradle.ext.javaVersions = [
|
|
|
|
main: [
|
|
|
|
compiler: JavaLanguageVersion.of( hasProperty( 'main.jdk.version' )
|
|
|
|
? getProperty( 'main.jdk.version' ) : gradle.ext.baselineJavaVersion.asInt() ),
|
|
|
|
release: gradle.ext.baselineJavaVersion
|
|
|
|
],
|
|
|
|
test: [
|
|
|
|
compiler: JavaLanguageVersion.of( hasProperty( 'test.jdk.version' )
|
|
|
|
? getProperty( 'test.jdk.version' ) : gradle.ext.baselineJavaVersion.asInt() )
|
|
|
|
]
|
|
|
|
]
|
|
|
|
def testCompilerVersion = gradle.ext.javaVersions.test.compiler
|
|
|
|
if ( testCompilerVersion.asInt() > GRADLE_MAX_SUPPORTED_BYTECODE_VERSION ) {
|
|
|
|
logger.warn( "[WARN] Gradle does not support bytecode version '${testCompilerVersion}'." +
|
|
|
|
" Forcing test bytecode to version ${GRADLE_MAX_SUPPORTED_BYTECODE_VERSION}." )
|
|
|
|
gradle.ext.javaVersions.test.release = JavaLanguageVersion.of( GRADLE_MAX_SUPPORTED_BYTECODE_VERSION )
|
2019-10-23 02:45:47 -04:00
|
|
|
}
|
|
|
|
else {
|
2020-11-09 04:13:34 -05:00
|
|
|
gradle.ext.javaVersions.test.release = testCompilerVersion
|
|
|
|
}
|
|
|
|
gradle.ext.javaVersions.test.launcher = testCompilerVersion
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// Not testing a particular JDK version: we will use the same JDK used to run Gradle.
|
|
|
|
// We disable toolchains for convenience, so that anyone can just run the build with their own JDK
|
|
|
|
// without any additional options and without downloading the whole JDK.
|
|
|
|
gradle.ext.javaToolchainEnabled = false
|
|
|
|
def gradleJdkVersion = JavaLanguageVersion.of( JavaVersion.current().getMajorVersion() )
|
|
|
|
if ( gradleJdkVersion.asInt() > GRADLE_MAX_SUPPORTED_BYTECODE_VERSION ) {
|
|
|
|
logger.warn( "[WARN] Gradle does not support this JDK, because it is too recent; build is likely to fail." +
|
|
|
|
" To avoid failures, you should use an older Java version when running Gradle, and rely on toolchains." +
|
|
|
|
" To that end, specify the version of Java you want to run tests with using property 'test.jdk.version'," +
|
|
|
|
" and specify the path to JDK8 *and* a JDK of the test version using property 'org.gradle.java.installations.paths'." +
|
|
|
|
" Example:" +
|
|
|
|
"./gradlew build -Ptest.jdk.version=15 -Porg.gradle.java.installations.paths=\$SDKMAN_CANDIDATES_DIR/java/15.0.1-open,\$SDKMAN_CANDIDATES_DIR/java/8" )
|
2019-10-23 02:45:47 -04:00
|
|
|
}
|
|
|
|
|
2020-11-09 04:13:34 -05:00
|
|
|
gradle.ext.javaVersions = [
|
|
|
|
main: [
|
|
|
|
compiler: gradleJdkVersion,
|
|
|
|
release: gradle.ext.baselineJavaVersion
|
|
|
|
],
|
|
|
|
test: [
|
|
|
|
compiler: gradleJdkVersion,
|
|
|
|
release: JavaLanguageVersion.of(
|
|
|
|
Math.min( GRADLE_MAX_SUPPORTED_BYTECODE_VERSION, gradleJdkVersion.asInt() ) ),
|
|
|
|
launcher: gradleJdkVersion
|
|
|
|
]
|
|
|
|
]
|
2015-03-31 14:01:57 -04:00
|
|
|
}
|
|
|
|
|
2020-11-09 04:13:34 -05:00
|
|
|
logger.lifecycle "Java versions for main code: " + gradle.ext.javaVersions.main
|
|
|
|
logger.lifecycle "Java versions for tests: " + gradle.ext.javaVersions.test
|
|
|
|
|
2010-10-08 21:20:10 -04:00
|
|
|
include 'hibernate-core'
|
2016-06-17 14:35:03 -04:00
|
|
|
include 'hibernate-entitymanager'
|
2013-11-26 18:48:25 -05:00
|
|
|
include 'hibernate-testing'
|
2010-10-09 14:24:27 -04:00
|
|
|
include 'hibernate-envers'
|
2019-07-25 12:39:32 -04:00
|
|
|
// todo (6.0): re-enable hibernate-spatial
|
|
|
|
//include 'hibernate-spatial'
|
2010-10-08 21:20:10 -04:00
|
|
|
|
2016-06-23 03:34:34 -04:00
|
|
|
include 'hibernate-java8'
|
|
|
|
|
2015-03-23 16:27:02 -04:00
|
|
|
include 'hibernate-osgi'
|
2013-01-23 18:22:03 -05:00
|
|
|
|
2010-10-09 14:27:47 -04:00
|
|
|
include 'hibernate-c3p0'
|
2010-10-09 14:31:54 -04:00
|
|
|
include 'hibernate-proxool'
|
2014-03-17 16:33:44 -04:00
|
|
|
include 'hibernate-hikaricp'
|
2018-01-13 07:48:46 -05:00
|
|
|
include 'hibernate-vibur'
|
2017-09-05 19:49:17 -04:00
|
|
|
include 'hibernate-agroal'
|
2010-10-09 14:27:47 -04:00
|
|
|
|
2014-03-19 21:43:42 -04:00
|
|
|
include 'hibernate-jcache'
|
2010-10-09 14:44:08 -04:00
|
|
|
include 'hibernate-ehcache'
|
2010-10-09 14:55:13 -04:00
|
|
|
include 'hibernate-infinispan'
|
2020-11-17 17:39:43 -05:00
|
|
|
include 'hibernate-micrometer'
|
2020-02-13 06:41:04 -05:00
|
|
|
include 'hibernate-graalvm'
|
2016-06-27 08:07:08 -04:00
|
|
|
|
2020-11-09 04:13:34 -05:00
|
|
|
// The plugin used to generate Java modules was compiled using JDK11.
|
|
|
|
// This means even with toolchains, Gradle needs to be run with Java 11+ in order to run Java modules ITs.
|
|
|
|
// We might be able to get rid of that limitation by relying on Gradle's built-in support for Java modules,
|
|
|
|
// but I (Yoann) tried and failed to make it work.
|
|
|
|
// See https://docs.gradle.org/current/samples/sample_java_modules_multi_project.html
|
|
|
|
if ( JavaVersion.current().isJava11Compatible() && gradle.ext.javaVersions.test.release.asInt() >= 9 ) {
|
2019-05-24 03:26:01 -04:00
|
|
|
include 'hibernate-integrationtest-java-modules'
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
logger.warn( '[WARN] Skipping Java module path integration tests because the JDK does not support it' )
|
|
|
|
}
|
|
|
|
|
2013-11-13 19:23:48 -05:00
|
|
|
include 'documentation'
|
|
|
|
include 'release'
|
|
|
|
|
2013-10-25 15:27:45 -04:00
|
|
|
include 'metamodel-generator'
|
|
|
|
project(':metamodel-generator').projectDir = new File(rootProject.projectDir, "tooling/metamodel-generator")
|
2015-03-23 15:36:41 -04:00
|
|
|
project(':metamodel-generator').name = 'hibernate-jpamodelgen'
|
2013-10-25 15:27:45 -04:00
|
|
|
|
2013-07-19 10:53:20 -04:00
|
|
|
include 'hibernate-gradle-plugin'
|
2013-11-13 19:23:48 -05:00
|
|
|
project(':hibernate-gradle-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-gradle-plugin")
|
2013-10-25 15:27:45 -04:00
|
|
|
|
2021-03-18 16:50:22 -04:00
|
|
|
//include 'project-template'
|
|
|
|
//project(':project-template').projectDir = new File(rootProject.projectDir, "tooling/project-template")
|
2020-10-15 18:20:30 -04:00
|
|
|
|
2015-03-25 21:41:23 -04:00
|
|
|
include 'hibernate-enhance-maven-plugin'
|
|
|
|
project(':hibernate-enhance-maven-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-enhance-maven-plugin")
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2010-10-08 21:20:10 -04:00
|
|
|
rootProject.children.each { project ->
|
|
|
|
project.buildFileName = "${project.name}.gradle"
|
|
|
|
assert project.projectDir.isDirectory()
|
2013-11-13 19:23:48 -05:00
|
|
|
assert project.buildFile.exists()
|
2010-10-08 21:20:10 -04:00
|
|
|
assert project.buildFile.isFile()
|
2020-10-15 18:20:30 -04:00
|
|
|
}
|