diff --git a/hibernate-core-jakarta/hibernate-core-jakarta.gradle b/hibernate-core-jakarta/hibernate-core-jakarta.gradle index 427b45a2e4..a2ece88646 100644 --- a/hibernate-core-jakarta/hibernate-core-jakarta.gradle +++ b/hibernate-core-jakarta/hibernate-core-jakarta.gradle @@ -151,11 +151,18 @@ project.ext { tasks.compileTestJava { enabled false - dependsOn project(':hibernate-core').tasks.testJar + dependsOn project(':hibernate-core').tasks.compileTestJava + dependsOn +} + +tasks.processTestResources { + enabled false + dependsOn project(':hibernate-core').tasks.compileTestJava } task unpackTests(type: Copy) { - from zipTree( project( ':hibernate-core' ).tasks.testJar.archiveFile ) + from project( ':hibernate-core' ).sourceSets.test.output +// from zipTree( project( ':hibernate-core' ).tasks.testJar.archiveFile ) into project.testClassesUnpackTargetDirectory exclude 'templates/**' } @@ -163,16 +170,15 @@ task unpackTests(type: Copy) { 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.compileTestJava.finalizedBy tasks.jakartafyTests -tasks.jakartafyTests.dependsOn tasks.unpackTests -tasks.unpackTests.dependsOn project( ':hibernate-core' ).tasks.testJar - -tasks.processTestResources { - enabled false -} task copyTestBundles(type: Copy) { // `:hibernate-core:processTestResources` also triggers processing the diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index 0aa698f409..b787f77065 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -171,13 +171,18 @@ ext { jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" ) } -sourceSets.main { - java.srcDir project.jaxbTargetDir -} - -// resources inherently exclude sources -sourceSets.test.resources { - setSrcDirs( ['src/test/java','src/test/resources','src/test/bundles'] ) +sourceSets { + main { + java { + srcDir project.jaxbTargetDir + } + } + test { + resources { + // resources inherently exclude Java sources + srcDir 'src/test/java' + } + } } idea { @@ -227,9 +232,8 @@ task copyBundleResources (type: Copy) { ext.bundlesTargetDir.mkdirs() } } -// Not sure if this is a proper fix, but if we use dependsOn instead of finalizedBy, -// we will end up a test JAR with bundle files that where variables are replaced -processTestResources.finalizedBy copyBundleResources + +processTestResources.dependsOn copyBundleResources sourcesJar { duplicatesStrategy = DuplicatesStrategy.EXCLUDE