You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by aw...@apache.org on 2020/07/04 10:25:34 UTC
[fineract] branch develop updated: FINERACT-1072: Implementing
Spotless for Gradle files
This is an automated email from the ASF dual-hosted git repository.
awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 3f444e2 FINERACT-1072: Implementing Spotless for Gradle files
3f444e2 is described below
commit 3f444e2710c7fbdacf71c7f3dd5273602ed866ca
Author: Petri Tuomola <pe...@tuomola.org>
AuthorDate: Sat Jul 4 07:25:51 2020 +0300
FINERACT-1072: Implementing Spotless for Gradle files
---
fineract-provider/build.gradle | 233 ++++++++++++++++++++--------------
fineract-provider/dependencies.gradle | 18 +--
2 files changed, 146 insertions(+), 105 deletions(-)
diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle
index 9c5dfaa..e21ae81 100644
--- a/fineract-provider/build.gradle
+++ b/fineract-provider/build.gradle
@@ -37,9 +37,9 @@ buildscript {
dependencies {
classpath 'io.spring.gradle:dependency-management-plugin:1.0.9.RELEASE'
classpath 'com.bmuschko:gradle-cargo-plugin:2.7.1',
- 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0',
- 'org.zeroturnaround:gradle-jrebel-plugin:1.1.10',
- 'org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE'
+ 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0',
+ 'org.zeroturnaround:gradle-jrebel-plugin:1.1.10',
+ 'org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE'
// below
classpath 'org.apache.openjpa:openjpa:3.1.1' // when upgrading, also change OpenJPA version repeated below in dependencyManagement!
classpath 'com.radcortez.gradle:openjpa-gradle-plugin:3.1.0'
@@ -184,7 +184,10 @@ eclipse
System.setProperty("openjpa.Log", "commons")
openjpa {
- includes = ['**/AbstractPersistableCustom.class', '**/domain/*.class']
+ includes = [
+ '**/AbstractPersistableCustom.class',
+ '**/domain/*.class'
+ ]
enhance {
enforcePropertyRestrictions true
}
@@ -218,24 +221,32 @@ jacocoTestReport{
}
spotless {
- format 'misc', {
- target '**/*.md', '**/*.properties', '**/*.gradle', '**/.gitignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql'
- targetExclude '**/build/**', '**/bin/**', '**/.settings/**','**/.idea/**'
- indentWithSpaces(4)
- endWithNewline()
- trimTrailingWhitespace()
- }
-
- java {
- importOrder() //sort imports alphabetically
- removeUnusedImports()
- eclipse().configFile '../config/fineractdev-formatter.xml'
- endWithNewline()
- trimTrailingWhitespace()
-
- // Enforce style modifier order
- custom 'Modifier ordering', {
- def modifierRanking = [
+ format 'misc', {
+ target '**/*.md', '**/*.properties', '**/.gitignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql'
+ targetExclude '**/build/**', '**/bin/**', '**/.settings/**','**/.idea/**'
+ indentWithSpaces(4)
+ endWithNewline()
+ trimTrailingWhitespace()
+ }
+
+ groovyGradle {
+ target '*.gradle', '**/*.gradle'
+ greclipse()
+ indentWithSpaces(4)
+ endWithNewline()
+ trimTrailingWhitespace()
+ }
+
+ java {
+ importOrder() //sort imports alphabetically
+ removeUnusedImports()
+ eclipse().configFile '../config/fineractdev-formatter.xml'
+ endWithNewline()
+ trimTrailingWhitespace()
+
+ // Enforce style modifier order
+ custom 'Modifier ordering', {
+ def modifierRanking = [
public : 1,
protected : 2,
private : 3,
@@ -248,20 +259,20 @@ spotless {
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(' ') + ' '
- }
- )
+ // 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'
}
@@ -309,7 +320,6 @@ rat {
'**/native/**',
'**/wrapper/**',
'**/build/**',
-
//Api Docs
'**/api-docs/*.*',
'**/docs/system-architecture/.htaccess',
@@ -318,14 +328,11 @@ rat {
'**/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',
@@ -340,12 +347,10 @@ rat {
'**/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",
]
@@ -374,13 +379,34 @@ configurations {
}
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"]
- // TODO FINERACT-959 (gradually) enable -Xlint:all (see "javac -help -X")
+ 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"
+ ]
+ // TODO FINERACT-959 (gradually) enable -Xlint:all (see "javac -help -X")
options.deprecation = true
options.errorprone {
@@ -396,7 +422,7 @@ tasks.withType(JavaCompile) {
"ReturnFromVoid",
"AlmostJavadoc",
"InvalidBlockTag",
- )
+ )
//TODO gradually enable these checks
error(
"DefaultCharset",
@@ -468,28 +494,33 @@ tasks.withType(JavaCompile) {
"ModifiedButNotUsed",
"InconsistentCapitalization",
"MissingOverride",
-// "InvalidBlockTag",
-// "InconsistentOverloads",
-// "MethodCanBeStatic",
-// "Var",
-// "ConstantField",
-// "UnnecessaryDefaultInEnumSwitch",
-// "FieldCanBeFinal"
- )
+ // "InvalidBlockTag",
+ // "InconsistentOverloads",
+ // "MethodCanBeStatic",
+ // "Var",
+ // "ConstantField",
+ // "UnnecessaryDefaultInEnumSwitch",
+ // "FieldCanBeFinal"
+ )
}
- options.compilerArgs +=["-Xmaxwarns",1500,"-Xmaxerrs",1500]
+ options.compilerArgs +=[
+ "-Xmaxwarns",
+ 1500,
+ "-Xmaxerrs",
+ 1500
+ ]
}
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'
-}
-*/
+ // 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 */
if (project.hasProperty('security') && project.getProperty('security') == 'oauth') {
@@ -539,7 +570,7 @@ modernizer {
exclusions = []
exclusionPatterns = [
- // To be removed when https://issues.apache.org/jira/browse/FINERACT-826 is fixed
+ // To be removed when https://issues.apache.org/jira/browse/FINERACT-826 is fixed
'org/joda/time/.*'
]
}
@@ -550,25 +581,29 @@ compileJava{
finalizedBy resolve
}
/*
-pmd {
- sourceSets = [sourceSets.main]
-}
-*/
+ pmd {
+ sourceSets = [sourceSets.main]
+ }
+ */
war {
- from('../licenses/binary/') { // notice the parens
+ from('../licenses/binary/') {
+ // notice the parens
into "WEB-INF/licenses/binary/" // no leading slash
}
- from('../LICENSE_RELEASE') { // notice the parens
+ from('../LICENSE_RELEASE') {
+ // notice the parens
into "WEB-INF/" // no leading slash
}
- from('../NOTICE_RELEASE') { // notice the parens
+ from('../NOTICE_RELEASE') {
+ // notice the parens
into "WEB-INF/" // no leading slash
}
rename ('LICENSE_RELEASE', 'LICENSE')
rename ('NOTICE_RELEASE', 'NOTICE')
- from('../DISCLAIMER') { // notice the parens
+ from('../DISCLAIMER') {
+ // notice the parens
into "WEB-INF/" // no leading slash
}
war.finalizedBy(bootWar)
@@ -589,42 +624,46 @@ license {
}
task licenseFormatBuildScripts (type:nl.javadude.gradle.plugins.license.License) {
- source = fileTree(dir: '../', includes: ['**/*.bat', '**/*.sh', '**/*.sql'])
+ source = fileTree(dir: '../', includes: [
+ '**/*.bat',
+ '**/*.sh',
+ '**/*.sql'
+ ])
}
licenseFormat.dependsOn licenseFormatBuildScripts
configurations
{
- tomcat
+ tomcat
}
dependencies {
- tomcat "org.apache.tomcat:tomcat:9.0.36@zip"
+ tomcat "org.apache.tomcat:tomcat:9.0.36@zip"
}
dependencies {
errorprone "com.google.errorprone:error_prone_core:2.4.0"
}
cargo {
- containerId "tomcat9x"
+ containerId "tomcat9x"
- local {
- installer {
- installConfiguration = configurations.tomcat
- downloadDir = file("$buildDir/download")
- extractDir = file("$buildDir/tomcat")
- }
- startStopTimeout = 240000
- containerProperties {
- property 'cargo.tomcat.connector.keystoreFile', file('src/main/resources/keystore.jks')
- property 'cargo.tomcat.connector.keystorePass', 'openmf'
- property 'cargo.tomcat.httpSecure', true
- property 'cargo.tomcat.connector.sslProtocol', 'TLS'
- property 'cargo.tomcat.connector.clientAuth', false
- property 'cargo.protocol', 'https'
- property 'cargo.servlet.port', 8443
+ local {
+ installer {
+ installConfiguration = configurations.tomcat
+ downloadDir = file("$buildDir/download")
+ extractDir = file("$buildDir/tomcat")
+ }
+ startStopTimeout = 240000
+ containerProperties {
+ property 'cargo.tomcat.connector.keystoreFile', file('src/main/resources/keystore.jks')
+ property 'cargo.tomcat.connector.keystorePass', 'openmf'
+ property 'cargo.tomcat.httpSecure', true
+ property 'cargo.tomcat.connector.sslProtocol', 'TLS'
+ property 'cargo.tomcat.connector.clientAuth', false
+ property 'cargo.protocol', 'https'
+ property 'cargo.servlet.port', 8443
+ }
}
- }
}
cargoRunLocal.dependsOn bootWar
@@ -655,7 +694,7 @@ if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) {
}
sourceSets {
- integrationTest {
+ integrationTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
@@ -677,7 +716,8 @@ task integrationTest(type:Test) {
integrationTest {
useJUnitPlatform()
- testLogging { // FINERACT-927
+ testLogging {
+ // FINERACT-927
events "skipped", "failed"
showStandardStreams = false
exceptionFormat "full"
@@ -685,7 +725,8 @@ integrationTest {
}
test {
useJUnitPlatform()
- testLogging { // FINERACT-927
+ testLogging {
+ // FINERACT-927
events "skipped", "failed"
showStandardStreams = false
exceptionFormat "full"
diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle
index c8b8d0c..700d5a1 100644
--- a/fineract-provider/dependencies.gradle
+++ b/fineract-provider/dependencies.gradle
@@ -71,16 +71,16 @@ dependencies {
'com.github.spullara.mustache.java:compiler',
'com.jayway.jsonpath:json-path',
- // JAX-B dependencies for JDK 9+
- 'jakarta.xml.bind:jakarta.xml.bind-api',
+ // JAX-B dependencies for JDK 9+
+ 'jakarta.xml.bind:jakarta.xml.bind-api',
- 'org.dom4j:dom4j',
+ 'org.dom4j:dom4j',
- 'javax.cache:cache-api',
+ 'javax.cache:cache-api',
- 'com.github.spotbugs:spotbugs-annotations',
- 'io.swagger.core.v3:swagger-annotations'
- )
+ 'com.github.spotbugs:spotbugs-annotations',
+ 'io.swagger.core.v3:swagger-annotations'
+ )
implementation ('org.apache.activemq:activemq-broker') {
exclude group: 'org.apache.geronimo.specs'
}
@@ -114,7 +114,7 @@ dependencies {
// Although fineract (at the time of writing) doesn't have any compile time dep. on httpclient,
// it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility
'org.apache.httpcomponents:httpclient',
- )
+ )
// testCompile dependencies are ONLY used in src/test and/or src/integrationTest, not src/main.
// Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly!
@@ -124,7 +124,7 @@ dependencies {
'org.junit.platform:junit-platform-runner', // required to be able to run tests directly under Eclipse, see FINERACT-943 & FINERACT-1021
'io.github.classgraph:classgraph',
'org.awaitility:awaitility'
- )
+ )
testImplementation('org.mock-server:mockserver-junit-jupiter') {
exclude group: 'com.sun.mail', module: 'mailapi'
exclude group: 'javax.servlet', module: 'javax.servlet-api'