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
|
|
|
}
|
|
|
|
|
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' )
|
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
|
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')
|
2018-01-10 16:06:58 -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
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2013-10-25 15:27:45 -04: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
|
|
|
|
//compileTestJava17Java {
|
|
|
|
compileTestJava {
|
|
|
|
javaCompiler = javaToolchains.compilerFor {
|
2023-08-15 13:35:08 -04:00
|
|
|
languageVersion = jdkVersions.test.compile
|
2023-04-03 04:37:58 -04:00
|
|
|
}
|
|
|
|
sourceCompatibility = 17
|
|
|
|
targetCompatibility = 17
|
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
|
|
|
javaLauncher = javaToolchains.launcherFor {
|
2023-08-15 13:35:08 -04:00
|
|
|
languageVersion = jdkVersions.test.launcher
|
2023-04-03 04:37:58 -04:00
|
|
|
}
|
|
|
|
}
|
2024-02-24 14:45:38 -05:00
|
|
|
}
|
|
|
|
else {
|
2023-04-03 04:37:58 -04:00
|
|
|
sourceSets {
|
|
|
|
test {
|
|
|
|
java {
|
|
|
|
exclude '**/records/*.java'
|
2024-02-23 16:38:01 -05:00
|
|
|
exclude '**/data/*.java'
|
2023-04-03 04:37:58 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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,
|
2013-10-25 15:27:45 -04:00
|
|
|
package: 'org.hibernate.jpamodelgen.xml.jaxb',
|
|
|
|
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/**'
|
|
|
|
|