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

This reverts commit 11cecb0d45.
This commit is contained in:
Arnold Galovics
2025-06-20 21:53:28 +02:00
committed by Arnold Gálovics
parent d46ab4e73e
commit 1ebfad230c
38 changed files with 810 additions and 1909 deletions
+14 -47
View File
@@ -22,50 +22,32 @@ apply plugin: 'java'
apply plugin: 'eclipse'
tasks.register('staticWeaveJpa', JavaExec) {
group = "build"
description = "Performs EclipseLink static weaving of entity classes"
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/document/persistence.xml")
into "${persistenceInfo}/META-INF/"
}
def classesDir = file("$buildDir/classes/java/main")
mainClass.set("org.eclipse.persistence.tools.weaving.jpa.StaticWeave")
mainClass.set('org.eclipse.persistence.tools.weaving.jpa.StaticWeave')
classpath = sourceSets.main.runtimeClasspath
args = [
'-persistenceinfo', persistenceInfo,
classesDir.absolutePath,
outputDir.absolutePath
]
args '-persistenceinfo', classesDir.absolutePath, classesDir.absolutePath, classesDir.absolutePath
}
tasks.register("weavedJar", Jar) {
archiveClassifier.set("")
dependsOn staticWeaveJpa
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(layout.buildDirectory.dir("weaved-classes"))
exclude("META-INF/persistence.xml")
staticWeaveJpa.doLast {
delete "${sourceSets.main.output.classesDirs.asPath}/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
tasks.named('classes') {
finalizedBy staticWeaveJpa
}
// Make sure the assemble task depends on weavedJar
tasks.named('assemble') {
dependsOn weavedJar
tasks.named('processResources') {
from('src/main/resources')
into sourceSets.main.java.classesDirectory
outputs.upToDateWhen { false }
}
compileJava {
dependsOn ':fineract-avro-schemas:buildJavaSdk'
}
@@ -118,18 +100,3 @@ if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) {
}
}
}
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
)
}