Improved build configuration to better leverage Gradle up-to-date handling;

Preparation for moving to Gradle 7.0

- Improve Jakarta transformation handling (tests are also actually run now as a bonus);
- Improved CacheableHbmXmlTest to not write "ser" file to `${buildDir}/resources/test`
- Improved DatabaseService(Plugin)
- Update a number of plugins which did not handle up-to-date-ness properly
This commit is contained in:
Steve Ebersole 2021-06-26 08:46:09 -05:00
parent a6dc84e1fe
commit 172ddf8700
26 changed files with 764 additions and 530 deletions

View File

@ -26,10 +26,10 @@ buildscript {
plugins { plugins {
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'nu.studer.credentials' version '2.1' id 'nu.studer.credentials' version '2.1'
id 'org.hibernate.build.plugin' version '1.0.0-SNAPSHOT' apply false id 'org.hibernate.orm.database-service' version '1.0.0-SNAPSHOT' apply false
id 'idea' id 'idea'
id 'org.jetbrains.gradle.plugin.idea-ext' version '0.5' id 'org.jetbrains.gradle.plugin.idea-ext' version '1.0'
id 'eclipse' id 'eclipse'
id 'org.hibernate.build.xjc' version '2.0.1' apply false id 'org.hibernate.build.xjc' version '2.0.1' apply false
@ -49,6 +49,7 @@ allprojects {
} }
apply from: rootProject.file( 'gradle/base-information.gradle' ) apply from: rootProject.file( 'gradle/base-information.gradle' )
apply plugin: 'org.hibernate.orm.database-service'
apply plugin: 'idea' apply plugin: 'idea'
apply plugin: 'eclipse' apply plugin: 'eclipse'

View File

@ -6,7 +6,6 @@
*/ */
repositories { repositories {
mavenCentral() mavenCentral()
jcenter()
} }
apply plugin: 'java-gradle-plugin' apply plugin: 'java-gradle-plugin'
@ -16,7 +15,7 @@ version = '1.0.0-SNAPSHOT'
buildDir = "target" buildDir = "target"
dependencies { dependencies {
compile gradleApi() implementation gradleApi()
} }
tasks.compileJava { tasks.compileJava {
@ -27,9 +26,9 @@ tasks.compileJava {
gradlePlugin { gradlePlugin {
plugins { plugins {
customPlugin { databaseServicePlugin {
id = 'org.hibernate.build.plugin' id = 'org.hibernate.orm.database-service'
implementationClass = 'org.hibernate.build.HibernateBuildPlugin' implementationClass = 'org.hibernate.orm.db.DatabaseServicePlugin'
} }
} }
} }

View File

@ -1,36 +0,0 @@
/*
* 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>.
*/
package org.hibernate.build;
import java.util.Set;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.provider.Provider;
/**
* @author Christian Beikov
*/
public class HibernateBuildPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
Provider<DatabaseService> provider = project.getGradle().getSharedServices().registerIfAbsent(
"db",
DatabaseService.class,
spec -> {
spec.getMaxParallelUsages().set( 1 );
}
);
Set<Task> tasks = project.getTasksByName( "test", false );
for ( Task task : tasks ) {
task.usesService( provider );
}
}
}

View File

@ -1,13 +1,14 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * 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>. * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/ */
package org.hibernate.build; package org.hibernate.orm.db;
import org.gradle.api.services.BuildService; import org.gradle.api.services.BuildService;
import org.gradle.api.services.BuildServiceParameters; import org.gradle.api.services.BuildServiceParameters;
public abstract class DatabaseService implements BuildService<BuildServiceParameters.None> { public abstract class DatabaseService implements BuildService<BuildServiceParameters.None> {
public static final String REGISTRATION_NAME = "databaseService";
} }

View File

@ -0,0 +1,37 @@
/*
* 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
*/
package org.hibernate.orm.db;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.provider.Provider;
import org.gradle.api.services.BuildServiceRegistry;
import org.gradle.api.tasks.testing.Test;
import static org.hibernate.orm.db.DatabaseService.REGISTRATION_NAME;
/**
* @author Steve Ebersole
*/
public class DatabaseServicePlugin implements Plugin<Project> {
@Override
@SuppressWarnings("UnstableApiUsage")
public void apply(Project project) {
// register the service used to restrict parallel execution
// of tests - used to avoid database schema/catalog collisions
final BuildServiceRegistry sharedServices = project.getGradle().getSharedServices();
final Provider<DatabaseService> databaseServiceProvider = sharedServices.registerIfAbsent(
REGISTRATION_NAME,
DatabaseService.class,
spec -> spec.getMaxParallelUsages().set( 1 )
);
project.getTasks().withType( Test.class ).forEach(
test -> test.usesService( databaseServiceProvider )
);
}
}

View File

@ -0,0 +1,76 @@
/*
* 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
*/
package org.hibernate.orm.jakarta;
import java.io.File;
import javax.inject.Inject;
import org.gradle.api.DefaultTask;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.TaskAction;
/**
* @author Steve Ebersole
*/
public abstract class JakartaDirectoryTransformation extends DefaultTask {
private final DirectoryProperty sourceDirectory;
private final DirectoryProperty targetDirectory;
@Inject
public JakartaDirectoryTransformation(ObjectFactory objectFactory) {
sourceDirectory = objectFactory.directoryProperty();
targetDirectory = objectFactory.directoryProperty();
}
@InputDirectory
public DirectoryProperty getSourceDirectory() {
return sourceDirectory;
}
@OutputDirectory
public DirectoryProperty getTargetDirectory() {
return targetDirectory;
}
@TaskAction
void transform() {
final File sourceDirAsFile = sourceDirectory.get().getAsFile();
final File targetDirAsFile = targetDirectory.get().getAsFile();
// If the target directory already exists, the transformer tool will
// skip the transformation - even if the directory is empty.
// Gradle is nice enough to make sure that directory exists, but
// unfortunately that "confuses" the transformer tool.
//
// For now, delete the dir before executing the transformer.
//
// NOTE : Gradle has already done its up-to-date checks and our task
// is actually executing at this point, so deleting the directory will
// have no effect on the incremental build
targetDirAsFile.delete();
getProject().javaexec(
(javaExecSpec) -> {
javaExecSpec.classpath( getProject().getConfigurations().getByName( "jakartaeeTransformTool" ) );
javaExecSpec.setMain( "org.eclipse.transformer.jakarta.JakartaTransformer" );
javaExecSpec.args(
sourceDirAsFile.getAbsolutePath(),
targetDirAsFile.getAbsolutePath(),
"-q",
"-tr", getProject().getRootProject().file( "rules/jakarta-renames.properties" ).getAbsolutePath(),
"-tv", getProject().getRootProject().file( "rules/jakarta-versions.properties" ).getAbsolutePath(),
"-td", getProject().getRootProject().file( "rules/jakarta-direct.properties" ).getAbsolutePath()
);
}
);
}
}

View File

@ -0,0 +1,58 @@
/*
* 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
*/
package org.hibernate.orm.jakarta;
import javax.inject.Inject;
import org.gradle.api.DefaultTask;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;
/**
* @author Steve Ebersole
*/
public abstract class JakartaJarTransformation extends DefaultTask {
private final RegularFileProperty sourceJar;
private final RegularFileProperty targetJar;
@Inject
public JakartaJarTransformation(ObjectFactory objectFactory) {
sourceJar = objectFactory.fileProperty();
targetJar = objectFactory.fileProperty();
}
@InputFile
public RegularFileProperty getSourceJar() {
return sourceJar;
}
@OutputFile
public RegularFileProperty getTargetJar() {
return targetJar;
}
@TaskAction
void transform() {
getProject().javaexec(
(javaExecSpec) -> {
javaExecSpec.classpath( getProject().getConfigurations().getByName( "jakartaeeTransformTool" ) );
javaExecSpec.setMain( "org.eclipse.transformer.jakarta.JakartaTransformer" );
javaExecSpec.args(
sourceJar.get().getAsFile().getAbsolutePath(),
targetJar.get().getAsFile().getAbsolutePath(),
"-q",
"-tr", getProject().getRootProject().file( "rules/jakarta-renames.properties" ).getAbsolutePath(),
"-tv", getProject().getRootProject().file( "rules/jakarta-versions.properties" ).getAbsolutePath(),
"-td", getProject().getRootProject().file( "rules/jakarta-direct.properties" ).getAbsolutePath()
);
}
);
}
}

View File

@ -176,7 +176,7 @@ task aggregateJavadocs(type: Javadoc) {
} }
} }
asciidoctor { tasks.asciidoctor {
// we do not want it creating its "default task" // we do not want it creating its "default task"
enabled = false enabled = false
} }

