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

This commit is contained in:
Adam Saghy
2025-05-25 22:12:22 +02:00
parent 25ef93a30b
commit 6cb60f48fc
36 changed files with 522 additions and 393 deletions
+51 -49
View File
@@ -365,12 +365,12 @@ configure(project.fineractJavaProjects) {
withJavadocJar()
}
tasks.withType(ProcessResources) {
tasks.withType(ProcessResources).configureEach {
destinationDir = layout.buildDirectory.dir('classes/java/main').get().asFile
}
// Add performance optimizations
configurations.all {
configurations.configureEach {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
cacheDynamicVersionsFor 0, 'seconds'
@@ -422,40 +422,40 @@ configure(project.fineractJavaProjects) {
configurations {
api.setCanBeResolved(true)
}
tasks.withType(Copy) {
tasks.withType(Copy).configureEach {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += [
"-Xlint:cast",
"-Xlint:auxiliaryclass",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:exports",
"-Xlint:fallthrough",
"-Xlint:finally",
"-Xlint:module",
"-Xlint:opens",
"-Xlint:options",
"-Xlint:overloads",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:removal",
"-Xlint:requires-automatic",
"-Xlint:requires-transitive-automatic",
"-Xlint:try",
"-Xlint:varargs",
"-Xlint:preview",
"-Xlint:static",
// -Werror needs to be disabled because EclipseLink's static weaving doesn't generate warning-free code
// and during an IntelliJ recompilation, it fails
//"-Werror",
"-Xmaxwarns",
"1500",
"-Xmaxerrs",
"1500"
"-Xlint:cast",
"-Xlint:auxiliaryclass",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:exports",
"-Xlint:fallthrough",
"-Xlint:finally",
"-Xlint:module",
"-Xlint:opens",
"-Xlint:options",
"-Xlint:overloads",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:removal",
"-Xlint:requires-automatic",
"-Xlint:requires-transitive-automatic",
"-Xlint:try",
"-Xlint:varargs",
"-Xlint:preview",
"-Xlint:static",
// -Werror needs to be disabled because EclipseLink's static weaving doesn't generate warning-free code
// and during an IntelliJ recompilation, it fails
//"-Werror",
"-Xmaxwarns",
"1500",
"-Xmaxerrs",
"1500"
]
// TODO FINERACT-959 (gradually) enable -Xlint:all (see "javac -help -X")
@@ -738,11 +738,13 @@ configure(project.fineractJavaProjects) {
]
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = 'UTF-8'
// Ignore any errors during javadoc generation
failOnError = false
tasks.withType(Javadoc).tap {
configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = 'UTF-8'
// Ignore any errors during javadoc generation
failOnError = false
}
}
}
@@ -868,17 +870,17 @@ configure(project.fineractPublishProjects) {
}
}
task printSourceSetInformation() {
doLast{
sourceSets.each { srcSet ->
println "["+srcSet.name+"]"
print "-->Source directories: "+srcSet.allJava.srcDirs+"\n"
print "-->Output directories: "+srcSet.output.classesDirs.files+"\n"
print "-->Compile classpath:\n"
srcSet.compileClasspath.files.each {
print " "+it.path+"\n"
tasks.register('printSourceSetInformation') {
doLast {
sourceSets.each { srcSet ->
println "[" + srcSet.name + "]"
print "-->Source directories: " + srcSet.allJava.srcDirs + "\n"
print "-->Output directories: " + srcSet.output.classesDirs.files + "\n"
print "-->Compile classpath:\n"
srcSet.compileClasspath.files.each {
print " " + it.path + "\n"
}
println ""
}
println ""
}
}
}