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 {
|
2022-04-22 19:40:06 -04:00
|
|
|
implementation jakartaLibs.jaxbApi
|
|
|
|
implementation jakartaLibs.jaxb
|
2023-06-16 15:02:39 -04:00
|
|
|
implementation libs.antlrRuntime
|
|
|
|
implementation project( ':hibernate-core' )
|
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')
|
2021-05-14 15:59:59 -04:00
|
|
|
|
|
|
|
testImplementation project( ':hibernate-core' )
|
2021-09-23 09:57:10 -04:00
|
|
|
|
2022-04-22 19:40:06 -04:00
|
|
|
testImplementation jakartaLibs.validation
|
2023-05-06 05:56:15 -04:00
|
|
|
testImplementation jakartaLibs.annotation
|
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
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-04-09 22:42:42 -04:00
|
|
|
tasks.compileJava.dependsOn jaxb
|
2013-10-25 15:27:45 -04:00
|
|
|
|
|
|
|
checkstyleMain.exclude '**/jaxb/**'
|
|
|
|
|