View File

@ -8,67 +8,37 @@
apply from: rootProject.file( 'gradle/java-module.gradle' ) apply from: rootProject.file( 'gradle/java-module.gradle' )
apply from: rootProject.file( 'gradle/publishing-pom.gradle' ) apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
configurations {
jakartaeeTransformTool {
description = 'JakartaTransformer tool dependencies'
}
tests {
description = 'Configuration for the produced test jar'
}
}
dependencies {
jakartaeeTransformTool 'org.eclipse.transformer:org.eclipse.transformer:0.2.0'
jakartaeeTransformTool 'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
}
tasks.withType( Test ) { test ->
test.usesService( project.gradle.sharedServices.registrations.getByName( 'databaseService' ).service )
}
publishing { publishing {
publications { publications {
publishedArtifacts { publishedArtifacts {
from components.java from components.java
} }
relocationArtifacts( MavenPublication ) {
pom {
name = project.name + ' - relocation'
groupId = 'org.hibernate'
artifactId = project.name
version = project.version
description = project.description
url = 'https://hibernate.org/orm'
organization {
name = 'Hibernate.org'
url = 'https://hibernate.org'
}
licenses {
license {
name = 'GNU Library General Public License v2.1 or later'
url = 'https://www.opensource.org/licenses/LGPL-2.1'
comments = 'See discussion at https://hibernate.org/community/license/ for more details.'
distribution = 'repo'
} }
} }
scm { java {
url = 'https://github.com/hibernate/hibernate-orm' withJavadocJar()
connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git' withSourcesJar()
developerConnection = 'scm:git:git@github.com:hibernate/hibernate-orm.git'
} }
developers {
developer {
id = 'hibernate-team'
name = 'The Hibernate Development Team'
organization = 'Hibernate.org'
organizationUrl = 'https://hibernate.org'
}
}
issueManagement {
system = 'jira'
url = 'https://hibernate.atlassian.net/browse/HHH'
}
distributionManagement {
relocation {
groupId = 'org.hibernate.orm'
artifactId = project.name
version = project.version
}
}
}
}
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Release / publishing tasks // Release / publishing tasks
@ -77,3 +47,5 @@ task ciBuild( dependsOn: [test, publish] )
task release(dependsOn: [test, publishToSonatype]) task release(dependsOn: [test, publishToSonatype])
publishToSonatype.mustRunAfter test publishToSonatype.mustRunAfter test

View File

@ -14,7 +14,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'de.thetaphi:forbiddenapis:3.0.1' classpath 'de.thetaphi:forbiddenapis:3.1'
} }
} }
@ -24,24 +24,14 @@ import org.apache.tools.ant.filters.ReplaceTokens
apply from: rootProject.file( 'gradle/libraries.gradle' ) apply from: rootProject.file( 'gradle/libraries.gradle' )
apply from: rootProject.file( 'gradle/databases.gradle' ) apply from: rootProject.file( 'gradle/databases.gradle' )
apply plugin: 'java'
apply plugin: 'org.hibernate.build.plugin'
apply plugin: 'java-library' apply plugin: 'java-library'
apply plugin: 'org.hibernate.orm.database-service'
apply plugin: 'biz.aQute.bnd.builder' apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'checkstyle' apply plugin: 'checkstyle'
apply plugin: 'build-dashboard' apply plugin: 'build-dashboard'
apply plugin: 'project-report' apply plugin: 'project-report'
ext {
forbiddenAPITargetJDKCompatibility = '11'
}
if ( !project.description ) {
project.description = "The Hibernate ORM $project.name module"
}
// Attempt to leverage JetBrain's Gradle extension to automatically define // Attempt to leverage JetBrain's Gradle extension to automatically define
// `copyResourcesToIntelliJOutFolder` as a "build trigger" on import. // `copyResourcesToIntelliJOutFolder` as a "build trigger" on import.
@ -211,10 +201,6 @@ else {
task compile(dependsOn: [compileJava, processResources, compileTestJava, processTestResources] ) task compile(dependsOn: [compileJava, processResources, compileTestJava, processTestResources] )
sourceSets.main {
compileClasspath += configurations.provided
}
convention.findPlugin( JavaPluginConvention.class ).sourceSets.each { sourceSet -> convention.findPlugin( JavaPluginConvention.class ).sourceSets.each { sourceSet ->
JavaCompile javaCompileTask = project.tasks.findByName( sourceSet.compileJavaTaskName ) as JavaCompile JavaCompile javaCompileTask = project.tasks.findByName( sourceSet.compileJavaTaskName ) as JavaCompile
@ -269,6 +255,8 @@ if ( gradle.ext.javaToolchainEnabled ) {
tasks.withType( Test.class ).each { test -> tasks.withType( Test.class ).each { test ->
test.useJUnitPlatform() test.useJUnitPlatform()
test.usesService( project.gradle.sharedServices.registrations.getByName( 'databaseService' ).service )
if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) { if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
// Byteman needs this property to be set, https://developer.jboss.org/thread/274997 // Byteman needs this property to be set, https://developer.jboss.org/thread/274997
test.jvmArgs += ["-Djdk.attach.allowAttachSelf=true"] test.jvmArgs += ["-Djdk.attach.allowAttachSelf=true"]
@ -435,64 +423,14 @@ task sourcesJar(type: Jar) {
apply from: rootProject.file( 'gradle/javadoc.gradle' ) apply from: rootProject.file( 'gradle/javadoc.gradle' )
javadoc {
doFirst {
// ordering problems if we try to do this during config phase :(
classpath += project.sourceSets.main.output.classesDirs + project.sourceSets.main.compileClasspath + project.configurations.provided
}
}
task javadocJar(type: Jar) {
from project.tasks.javadoc.outputs
manifest {
attributes(
// Basic JAR manifest attributes
'Specification-Title': project.name,
'Specification-Version': project.version,
'Specification-Vendor': 'Hibernate.org',
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Hibernate.org',
'Implementation-Vendor-Id': 'org.hibernate',
'Implementation-Url': 'https://hibernate.org/orm',
// Hibernate-specific JAR manifest attributes
'Hibernate-VersionFamily': project.ormVersion.family,
'Hibernate-JpaVersion': project.jpaVersion.name
)
}
archiveClassifier.set( 'javadoc' )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// IDE // IDE
//idea {
// module {
// jdkName = project.sourceCompatibility
//
// excludeDirs = [file( ".gradle" )]
// excludeDirs += file( "$buildDir/classes" )
// excludeDirs += file( "$buildDir/bundles" )
// excludeDirs += file( "$buildDir/packages" )
// excludeDirs += file( "$buildDir/dependency-cache" )
// excludeDirs += file( "$buildDir/libs" )
// excludeDirs += file( "$buildDir/reports" )
// excludeDirs += file( "$buildDir/test-results" )
// excludeDirs += file( "$buildDir/tmp" )
// excludeDirs += file( "$buildDir/matrix" )
// excludeDirs += file( "$buildDir/resources" )
//
// downloadSources = true
// scopes.PROVIDED.plus += [configurations.provided]
// }
//}
//
/* /*
The latest versions of IntelliJ copy and use the test resources into out/test/resources The latest versions of IntelliJ copy the test resources into out/test/resources and
this occurs before the placeholder in the test config file are substituted use those for its test classpath. Unfortunately, this occurs before the placeholder
with the testing values. in the test config file are substituted with the testing values.
This behaviour prevents the execution of the hibernate tests from inside the IDE. This behaviour prevents the execution of the hibernate tests from inside the IDE.
@ -507,23 +445,8 @@ task copyResourcesToIntelliJOutFolder(type: Task, dependsOn: project.tasks.proce
} }
} }
} }
//
//
//
//eclipse {
// jdt {
// sourceCompatibility = project.sourceCompatibility
// targetCompatibility = project.targetCompatibility
// }
// classpath {
// plusConfigurations.add( configurations.provided )
// }
//}
//
//// eclipseClasspath will not add sources to classpath unless the dirs actually exist.
//// TODO: Eclipse's annotation processor handling is also fairly stupid (and completely lacks in the
//// Gradle plugin). For now, just compile first in order to get the logging classes.
//eclipseClasspath.dependsOn compile
/* /*
Use this task to set the current DB in a given module. Use this task to set the current DB in a given module.
@ -563,21 +486,11 @@ checkstyleMain.exclude '**/org/hibernate/cfg/*'
task forbiddenApisSystemOut(type: CheckForbiddenApis, dependsOn: compileJava) { task forbiddenApisSystemOut(type: CheckForbiddenApis, dependsOn: compileJava) {
classesDirs = project.sourceSets.main.output.classesDirs
classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath
targetCompatibility = project.forbiddenAPITargetJDKCompatibility
bundledSignatures += 'jdk-system-out' bundledSignatures += 'jdk-system-out'
suppressAnnotations += ['org.hibernate.internal.build.AllowSysOut', 'org.hibernate.internal.build.AllowPrintStacktrace'] suppressAnnotations += ['org.hibernate.internal.build.AllowSysOut', 'org.hibernate.internal.build.AllowPrintStacktrace']
// This slows down the checks a little, but is necessary to avoid the gradle deamon holding on
// to class definitions loaded previously - even possibly in a previous build.
disableClassloadingCache = true
} }
task forbiddenApisUnsafe(type: CheckForbiddenApis, dependsOn: compileJava) { task forbiddenApisUnsafe(type: CheckForbiddenApis, dependsOn: compileJava) {
classesDirs = project.sourceSets.main.output.classesDirs
classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath
targetCompatibility = project.forbiddenAPITargetJDKCompatibility
bundledSignatures += "jdk-unsafe-${gradle.ext.baselineJavaVersion}".toString() bundledSignatures += "jdk-unsafe-${gradle.ext.baselineJavaVersion}".toString()
// unfortunately we currently have many uses of default Locale implicitly (~370) which need to be fixed // unfortunately we currently have many uses of default Locale implicitly (~370) which need to be fixed
@ -585,24 +498,23 @@ task forbiddenApisUnsafe(type: CheckForbiddenApis, dependsOn: compileJava) {
// //
// No idea how findbugs was missing these b4 // No idea how findbugs was missing these b4
ignoreFailures = true ignoreFailures = true
// This slows down the checks a little, but is necessary to avoid the gradle deamon holding on
// to class definitions loaded previously - even possibly in a previous build.
disableClassloadingCache = true
} }
task forbiddenApisNonPortable(type: CheckForbiddenApis, dependsOn: compileJava) { task forbiddenApisNonPortable(type: CheckForbiddenApis, dependsOn: compileJava) {
classesDirs = project.sourceSets.main.output.classesDirs
classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath
targetCompatibility = project.forbiddenAPITargetJDKCompatibility
bundledSignatures += 'jdk-non-portable' bundledSignatures += 'jdk-non-portable'
// This slows down the checks a little, but is necessary to avoid the gradle deamon holding on
// to class definitions loaded previously - even possibly in a previous build.
disableClassloadingCache = true
} }
task forbiddenApis task forbiddenApis
project.tasks.withType( CheckForbiddenApis ).each { task -> forbiddenApis.finalizedBy task } project.tasks.withType( CheckForbiddenApis ).each { task ->
task.outputs.dirs project.sourceSets.main.output.classesDirs
task.classesDirs = project.sourceSets.main.output.classesDirs
task.classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath
task.targetCompatibility = project.forbiddenAPITargetJDKCompatibility
// This slows down the checks a little, but is necessary to avoid the gradle deamon holding on
// to class definitions loaded previously - even possibly in a previous build.
task.disableClassloadingCache = true
project.tasks.check.finalizedBy forbiddenApis tasks.forbiddenApis.finalizedBy task
}
project.tasks.check.finalizedBy tasks.forbiddenApis

View File

@ -58,3 +58,25 @@ javadoc {
) )
} }
} }
task javadocJar(type: Jar) {
from project.tasks.javadoc.outputs
manifest {
attributes(
// Basic JAR manifest attributes
'Specification-Title': project.name,
'Specification-Version': project.version,
'Specification-Vendor': 'Hibernate.org',
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Hibernate.org',
'Implementation-Vendor-Id': 'org.hibernate',
'Implementation-Url': 'https://hibernate.org/orm',
// Hibernate-specific JAR manifest attributes
'Hibernate-VersionFamily': project.ormVersion.family,
'Hibernate-JpaVersion': project.jpaVersion.name
)
}
archiveClassifier.set( 'javadoc' )
}

View File

@ -1,22 +1,19 @@
import javax.inject.Inject
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * 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>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
import org.hibernate.orm.jakarta.JakartaDirectoryTransformation
import org.apache.tools.ant.filters.ReplaceTokens import org.hibernate.orm.jakarta.JakartaJarTransformation
description = 'Hibernate O/RM implementation of the Jakarta Persistence specification' description = 'Hibernate O/RM implementation of the Jakarta Persistence specification'
apply from: rootProject.file( 'gradle/jakarta-java-module.gradle' ) apply from: rootProject.file( 'gradle/jakarta-java-module.gradle' )
configurations { evaluationDependsOn( ':hibernate-core' )
tests {
description = 'Configuration for the produced test jar'
}
jakartaeeTransformJars
}
dependencies { dependencies {
api libraries.jakarta_jpa api libraries.jakarta_jpa
@ -40,13 +37,6 @@ dependencies {
api libraries.jakarta_jaxb_api api libraries.jakarta_jaxb_api
api libraries.jakarta_jaxb_runtime api libraries.jakarta_jaxb_runtime
jakartaeeTransformJars 'biz.aQute.bnd:biz.aQute.bnd.transform:5.1.1',
'commons-cli:commons-cli:1.4',
'org.slf4j:slf4j-simple:1.7.30',
'org.slf4j:slf4j-api:1.7.26',
'org.eclipse.transformer:org.eclipse.transformer:0.2.0',
'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
testImplementation project(':hibernate-testing-jakarta') testImplementation project(':hibernate-testing-jakarta')
testImplementation fileTree(dir: 'libs', include: '*.jar') testImplementation fileTree(dir: 'libs', include: '*.jar')
@ -91,92 +81,139 @@ dependencies {
testImplementation libraries.jboss_annotation_spec_jar testImplementation libraries.jboss_annotation_spec_jar
} }
jar {
mustRunAfter project(':hibernate-core').tasks.jar // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mustRunAfter project(':hibernate-core').tasks.testJar // main jar
dependsOn project(':hibernate-core').tasks.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.testJar dependsOn project(':hibernate-core').tasks.testJar
def baseDir = project(':hibernate-core').buildDir
def baseJars = fileTree(baseDir).matching {include 'libs/*.jar' }
inputs.files(baseJars).skipWhenEmpty()
outputs.dir project.buildDir
doLast {
new File(project.buildDir, "libs").mkdirs()
fileTree(project.buildDir).matching { include 'libs/*.jar' }.each { delete it }
baseJars.each { bundleJar ->
def sourceJarPath = baseDir.path + '/libs/' + bundleJar.name
println 'Initial bundle jar name [ ' + sourceJarPath + ' ]'
def finalBundleJarName = project.buildDir.path + '/libs/' + bundleJar.name.replaceAll( 'hibernate-core', 'hibernate-core-jakarta' )
println 'Default jakarta final bundle jar name [ ' + finalBundleJarName + ' ]'
def transformerArgs = [
sourceJarPath, finalBundleJarName,
'-q', // quiet output
'-tr', new File(getProjectDir().getParentFile(), 'rules/jakarta-renames.properties').path,
'-tv', new File(getProjectDir().getParentFile(), 'rules/jakarta-versions.properties').path,
'-td', new File(getProjectDir().getParentFile(), 'rules/jakarta-direct.properties').path,
]
println 'Transformer options:'
transformerArgs.each {
println ' [ ' + it + ' ]'
} }
javaexec { task unpackTests(type: Copy) {
classpath configurations.jakartaeeTransformJars from zipTree( project( ':hibernate-core' ).tasks.testJar.archiveFile )
main = 'org.eclipse.transformer.jakarta.JakartaTransformer' into project.testClassesUnpackTargetDirectory
args = transformerArgs exclude 'templates/**'
}
}
}
} }
task unpackTestJar(type: Copy) { task jakartafyTests(type: JakartaDirectoryTransformation) {
dependsOn jar sourceDirectory = project.testClassesUnpackTargetDirectory
fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each { targetDirectory = project.testClassesTransformationTargetDirectory
def outputDir = file("${buildDir}/unpacked/" + it.name)
from zipTree(it)
into outputDir
}
} }
task copyBundleResources (type: Copy) {
dependsOn unpackTestJar tasks.compileTestJava.finalizedBy tasks.jakartafyTests
File unpackedDir = new File(project.buildDir, "libs/hibernate-core-jakarta-${project.version}-test.jar") tasks.jakartafyTests.dependsOn tasks.unpackTests
ext { tasks.unpackTests.dependsOn project( ':hibernate-core' ).tasks.testJar
bundlesTargetDir = file( "${buildDir}/bundles" )
bundleTokens = dbBundle[db] tasks.processTestResources {
ext.bundleTokens['buildDirName'] = buildDir.absolutePath enabled false
} }
from file("${buildDir}/unpacked/${unpackedDir.name}/templates")
into ext.bundlesTargetDir 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 project.templateUnpackTargetDirectory
from project( ':hibernate-core' ).layout.buildDirectory.dir( 'bundles' )
into project.templateUnpackTargetDirectory
// There are persistence.xml files referencing jar files through their absolute path so we // There are persistence.xml files referencing jar files through their absolute path so we
// have to replace 'hibernate-core/hibernate-core' in the path with 'hibernate-core/hibernate-core-jakarta' // have to replace 'hibernate-core' references in the path with 'hibernate-core-jakarta'
filter { line -> filter { line ->
line.replaceAll( 'hibernate-core/target', 'hibernate-core-jakarta/target' ) line.replaceAll( 'hibernate-core/target', 'hibernate-core-jakarta/target' )
} }
doFirst { doFirst {
ext.bundlesTargetDir.mkdirs() project.templateUnpackTargetDirectory.get().asFile.mkdirs()
} }
} }
processTestResources.dependsOn copyBundleResources task jakartafyTemplates(type: JakartaDirectoryTransformation) {
dependsOn tasks.copyTestBundles
artifacts { sourceDirectory = project.templateUnpackTargetDirectory
tests new File(project.buildDir, "libs/hibernate-core-jakarta-${project.version}-test.jar") targetDirectory = project.templatesTransformationTargetDirectory
} }
test { tasks.processTestResources.dependsOn tasks.jakartafyTemplates
fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each {
def outputDir = file("${buildDir}/unpacked/" + it.name) tasks.test {
testClassesDirs += files(outputDir) ext {
classpath += files(outputDir) combinedDirs = project.files( tasks.jakartafyTests.targetDirectory ) + project.files( tasks.jakartafyTemplates.targetDirectory )
} }
testClassesDirs += combinedDirs
classpath += combinedDirs
systemProperty 'file.encoding', 'utf-8' systemProperty 'file.encoding', 'utf-8'
if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) { if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
@ -187,3 +224,14 @@ test {
jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] ) jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
} }
} }
task testJar(type: Jar, dependsOn: testClasses) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set( 'test' )
from tasks.jakartafyTests.targetDirectory
from tasks.jakartafyTemplates.targetDirectory
}
artifacts {
tests tasks.testJar
}

View File

@ -414,6 +414,20 @@ public class MetadataSources implements Serializable {
return this; return this;
} }
/**
* See {@link #addCacheableFile(java.io.File)} for description
*
* @param path The path to a file. Expected to be resolvable by {@link java.io.File#File(String)}
*
* @return this (for method chaining purposes)
*
* @see #addCacheableFile(java.io.File)
*/
public MetadataSources addCacheableFile(String path, File cacheDirectory) {
addCacheableFile( new File( path ), cacheDirectory );
return this;
}
/** /**
* Add a cached mapping file. A cached file is a serialized representation of the DOM structure of a * Add a cached mapping file. A cached file is a serialized representation of the DOM structure of a
* particular mapping. It is saved from a previous call as a file with the name {@code {xmlFile}.bin} * particular mapping. It is saved from a previous call as a file with the name {@code {xmlFile}.bin}
@ -428,7 +442,24 @@ public class MetadataSources implements Serializable {
* @return this (for method chaining purposes) * @return this (for method chaining purposes)
*/ */
public MetadataSources addCacheableFile(File file) { public MetadataSources addCacheableFile(File file) {
final XmlSource xmlSource = XmlSources.fromCacheableFile( file ); return addCacheableFile( file, file.getParentFile() );
}
/**
* Add a cached mapping file. A cached file is a serialized representation of the DOM structure of a
* particular mapping. It is saved from a previous call as a file with the name {@code {xmlFile}.bin}
* where {@code {xmlFile}} is the name of the original mapping file.
* </p>
* If a cached {@code {xmlFile}.bin} exists and is newer than {@code {xmlFile}}, the {@code {xmlFile}.bin}
* file will be read directly. Otherwise {@code {xmlFile}} is read and then serialized to {@code {xmlFile}.bin} for
* use the next time.
*
* @param file The cacheable mapping file to be added, {@code {xmlFile}} in above discussion.
*
* @return this (for method chaining purposes)
*/
public MetadataSources addCacheableFile(File file, File cacheDirectory) {
final XmlSource xmlSource = XmlSources.fromCacheableFile( file, cacheDirectory );
final XmlMappingBinderAccess binderAccess = getXmlMappingBinderAccess(); final XmlMappingBinderAccess binderAccess = getXmlMappingBinderAccess();
getXmlBindingsForWrite().add( xmlSource.doBind( binderAccess.getMappingBinder() ) ); getXmlBindingsForWrite().add( xmlSource.doBind( binderAccess.getMappingBinder() ) );
return this; return this;
@ -454,6 +485,26 @@ public class MetadataSources implements Serializable {
return this; return this;
} }
/**
* <b>INTENDED FOR TESTSUITE USE ONLY!</b>
* <p/>
* Much like {@link #addCacheableFile(java.io.File)} except that here we will fail immediately if
* the cache version cannot be found or used for whatever reason
*
* @param file The xml file, not the bin!
*
* @return The dom "deserialized" from the cached file.
*
* @throws org.hibernate.type.SerializationException Indicates a problem deserializing the cached dom tree
* @throws java.io.FileNotFoundException Indicates that the cached file was not found or was not usable.
*/
public MetadataSources addCacheableFileStrictly(File file, File cacheDir) throws SerializationException {
final XmlSource xmlSource = XmlSources.fromCacheableFile( file, cacheDir, true );
final XmlMappingBinderAccess binderAccess = getXmlMappingBinderAccess();
getXmlBindingsForWrite().add( xmlSource.doBind( binderAccess.getMappingBinder() ) );
return this;
}
/** /**
* Read metadata from an {@link java.io.InputStream} access * Read metadata from an {@link java.io.InputStream} access
* *

View File

@ -33,12 +33,12 @@ public class CacheableFileXmlSource extends XmlSource {
private final File serFile; private final File serFile;
private final boolean strict; private final boolean strict;
public CacheableFileXmlSource(Origin origin, File xmlFile, boolean strict) { public CacheableFileXmlSource(Origin origin, File xmlFile, File cachedFileDir, boolean strict) {
super( origin ); super( origin );
this.xmlFile = xmlFile; this.xmlFile = xmlFile;
this.strict = strict; this.strict = strict;
this.serFile = determineCachedFile( xmlFile ); this.serFile = new File( cachedFileDir, xmlFile.getName() + ".bin" );
if ( strict ) { if ( strict ) {
if ( !serFile.exists() ) { if ( !serFile.exists() ) {
@ -133,11 +133,15 @@ public class CacheableFileXmlSource extends XmlSource {
} }
public static void createSerFile(File xmlFile, Binder binder) { public static void createSerFile(File xmlFile, Binder binder) {
createSerFile( xmlFile, determineCachedFile( xmlFile ), binder );
}
public static void createSerFile(File xmlFile, File outputFile, Binder binder) {
final Origin origin = new Origin( SourceType.FILE, xmlFile.getAbsolutePath() ); final Origin origin = new Origin( SourceType.FILE, xmlFile.getAbsolutePath() );
writeSerFile( writeSerFile(
FileXmlSource.doBind( binder, xmlFile, origin ), FileXmlSource.doBind( binder, xmlFile, origin ),
xmlFile, xmlFile,
determineCachedFile( xmlFile ) outputFile
); );
} }

View File

@ -72,15 +72,23 @@ public class XmlSources {
} }
public static XmlSource fromCacheableFile(File file) { public static XmlSource fromCacheableFile(File file) {
return fromCacheableFile( file, false ); return fromCacheableFile( file, file.getParentFile() );
}
public static XmlSource fromCacheableFile(File file, File cacheableDir) {
return fromCacheableFile( file, cacheableDir, false );
} }
public static XmlSource fromCacheableFile(File file, boolean strict) { public static XmlSource fromCacheableFile(File file, boolean strict) {
return fromCacheableFile( file, file.getParentFile(), strict );
}
public static XmlSource fromCacheableFile(File file, File cacheableDir, boolean strict) {
final String filePath = file.getPath(); final String filePath = file.getPath();
JaxbLogger.JAXB_LOGGER.tracef( "reading mappings from cacheable-file : %s", filePath ); JaxbLogger.JAXB_LOGGER.tracef( "reading mappings from cacheable-file : %s", filePath );
final Origin origin = new Origin( SourceType.FILE, filePath ); final Origin origin = new Origin( SourceType.FILE, filePath );
return new CacheableFileXmlSource( origin, file, strict ); return new CacheableFileXmlSource( origin, file, cacheableDir, strict );
} }
public static XmlSource fromStream(InputStreamAccess inputStreamAccess) { public static XmlSource fromStream(InputStreamAccess inputStreamAccess) {

View File

@ -7,7 +7,6 @@
package org.hibernate.orm.test.bootstrap.binding.hbm.cacheable; package org.hibernate.orm.test.bootstrap.binding.hbm.cacheable;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.net.URL; import java.net.URL;
import org.hibernate.boot.MappingException; import org.hibernate.boot.MappingException;
@ -15,15 +14,15 @@ import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.jaxb.internal.CacheableFileXmlSource; import org.hibernate.boot.jaxb.internal.CacheableFileXmlSource;
import org.hibernate.boot.jaxb.internal.MappingBinder; import org.hibernate.boot.jaxb.internal.MappingBinder;
import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.boot.spi.XmlMappingBinderAccess; import org.hibernate.boot.spi.XmlMappingBinderAccess;
import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.junit.After; import org.hibernate.testing.orm.junit.ServiceRegistryScope;
import org.junit.Before; import org.junit.jupiter.api.BeforeAll;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import static org.junit.Assert.fail; import static org.junit.jupiter.api.Assertions.fail;
/** /**
* Originally developed to help diagnose HHH-10131 - the original tests * Originally developed to help diagnose HHH-10131 - the original tests
@ -36,23 +35,19 @@ import static org.junit.Assert.fail;
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class CacheableHbmXmlTest extends BaseUnitTestCase { @ServiceRegistry()
public class CacheableHbmXmlTest {
private static final String HBM_RESOURCE_NAME = "org/hibernate/orm/test/bootstrap/binding/hbm/cacheable/SimpleEntity.hbm.xml"; private static final String HBM_RESOURCE_NAME = "org/hibernate/orm/test/bootstrap/binding/hbm/cacheable/SimpleEntity.hbm.xml";
private StandardServiceRegistry ssr; private static MappingBinder binder;
private MappingBinder binder; private static File hbmXmlFile;
private File hbmXmlFile; @BeforeAll
private File hbmXmlBinFile; public static void prepareFixtures(ServiceRegistryScope scope) throws Exception {
binder = new XmlMappingBinderAccess( scope.getRegistry() ).getMappingBinder();
@Before final URL hbmXmlUrl = CacheableHbmXmlTest.class.getClassLoader().getResource( HBM_RESOURCE_NAME );
public void before() throws Exception {
ssr = new StandardServiceRegistryBuilder()
.build();
binder = new XmlMappingBinderAccess( ssr ).getMappingBinder();
final URL hbmXmlUrl = getClass().getClassLoader().getResource( HBM_RESOURCE_NAME );
if ( hbmXmlUrl == null ) { if ( hbmXmlUrl == null ) {
throw couldNotFindHbmXmlResource(); throw couldNotFindHbmXmlResource();
} }
@ -60,32 +55,27 @@ public class CacheableHbmXmlTest extends BaseUnitTestCase {
if ( ! hbmXmlFile.exists() ) { if ( ! hbmXmlFile.exists() ) {
throw couldNotFindHbmXmlFile( hbmXmlFile ); throw couldNotFindHbmXmlFile( hbmXmlFile );
} }
hbmXmlBinFile = CacheableFileXmlSource.determineCachedFile( hbmXmlFile );
} }
private Exception couldNotFindHbmXmlResource() { private static Exception couldNotFindHbmXmlResource() {
throw new IllegalStateException( "Could not locate `" + HBM_RESOURCE_NAME + "` by resource lookup" ); throw new IllegalStateException( "Could not locate `" + HBM_RESOURCE_NAME + "` by resource lookup" );
} }
private Exception couldNotFindHbmXmlFile(File file) { private static Exception couldNotFindHbmXmlFile(File file) {
throw new IllegalStateException( throw new IllegalStateException(
"File `" + file.getAbsolutePath() + "` resolved from `" + HBM_RESOURCE_NAME + "` resource-lookup does not exist" "File `" + file.getAbsolutePath() + "` resolved from `" + HBM_RESOURCE_NAME + "` resource-lookup does not exist"
); );
} }
@After
public void after() {
if ( ssr != null ) {
StandardServiceRegistryBuilder.destroy( ssr );
}
}
@Test @Test
public void testStrictCaseWhereFileDoesPreviouslyExist() throws FileNotFoundException { public void testStrictlyWithExistingFile(ServiceRegistryScope serviceRegistryScope, @TempDir File binOutputDir) {
deleteBinFile(); final StandardServiceRegistry ssr = serviceRegistryScope.getRegistry();
createBinFile();
// create the cacheable file so that it exists before we try to build the boot model
createBinFile( binOutputDir );
try { try {
new MetadataSources( ssr ).addCacheableFileStrictly( hbmXmlFile ).buildMetadata(); new MetadataSources( ssr ).addCacheableFileStrictly( hbmXmlFile, binOutputDir ).buildMetadata();
} }
catch (MappingException e) { catch (MappingException e) {
fail( "addCacheableFileStrictly led to MappingException when bin file existed" ); fail( "addCacheableFileStrictly led to MappingException when bin file existed" );
@ -93,10 +83,12 @@ public class CacheableHbmXmlTest extends BaseUnitTestCase {
} }
@Test @Test
public void testStrictCaseWhereFileDoesNotPreviouslyExist() throws FileNotFoundException { public void testStrictlyWithNoExistingFile(ServiceRegistryScope serviceRegistryScope, @TempDir File binOutputDir) {
deleteBinFile();
try { try {
new MetadataSources( ssr ).addCacheableFileStrictly( hbmXmlFile ).buildMetadata(); final StandardServiceRegistry ssr = serviceRegistryScope.getRegistry();
new MetadataSources( ssr )
.addCacheableFileStrictly( hbmXmlFile, binOutputDir )
.buildMetadata();
fail( "addCacheableFileStrictly should be led to MappingException when bin file does not exist" ); fail( "addCacheableFileStrictly should be led to MappingException when bin file does not exist" );
} }
catch (MappingException ignore) { catch (MappingException ignore) {
@ -105,34 +97,29 @@ public class CacheableHbmXmlTest extends BaseUnitTestCase {
} }
@Test @Test
public void testNonStrictCaseWhereFileDoesPreviouslyExist() { public void testNonStrictlyWithExistingFile(ServiceRegistryScope serviceRegistryScope, @TempDir File binOutputDir) {
deleteBinFile(); final StandardServiceRegistry ssr = serviceRegistryScope.getRegistry();
createBinFile();
new MetadataSources( ssr ).addCacheableFile( hbmXmlFile ).buildMetadata(); // create the cacheable file so that it exists before we try to build the boot model
createBinFile( binOutputDir );
try {
new MetadataSources( ssr ).addCacheableFile( hbmXmlFile, binOutputDir ).buildMetadata();
}
catch (MappingException e) {
fail( "addCacheableFileStrictly led to MappingException when bin file existed" );
}
} }
@Test @Test
public void testNonStrictCaseWhereFileDoesNotPreviouslyExist() { public void testNonStrictlyWithNoExistingFile(ServiceRegistryScope serviceRegistryScope, @TempDir File binOutputDir) {
deleteBinFile(); final StandardServiceRegistry ssr = serviceRegistryScope.getRegistry();
new MetadataSources( ssr ).addCacheableFile( hbmXmlFile ).buildMetadata(); new MetadataSources( ssr ).addCacheableFile( hbmXmlFile, binOutputDir ).buildMetadata();
} }
private void deleteBinFile() { private void createBinFile(File binOutputDir) {
// if it exists final String outputName = hbmXmlFile.getName() + ".bin";
if ( hbmXmlBinFile.exists() ) { final File file = new File( binOutputDir, outputName );
final boolean success = hbmXmlBinFile.delete(); CacheableFileXmlSource.createSerFile( hbmXmlFile, file, binder );
if ( !success ) {
log.warn( "Unable to delete existing cached hbm.xml.bin file", new Exception() );
}
}
}
private void createBinFile() {
if ( hbmXmlBinFile.exists() ) {
log.warn( "Cached hbm.xml.bin file already existed on request to create", new Exception() );
}
else {
CacheableFileXmlSource.createSerFile( hbmXmlFile, binder );
}
} }
} }

View File

@ -6,28 +6,16 @@
*/ */
package org.hibernate.orm.test.bootstrap.binding.hbm.cid.nonaggregated.dynamic; package org.hibernate.orm.test.bootstrap.binding.hbm.cid.nonaggregated.dynamic;
import org.hibernate.boot.MetadataSources;
import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.AvailableSettings;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
import org.hibernate.metamodel.mapping.internal.EmbeddedIdentifierMappingImpl;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.FailureExpected; import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.ServiceRegistryScope;
import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.Setting; import org.hibernate.testing.orm.junit.Setting;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -1,4 +1,5 @@
import org.apache.tools.ant.filters.ReplaceTokens import org.hibernate.orm.jakarta.JakartaDirectoryTransformation
import org.hibernate.orm.jakarta.JakartaJarTransformation
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
@ -11,86 +12,115 @@ description = 'Hibernate\'s entity version (audit/history) support Jakarta editi
apply from: rootProject.file( 'gradle/jakarta-java-module.gradle' ) apply from: rootProject.file( 'gradle/jakarta-java-module.gradle' )
configurations { evaluationDependsOn( ':hibernate-envers' )
jakartaeeTransformJars
}
dependencies { dependencies {
compile( project( ':hibernate-core-jakarta' ) ) { api( project( ':hibernate-core-jakarta' ) ) {
// Exclude access to this to avoid future use. // Exclude access to this to avoid future use.
exclude group: "org.javassist", module: "javassist" exclude group: "org.javassist", module: "javassist"
} }
jakartaeeTransformJars 'biz.aQute.bnd:biz.aQute.bnd.transform:5.1.1', testImplementation( project( ':hibernate-envers-jakarta' ) )
'commons-cli:commons-cli:1.4', testImplementation( project( ':hibernate-testing-jakarta' ) )
'org.slf4j:slf4j-simple:1.7.30', testImplementation( project( path: ':hibernate-core-jakarta', configuration: 'tests' ) )
'org.slf4j:slf4j-api:1.7.26',
'org.eclipse.transformer:org.eclipse.transformer:0.2.0',
'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
testCompile( project( ':hibernate-envers-jakarta' ) )
testCompile( project( ':hibernate-testing-jakarta' ) )
testCompile( project( path: ':hibernate-core-jakarta', configuration: 'tests' ) )
} }
jar {
mustRunAfter project(':hibernate-envers').tasks.jar
mustRunAfter project(':hibernate-envers').tasks.testJar
dependsOn project(':hibernate-envers').tasks.jar
dependsOn project(':hibernate-envers').tasks.testJar
def baseDir = project(':hibernate-envers').buildDir
def baseJars = fileTree(baseDir).matching {include 'libs/*.jar' }
inputs.files(baseJars).skipWhenEmpty()
outputs.dir project.buildDir
doLast {
new File(project.buildDir, "libs").mkdirs()
fileTree(project.buildDir).matching { include 'libs/*.jar' }.each { delete it }
baseJars.each { bundleJar -> // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def sourceJarPath = baseDir.path + '/libs/' + bundleJar.name // main jar
println 'Initial bundle jar name [ ' + sourceJarPath + ' ]'
def finalBundleJarName = project.buildDir.path + '/libs/' + bundleJar.name.replaceAll( 'hibernate-envers', 'hibernate-envers-jakarta' ) tasks.jar {
println 'Default jakarta final bundle jar name [ ' + finalBundleJarName + ' ]' enabled false
def transformerArgs = [
sourceJarPath, finalBundleJarName,
'-q', // quiet output
'-tr', new File(getProjectDir().getParentFile(), 'rules/jakarta-renames.properties').path,
'-tv', new File(getProjectDir().getParentFile(), 'rules/jakarta-versions.properties').path,
'-td', new File(getProjectDir().getParentFile(), 'rules/jakarta-direct.properties').path,
]
println 'Transformer options:'
transformerArgs.each {
println ' [ ' + it + ' ]'
} }
javaexec { task jakartafyJar( type: JakartaJarTransformation ) {
classpath configurations.jakartaeeTransformJars sourceJar = project(':hibernate-envers').tasks.jar.archiveFile
main = 'org.eclipse.transformer.jakarta.JakartaTransformer' targetJar = tasks.jar.archiveFile
args = transformerArgs
}
}
}
} }
task unpackTestJar(type: Copy) { tasks.jar.dependsOn project(':hibernate-envers').tasks.jar
dependsOn jar tasks.jar.finalizedBy tasks.jakartafyJar
fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each { tasks.jakartafyJar.dependsOn tasks.jar
def outputDir = file("${buildDir}/unpacked/" + it.name) tasks.jakartafyJar.mustRunAfter tasks.jar
from zipTree(it)
into outputDir
} // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// javadoc jar
tasks.javadocJar {
enabled false
} }
test { task jakartafyJavadocJar( type: JakartaJarTransformation ) {
dependsOn unpackTestJar sourceJar = project(':hibernate-envers').tasks.javadocJar.archiveFile
fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each { targetJar = tasks.javadocJar.archiveFile
def outputDir = file("${buildDir}/unpacked/" + it.name)
testClassesDirs += files(outputDir)
classpath += files(outputDir)
} }
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 )
systemProperty 'file.encoding', 'utf-8' systemProperty 'file.encoding', 'utf-8'
if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) { if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
@ -101,3 +131,15 @@ test {
jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] ) jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
} }
} }
tasks.test.dependsOn project( ':hibernate-transaction-client' ).tasks.jar
task testJar(type: Jar, dependsOn: testClasses) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set( 'test' )
from sourceSets.test.output
}
artifacts {
tests tasks.testJar
}

View File

@ -1,3 +1,6 @@
import org.hibernate.orm.jakarta.JakartaDirectoryTransformation
import org.hibernate.orm.jakarta.JakartaJarTransformation
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
@ -7,11 +10,10 @@
description = 'Support for testing Hibernate ORM Jakarta functionality' description = 'Support for testing Hibernate ORM Jakarta functionality'
apply from: rootProject.file( 'gradle/jakarta-java-module.gradle' ) apply from: rootProject.file( 'gradle/jakarta-java-module.gradle' )
configurations { evaluationDependsOn( ':hibernate-testing' )
jakartaeeTransformJars
}
dependencies { dependencies {
api project( ':hibernate-core-jakarta' ) api project( ':hibernate-core-jakarta' )
@ -37,51 +39,124 @@ dependencies {
api libraries.log4j2 api libraries.log4j2
jakartaeeTransformJars 'biz.aQute.bnd:biz.aQute.bnd.transform:5.1.1', implementation project( ':hibernate-transaction-client' )
'commons-cli:commons-cli:1.4',
'org.slf4j:slf4j-simple:1.7.30', testImplementation fileTree(dir: 'libs', include: '*.jar')
'org.slf4j:slf4j-api:1.7.26',
'org.eclipse.transformer:org.eclipse.transformer:0.2.0',
'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
testCompile fileTree(dir: 'libs', include: '*.jar')
} }
jar {
mustRunAfter project(':hibernate-testing').tasks.jar
dependsOn project(':hibernate-testing').tasks.jar
def baseDir = project(':hibernate-testing').buildDir
def baseJars = fileTree(baseDir).matching {include 'libs/*.jar' }
inputs.files(baseJars).skipWhenEmpty()
outputs.dir project.buildDir
doLast {
new File(project.buildDir, "libs").mkdirs()
fileTree(project.buildDir).matching { include 'libs/*.jar' }.each { delete it }
baseJars.each { bundleJar -> // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def sourceJarPath = baseDir.path + '/libs/' + bundleJar.name // main jar
println 'Initial bundle jar name [ ' + sourceJarPath + ' ]'
def finalBundleJarName = project.buildDir.path + '/libs/' + bundleJar.name.replaceAll( 'hibernate-testing', 'hibernate-testing-jakarta' ) tasks.jar {
println 'Default jakarta final bundle jar name [ ' + finalBundleJarName + ' ]' enabled false
def transformerArgs = [
sourceJarPath, finalBundleJarName,
'-q', // quiet output
'-tr', new File(getProjectDir().getParentFile(), 'rules/jakarta-renames.properties').path,
'-tv', new File(getProjectDir().getParentFile(), 'rules/jakarta-versions.properties').path,
'-td', new File(getProjectDir().getParentFile(), 'rules/jakarta-direct.properties').path,
]
println 'Transformer options:'
transformerArgs.each {
println ' [ ' + it + ' ]'
} }
javaexec { task jakartafyJar( type: JakartaJarTransformation ) {
classpath configurations.jakartaeeTransformJars sourceJar = project(':hibernate-testing').tasks.jar.archiveFile
main = 'org.eclipse.transformer.jakarta.JakartaTransformer' targetJar = tasks.jar.archiveFile
args = transformerArgs }
tasks.jar.dependsOn project(':hibernate-testing').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-testing').tasks.javadocJar.archiveFile
targetJar = tasks.javadocJar.archiveFile
}
tasks.javadocJar.dependsOn project(':hibernate-testing').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-testing').tasks.sourcesJar.archiveFile
targetJar = tasks.javadocJar.archiveFile
}
tasks.sourcesJar.dependsOn project(':hibernate-testing').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-testing' ).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-testing').tasks.testJar
tasks.jakartafyTests.dependsOn tasks.unpackTests
tasks.test {
testClassesDirs += project.files( tasks.jakartafyTests.targetDirectory )
classpath += project.files( tasks.jakartafyTests.targetDirectory )
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'] )
} }
} }
task testJar(type: Jar, dependsOn: testClasses) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set( 'test' )
from tasks.jakartafyTests.targetDirectory
} }
artifacts {
tests tasks.testJar
} }

