From 4d1e4e5fba028c589cd065055c3172e2eb4cc5e6 Mon Sep 17 00:00:00 2001 From: Kristof Jozsa Date: Sat, 30 Nov 2024 13:45:48 +0100 Subject: [PATCH] Improve Gradle build configuration --- .github/workflows/build-mariadb.yml | 4 +- .github/workflows/build-mysql.yml | 4 +- .github/workflows/build-postgresql.yml | 4 +- build.gradle | 47 +- config/checkstyle/checkstyle.xml | 186 ++-- fineract-avro-schemas/build.gradle.kts | 209 +++++ .../{build.gradle => build.gradle.off} | 0 fineract-avro-schemas/dependencies.gradle | 21 - fineract-core/dependencies.gradle | 31 +- fineract-e2e-tests-core/build.gradle | 5 +- .../data/loanproduct/DefaultLoanProduct.java | 4 +- .../LoanProductGlobalInitializerStep.java | 22 + .../test/stepdef/loan/LoanStepDef.java | 322 +++++++ .../fineract/test/support/TestContextKey.java | 1 + fineract-e2e-tests-runner/build.gradle | 4 +- .../resources/features/LoanChargeOff.feature | 107 ++- .../resources/features/LoanChargeback.feature | 801 +++++++++++++++--- .../features/LoanDelinquency.feature | 251 ++++-- .../features/LoanDownPayment.feature | 258 ++++-- .../LoanInterestPaymentWaiver.feature | 691 +++++++++++++++ .../resources/features/LoanProduct.feature | 20 +- .../resources/features/LoanRepayment.feature | 39 + .../domain/LoanTransactionRelation.java | 2 + fineract-progressive-loan/build.gradle | 100 --- fineract-progressive-loan/build.gradle.kts | 54 ++ fineract-progressive-loan/build.gradle.off | 77 ++ fineract-progressive-loan/dependencies.gradle | 62 -- ...edPaymentScheduleTransactionProcessor.java | 15 +- .../calc/ProgressiveEMICalculator.java | 38 +- .../calc/ProgressiveEMICalculatorTest.java | 8 +- fineract-provider/build.gradle | 252 ++---- fineract-provider/dependencies.gradle | 169 ++-- .../conditions/LoanCOBEnabledCondition.java | 2 +- .../src/main/resources/application.properties | 1 + gradle.properties | 4 +- integration-tests/build.gradle | 6 +- 36 files changed, 2903 insertions(+), 918 deletions(-) create mode 100644 fineract-avro-schemas/build.gradle.kts rename fineract-avro-schemas/{build.gradle => build.gradle.off} (100%) delete mode 100644 fineract-avro-schemas/dependencies.gradle create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPaymentWaiver.feature delete mode 100644 fineract-progressive-loan/build.gradle create mode 100644 fineract-progressive-loan/build.gradle.kts create mode 100644 fineract-progressive-loan/build.gradle.off diff --git a/.github/workflows/build-mariadb.yml b/.github/workflows/build-mariadb.yml index 7b7fc23fd51..8e2eb4431d6 100644 --- a/.github/workflows/build-mariadb.yml +++ b/.github/workflows/build-mariadb.yml @@ -54,8 +54,8 @@ jobs: done - name: Initialise databases run: | - ./gradlew --no-daemon -q createDB -PdbName=fineract_tenants - ./gradlew --no-daemon -q createDB -PdbName=fineract_default + mysql -h 127.0.0.1 -P 3306 -u root -pmysql -e "CREATE DATABASE IF NOT EXISTS fineract_tenants CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + mysql -h 127.0.0.1 -P 3306 -u root -pmysql -e "CREATE DATABASE IF NOT EXISTS fineract_default CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" - name: Start LocalStack env: AWS_ENDPOINT_URL: http://localhost:4566 diff --git a/.github/workflows/build-mysql.yml b/.github/workflows/build-mysql.yml index a14afa7585b..3d8306c8839 100644 --- a/.github/workflows/build-mysql.yml +++ b/.github/workflows/build-mysql.yml @@ -54,8 +54,8 @@ jobs: done - name: Initialise databases run: | - ./gradlew --no-daemon -q createMySQLDB -PdbName=fineract_tenants - ./gradlew --no-daemon -q createMySQLDB -PdbName=fineract_default + mysql -h 127.0.0.1 -P 3306 -u root -pmysql -e "CREATE DATABASE IF NOT EXISTS fineract_tenants CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + mysql -h 127.0.0.1 -P 3306 -u root -pmysql -e "CREATE DATABASE IF NOT EXISTS fineract_default CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" - name: Start LocalStack env: AWS_ENDPOINT_URL: http://localhost:4566 diff --git a/.github/workflows/build-postgresql.yml b/.github/workflows/build-postgresql.yml index 8d4106a50c7..1f87f391785 100644 --- a/.github/workflows/build-postgresql.yml +++ b/.github/workflows/build-postgresql.yml @@ -55,8 +55,8 @@ jobs: done - name: Initialise databases run: | - ./gradlew --no-daemon -q createPGDB -PdbName=fineract_tenants - ./gradlew --no-daemon -q createPGDB -PdbName=fineract_default + PGPASSWORD=postgres psql -h 127.0.0.1 -U root -d postgres -c "CREATE DATABASE fineract_tenants WITH OWNER = root ENCODING = 'UTF8' CONNECTION LIMIT = -1;" + PGPASSWORD=postgres psql -h 127.0.0.1 -U root -d postgres -c "CREATE DATABASE fineract_default WITH OWNER = root ENCODING = 'UTF8' CONNECTION LIMIT = -1;" - name: Start LocalStack env: AWS_ENDPOINT_URL: http://localhost:4566 diff --git a/build.gradle b/build.gradle index cba4529dfe8..bbcebbee505 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ - /** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -87,28 +87,32 @@ buildscript { } plugins { - id 'me.qoomon.git-versioning' version '6.4.4' + // id 'org.asciidoctor.jvm.gems' version '3.3.2' apply false + // id 'org.asciidoctor.jvm.revealjs' version '3.3.2' apply false + id "com.github.davidmc24.gradle.plugin.avro-base" version "1.9.1" apply false id "org.barfuin.gradle.taskinfo" version "2.2.0" id 'com.adarshr.test-logger' version '4.0.0' id 'com.diffplug.spotless' version '6.25.0' apply false - id 'org.nosphere.apache.rat' version '0.8.1' apply false + id 'com.github.andygoossens.modernizer' version '1.9.3' apply false id 'com.github.hierynomus.license' version '0.16.1' apply false id 'com.github.jk1.dependency-license-report' version '2.9' apply false - id 'org.zeroturnaround.gradle.jrebel' version '1.2.0' apply false - id 'org.springframework.boot' version '3.3.4' apply false - id 'net.ltgt.errorprone' version '3.1.0' apply false - id 'io.swagger.core.v3.swagger-gradle-plugin' version '2.2.23' apply false + id 'com.github.spotbugs' version '6.0.24' apply false + id 'com.google.cloud.tools.jib' version '3.4.3' apply false id 'com.gorylenko.gradle-git-properties' version '2.4.2' apply false + id "io.freefair.lombok" version "8.10.2" + id 'io.swagger.core.v3.swagger-gradle-plugin' version '2.2.23' apply false + id 'me.qoomon.git-versioning' version '6.4.4' + id 'net.ltgt.errorprone' version '3.1.0' apply false id 'org.asciidoctor.jvm.convert' version '3.3.2' apply false + id 'org.asciidoctor.jvm.epub' version '3.3.2' apply false id 'org.asciidoctor.jvm.pdf' version '3.3.2' apply false - id 'com.google.cloud.tools.jib' version '3.4.3' apply false - id 'org.sonarqube' version '4.4.1.3373' - id 'com.github.andygoossens.modernizer' version '1.9.3' apply false - // TODO: upgrade to 6.0.4 - id 'com.github.spotbugs' version '6.0.24' apply false - id 'se.thinkcode.cucumber-runner' version '0.0.11' apply false - id "com.github.davidmc24.gradle.plugin.avro-base" version "1.9.1" apply false + id 'org.asciidoctor.kindlegen.base' version '3.2.0' apply false + id 'org.nosphere.apache.rat' version '0.8.1' apply false id 'org.openapi.generator' version '7.8.0' apply false + id 'org.sonarqube' version '4.4.1.3373' apply false + id 'org.springframework.boot' version '3.3.3' apply false + id 'org.zeroturnaround.gradle.jrebel' version '1.2.0' apply false + id 'se.thinkcode.cucumber-runner' version '0.0.11' apply false } apply from: "${rootDir}/buildSrc/src/main/groovy/org.apache.fineract.release.gradle" @@ -321,7 +325,6 @@ configure(project.fineractJavaProjects) { apply plugin: 'java' apply plugin: 'idea' - apply plugin: 'eclipse' apply plugin: 'checkstyle' apply plugin: 'jacoco' apply plugin: 'net.ltgt.errorprone' @@ -374,7 +377,7 @@ configure(project.fineractJavaProjects) { "-Xlint:overloads", "-Xlint:overrides", "-Xlint:path", - "-Xlint:processing", + "-Xlint:-processing", "-Xlint:removal", "-Xlint:requires-automatic", "-Xlint:requires-transitive-automatic", @@ -682,8 +685,9 @@ configure(project.fineractCustomProjects) { exclude(module: "slf4j-api") } - compileOnly('org.projectlombok:lombok') - annotationProcessor('org.projectlombok:lombok') + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + annotationProcessor('org.mapstruct:mapstruct-processor') annotationProcessor('org.springframework.boot:spring-boot-autoconfigure-processor') annotationProcessor('org.springframework.boot:spring-boot-configuration-processor') @@ -802,3 +806,10 @@ task printSourceSetInformation() { } } } + +if ('sonarqube' in gradle.startParameter.taskNames) { + apply plugin: 'org.sonarqube' + tasks.named('sonarqube') { + dependsOn build + } +} diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 9634f88e778..d4fac8fa5d3 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -20,8 +20,8 @@ --> + "-//Puppy Crawl//DTD Check Configuration 1.3//EN" + "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> @@ -50,21 +50,21 @@ - + - - + value="Parameter name ''{0}'' must match pattern ''{1}''."/> + + - - - - + + + + - + @@ -74,12 +74,12 @@ - + - - + + @@ -96,29 +96,29 @@ - - - - + + + + - - - + + + - + - - + + + value="Type name ''{0}'' must match pattern ''{1}''."/> - + + value="Method type name ''{0}'' must match pattern ''{1}''."/> @@ -129,14 +129,14 @@ + value="Package name ''{0}'' must match pattern ''{1}''."/> - + @@ -145,78 +145,78 @@ - - - - - - + + + + + + - + - - - + value="GenericWhitespace ''{0}'' is followed by whitespace."/> + + + - + + value="Method name ''{0}'' must match pattern ''{1}''."/> - + + value="Class type name ''{0}'' must match pattern ''{1}''."/> - - + + - + value="WhitespaceAround: ''{0}'' is not followed by whitespace."/> + + value="Member name ''{0}'' must match pattern ''{1}''."/> - + - + + value="Local variable name ''{0}'' must match pattern ''{1}''."/> - + + + + + + + < ! - - Do NOT 'scope' this one; any JavaDoc (public/protected/private) IFF present, should be style checked. - - > + + + + + + + + + + < ! - - TODO Enable proper JavaDoc paragraphs (requires removing /** from all license headers) - - > + + + + -->