794 lines
30 KiB
Groovy
794 lines
30 KiB
Groovy
/**
|
|
* 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
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
* to you under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance
|
|
* with the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
// TODO: this is work in progress, please follow FINERACT-1171
|
|
buildscript {
|
|
ext {
|
|
jacocoVersion = '0.8.7'
|
|
retrofitVersion = '2.9.0'
|
|
okhttpVersion = '4.9.3'
|
|
oltuVersion = '1.0.1'
|
|
fineractJavaProjects = subprojects.findAll{
|
|
[
|
|
'fineract-api',
|
|
'fineract-provider',
|
|
'integration-tests',
|
|
'twofactor-tests',
|
|
'oauth2-tests',
|
|
'fineract-client',
|
|
'core',
|
|
'service',
|
|
'starter'
|
|
].contains(it.name)
|
|
}
|
|
fineractPublishProjects = subprojects.findAll{
|
|
[
|
|
'fineract-client'
|
|
].contains(it.name)
|
|
}
|
|
}
|
|
repositories {
|
|
maven { url 'https://plugins.gradle.org/m2/' }
|
|
}
|
|
|
|
dependencies {
|
|
classpath 'com.bmuschko:gradle-cargo-plugin:2.9.0'
|
|
classpath 'org.eclipse.persistence:eclipselink:2.7.10'
|
|
classpath 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6'
|
|
classpath 'com.google.cloud.tools:jib-layer-filter-extension-gradle:0.3.0'
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
|
id "org.barfuin.gradle.taskinfo" version "1.4.0"
|
|
id 'com.adarshr.test-logger' version '3.2.0'
|
|
id 'com.diffplug.spotless' version '6.4.1' 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.jk1.dependency-license-report' version '2.1' apply false
|
|
id 'org.openapi.generator' version '5.4.0' apply false
|
|
id 'org.zeroturnaround.gradle.jrebel' version '1.1.11' apply false
|
|
id 'org.springframework.boot' version '2.6.6' apply false
|
|
id 'net.ltgt.errorprone' version '2.0.2' apply false
|
|
id 'io.swagger.core.v3.swagger-gradle-plugin' version '2.1.13' apply false
|
|
id 'com.gorylenko.gradle-git-properties' version '2.4.0' apply false
|
|
id 'org.asciidoctor.jvm.convert' version '3.3.2' apply false
|
|
id 'org.asciidoctor.jvm.pdf' version '3.3.2' apply false
|
|
id 'org.asciidoctor.jvm.epub' version '3.3.2' apply false
|
|
id 'org.asciidoctor.jvm.revealjs' version '3.3.2' apply false
|
|
id 'org.asciidoctor.jvm.gems' version '3.3.2' apply false
|
|
id 'org.asciidoctor.kindlegen.base' version '3.2.0' apply false
|
|
id 'com.google.cloud.tools.jib' version '3.2.1' apply false
|
|
id 'fr.brouillard.oss.gradle.jgitver' version '0.10.0-rc03'
|
|
id 'org.sonarqube' version '3.3'
|
|
id 'com.github.andygoossens.modernizer' version '1.6.2' apply false
|
|
id 'com.github.spotbugs' version '5.0.6' apply false
|
|
id 'se.thinkcode.cucumber-runner' version '0.0.10' apply false
|
|
}
|
|
|
|
description = '''\
|
|
Run as:
|
|
gradle clean bootRun'''
|
|
|
|
ext['groovy.version'] = '3.0.10'
|
|
ext['swaggerFile'] = "$rootDir/fineract-provider/build/generated/swagger-ui/fineract.yaml".toString()
|
|
|
|
allprojects {
|
|
group = 'org.apache.fineract'
|
|
|
|
jgitver {
|
|
strategy 'PATTERN'
|
|
versionPattern '${M}.${m}.${p}-${meta.GIT_SHA1_8}'
|
|
// versionPattern '${v}'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
apply plugin: 'io.spring.dependency-management'
|
|
apply plugin: 'com.adarshr.test-logger'
|
|
apply plugin: 'com.diffplug.spotless'
|
|
apply plugin: 'com.github.hierynomus.license'
|
|
apply plugin: 'org.nosphere.apache.rat'
|
|
apply plugin: 'project-report'
|
|
apply plugin: 'com.github.jk1.dependency-license-report'
|
|
|
|
// Configuration for the dependency management plugin
|
|
// https://github.com/spring-gradle-plugins/dependency-management-plugin
|
|
dependencyManagement {
|
|
imports {
|
|
mavenBom 'org.springframework:spring-framework-bom:5.3.18'
|
|
mavenBom 'org.springframework.boot:spring-boot-dependencies:2.6.6'
|
|
mavenBom 'org.jetbrains.kotlin:kotlin-bom:1.6.20'
|
|
mavenBom 'org.junit:junit-bom:5.8.2'
|
|
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.2'
|
|
mavenBom 'io.cucumber:cucumber-bom:7.2.3'
|
|
mavenBom 'io.netty:netty-bom:4.1.75.Final'
|
|
mavenBom 'org.mockito:mockito-bom:4.4.0'
|
|
mavenBom 'io.github.swagger2markup:swagger2markup-bom:1.3.4'
|
|
}
|
|
|
|
dependencies {
|
|
// We use fixed versions, instead of inheriting them from the Spring BOM, to be able to be on more recent ones.
|
|
// We do not use :+ to get the latest available version available on Maven Central, as that could suddenly break things.
|
|
// We use the Renovate Bot to automatically propose Pull Requests (PRs) when upgrades for all of these versions are available.
|
|
|
|
dependency 'org.slf4j:slf4j-api:1.7.36'
|
|
dependency 'org.slf4j:slf4j-simple:1.7.36'
|
|
dependency 'org.slf4j:jcl-over-slf4j:1.7.36'
|
|
dependency 'org.slf4j:jul-to-slf4j:1.7.36'
|
|
dependency 'org.slf4j:log4j-over-slf4j:1.7.36'
|
|
dependency 'ch.qos.logback:logback-core:1.2.11'
|
|
dependency 'ch.qos.logback:logback-classic:1.2.11'
|
|
|
|
dependency 'org.eclipse.persistence:org.eclipse.persistence.jpa:2.7.10'
|
|
dependency 'com.google.guava:guava:31.1-jre'
|
|
dependency 'com.google.code.gson:gson:2.9.0'
|
|
dependency 'com.google.truth:truth:1.1.3'
|
|
dependency 'com.google.truth.extensions:truth-java8-extension:1.1.3'
|
|
dependency 'com.google.googlejavaformat:google-java-format:1.15.0'
|
|
dependency 'org.apache.commons:commons-email:1.5'
|
|
dependency 'commons-io:commons-io:2.11.0'
|
|
dependency 'com.github.librepdf:openpdf:1.3.27'
|
|
dependency 'org.mnode.ical4j:ical4j:3.2.1'
|
|
dependency 'org.quartz-scheduler:quartz:2.3.2'
|
|
dependency 'com.amazonaws:aws-java-sdk-s3:1.12.191'
|
|
dependency 'org.ehcache:ehcache:3.10.0'
|
|
dependency 'com.github.spullara.mustache.java:compiler:0.9.10'
|
|
dependency 'com.jayway.jsonpath:json-path:2.7.0'
|
|
dependency 'org.apache.tika:tika-core:2.3.0'
|
|
dependency 'org.apache.httpcomponents:httpclient:4.5.13'
|
|
dependency 'jakarta.management.j2ee:jakarta.management.j2ee-api:1.1.4'
|
|
dependency 'jakarta.jms:jakarta.jms-api:2.0.3'
|
|
dependency 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3' // Swagger needs exactly this version
|
|
dependency 'org.glassfish.jaxb:jaxb-runtime:2.3.6' // Swagger needs exactly this version
|
|
dependency 'org.apache.bval:org.apache.bval.bundle:2.0.5'
|
|
dependency 'joda-time:joda-time:2.10.14'
|
|
|
|
dependency 'io.github.classgraph:classgraph:4.8.143'
|
|
dependency 'org.awaitility:awaitility:4.2.0'
|
|
dependency 'com.github.spotbugs:spotbugs-annotations:4.6.0'
|
|
dependency 'javax.cache:cache-api:1.1.1'
|
|
dependency 'org.mock-server:mockserver-junit-jupiter:5.13.1'
|
|
dependency 'org.webjars.npm:swagger-ui-dist:4.10.3'
|
|
dependency 'org.webjars:webjars-locator-core:0.50'
|
|
dependency 'com.icegreen:greenmail-junit5:1.6.8'
|
|
dependency 'com.intuit.karate:karate-junit5:1.2.0.RC5'
|
|
|
|
// fineract client dependencies
|
|
dependency "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:retrofit-mock:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:adapter-java8:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:adapter-rxjava3:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:adapter-guava:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:converter-wire:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:converter-jackson:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:converter-simplexml:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:converter-jaxb:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:converter-java8:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:converter-gson:$retrofitVersion"
|
|
dependency "com.squareup.retrofit2:converter-protobuf:$retrofitVersion"
|
|
dependency "org.apache.oltu.oauth2:org.apache.oltu.oauth2.common:$oltuVersion"
|
|
dependency "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltuVersion"
|
|
dependency "org.apache.oltu.oauth2:org.apache.oltu.oauth2.httpclient4:$oltuVersion"
|
|
dependency "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
|
dependency "com.squareup.okhttp3:okcurl:$okhttpVersion"
|
|
dependency "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
|
|
dependency "com.squareup.okhttp3:okhttp-apache:$okhttpVersion"
|
|
dependency "com.squareup.okhttp3:okhttp-android-support:$okhttpVersion"
|
|
dependency "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
|
|
dependency "com.squareup.okhttp3:okhttp-sse:$okhttpVersion"
|
|
dependency "io.gsonfire:gson-fire:1.8.5"
|
|
dependency "io.swagger:swagger-core:1.6.5"
|
|
dependency "io.swagger:swagger-annotations:1.6.5"
|
|
dependency "jakarta.annotation:jakarta.annotation-api:1.3.5"
|
|
dependency "com.google.code.findbugs:jsr305:3.0.2"
|
|
dependency "commons-codec:commons-codec:1.15"
|
|
dependency "org.bouncycastle:bcpkix-jdk15to18:1.70"
|
|
dependency "org.bouncycastle:bcprov-jdk15to18:1.70"
|
|
|
|
|
|
dependency ('org.apache.activemq:activemq-broker:5.17.0') {
|
|
exclude 'javax.annotation:javax.annotation-api'
|
|
}
|
|
|
|
dependency 'io.swagger.core.v3:swagger-annotations:2.1.13'
|
|
dependency ('io.swagger.core.v3:swagger-jaxrs2:2.1.13') {
|
|
exclude 'jakarta.activation:jakarta.activation-api'
|
|
}
|
|
|
|
dependency ('org.liquibase:liquibase-core:4.9.1') {
|
|
exclude 'javax.xml.bind:jaxb-api'
|
|
}
|
|
|
|
dependency ('org.dom4j:dom4j:2.1.3') {
|
|
exclude 'relaxngDatatype:relaxngDatatype' // already in com.sun.xml.bind:jaxb-osgi:2.3.0.1
|
|
// FINERACT-940 && FINERACT-966 https://github.com/spotbugs/spotbugs/issues/1128
|
|
exclude 'xpp3:xpp3'
|
|
exclude 'pull-parser:pull-parser'
|
|
}
|
|
|
|
dependencySet(group: 'org.apache.poi', version: '5.2.2') {
|
|
entry 'poi'
|
|
entry 'poi-ooxml'
|
|
entry 'poi-ooxml-schemas'
|
|
}
|
|
|
|
dependencySet(group: 'io.rest-assured', version: '4.5.1') {
|
|
entry 'rest-assured'
|
|
entry 'json-path'
|
|
entry 'xml-path'
|
|
}
|
|
}
|
|
}
|
|
|
|
// Configuration for the sonarqube plugin
|
|
// https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-gradle/
|
|
sonarqube {
|
|
properties {
|
|
property "sonar.projectKey", "apache_fineract"
|
|
}
|
|
}
|
|
|
|
// Configuration for the spotless plugin
|
|
// https://github.com/diffplug/spotless/tree/main/plugin-gradle
|
|
spotless {
|
|
format 'misc', {
|
|
target '**/*.md', '**/*.properties', '**/.gitignore', '**/.openapi-generator-ignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql'
|
|
targetExclude '**/build/**', '**/bin/**', '**/.settings/**', '**/.idea/**', '**/.gradle/**', '**/gradlew.bat', '**/licenses/**', '**/banner.txt'
|
|
indentWithSpaces(4)
|
|
endWithNewline()
|
|
trimTrailingWhitespace()
|
|
}
|
|
|
|
groovyGradle {
|
|
target '*.gradle', '**/*.gradle'
|
|
targetExclude '**/build/**'
|
|
greclipse()
|
|
indentWithSpaces(4)
|
|
endWithNewline()
|
|
trimTrailingWhitespace()
|
|
}
|
|
|
|
lineEndings 'UNIX'
|
|
}
|
|
|
|
// Configuration for Gradle license plug-in
|
|
// https://github.com/hierynomus/license-gradle-plugin
|
|
license {
|
|
header rootProject.file("$rootDir/APACHE_LICENSETEXT.md")
|
|
excludes([
|
|
"**/gradlew*",
|
|
"**/git.properties",
|
|
"**/*.html",
|
|
"**/templates/**",
|
|
"**/features/**",
|
|
"**/results/**",
|
|
"**/package-info.java",
|
|
"**/keystore.jks",
|
|
"**/static/swagger-ui/**",
|
|
"**/api-docs/**",
|
|
"**/banner.txt",
|
|
"**/build.gradle.mustache",
|
|
"**/pom.mustache",
|
|
])
|
|
strictCheck true
|
|
}
|
|
|
|
task licenseFormatBuildScripts (type:nl.javadude.gradle.plugins.license.License) {
|
|
source = fileTree(dir: "$rootDir/", includes: [
|
|
'**/*.bat',
|
|
'**/*.sh',
|
|
'**/*.sql'
|
|
], excludes: [
|
|
'**/gradlew*'
|
|
])
|
|
}
|
|
|
|
licenseFormat.dependsOn licenseFormatBuildScripts
|
|
|
|
licenseReport {
|
|
outputDir = "$projectDir/licenses"
|
|
}
|
|
|
|
// Configuration for Apache Release Audit Tool task
|
|
// https://github.com/eskatos/creadur-rat-gradle
|
|
rat {
|
|
verbose = false
|
|
reportDir = file("$buildDir/reports/rat")
|
|
excludes = [
|
|
'**/src/main/templates/**/*.mustache',
|
|
'**/.dockerignore',
|
|
'**/*.launch',
|
|
'**/licenses/**',
|
|
'**/*.md',
|
|
'**/*.adoc',
|
|
'**/.asciidoctorconfig',
|
|
'**/*.puml',
|
|
'**/*.github/**',
|
|
'**/MANIFEST.MF',
|
|
'**/spring.factories',
|
|
'**/*.json',
|
|
'**/*.json.template',
|
|
'**/*.txt',
|
|
'**/*.log',
|
|
'**/fineractdev-eclipse-preferences.epf',
|
|
'**/features/**',
|
|
'**/templates/**',
|
|
'**/results/**',
|
|
'**/.classpath',
|
|
'**/.project',
|
|
'**/.idea/**',
|
|
'**/*.ipr',
|
|
'**/*.iws',
|
|
'**/.settings/**',
|
|
'**/bin/**',
|
|
'**/.git/**',
|
|
'**/.gitignore',
|
|
'**/.openapi-generator-ignore',
|
|
'**/.gitkeep',
|
|
'**/*.iml',
|
|
'**/config/swagger/templates/**',
|
|
// Notice files
|
|
'**/NOTICE_RELEASE',
|
|
'**/NOTICE_SOURCE',
|
|
// Swagger License
|
|
'**/src/main/resources/static/swagger-ui/**',
|
|
// gradle
|
|
'**/.gradle/**',
|
|
'**/gradlew',
|
|
'**/gradlew.bat',
|
|
'**/gradle/wrapper/gradle-wrapper.properties',
|
|
'**/caches/**',
|
|
'**/daemon/**',
|
|
'**/native/**',
|
|
'**/wrapper/**',
|
|
'**/build/**',
|
|
// Api Docs
|
|
'**/api-docs/*.*',
|
|
'**/docs/system-architecture/.htaccess',
|
|
'**/docs/system-architecture/404.html',
|
|
'**/docs/system-architecture/index.html',
|
|
'**/docs/system-architecture/**/*.xml',
|
|
'**/bootstrap-3.0.0/assets/application.js',
|
|
'**/system-architecture/js/plugins.js',
|
|
// Apache License
|
|
'**/bootstrap-3.0.0/assets/less.js',
|
|
'**/css/bootstrap-3.0.0/**/*.*',
|
|
// Public Domain See http://www.JSON.org/js.html
|
|
'**/bootstrap-3.0.0/assets/json2.js.htm',
|
|
// MIT License
|
|
'**/modernizr-2.6.2.min.js',
|
|
'**/css/normalize.css',
|
|
'**/assets/filesaver.js',
|
|
'**/css/fonts/glyphicons-halflings-regular.svg',
|
|
'**/assets/jszip.js',
|
|
'**/assets/jquery.js',
|
|
'**/api-docs/jquery-1.7.min.js',
|
|
'**/css/toc-0.1.2/**/*.*',
|
|
'**/docs/system-architecture/css/main.css',
|
|
'**/system-architecture/js/vendor/jquery-1.9.1.min.js',
|
|
'**/system-architecture/js/vendor/toc-0.1.2/jquery.toc.min.js',
|
|
'**/assets/respond.min.js',
|
|
'**/assets/html5shiv.js',
|
|
// BSD License
|
|
'**/assets/uglify.js',
|
|
// Ignore out folder
|
|
'**/out/**',
|
|
// Git build info
|
|
"**/git.properties",
|
|
".mailmap",
|
|
]
|
|
}
|
|
}
|
|
|
|
configure(project.fineractJavaProjects) {
|
|
// NOTE: order matters!
|
|
|
|
apply plugin: 'java'
|
|
apply plugin: 'idea'
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'checkstyle'
|
|
apply plugin: 'jacoco'
|
|
apply plugin: 'net.ltgt.errorprone'
|
|
apply plugin: 'com.github.spotbugs'
|
|
apply plugin: 'com.github.andygoossens.modernizer'
|
|
apply plugin: 'se.thinkcode.cucumber-runner'
|
|
|
|
/* define the valid syntax level for source files */
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
/* define binary compatibility version */
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
|
|
/* http://stackoverflow.com/questions/19653311/jpa-repository-works-in-idea-and-production-but-not-in-gradle */
|
|
sourceSets.main.output.resourcesDir = sourceSets.main.java.outputDir
|
|
sourceSets.test.output.resourcesDir = sourceSets.test.java.outputDir
|
|
|
|
configurations {
|
|
implementation.setCanBeResolved(true)
|
|
api.setCanBeResolved(true)
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs += [
|
|
"-Xlint:unchecked",
|
|
"-Xlint:cast",
|
|
"-Xlint:auxiliaryclass",
|
|
"-Xlint:deprecation",
|
|
"-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")
|
|
|
|
options.deprecation = true
|
|
}
|
|
|
|
dependencies {
|
|
spotbugsPlugins 'jp.skypencil.findbugs.slf4j:bug-pattern:1.5.0@jar'
|
|
}
|
|
|
|
// Configuration for the spotless plugin
|
|
// https://github.com/diffplug/spotless/tree/main/plugin-gradle
|
|
spotless {
|
|
java {
|
|
targetExclude '**/build/**', '**/bin/**', '**/out/**'
|
|
importOrder() //sort imports alphabetically
|
|
removeUnusedImports()
|
|
eclipse().configFile "$rootDir/config/fineractdev-formatter.xml"
|
|
endWithNewline()
|
|
trimTrailingWhitespace()
|
|
|
|
// Enforce style modifier order
|
|
custom 'Modifier ordering', {
|
|
def modifierRanking = [
|
|
public : 1,
|
|
protected : 2,
|
|
private : 3,
|
|
abstract : 4,
|
|
default : 5,
|
|
static : 6,
|
|
final : 7,
|
|
transient : 8,
|
|
volatile : 9,
|
|
synchronized: 10,
|
|
native : 11,
|
|
strictfp : 12]
|
|
// Find any instance of multiple modifiers. Lead with a non-word character to avoid
|
|
// accidental matching against for instance, "an alternative default value"
|
|
it.replaceAll(/\W(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
|
|
// Do not replace the leading non-word character. Identify the modifiers
|
|
it.replaceAll(/(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
|
|
// Sort the modifiers according to the ranking above
|
|
it.split().sort({ modifierRanking[it] }).join(' ') + ' '
|
|
}
|
|
)
|
|
}
|
|
)
|
|
}
|
|
}
|
|
|
|
lineEndings 'UNIX'
|
|
}
|
|
|
|
// compileJava may create more source files into generated, hence we need to run these tasks after it
|
|
licenseMain.dependsOn compileJava
|
|
processResources.dependsOn compileJava
|
|
|
|
// If we are running Gradle within Eclipse to enhance classes,
|
|
// set the classes directory to point to Eclipse's default build directory
|
|
if (project.hasProperty('env') && project.getProperty('env') == 'eclipse') {
|
|
sourceSets.main.java.outputDir = file("$projectDir/bin/main")
|
|
}
|
|
|
|
// Configuration for the Checkstyle plugin
|
|
// https://docs.gradle.org/current/userguide/checkstyle_plugin.html
|
|
dependencies {
|
|
checkstyle 'com.puppycrawl.tools:checkstyle:10.1'
|
|
checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.41.0'
|
|
}
|
|
|
|
// Configuration for JaCoCo code coverage task
|
|
// https://www.eclemma.org/jacoco/
|
|
jacoco {
|
|
toolVersion = jacocoVersion
|
|
reportsDir = file("$buildDir/reports/jacoco")
|
|
}
|
|
|
|
jacocoTestReport {
|
|
reports {
|
|
html.enabled=true
|
|
xml.enabled=true
|
|
html.destination file("${buildDir}/code-coverage")
|
|
}
|
|
}
|
|
|
|
// Configuration for the errorprone plugin
|
|
// https://github.com/tbroyer/gradle-errorprone-plugin
|
|
dependencies {
|
|
errorprone "com.google.errorprone:error_prone_core:2.11.0"
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.errorprone {
|
|
disableWarningsInGeneratedCode = true
|
|
excludedPaths = ".*/build/.*"
|
|
disable(
|
|
// TODO Remove disabled checks from this list, by fixing remaining usages
|
|
"UnusedVariable",
|
|
"TypeParameterUnusedInFormals",
|
|
"EmptyBlockTag",
|
|
"MissingSummary",
|
|
"InvalidParam",
|
|
"ReturnFromVoid",
|
|
"AlmostJavadoc",
|
|
"InvalidBlockTag",
|
|
"JavaUtilDate", // TODO FINERACT-1298
|
|
"ReturnValueIgnored"
|
|
)
|
|
error(
|
|
"DefaultCharset",
|
|
"RemoveUnusedImports",
|
|
"WaitNotInLoop",
|
|
"ThreeLetterTimeZoneID",
|
|
"VariableNameSameAsType",
|
|
"UnnecessaryParentheses",
|
|
"MultipleTopLevelClasses",
|
|
"MixedMutabilityReturnType",
|
|
"MultiVariableDeclaration",
|
|
"AssertEqualsArgumentOrderChecker",
|
|
"EmptySetMultibindingContributions",
|
|
"BigDecimalEquals",
|
|
"MixedArrayDimensions",
|
|
"PackageLocation",
|
|
"UseBinds",
|
|
"BadImport",
|
|
"IntLongMath",
|
|
"FloatCast",
|
|
"ReachabilityFenceUsage",
|
|
"StreamResourceLeak",
|
|
"TruthIncompatibleType",
|
|
"ByteBufferBackingArray",
|
|
"SameNameButDifferent",
|
|
"OrphanedFormatString",
|
|
"CatchAndPrintStackTrace",
|
|
"ObjectToString",
|
|
"StringSplitter",
|
|
"AssertThrowsMultipleStatements",
|
|
"BoxedPrimitiveConstructor",
|
|
"EmptyCatch",
|
|
"BoxedPrimitiveEquality",
|
|
"SynchronizeOnNonFinalField",
|
|
"WildcardImport",
|
|
"FutureReturnValueIgnored",
|
|
"PrivateConstructorForNoninstantiableModule",
|
|
"ClassCanBeStatic",
|
|
"ClassNewInstance",
|
|
"UnnecessaryStaticImport",
|
|
"UnsafeFinalization",
|
|
"JavaTimeDefaultTimeZone",
|
|
"JodaPlusMinusLong",
|
|
"SwitchDefault",
|
|
"VarTypeName",
|
|
"ArgumentSelectionDefectChecker",
|
|
"CompareToZero",
|
|
"InjectOnConstructorOfAbstractClass",
|
|
"ImmutableEnumChecker",
|
|
"NarrowingCompoundAssignment",
|
|
"MissingCasesInEnumSwitch",
|
|
"ReferenceEquality",
|
|
"UndefinedEquals",
|
|
"PublicConstructorForAbstractClass",
|
|
"UnescapedEntity",
|
|
"ModifyCollectionInEnhancedForLoop",
|
|
"NonCanonicalType",
|
|
"InvalidInlineTag",
|
|
"MutablePublicArray",
|
|
"StaticAssignmentInConstructor",
|
|
"ProtectedMembersInFinalClass",
|
|
"OperatorPrecedence",
|
|
"EqualsGetClass",
|
|
"EqualsUnsafeCast",
|
|
"DoubleBraceInitialization",
|
|
"UnnecessaryDefaultInEnumSwitch",
|
|
"UnusedNestedClass",
|
|
"UnusedMethod",
|
|
"ModifiedButNotUsed",
|
|
"InconsistentCapitalization",
|
|
"MissingOverride",
|
|
// TODO enable these remaining checks (one by one)
|
|
// "InvalidBlockTag",
|
|
// "InconsistentOverloads",
|
|
// "MethodCanBeStatic",
|
|
// "Var",
|
|
// "ConstantField",
|
|
// "UnnecessaryDefaultInEnumSwitch",
|
|
// "FieldCanBeFinal"
|
|
)
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation (
|
|
'ch.qos.logback:logback-core',
|
|
'org.slf4j:slf4j-api',
|
|
'org.slf4j:log4j-over-slf4j',
|
|
'org.slf4j:jul-to-slf4j',
|
|
)
|
|
implementation ("ch.qos.logback:logback-classic") {
|
|
exclude(module: "slf4j-api")
|
|
}
|
|
|
|
testImplementation( 'org.mockito:mockito-core',
|
|
'org.mockito:mockito-junit-jupiter',
|
|
'org.junit.jupiter:junit-jupiter-api',
|
|
'org.junit.jupiter:junit-jupiter-engine',
|
|
'org.junit.platform:junit-platform-runner', // required to be able to run tests directly under Eclipse, see FINERACT-943 & FINERACT-1021
|
|
'org.bouncycastle:bcpkix-jdk15to18',
|
|
'org.bouncycastle:bcprov-jdk15to18',
|
|
'org.awaitility:awaitility',
|
|
'com.google.truth:truth',
|
|
'com.google.truth.extensions:truth-java8-extension',
|
|
'io.cucumber:cucumber-core',
|
|
'io.cucumber:cucumber-java',
|
|
'io.cucumber:cucumber-java8',
|
|
'io.cucumber:cucumber-junit-platform-engine',
|
|
)
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
dependsOn 'cucumber'
|
|
|
|
if (project.hasProperty('excludeTests')) {
|
|
filter {
|
|
excludeTestsMatching project.property('excludeTests')
|
|
}
|
|
}
|
|
}
|
|
|
|
testlogger {
|
|
logLevel 'quiet'
|
|
}
|
|
|
|
cucumber {
|
|
tags = 'not @ignore'
|
|
main = 'io.cucumber.core.cli.Main'
|
|
shorten = 'argfile'
|
|
}
|
|
|
|
// Configuration for spotbugs plugin
|
|
// https://github.com/spotbugs/spotbugs-gradle-plugin
|
|
|
|
// To generate an HTML report instead of XML
|
|
spotbugs {
|
|
reportLevel = 'high'
|
|
showProgress = false
|
|
excludeFilter = file("$rootDir/config/spotbugs/exclude.xml")
|
|
}
|
|
// https://github.com/spotbugs/spotbugs-gradle-plugin/issues/242
|
|
spotbugsMain {
|
|
reports {
|
|
html {
|
|
enabled = true
|
|
stylesheet = 'fancy-hist.xsl'
|
|
}
|
|
}
|
|
}
|
|
spotbugsTest {
|
|
reports {
|
|
html {
|
|
enabled = true
|
|
stylesheet = 'fancy-hist.xsl'
|
|
}
|
|
}
|
|
}
|
|
|
|
// Configuration for https://github.com/andygoossens/gradle-modernizer-plugin
|
|
modernizer {
|
|
includeTestClasses = true
|
|
failOnViolations = true
|
|
violationLogLevel="error"
|
|
javaVersion = project.targetCompatibility
|
|
ignoreGeneratedClasses = true
|
|
}
|
|
}
|
|
|
|
configure(project.fineractPublishProjects) {
|
|
apply plugin: 'maven-publish'
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
from components.java
|
|
|
|
versionMapping {
|
|
usage('java-api') {
|
|
fromResolutionOf('runtimeClasspath')
|
|
}
|
|
usage('java-runtime') {
|
|
fromResolutionResult()
|
|
}
|
|
}
|
|
|
|
pom {
|
|
name = 'Fineract'
|
|
description = 'A secure, multi-tenanted microfinance platform'
|
|
url = 'https://fineract.apache.org'
|
|
licenses {
|
|
license {
|
|
name = 'The Apache License, Version 2.0'
|
|
url = 'http://www.apache.org/licenses/LICENSE-2.0.html'
|
|
}
|
|
}
|
|
scm {
|
|
connection = 'scm:git:https://github.com/apache/fineract.git'
|
|
developerConnection = 'scm:git:git://github.com:apache/fineract.git'
|
|
url = 'https://fineract.apache.org/'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// TODO FINERACT-1102: Actually use this to deploy to ASF (Apache Software Foundation) Nexus Maven Repository
|
|
}
|
|
}
|
|
|
|
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"
|
|
}
|
|
println ""
|
|
}
|
|
}
|
|
}
|