FINERACT-2181: Some tweaks in the gradle build to ensure correct task processing

This commit is contained in:
Adam Saghy
2025-06-18 15:54:00 +02:00
committed by Arnold Gálovics
parent e840db50fc
commit 11cecb0d45
37 changed files with 1904 additions and 805 deletions
+56
View File
@@ -80,3 +80,59 @@ jmh {
timeOnIteration = '2s' // Time per iteration
benchmarkMode = ['thrpt'] // Default benchmark mode
}
tasks.register('staticWeaveJpa', JavaExec) {
dependsOn classes
def classesDir = layout.buildDirectory.dir("classes/java/main").get().asFile
def outputDir = layout.buildDirectory.dir("weaved-classes").get().asFile
def persistenceInfo = layout.buildDirectory.dir('static-weaving').get()
copy {
from file("src/main/resources/jpa/static-weaving/module/command/persistence.xml")
into "${persistenceInfo}/META-INF/"
}
mainClass.set("org.eclipse.persistence.tools.weaving.jpa.StaticWeave")
classpath = sourceSets.main.runtimeClasspath
args = [
'-persistenceinfo', persistenceInfo,
classesDir.absolutePath,
outputDir.absolutePath
]
}
tasks.register("weavedJar", Jar) {
archiveClassifier.set("")
dependsOn staticWeaveJpa
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(layout.buildDirectory.dir("weaved-classes"))
exclude("META-INF/persistence.xml")
}
// Configure the default jar task to depend on weavedJar and use its output
tasks.named('jar') {
dependsOn weavedJar
enabled = false // Disable the default jar task
// The weavedJar will be used as the primary artifact
}
// Make sure the assemble task depends on weavedJar
tasks.named('assemble') {
dependsOn weavedJar
}
tasks.named("test") {
dependsOn staticWeaveJpa
def testClasses = layout.buildDirectory.dir("classes/java/test").get().asFile
def weavedClasses = layout.buildDirectory.dir("weaved-classes").get().asFile
def testResources = layout.buildDirectory.dir("resources/test").get().asFile
classpath = files(
weavedClasses,
testClasses,
testResources,
configurations.testRuntimeClasspath
)
}