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>.
|
|
|
|
*/
|
2021-09-22 18:52:06 -04:00
|
|
|
plugins {
|
|
|
|
id 'org.hibernate.build.xjc-jakarta'
|
|
|
|
}
|
2018-01-10 16:06:58 -05:00
|
|
|
|
2024-02-24 14:45:38 -05:00
|
|
|
description = 'Hibernate compile-time tooling'
|
2020-04-06 13:21:11 -04:00
|
|
|
|
2018-01-10 16:06:58 -05:00
|
|
|
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
|
2013-10-25 15:27:45 -04:00
|
|
|
apply plugin: 'version-injection'
|
|
|
|
|
2013-11-24 16:16:12 -05:00
|
|
|
ext {
|
2021-08-02 17:35:16 -04:00
|
|
|
xjcTargetDir = file( "${buildDir}/generated/sources/xjc/main" )
|
2013-11-24 16:16:12 -05:00
|
|
|
xsdDir = file( "${projectDir}/src/main/xsd" )
|
2013-10-25 15:27:45 -04:00
|
|
|
}
|
|
|
|
|
2024-02-26 09:33:13 -05:00
|
|
|
sourceSets {
|
|
|
|
quarkusOrmPanache {
|
|
|
|
java {
|
|
|
|
srcDirs = ['src/quarkusOrmPanache/java']
|
|
|
|
}
|
|
|
|
resources {
|
2024-05-30 08:23:38 -04:00
|
|
|
srcDirs sourceSets.main.resources
|
2024-02-26 09:33:13 -05:00
|
|
|
}
|
|
|
|
compileClasspath += sourceSets.main.output + sourceSets.test.output
|
|
|
|
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
|
|
|
|
}
|
|
|
|
quarkusHrPanache {
|
|
|
|
java {
|
|
|
|
srcDirs = ['src/quarkusHrPanache/java']
|
|
|
|
}
|
|
|
|
resources {
|
2024-05-30 08:23:38 -04:00
|
|
|
srcDirs sourceSets.main.resources
|
2024-02-26 09:33:13 -05:00
|
|
|
}
|
|
|
|
compileClasspath += sourceSets.main.output + sourceSets.test.output
|
|
|
|
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
|
|
|
|
}
|
2024-03-01 14:04:13 -05:00
|
|
|
jakartaData {
|
|
|
|
java {
|
|
|
|
srcDirs = ['src/jakartaData/java']
|
|
|
|
}
|
|
|
|
resources {
|
2024-05-30 08:23:38 -04:00
|
|
|
srcDirs sourceSets.main.resources
|
2024-03-01 14:04:13 -05:00
|
|
|
}
|
|
|
|
compileClasspath += sourceSets.main.output + sourceSets.test.output
|
|
|
|
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
|
|
|
|
}
|
2024-02-28 09:29:25 -05:00
|
|
|
}
|
|
|
|
|
2018-01-10 16:06:58 -05:00
|
|
|
dependencies {
|
2023-11-17 14:11:24 -05:00
|
|
|
// api - ewww... but Maven needs them this way
|
|
|
|
api project( ':hibernate-core' )
|
2024-03-24 06:40:16 -04:00
|
|
|
api libs.hcann
|
|
|
|
api libs.jandex
|
2023-11-16 06:54:58 -05:00
|
|
|
api jakartaLibs.jaxbApi
|
|
|
|
api jakartaLibs.jaxb
|
|
|
|
api jakartaLibs.validation
|
|
|
|
api jakartaLibs.annotation
|
|
|
|
api libs.antlrRuntime
|
|
|
|
api libs.byteBuddy
|
2024-03-24 06:40:16 -04:00
|
|
|
api libs.logging
|
2018-10-15 04:55:56 -04:00
|
|
|
|
2022-04-22 19:40:06 -04:00
|
|
|
xjc jakartaLibs.xjc
|
|
|
|
xjc jakartaLibs.jaxb
|
2021-09-22 18:52:06 -04:00
|
|
|
xjc rootProject.fileTree(dir: 'patched-libs/jaxb2-basics', include: '*.jar')
|
2024-02-22 07:31:14 -05:00
|
|
|
|
2024-02-26 09:33:13 -05:00
|
|
|
quarkusOrmPanacheImplementation "io.quarkus:quarkus-hibernate-orm-panache:3.6.2"
|
|
|
|
quarkusHrPanacheImplementation "io.quarkus:quarkus-hibernate-reactive-panache:3.6.2"
|
2024-06-12 04:40:19 -04:00
|
|
|
jakartaDataImplementation "jakarta.data:jakarta.data-api:1.0.0"
|
2024-03-25 09:41:55 -04:00
|
|
|
jakartaDataImplementation "org.hibernate.reactive:hibernate-reactive-core:2.2.2.Final"
|
2024-04-18 09:43:27 -04:00
|
|
|
jakartaDataImplementation "io.quarkus:quarkus-hibernate-orm-panache:3.6.2"
|
2024-02-26 09:33:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// The source set gets a custom configuration which extends the normal test implementation config
|
|
|
|
configurations {
|
|
|
|
quarkusOrmPanacheImplementation.extendsFrom(testImplementation)
|
|
|
|
quarkusOrmPanacheRuntimeOnly.extendsFrom(testRuntimeOnly)
|
|
|
|
quarkusOrmPanacheCompileOnly.extendsFrom(testCompileOnly)
|
|
|
|
quarkusHrPanacheImplementation.extendsFrom(testImplementation)
|
|
|
|
quarkusHrPanacheRuntimeOnly.extendsFrom(testRuntimeOnly)
|
|
|
|
quarkusHrPanacheCompileOnly.extendsFrom(testCompileOnly)
|
2024-03-01 14:04:13 -05:00
|
|
|
jakartaDataImplementation.extendsFrom(testImplementation)
|
|
|
|
jakartaDataRuntimeOnly.extendsFrom(testRuntimeOnly)
|
|
|
|
jakartaDataCompileOnly.extendsFrom(testCompileOnly)
|
2024-02-28 09:29:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
def quarkusOrmPanacheTestTask = tasks.register( 'quarkusOrmPanacheTest', Test ) {
|
|
|
|
description = 'Runs the Quarkus ORM Panache tests.'
|
|
|
|
group = 'verification'
|
|
|
|
|
2024-02-26 09:33:13 -05:00
|
|
|
testClassesDirs = sourceSets.quarkusOrmPanache.output.classesDirs
|
|
|
|
classpath = sourceSets.quarkusOrmPanache.runtimeClasspath
|
2024-02-28 09:29:25 -05:00
|
|
|
shouldRunAfter test
|
|
|
|
}
|
|
|
|
|
|
|
|
def quarkusHrPanacheTestTask = tasks.register( 'quarkusHrPanacheTest', Test ) {
|
|
|
|
description = 'Runs the Quarkus HR Panache tests.'
|
|
|
|
group = 'verification'
|
|
|
|
|
2024-02-26 09:33:13 -05:00
|
|
|
testClassesDirs = sourceSets.quarkusHrPanache.output.classesDirs
|
|
|
|
classpath = sourceSets.quarkusHrPanache.runtimeClasspath
|
2024-02-28 09:29:25 -05:00
|
|
|
shouldRunAfter test
|
2018-01-10 16:06:58 -05:00
|
|
|
}
|
|
|
|
|
2024-03-01 14:04:13 -05:00
|
|
|
def jakartaDataTestTask = tasks.register( 'jakartaDataTest', Test ) {
|
|
|
|
description = 'Runs the Jakarta Data tests.'
|
|
|
|
group = 'verification'
|
|
|
|
|
|
|
|
testClassesDirs = sourceSets.jakartaData.output.classesDirs
|
|
|
|
classpath = sourceSets.jakartaData.runtimeClasspath
|
|
|
|
shouldRunAfter test
|
|
|
|
}
|
|
|
|
|
2024-02-28 09:29:25 -05:00
|
|
|
check.dependsOn quarkusHrPanacheTestTask
|
|
|
|
check.dependsOn quarkusOrmPanacheTestTask
|
2024-02-29 05:55:14 -05:00
|
|
|
test.dependsOn quarkusHrPanacheTestTask
|
|
|
|
test.dependsOn quarkusOrmPanacheTestTask
|
2024-02-28 09:29:25 -05:00
|
|
|
|
2013-10-25 15:27:45 -04:00
|
|
|
sourceSets.main {
|
2015-04-09 22:42:42 -04:00
|
|
|
java.srcDir xjcTargetDir
|
2013-11-24 16:16:12 -05:00
|
|
|
resources.srcDir xsdDir
|
2013-10-25 15:27:45 -04:00
|
|
|
}
|
|
|
|
|
2013-11-22 20:46:05 -05:00
|
|
|
compileTestJava {
|
|
|
|
options.compilerArgs += [
|
2024-02-24 14:45:38 -05:00
|
|
|
"-proc:none",
|
|
|
|
"-AsuppressJakartaDataMetamodel=true"
|
2013-11-22 20:46:05 -05:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2023-04-03 04:37:58 -04:00
|
|
|
// Tests with records
|
2023-08-07 21:05:47 -04:00
|
|
|
if ( jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit ) {
|
2023-04-03 04:37:58 -04:00
|
|
|
// We need to configure the source and target version to 17
|
2024-03-05 03:44:12 -05:00
|
|
|
def testCompilerConfig = {
|
|
|
|
javaCompiler = javaToolchains.compilerFor {
|
|
|
|
languageVersion = jdkVersions.test.compile
|
|
|
|
}
|
|
|
|
sourceCompatibility = 17
|
|
|
|
targetCompatibility = 17
|
|
|
|
}
|
|
|
|
|
2023-04-03 04:37:58 -04:00
|
|
|
compileTestJava {
|
2024-03-05 03:44:12 -05:00
|
|
|
configure testCompilerConfig
|
2023-04-03 04:37:58 -04:00
|
|
|
}
|
|
|
|
|
2024-03-05 03:44:12 -05:00
|
|
|
compileQuarkusOrmPanacheJava {
|
|
|
|
configure testCompilerConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
compileQuarkusHrPanacheJava {
|
|
|
|
configure testCompilerConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
compileJakartaDataJava {
|
|
|
|
configure testCompilerConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
def testLauncherConfig = {
|
|
|
|
javaLauncher = javaToolchains.launcherFor {
|
|
|
|
languageVersion = jdkVersions.test.launcher
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-03 04:37:58 -04:00
|
|
|
test {
|
2024-03-05 03:44:12 -05:00
|
|
|
configure testLauncherConfig
|
2023-04-03 04:37:58 -04:00
|
|
|
}
|
2024-03-05 03:44:12 -05:00
|
|
|
|
|
|
|
quarkusOrmPanacheTest {
|
|
|
|
configure testLauncherConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
quarkusHrPanacheTest {
|
|
|
|
configure testLauncherConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
jakartaDataTest {
|
|
|
|
configure testLauncherConfig
|
|
|
|
}
|
2024-02-24 14:45:38 -05:00
|
|
|
}
|
|
|
|
else {
|
2023-04-03 04:37:58 -04:00
|
|
|
sourceSets {
|
|
|
|
test {
|
|
|
|
java {
|
|
|
|
exclude '**/records/*.java'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-25 15:27:45 -04:00
|
|
|
task jaxb {
|
|
|
|
// configure Gradle up-to-date checking
|
2021-07-29 14:02:52 -04:00
|
|
|
inputs.dir( xsdDir ).withPropertyName("xsdDir" ).withPathSensitivity( PathSensitivity.RELATIVE )
|
2015-04-09 22:42:42 -04:00
|
|
|
outputs.dir( xjcTargetDir )
|
2021-07-29 14:02:52 -04:00
|
|
|
outputs.cacheIf { true }
|
2013-10-25 15:27:45 -04:00
|
|
|
|
|
|
|
// perform actions
|
|
|
|
doLast {
|
2015-04-09 22:42:42 -04:00
|
|
|
xjcTargetDir.mkdirs()
|
2013-10-25 15:27:45 -04:00
|
|
|
|
2015-04-09 22:42:42 -04:00
|
|
|
ant.taskdef(name: 'xjc', classname: 'org.jvnet.jaxb2_commons.xjc.XJC2Task', classpath: configurations.xjc.asPath)
|
2013-10-25 15:27:45 -04:00
|
|
|
|
|
|
|
ant.xjc(
|
2015-04-09 22:42:42 -04:00
|
|
|
destdir: ( xjcTargetDir as File ).absolutePath,
|
2024-03-01 16:09:04 -05:00
|
|
|
package: 'org.hibernate.processor.xml.jaxb',
|
2013-10-25 15:27:45 -04:00
|
|
|
extension: 'true'
|
|
|
|
) {
|
2021-07-26 14:51:22 -04:00
|
|
|
project.ant.arg line: '-no-header'
|
|
|
|
project.ant.arg line: '-npa'
|
|
|
|
schema( dir: xsdDir.path, includes: "*.xsd" )
|
2013-10-25 15:27:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-08-03 09:38:03 -04:00
|
|
|
tasks.sourcesJar.dependsOn jaxb
|
|
|
|
tasks.sourcesJar.dependsOn ':hibernate-core:generateHqlParser'
|
|
|
|
tasks.sourcesJar.dependsOn ':hibernate-core:generateSqlScriptParser'
|
2015-04-09 22:42:42 -04:00
|
|
|
tasks.compileJava.dependsOn jaxb
|
2013-10-25 15:27:45 -04:00
|
|
|
|
|
|
|
checkstyleMain.exclude '**/jaxb/**'
|
|
|
|
|