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
|
|
|
|
2020-04-06 13:21:11 -04:00
|
|
|
description = 'Annotation Processor to generate JPA 2 static metamodel classes'
|
|
|
|
|
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 += [
|
|
|
|
"-proc:none"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2023-08-15 13:35:08 -04:00
|
|
|
if ( jdkVersions.test.launcher.asInt() >= 19 ) {
|
2023-04-03 04:37:58 -04:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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/**'
|
|
|
|
|