FINERACT-1198: Fixing incremental build for Gradle
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
6e052e536b
commit
46ff275d07
+6
-10
@@ -46,9 +46,6 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.bmuschko:gradle-cargo-plugin:2.8.0'
|
classpath 'com.bmuschko:gradle-cargo-plugin:2.8.0'
|
||||||
classpath 'org.apache.openjpa:openjpa:3.2.0' // when upgrading, also change OpenJPA version repeated in fineract-provider/build.gradle!
|
classpath 'org.apache.openjpa:openjpa:3.2.0' // when upgrading, also change OpenJPA version repeated in fineract-provider/build.gradle!
|
||||||
classpath 'com.radcortez.gradle:openjpa-gradle-plugin:3.1.0'
|
|
||||||
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.5'
|
|
||||||
classpath 'gradle.plugin.com.github.andygoossens:gradle-modernizer-plugin:1.3.0'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +53,7 @@ plugins {
|
|||||||
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
||||||
id "org.barfuin.gradle.taskinfo" version "1.3.1"
|
id "org.barfuin.gradle.taskinfo" version "1.3.1"
|
||||||
id 'com.adarshr.test-logger' version '3.1.0'
|
id 'com.adarshr.test-logger' version '3.1.0'
|
||||||
id 'com.diffplug.spotless' version '5.17.1' apply false
|
id 'com.diffplug.spotless' version '6.1.0' apply false
|
||||||
id 'org.nosphere.apache.rat' version '0.7.0' apply false
|
id 'org.nosphere.apache.rat' version '0.7.0' apply false
|
||||||
id 'com.github.hierynomus.license' version '0.16.1' apply false
|
id 'com.github.hierynomus.license' version '0.16.1' apply false
|
||||||
id 'com.github.jk1.dependency-license-report' version '2.0' apply false
|
id 'com.github.jk1.dependency-license-report' version '2.0' apply false
|
||||||
@@ -74,6 +71,8 @@ plugins {
|
|||||||
id 'org.asciidoctor.kindlegen.base' version '3.2.0' apply false
|
id 'org.asciidoctor.kindlegen.base' version '3.2.0' apply false
|
||||||
id "com.google.cloud.tools.jib" version "3.1.4" apply false
|
id "com.google.cloud.tools.jib" version "3.1.4" apply false
|
||||||
id "org.sonarqube" version "3.3"
|
id "org.sonarqube" version "3.3"
|
||||||
|
id "com.github.andygoossens.modernizer" version "1.6.1" apply false
|
||||||
|
id 'com.github.spotbugs' version '5.0.3' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
description = '''\
|
description = '''\
|
||||||
@@ -82,7 +81,7 @@ gradle clean bootRun'''
|
|||||||
|
|
||||||
project.ext.jerseyVersion = '1.19.4'
|
project.ext.jerseyVersion = '1.19.4'
|
||||||
ext['groovy.version'] = '3.0.6'
|
ext['groovy.version'] = '3.0.6'
|
||||||
ext['swaggerFile'] = "$rootDir/fineract-provider/build/classes/java/main/static/swagger-ui/fineract.yaml".toString()
|
ext['swaggerFile'] = "$rootDir/fineract-provider/build/generated/swagger-ui/fineract.yaml".toString()
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = 'org.apache.fineract'
|
group = 'org.apache.fineract'
|
||||||
@@ -139,7 +138,7 @@ allprojects {
|
|||||||
|
|
||||||
dependency 'io.github.classgraph:classgraph:4.8.129'
|
dependency 'io.github.classgraph:classgraph:4.8.129'
|
||||||
dependency 'org.awaitility:awaitility:4.1.1'
|
dependency 'org.awaitility:awaitility:4.1.1'
|
||||||
dependency 'com.github.spotbugs:spotbugs-annotations:4.4.2'
|
dependency 'com.github.spotbugs:spotbugs-annotations:4.5.2'
|
||||||
dependency 'javax.cache:cache-api:1.1.1'
|
dependency 'javax.cache:cache-api:1.1.1'
|
||||||
dependency 'org.mock-server:mockserver-junit-jupiter:5.11.2'
|
dependency 'org.mock-server:mockserver-junit-jupiter:5.11.2'
|
||||||
dependency 'org.webjars.npm:swagger-ui-dist:4.0.1'
|
dependency 'org.webjars.npm:swagger-ui-dist:4.0.1'
|
||||||
@@ -371,7 +370,7 @@ configure(project.fineractJavaProjects) {
|
|||||||
apply plugin: 'jacoco'
|
apply plugin: 'jacoco'
|
||||||
apply plugin: "net.ltgt.errorprone"
|
apply plugin: "net.ltgt.errorprone"
|
||||||
apply plugin: "com.github.spotbugs"
|
apply plugin: "com.github.spotbugs"
|
||||||
apply plugin: 'com.github.andygoossens.gradle-modernizer-plugin'
|
apply plugin: 'com.github.andygoossens.modernizer'
|
||||||
|
|
||||||
/* define the valid syntax level for source files */
|
/* define the valid syntax level for source files */
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
@@ -426,7 +425,6 @@ configure(project.fineractJavaProjects) {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
spotbugsPlugins 'jp.skypencil.findbugs.slf4j:bug-pattern:1.5.0@jar'
|
spotbugsPlugins 'jp.skypencil.findbugs.slf4j:bug-pattern:1.5.0@jar'
|
||||||
spotbugs 'com.github.spotbugs:spotbugs:4.4.2'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configuration for the spotless plugin
|
// Configuration for the spotless plugin
|
||||||
@@ -472,8 +470,6 @@ configure(project.fineractJavaProjects) {
|
|||||||
lineEndings 'UNIX'
|
lineEndings 'UNIX'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.dependsOn spotlessCheck
|
|
||||||
|
|
||||||
// compileJava may create more source files into generated, hence we need to run these tasks after it
|
// compileJava may create more source files into generated, hence we need to run these tasks after it
|
||||||
licenseMain.dependsOn compileJava
|
licenseMain.dependsOn compileJava
|
||||||
processResources.dependsOn compileJava
|
processResources.dependsOn compileJava
|
||||||
|
|||||||
@@ -22,25 +22,76 @@ apply plugin: 'org.zeroturnaround.gradle.jrebel'
|
|||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'org.springframework.boot'
|
apply plugin: 'org.springframework.boot'
|
||||||
apply plugin: 'openjpa'
|
|
||||||
apply plugin: 'com.gorylenko.gradle-git-properties'
|
apply plugin: 'com.gorylenko.gradle-git-properties'
|
||||||
apply plugin: 'io.swagger.core.v3.swagger-gradle-plugin'
|
apply plugin: 'io.swagger.core.v3.swagger-gradle-plugin'
|
||||||
apply plugin: 'distribution'
|
apply plugin: 'distribution'
|
||||||
apply plugin: 'signing'
|
apply plugin: 'signing'
|
||||||
apply plugin: 'com.google.cloud.tools.jib'
|
apply plugin: 'com.google.cloud.tools.jib'
|
||||||
|
|
||||||
// Configuration for the OpenJPA enhance task
|
// Custom OpenJPA enhancement
|
||||||
// https://github.com/radcortez/openjpa-gradle-plugin
|
compileJava.doLast {
|
||||||
System.setProperty("openjpa.Log", "commons")
|
def enhanceIncludes = [
|
||||||
|
|
||||||
openjpa {
|
|
||||||
includes = [
|
|
||||||
'**/AbstractPersistableCustom.class',
|
'**/AbstractPersistableCustom.class',
|
||||||
'**/domain/*.class'
|
'**/domain/*.class'
|
||||||
]
|
]
|
||||||
enhance {
|
|
||||||
enforcePropertyRestrictions true
|
def classesToEnhance = project.sourceSets.main.output.classesDirs.collectMany { classesDir ->
|
||||||
|
project.fileTree(classesDir).matching {
|
||||||
|
enhanceIncludes.forEach { include it }
|
||||||
|
}.files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String persistenceXml = "META-INF/persistence.xml"
|
||||||
|
def persistenceXmlFile
|
||||||
|
|
||||||
|
// Check if persistence.xml is in the resource dirs.
|
||||||
|
project.sourceSets.main.resources.srcDirs.collect { resourceDir ->
|
||||||
|
def persistenceXmlFileCandidate = project.fileTree(resourceDir).matching {
|
||||||
|
include persistenceXml
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!persistenceXmlFileCandidate.isEmpty()) {
|
||||||
|
if (persistenceXmlFile == null) {
|
||||||
|
persistenceXmlFile = persistenceXmlFileCandidate.singleFile
|
||||||
|
} else {
|
||||||
|
throw new InvalidUserDataException("Multiple persistence.xml files found in path: " +
|
||||||
|
persistenceXmlFile + ", " + persistenceXmlFileCandidate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nothing found. Fallback to plain file.
|
||||||
|
if (persistenceXmlFile == null) {
|
||||||
|
persistenceXmlFile = project.file(persistenceXml)
|
||||||
|
if (!persistenceXmlFile.exists()) {
|
||||||
|
throw new InvalidUserDataException(
|
||||||
|
"Could not find valid persistence.xml in path " + this.persistenceXml)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
org.apache.openjpa.lib.util.Options options = new org.apache.openjpa.lib.util.Options([
|
||||||
|
"addDefaultConstructor" : true,
|
||||||
|
"enforcePropertyRestrictions": true,
|
||||||
|
"tmpClassLoader" : false,
|
||||||
|
"propertiesFile" : persistenceXmlFile
|
||||||
|
])
|
||||||
|
|
||||||
|
def classes = project.sourceSets.main.output.classesDirs.collect { it.toURI().toURL() }
|
||||||
|
|
||||||
|
def compileJars = project.configurations.compileClasspath.files.collect { jar ->
|
||||||
|
jar.toURI().toURL()
|
||||||
|
}
|
||||||
|
|
||||||
|
def resources = project.sourceSets.main.resources.srcDirs.collect { resource ->
|
||||||
|
resource.toURI().toURL()
|
||||||
|
}
|
||||||
|
|
||||||
|
def urls = (classes + compileJars + resources)
|
||||||
|
|
||||||
|
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
|
||||||
|
Thread.currentThread().setContextClassLoader(new URLClassLoader((URL[])urls, currentClassLoader));
|
||||||
|
org.apache.openjpa.enhance.PCEnhancer.run((String []) classesToEnhance, options);
|
||||||
|
Thread.currentThread().setContextClassLoader(currentClassLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configuration for Swagger documentation generation task
|
// Configuration for Swagger documentation generation task
|
||||||
@@ -48,6 +99,8 @@ openjpa {
|
|||||||
import org.apache.tools.ant.filters.ReplaceTokens
|
import org.apache.tools.ant.filters.ReplaceTokens
|
||||||
|
|
||||||
task prepareInputYaml(dependsOn: 'generateGitProperties') {
|
task prepareInputYaml(dependsOn: 'generateGitProperties') {
|
||||||
|
outputs.file('config/swagger/fineract-input.yaml')
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
def versionForSwagger
|
def versionForSwagger
|
||||||
|
|
||||||
@@ -65,6 +118,7 @@ task prepareInputYaml(dependsOn: 'generateGitProperties') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rat.dependsOn prepareInputYaml
|
||||||
|
|
||||||
resolve {
|
resolve {
|
||||||
logging.captureStandardOutput LogLevel.INFO
|
logging.captureStandardOutput LogLevel.INFO
|
||||||
@@ -72,7 +126,7 @@ resolve {
|
|||||||
outputFormat = 'YAML'
|
outputFormat = 'YAML'
|
||||||
prettyPrint = 'TRUE'
|
prettyPrint = 'TRUE'
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
outputDir = file("${buildDir}/classes/java/main/static/swagger-ui")
|
outputDir = file("${buildDir}/generated/swagger-ui")
|
||||||
openApiFile = file("config/swagger/fineract-input.yaml")
|
openApiFile = file("config/swagger/fineract-input.yaml")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,14 +154,6 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apply from: 'dependencies.gradle'
|
apply from: 'dependencies.gradle'
|
||||||
/* TODO https://issues.apache.org/jira/browse/FINERACT-939 (dev-dependencies.gradle has been removed, as totally broken)
|
|
||||||
// Pick up dependencies based on the environment, defaults to production
|
|
||||||
if (project.hasProperty('env') && project.getProperty('env') == 'dev') {
|
|
||||||
apply from: 'dev-dependencies.gradle'
|
|
||||||
} else {
|
|
||||||
apply from: 'dependencies.gradle'
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Enable Oauth2 authentication based on environment, default to HTTP basic auth */
|
/* Enable Oauth2 authentication based on environment, default to HTTP basic auth */
|
||||||
if (project.hasProperty('security') && project.getProperty('security') == 'oauth') {
|
if (project.hasProperty('security') && project.getProperty('security') == 'oauth') {
|
||||||
@@ -245,6 +291,10 @@ bootJar {
|
|||||||
}
|
}
|
||||||
dependsOn resolve
|
dependsOn resolve
|
||||||
classifier = ''
|
classifier = ''
|
||||||
|
|
||||||
|
from('build/generated/swagger-ui') {
|
||||||
|
into 'BOOT-INF/classes/static/swagger-ui'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jib {
|
jib {
|
||||||
@@ -340,6 +390,7 @@ distributions {
|
|||||||
tasks.binaryDistZip.enabled false
|
tasks.binaryDistZip.enabled false
|
||||||
tasks.srcDistZip.enabled false
|
tasks.srcDistZip.enabled false
|
||||||
tasks.binaryDistTar.dependsOn bootJar
|
tasks.binaryDistTar.dependsOn bootJar
|
||||||
|
tasks.srcDistTar.dependsOn prepareInputYaml
|
||||||
|
|
||||||
// create signatures and checksums only if project parameter "fineract.release" is provided on the command line
|
// create signatures and checksums only if project parameter "fineract.release" is provided on the command line
|
||||||
if( project.hasProperty("fineract.release") ) {
|
if( project.hasProperty("fineract.release") ) {
|
||||||
@@ -384,11 +435,12 @@ gitProperties {
|
|||||||
extProperty = 'gitProps'
|
extProperty = 'gitProps'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processResources.dependsOn generateGitProperties
|
||||||
|
|
||||||
// make sure the generateGitProperties task always executes (even when git.properties is not changed)
|
// make sure the generateGitProperties task always executes (even when git.properties is not changed)
|
||||||
generateGitProperties.outputs.upToDateWhen { false }
|
generateGitProperties.outputs.upToDateWhen { false }
|
||||||
|
|
||||||
// Gradle 7.x asks for explicit dependencies between tasks
|
// Gradle 7.x asks for explicit dependencies between tasks
|
||||||
processResources.dependsOn generateGitProperties
|
|
||||||
checkstyleMain.dependsOn resolve
|
checkstyleMain.dependsOn resolve
|
||||||
checkstyleTest.dependsOn resolve
|
checkstyleTest.dependsOn resolve
|
||||||
licenseMain.dependsOn processResources, generateGitProperties
|
licenseMain.dependsOn processResources, generateGitProperties
|
||||||
|
|||||||
+1
-2
@@ -19,7 +19,6 @@
|
|||||||
package org.apache.fineract.infrastructure.bulkimport.importhandler;
|
package org.apache.fineract.infrastructure.bulkimport.importhandler;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
|
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
|
||||||
@@ -134,7 +133,7 @@ public final class ImportHandlerUtils {
|
|||||||
|
|
||||||
public static String trimEmptyDecimalPortion(String result) {
|
public static String trimEmptyDecimalPortion(String result) {
|
||||||
if (result != null && result.endsWith(".0")) {
|
if (result != null && result.endsWith(".0")) {
|
||||||
return Iterables.get(Splitter.on("\\.").split(result), 0);
|
return Splitter.on("\\.").split(result).iterator().next();
|
||||||
} else {
|
} else {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.portfolio.transfer.service;
|
package org.apache.fineract.portfolio.transfer.service;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -381,7 +380,6 @@ public class TransferWritePlatformServiceJpaRepositoryImpl implements TransferWr
|
|||||||
|
|
||||||
private void handleClientTransferLifecycleEvent(final Client client, final Office destinationOffice,
|
private void handleClientTransferLifecycleEvent(final Client client, final Office destinationOffice,
|
||||||
final TransferEventType transferEventType, final JsonCommand jsonCommand) {
|
final TransferEventType transferEventType, final JsonCommand jsonCommand) {
|
||||||
final Date todaysDate = DateUtils.getDateOfTenant();
|
|
||||||
/** Get destination loan officer if exists **/
|
/** Get destination loan officer if exists **/
|
||||||
Staff staff = null;
|
Staff staff = null;
|
||||||
Group destinationGroup = null;
|
Group destinationGroup = null;
|
||||||
@@ -459,7 +457,7 @@ public class TransferWritePlatformServiceJpaRepositoryImpl implements TransferWr
|
|||||||
} else if (!destinationGroup.isActive()) {
|
} else if (!destinationGroup.isActive()) {
|
||||||
throw new GroupNotActiveException(destinationGroup.getId());
|
throw new GroupNotActiveException(destinationGroup.getId());
|
||||||
}
|
}
|
||||||
transferClientBetweenGroups(Iterables.get(client.getGroups(), 0), client, destinationGroup, true, staff);
|
transferClientBetweenGroups(client.getGroups().stream().findFirst().get(), client, destinationGroup, true, staff);
|
||||||
} else if (client.getGroups().size() == 0 && destinationGroup != null) {
|
} else if (client.getGroups().size() == 0 && destinationGroup != null) {
|
||||||
client.getGroups().add(destinationGroup);
|
client.getGroups().add(destinationGroup);
|
||||||
client.updateStaff(destinationGroup.getStaff());
|
client.updateStaff(destinationGroup.getStaff());
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ war {
|
|||||||
}
|
}
|
||||||
enabled = true
|
enabled = true
|
||||||
classifier = ''
|
classifier = ''
|
||||||
|
|
||||||
|
from('$rootDir/fineract-provider/build/generated/swagger-ui') {
|
||||||
|
into 'BOOT-INF/classes/static/swagger-ui'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
Reference in New Issue
Block a user