Fix concurrency issue with Jakarta processing

This commit is contained in:
Steve Ebersole 2021-07-01 08:26:52 -05:00
parent 59f033194a
commit 58517b99d1
2 changed files with 29 additions and 19 deletions

View File

@ -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

View File

@ -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