From 253b2754c76a6485c3b1e81fc6aa46b0e8eea363 Mon Sep 17 00:00:00 2001 From: Kristof Jozsa Date: Sat, 30 Nov 2024 13:45:48 +0100 Subject: [PATCH] PS-2084: Speed up Fineract build --- .github/workflows/build-mariadb.yml | 4 +- .github/workflows/build-mysql.yml | 4 +- .github/workflows/build-postgresql.yml | 4 +- build.gradle | 45 +- 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 | 2 + .../LoanProductGlobalInitializerStep.java | 78 +- .../test/stepdef/loan/LoanStepDef.java | 477 +++---- fineract-e2e-tests-runner/build.gradle | 1 + .../resources/features/LoanChargeOff.feature | 8 +- .../resources/features/LoanChargeback.feature | 36 +- .../resources/features/LoanRepayment.feature | 1094 ++++------------- 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 - fineract-provider/build.gradle | 251 ++-- fineract-provider/dependencies.gradle | 169 ++- .../conditions/LoanCOBEnabledCondition.java | 2 +- .../src/main/resources/application.properties | 1 + gradle.properties | 4 +- integration-tests/build.gradle | 6 +- 26 files changed, 1070 insertions(+), 1856 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 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 9aa8d8e6947..d7c03951926 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 124b92ebd1a..b47a192108c 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 eba477b86d1..675ebebab17 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 1bd72f714b9..5895942fd40 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 'eclipse' + id 'idea' 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.10.0' 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.5' apply false - id 'net.ltgt.errorprone' version '4.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.26' apply false + id 'com.google.cloud.tools.jib' version '3.4.4' 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 '4.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.4' apply false - id 'org.sonarqube' version '4.4.1.3373' - id 'com.github.andygoossens.modernizer' version '1.10.0' apply false - // TODO: upgrade to 6.0.4 - id 'com.github.spotbugs' version '6.0.26' 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 id "com.github.davidmc24.gradle.plugin.avro-base" version "1.9.1" apply false - id 'org.openapi.generator' version '7.8.0' 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) - - > + + + + -->