View File

@ -9,6 +9,9 @@ description = 'Support for testing Hibernate ORM functionality'
apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply from: rootProject.file( 'gradle/published-java-module.gradle' )
configurations {
tests
}
dependencies { dependencies {
api project( ':hibernate-core' ) api project( ':hibernate-core' )
@ -37,4 +40,14 @@ dependencies {
tasks.test.include '**/*' tasks.test.include '**/*'
task testJar(type: Jar, dependsOn: testClasses) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set( 'test' )
from sourceSets.test.output
}
artifacts {
tests tasks.testJar
}

View File

@ -4,6 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * 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>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
import org.hibernate.orm.jakarta.JakartaJarTransformation
description = 'Wildfly Transaction Client transformed to be JTA 2.0 compatible' description = 'Wildfly Transaction Client transformed to be JTA 2.0 compatible'
@ -16,53 +17,27 @@ tasks.withType(PublishToMavenRepository) {
} }
configurations { configurations {
jakartaeeTransformJars wildFlyTxnClient {
description = 'Used to access the WildFly transaction client jar to be able to transform it'
}
} }
dependencies { dependencies {
compile( libraries.jakarta_jta ) api libraries.jakarta_jta
jakartaeeTransformJars 'biz.aQute.bnd:biz.aQute.bnd.transform:5.1.1', wildFlyTxnClient( libraries.wildfly_transaction_client ) {
'commons-cli:commons-cli:1.4',
'org.slf4j:slf4j-simple:1.7.30',
'org.slf4j:slf4j-api:1.7.26',
'org.eclipse.transformer:org.eclipse.transformer:0.2.0',
'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
testCompile ( libraries.wildfly_transaction_client ) {
transitive = false; transitive = false;
} }
} }
jar { tasks.compileJava.enabled = false
def sourceJarPath = project.configurations.testCompile.find { it.name.startsWith("wildfly-transaction-client-") } tasks.processResources.enabled = false
inputs.files(sourceJarPath).skipWhenEmpty() tasks.compileTestJava.enabled = false
outputs.dir project.buildDir tasks.processTestResources.enabled = false
doLast { tasks.test.enabled = false
new File(project.buildDir, "libs").mkdirs() tasks.jar.enabled = false
fileTree(project.buildDir).matching { include 'libs/*.jar' }.each { delete it }
println 'Initial bundle jar name [ ' + sourceJarPath + ' ]' task jakartafyDependency(type: JakartaJarTransformation) {
sourceJar = project.configurations.wildFlyTxnClient.resolvedConfiguration.resolvedArtifacts.find().file
def finalBundleJarName = project.buildDir.path + '/libs/hibernate-transaction-client-' + project.version + ".jar" targetJar = tasks.jar.archiveFile
println 'Default jakarta final bundle jar name [ ' + finalBundleJarName + ' ]'
def transformerArgs = [
sourceJarPath, finalBundleJarName,
'-q', // quiet output
'-tr', new File(getProjectDir().getParentFile(), 'rules/jakarta-renames.properties').path,
'-tv', new File(getProjectDir().getParentFile(), 'rules/jakarta-versions.properties').path,
'-td', new File(getProjectDir().getParentFile(), 'rules/jakarta-direct.properties').path,
]
println 'Transformer options:'
transformerArgs.each {
println ' [ ' + it + ' ]'
}
javaexec {
classpath configurations.jakartaeeTransformJars
main = 'org.eclipse.transformer.jakarta.JakartaTransformer'
args = transformerArgs
}
}
} }

View File

@ -12,6 +12,8 @@ plugins {
rootProject.name = 'hibernate-orm' rootProject.name = 'hibernate-orm'
includeBuild('database-service-plugin')
apply from: file( 'gradle/gradle-enterprise.gradle' ) apply from: file( 'gradle/gradle-enterprise.gradle' )
if ( !JavaVersion.current().java8Compatible ) { if ( !JavaVersion.current().java8Compatible ) {
@ -147,7 +149,6 @@ project(':hibernate-gradle-plugin').projectDir = new File(rootProject.projectDir
include 'hibernate-enhance-maven-plugin' include 'hibernate-enhance-maven-plugin'
project(':hibernate-enhance-maven-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-enhance-maven-plugin") project(':hibernate-enhance-maven-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-enhance-maven-plugin")
includeBuild('database-service-plugin')
rootProject.children.each { project -> rootProject.children.each { project ->
project.buildFileName = "${project.name}.gradle" project.buildFileName = "${project.name}.gradle"

View File

@ -11,7 +11,7 @@ plugins {
id 'java-gradle-plugin' id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.14.0' id 'com.gradle.plugin-publish' version '0.14.0'
id 'com.github.sebersole.testkit-junit5' version '1.0.1' id 'com.github.sebersole.testkit-junit5' version '1.2.0'
} }
apply from: rootProject.file( 'gradle/java-module.gradle' ) apply from: rootProject.file( 'gradle/java-module.gradle' )

View File

@ -15,8 +15,8 @@ configurations {
dependencies { dependencies {
// JAXB // JAXB
compile( libraries.jakarta_jaxb_api ) implementation( libraries.jakarta_jaxb_api )
compile( libraries.jakarta_jaxb_runtime ) implementation( libraries.jakarta_jaxb_runtime )
jakartaeeTransformJars 'biz.aQute.bnd:biz.aQute.bnd.transform:5.1.1', jakartaeeTransformJars 'biz.aQute.bnd:biz.aQute.bnd.transform:5.1.1',
'commons-cli:commons-cli:1.4', 'commons-cli:commons-cli:1.4',
@ -24,7 +24,7 @@ dependencies {
'org.slf4j:slf4j-api:1.7.26', 'org.slf4j:slf4j-api:1.7.26',
'org.eclipse.transformer:org.eclipse.transformer:0.2.0', 'org.eclipse.transformer:org.eclipse.transformer:0.2.0',
'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0' 'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
testCompile fileTree(dir: 'libs', include: '*.jar') testImplementation fileTree(dir: 'libs', include: '*.jar')
} }
jar { jar {