hibernate-orm/hibernate-core-jakarta/hibernate-core-jakarta.gradle

233 lines
7.4 KiB
Groovy
Raw Normal View History

/*
* 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'
2021-07-01 22:15:55 -04:00
apply from: rootProject.file( 'gradle/published-jakarta-java-module.gradle' )
evaluationDependsOn( ':hibernate-core' )
dependencies {
2021-05-25 12:11:29 -04:00
api libraries.jakarta_jpa
// This can now be made provided
// Could be made optional?
2021-05-25 12:11:29 -04:00
api libraries.byteBuddy
api libraries.antlr
api libraries.jakarta_jta
api libraries.jandex
api libraries.classmate
api libraries.jakarta_activation
2021-05-25 12:11:29 -04:00
compileOnly libraries.jakarta_jacc
compileOnly libraries.jakarta_validation
compileOnly libraries.ant
compileOnly libraries.jakarta_cdi
2021-05-25 12:11:29 -04:00
api libraries.dom4j
api libraries.commons_annotations
2021-05-25 12:11:29 -04:00
api libraries.jakarta_jaxb_api
api libraries.jakarta_jaxb_runtime
2021-05-25 12:11:29 -04:00
testImplementation project(':hibernate-testing-jakarta')
2021-05-07 03:50:35 -04:00
2021-05-25 12:11:29 -04:00
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
2021-05-07 03:50:35 -04:00
2021-05-25 12:11:29 -04:00
testImplementation libraries.jakarta_cdi
2021-05-07 03:50:35 -04:00
2021-05-25 12:11:29 -04:00
testImplementation( libraries.jakarta_validator ) {
2021-05-07 03:50:35 -04:00
// for test runtime
transitive = true
}
// for testing stored procedure support
2021-05-25 12:11:29 -04:00
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
2021-05-07 03:50:35 -04:00
// todo (jakarta): replace this when the jakarta artifact is released
2021-05-25 12:11:29 -04:00
testRuntimeOnly project(':hibernate-transaction-client')
// testRuntimeOnly libraries.wildfly_transaction_client_jakarta
2021-05-07 03:50:35 -04:00
2021-05-25 12:11:29 -04:00
testImplementation libraries.shrinkwrap_descriptors_api_javaee
testImplementation libraries.shrinkwrap_descriptors_impl_javaee
2021-05-07 03:50:35 -04:00
2021-05-25 12:11:29 -04:00
testImplementation libraries.jboss_ejb_spec_jar
testImplementation libraries.jboss_annotation_spec_jar
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// main jar
2021-07-01 22:15:55 -04:00
//
//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
2021-07-01 22:15:55 -04:00
//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
2021-07-01 22:15:55 -04:00
//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' )
}
2021-07-01 22:15:55 -04:00
//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
2021-07-01 22:15:55 -04:00
tasks.collectTests {
exclude 'templates/**'
}
2021-07-01 22:15:55 -04:00
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' )
2021-07-01 22:15:55 -04:00
outputs.dir bundleCollectDir
from project( ':hibernate-core' ).layout.buildDirectory.dir( 'bundles' )
2021-07-01 22:15:55 -04:00
into bundleCollectDir
2021-05-31 07:02:16 -04:00
// 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'
2021-05-31 07:02:16 -04:00
filter { line ->
line.replaceAll( 'hibernate-core/target', 'hibernate-core-jakarta/target' )
2021-05-31 07:02:16 -04:00
}
2021-05-07 03:50:35 -04:00
doFirst {
2021-07-01 22:15:55 -04:00
bundleCollectDir.get().asFile.mkdirs()
2021-05-07 03:50:35 -04:00
}
}
task jakartafyTemplates(type: JakartaDirectoryTransformation) {
dependsOn tasks.copyTestBundles
2021-07-01 22:15:55 -04:00
dependsOn tasks.jakartafyTests
2021-05-07 03:50:35 -04:00
2021-07-01 22:15:55 -04:00
sourceDirectory = bundleCollectDir
targetDirectory = bundleTransformedDir
2021-05-07 03:50:35 -04:00
}
tasks.test {
2021-07-01 22:15:55 -04:00
testClassesDirs += project.files( bundleTransformedDir )
classpath += project.files( bundleTransformedDir )
2021-05-07 03:50:35 -04:00
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()
}
}
2021-07-01 22:15:55 -04:00
}