hibernate-orm/hibernate-envers-jakarta/hibernate-envers-jakarta.gr...

147 lines
4.3 KiB
Groovy
Raw Normal View History

import org.hibernate.orm.jakarta.JakartaDirectoryTransformation
import org.hibernate.orm.jakarta.JakartaJarTransformation
/*
* 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\'s entity version (audit/history) support Jakarta edition'
apply from: rootProject.file( 'gradle/jakarta-java-module.gradle' )
evaluationDependsOn( ':hibernate-envers' )
evaluationDependsOn( ':hibernate-transaction-client' )
dependencies {
api( project( ':hibernate-core-jakarta' ) ) {
// Exclude access to this to avoid future use.
exclude group: "org.javassist", module: "javassist"
}
testImplementation( project( ':hibernate-envers-jakarta' ) )
testImplementation( project( ':hibernate-testing-jakarta' ) )
testImplementation( project( path: ':hibernate-core-jakarta', configuration: 'tests' ) )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// main jar
tasks.jar {
enabled false
}
task jakartafyJar( type: JakartaJarTransformation ) {
sourceJar = project(':hibernate-envers').tasks.jar.archiveFile
targetJar = tasks.jar.archiveFile
}
tasks.jar.dependsOn project(':hibernate-envers').tasks.jar
tasks.jar.finalizedBy tasks.jakartafyJar
tasks.jakartafyJar.dependsOn tasks.jar
tasks.jakartafyJar.mustRunAfter tasks.jar
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// javadoc jar
tasks.javadocJar {
enabled false
2021-05-07 03:50:35 -04:00
}
task jakartafyJavadocJar( type: JakartaJarTransformation ) {
sourceJar = project(':hibernate-envers').tasks.javadocJar.archiveFile
targetJar = tasks.javadocJar.archiveFile
}
tasks.javadocJar.dependsOn project(':hibernate-envers').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-envers').tasks.sourcesJar.archiveFile
targetJar = tasks.javadocJar.archiveFile
}
tasks.sourcesJar.dependsOn project(':hibernate-envers').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' )
}
tasks.compileTestJava {
enabled false
}
tasks.processTestResources {
enabled false
}
task unpackTests(type: Copy) {
from zipTree( project( ':hibernate-envers' ).tasks.testJar.archiveFile )
into project.testClassesUnpackTargetDirectory
}
task jakartafyTests(type: JakartaDirectoryTransformation) {
sourceDirectory = project.testClassesUnpackTargetDirectory
targetDirectory = project.testClassesTransformationTargetDirectory
}
tasks.compileTestJava.dependsOn tasks.unpackTests
tasks.compileTestJava.finalizedBy tasks.jakartafyTests
tasks.unpackTests.dependsOn project(':hibernate-envers').tasks.testJar
tasks.jakartafyTests.dependsOn tasks.unpackTests
tasks.test {
dependsOn tasks.jakartafyTests
testClassesDirs += project.files( tasks.jakartafyTests.targetDirectory )
classpath += project.files( tasks.jakartafyTests.targetDirectory )
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'] )
}
}
tasks.test.dependsOn ':hibernate-transaction-client:jar'
task testJar(type: Jar, dependsOn: testClasses) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set( 'test' )
from sourceSets.test.output
}
artifacts {
tests tasks.testJar
}