233 lines
7.4 KiB
Groovy
233 lines
7.4 KiB
Groovy
/*
|
|
* 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>.
|
|
*/
|
|
description = 'Hibernate O/RM implementation of the Jakarta Persistence specification'
|
|
|
|
apply from: rootProject.file( 'gradle/published-jakarta-java-module.gradle' )
|
|
|
|
evaluationDependsOn( ':hibernate-core' )
|
|
|
|
dependencies {
|
|
api libraries.jakarta_jpa
|
|
// This can now be made provided
|
|
// Could be made optional?
|
|
api libraries.byteBuddy
|
|
api libraries.antlr
|
|
api libraries.jakarta_jta
|
|
api libraries.jandex
|
|
api libraries.classmate
|
|
api libraries.jakarta_activation
|
|
|
|
compileOnly libraries.jakarta_jacc
|
|
compileOnly libraries.jakarta_validation
|
|
compileOnly libraries.ant
|
|
compileOnly libraries.jakarta_cdi
|
|
|
|
api libraries.dom4j
|
|
api libraries.commons_annotations
|
|
|
|
api libraries.jakarta_jaxb_api
|
|
api libraries.jakarta_jaxb_runtime
|
|
|
|
testImplementation project(':hibernate-testing-jakarta')
|
|
|
|
testImplementation libraries.shrinkwrap_api
|
|
testImplementation libraries.shrinkwrap
|
|
testImplementation libraries.jakarta_jacc
|
|
testImplementation libraries.jakarta_validation
|
|
testImplementation libraries.jandex
|
|
testImplementation libraries.classmate
|
|
testImplementation libraries.mockito
|
|
testImplementation libraries.mockito_inline
|
|
testImplementation libraries.jodaTime
|
|
testImplementation libraries.assertj
|
|
|
|
testImplementation libraries.jakarta_cdi
|
|
|
|
testImplementation( libraries.jakarta_validator ) {
|
|
// for test runtime
|
|
transitive = true
|
|
}
|
|
|
|
// for testing stored procedure support
|
|
testImplementation libraries.derby
|
|
|
|
testRuntimeOnly 'org.hamcrest:hamcrest-all:1.3'
|
|
testRuntimeOnly "org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.0.Final"
|
|
testRuntimeOnly libraries.jakarta_el
|
|
testRuntimeOnly 'jaxen:jaxen:1.1'
|
|
testRuntimeOnly libraries.javassist
|
|
testRuntimeOnly libraries.byteBuddy
|
|
testRuntimeOnly libraries.jakarta_weld
|
|
testRuntimeOnly libraries.atomikos
|
|
testRuntimeOnly libraries.atomikos_jta
|
|
// todo (jakarta): replace this when the jakarta artifact is released
|
|
testRuntimeOnly project(':hibernate-transaction-client')
|
|
// testRuntimeOnly libraries.wildfly_transaction_client_jakarta
|
|
|
|
testImplementation libraries.shrinkwrap_descriptors_api_javaee
|
|
testImplementation libraries.shrinkwrap_descriptors_impl_javaee
|
|
|
|
testImplementation libraries.jboss_ejb_spec_jar
|
|
testImplementation libraries.jboss_annotation_spec_jar
|
|
}
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// main jar
|
|
//
|
|
//tasks.jar {
|
|
// enabled false
|
|
//}
|
|
//
|
|
//task jakartafyJar( type: JakartaJarTransformation ) {
|
|
// sourceJar = project(':hibernate-core').tasks.jar.archiveFile
|
|
// targetJar = tasks.jar.archiveFile
|
|
//}
|
|
//
|
|
//tasks.jar.dependsOn project(':hibernate-core').tasks.jar
|
|
//tasks.jar.finalizedBy tasks.jakartafyJar
|
|
//tasks.jakartafyJar.dependsOn tasks.jar
|
|
//tasks.jakartafyJar.mustRunAfter tasks.jar
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// javadoc jar
|
|
|
|
//tasks.javadocJar {
|
|
// enabled false
|
|
//}
|
|
//
|
|
//task jakartafyJavadocJar( type: JakartaJarTransformation ) {
|
|
// sourceJar = project(':hibernate-core').tasks.javadocJar.archiveFile
|
|
// targetJar = tasks.javadocJar.archiveFile
|
|
//}
|
|
//
|
|
//tasks.javadocJar.dependsOn project(':hibernate-core').tasks.javadocJar
|
|
//tasks.javadocJar.finalizedBy tasks.jakartafyJavadocJar
|
|
//tasks.jakartafyJavadocJar.dependsOn tasks.javadocJar
|
|
//tasks.jakartafyJavadocJar.mustRunAfter tasks.javadocJar
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// sources jar
|
|
|
|
//tasks.sourcesJar {
|
|
// enabled false
|
|
//}
|
|
//
|
|
//task jakartafySourcesJar( type: JakartaJarTransformation ) {
|
|
// sourceJar = project(':hibernate-core').tasks.sourcesJar.archiveFile
|
|
// targetJar = tasks.javadocJar.archiveFile
|
|
//}
|
|
//
|
|
//tasks.sourcesJar.dependsOn project(':hibernate-core').tasks.sourcesJar
|
|
//tasks.sourcesJar.finalizedBy tasks.jakartafySourcesJar
|
|
//tasks.jakartafySourcesJar.dependsOn tasks.sourcesJar
|
|
//tasks.jakartafySourcesJar.mustRunAfter tasks.sourcesJar
|
|
//
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// testing
|
|
|
|
project.ext {
|
|
testClassesUnpackTargetDirectory = project.layout.buildDirectory.dir( 'jakarta/unpack/classes' )
|
|
testClassesTransformationTargetDirectory = project.layout.buildDirectory.dir( 'jakarta/test/classes' )
|
|
|
|
templateUnpackTargetDirectory = project.layout.buildDirectory.dir( 'jakarta/unpack/templates' )
|
|
templatesTransformationTargetDirectory = project.layout.buildDirectory.dir( 'jakarta/test/templates' )
|
|
}
|
|
|
|
//tasks.compileTestJava {
|
|
// enabled false
|
|
// dependsOn project(':hibernate-core').tasks.compileTestJava
|
|
// dependsOn
|
|
//}
|
|
//
|
|
//tasks.processTestResources {
|
|
// enabled false
|
|
// dependsOn project(':hibernate-core').tasks.compileTestJava
|
|
//}
|
|
//
|
|
//task unpackTests(type: Copy) {
|
|
// from project( ':hibernate-core' ).sourceSets.test.output
|
|
//// from zipTree( project( ':hibernate-core' ).tasks.testJar.archiveFile )
|
|
// into project.testClassesUnpackTargetDirectory
|
|
// exclude 'templates/**'
|
|
//}
|
|
//
|
|
//task jakartafyTests(type: JakartaDirectoryTransformation) {
|
|
// sourceDirectory = project.testClassesUnpackTargetDirectory
|
|
// targetDirectory = project.testClassesTransformationTargetDirectory
|
|
//
|
|
// dependsOn 'compileTestJava'
|
|
// dependsOn 'unpackTests'
|
|
//}
|
|
|
|
//tasks.test.dependsOn tasks.jakartafyTests
|
|
//tasks.jakartafyTests.dependsOn tasks.unpackTests
|
|
//tasks.unpackTests.dependsOn project( ':hibernate-core' ).tasks.testJar
|
|
|
|
tasks.collectTests {
|
|
exclude 'templates/**'
|
|
}
|
|
|
|
final Provider<Directory> bundleCollectDir = project.getLayout().getBuildDirectory().dir( "jakarta/collect/bundles" );
|
|
final Provider<Directory> bundleTransformedDir = project.getLayout().getBuildDirectory().dir( "jakarta/transformed/bundles" );
|
|
|
|
task copyTestBundles(type: Copy) {
|
|
// `:hibernate-core:processTestResources` also triggers processing the
|
|
// packaging "bundle templates" into it's `${buildDir}/bundles` dir.
|
|
// we want to start with that form
|
|
dependsOn project( ':hibernate-core' ).tasks.processTestResources
|
|
|
|
inputs.dir project( ':hibernate-core' ).layout.buildDirectory.dir( 'bundles' )
|
|
outputs.dir bundleCollectDir
|
|
|
|
from project( ':hibernate-core' ).layout.buildDirectory.dir( 'bundles' )
|
|
into bundleCollectDir
|
|
|
|
// There are persistence.xml files referencing jar files through their absolute path so we
|
|
// have to replace 'hibernate-core' references in the path with 'hibernate-core-jakarta'
|
|
filter { line ->
|
|
line.replaceAll( 'hibernate-core/target', 'hibernate-core-jakarta/target' )
|
|
}
|
|
|
|
doFirst {
|
|
bundleCollectDir.get().asFile.mkdirs()
|
|
}
|
|
}
|
|
|
|
task jakartafyTemplates(type: JakartaDirectoryTransformation) {
|
|
dependsOn tasks.copyTestBundles
|
|
dependsOn tasks.jakartafyTests
|
|
|
|
sourceDirectory = bundleCollectDir
|
|
targetDirectory = bundleTransformedDir
|
|
}
|
|
|
|
tasks.test {
|
|
testClassesDirs += project.files( bundleTransformedDir )
|
|
classpath += project.files( bundleTransformedDir )
|
|
|
|
systemProperty 'file.encoding', 'utf-8'
|
|
|
|
if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
|
|
// See org.hibernate.boot.model.naming.NamingHelperTest.DefaultCharset.set
|
|
jvmArgs( ['--add-opens', 'java.base/java.nio.charset=ALL-UNNAMED'] )
|
|
// Weld needs this to generate proxies
|
|
jvmArgs( ['--add-opens', 'java.base/java.security=ALL-UNNAMED'] )
|
|
jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
|
|
}
|
|
// Allow to exclude specific tests
|
|
if ( project.hasProperty( 'excludeTests' ) ) {
|
|
filter {
|
|
excludeTestsMatching project.property( 'excludeTests' ).toString()
|
|
}
|
|
}
|
|
} |