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
+30 -28
View File
@@ -1,3 +1,5 @@
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -35,7 +37,7 @@ openApiValidate {
recommend = true
}
task buildJavaSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
tasks.register('buildJavaSdk', GenerateTask) {
generatorName = 'java'
verbose = false
validateSpec = false
@@ -48,11 +50,11 @@ task buildJavaSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateT
invokerPackage = 'org.apache.fineract.client'
modelPackage = 'org.apache.fineract.client.models'
configOptions = [
dateLibrary: 'java8',
useRxJava2: 'false',
library: 'retrofit2',
hideGenerationTimestamp: 'true',
containerDefaultToNull: 'true'
dateLibrary : 'java8',
useRxJava2 : 'false',
library : 'retrofit2',
hideGenerationTimestamp: 'true',
containerDefaultToNull : 'true'
]
generateModelTests = false
generateApiTests = false
@@ -60,7 +62,7 @@ task buildJavaSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateT
dependsOn(':fineract-provider:resolve')
}
task buildTypescriptAngularSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
tasks.register('buildTypescriptAngularSdk', GenerateTask) {
generatorName = 'typescript-angular'
verbose = false
validateSpec = false
@@ -71,16 +73,16 @@ task buildTypescriptAngularSdk(type: org.openapitools.generator.gradle.plugin.ta
invokerPackage = 'apache-fineract-client/invoker'
modelPackage = 'apache-fineract-client/models'
configOptions = [
apiModulePrefix: 'apacheFineractClient',
configurationPrefix: 'apacheFineractClient',
ngVersion: '12.0.0',
npmName: '@apache/fineract-client',
npmRepository: "${npmRepository}"
apiModulePrefix : 'apacheFineractClient',
configurationPrefix: 'apacheFineractClient',
ngVersion : '12.0.0',
npmName : '@apache/fineract-client',
npmRepository : "${npmRepository}"
]
dependsOn(':fineract-provider:resolve')
}
task buildAsciidoc(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
tasks.register('buildAsciidoc', GenerateTask) {
generatorName = 'asciidoc'
verbose = false
validateSpec = false
@@ -91,18 +93,18 @@ task buildAsciidoc(type: org.openapitools.generator.gradle.plugin.tasks.Generate
invokerPackage = 'org.apache.fineract.client'
modelPackage = 'org.apache.fineract.client.models'
configOptions = [
appName: 'Apache Fineract REST API',
appDescription: '''Apache Fineract is a secure, multi-tenanted microfinance platform.
appName : 'Apache Fineract REST API',
appDescription : '''Apache Fineract is a secure, multi-tenanted microfinance platform.
The goal of the Apache Fineract API is to empower developers to build apps on top of the Apache Fineract Platform.
The https://cui.fineract.dev[reference app] (username: mifos, password: password) works on the same demo tenant as the interactive links in this documentation.
Until we complete the new REST API documentation you still have the legacy documentation available https://fineract.apache.org/legacy-docs/apiLive.htm[here].
Please check https://fineract.apache.org/docs/current[the Fineract documentation] for more information.''',
headerAttributes: 'false',
infoEmail: 'dev@fineract.apache.org',
infoUrl: 'https://fineract.apache.org',
licenseInfo: 'Apache 2.0',
licenseUrl: 'http://www.apache.org/licenses/LICENSE-2.0.html',
useMethodAndPath: 'true'
headerAttributes: 'false',
infoEmail : 'dev@fineract.apache.org',
infoUrl : 'https://fineract.apache.org',
licenseInfo : 'Apache 2.0',
licenseUrl : 'http://www.apache.org/licenses/LICENSE-2.0.html',
useMethodAndPath: 'true'
]
dependsOn(':fineract-provider:resolve')
}
@@ -131,23 +133,23 @@ tasks.withType(Jar).configureEach {
}
// Improve the cleanup task to track inputs and outputs
task cleanupGeneratedJavaFiles() {
tasks.register('cleanupGeneratedJavaFiles') {
def tempDir = file("$buildDir/generated/temp-java")
def targetDir = file("$buildDir/generated/java")
inputs.dir(tempDir)
outputs.dir(targetDir)
doLast {
copy {
from tempDir
into targetDir
filter { line ->
line
.replaceAll("import org\\.joda\\.time\\.\\*;", "")
.replaceAll(", \\)", ")")
.replaceAll(", , @HeaderMap", ", @HeaderMap")
.replaceAll("\\(, ", "(")
.replaceAll("import org\\.joda\\.time\\.\\*;", "")
.replaceAll(", \\)", ")")
.replaceAll(", , @HeaderMap", ", @HeaderMap")
.replaceAll("\\(, ", "(")
}
// Also set duplicates strategy for the copy task
duplicatesStrategy = DuplicatesStrategy.EXCLUDE