FINERACT-1188: README and other files are not covered by Spotless

This commit is contained in:
Aleksandar Vidakovic
2020-10-14 10:29:05 +03:00
committed by Petri Tuomola
parent 8c342a7d88
commit 5520bb3c2d
7 changed files with 133 additions and 133 deletions
+1 -1
View File
@@ -72,6 +72,6 @@ script:
# using "&&" instead of several "-" means that integrationTest does not run if test fails, # using "&&" instead of several "-" means that integrationTest does not run if test fails,
# and Docker test does not run if integration test fails, which makes PR failure easier to understand. # and Docker test does not run if integration test fails, which makes PR failure easier to understand.
# @see https://docs.travis-ci.com/user/job-lifecycle/#customizing-the-build-phase # @see https://docs.travis-ci.com/user/job-lifecycle/#customizing-the-build-phase
- ./gradlew --console=plain -PautomatedBuild=true licenseMain licenseTest licenseIntegrationTest check && ./gradlew --console=plain -PautomatedBuild=true integrationTest --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 60s && curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health && (( $(curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 )) && ./gradlew generateSwaggerCode && cd build/swagger-code-fineract && mvn test - ./gradlew --console=plain -PautomatedBuild=true licenseMain licenseTest licenseIntegrationTest check && ./gradlew --console=plain -PautomatedBuild=true integrationTest --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 60s && curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health && (( $(curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 )) && ./gradlew generateSwaggerCode && cd fineract-provider/build/swagger-code-fineract && mvn test
# We stop the mysql system service when running the Docker test to avoid port 3306 conflicts (unless we run the mysql in docker-compose on another port; req. FINERACT-773) # We stop the mysql system service when running the Docker test to avoid port 3306 conflicts (unless we run the mysql in docker-compose on another port; req. FINERACT-773)
# The fancy /actuator/info test makes sure that has more than 100 characters of JSON to test that the git.properties worked (see FINERACT-983) # The fancy /actuator/info test makes sure that has more than 100 characters of JSON to test that the git.properties worked (see FINERACT-983)
+1 -1
View File
@@ -25,7 +25,7 @@ WORKDIR /fineract
RUN ./gradlew -PautomatedBuild=true --no-daemon -q -x rat -x test bootJar RUN ./gradlew -PautomatedBuild=true --no-daemon -q -x rat -x test bootJar
WORKDIR /fineract/target WORKDIR /fineract/target
RUN jar -xf /fineract/build/libs/fineract-provider*.jar RUN jar -xf /fineract/fineract-provider/build/libs/fineract-provider*.jar
# https://issues.apache.org/jira/browse/LEGAL-462 # https://issues.apache.org/jira/browse/LEGAL-462
# https://issues.apache.org/jira/browse/FINERACT-762 # https://issues.apache.org/jira/browse/FINERACT-762
+2 -5
View File
@@ -83,13 +83,10 @@ Instructions to run and debug in Eclipse IDE
It is possible to run Fineract in Eclipse IDE and also to debug Fineract using Eclipse's debugging facilities. It is possible to run Fineract in Eclipse IDE and also to debug Fineract using Eclipse's debugging facilities.
To do this, you need to create the Eclipse project files and import the project into an Eclipse workspace: To do this, you need to create the Eclipse project files and import the project into an Eclipse workspace:
1. Create Eclipse project files into the Fineract project by running `./gradlew cleanEclipse eclipse` 1. Import the fineract-provider project into your Eclipse workspace (File->Import->Gradle->Existing Gradle Project into Workspace, choose root directory fineract/fineract-provider)
2. Import the fineract-provider project into your Eclipse workspace (File->Import->General->Existing Projects into Workspace, choose root directory fineract/fineract-provider) 2. Do a clean build of the project in Eclipse (Project->Clean...)
3. Do a clean build of the project in Eclipse (Project->Clean...)
3. Run / debug Fineract by right clicking on org.apache.fineract.ServerApplication class and choosing Run As / Debug As -> Java Application. All normal Eclipse debugging features (breakpoints, watchpoints etc) should work as expected. 3. Run / debug Fineract by right clicking on org.apache.fineract.ServerApplication class and choosing Run As / Debug As -> Java Application. All normal Eclipse debugging features (breakpoints, watchpoints etc) should work as expected.
If you change the project settings (dependencies etc) in Gradle, you should redo step 1 and refresh the project in Eclipse.
You can also use Eclipse Junit support to run tests in Eclipse (Run As->Junit Test) You can also use Eclipse Junit support to run tests in Eclipse (Run As->Junit Test)
Finally, modifying source code in Eclipse automatically triggers hot code replace to a running instance, allowing you to immediately test your changes Finally, modifying source code in Eclipse automatically triggers hot code replace to a running instance, allowing you to immediately test your changes
+112
View File
@@ -16,8 +16,120 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
// TODO: this is work in progress, please follow FINERACT-1171
buildscript { buildscript {
ext {
jacocoVersion = '0.8.5'
}
repositories {
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.bmuschko:gradle-cargo-plugin:2.7.1'
classpath 'org.zeroturnaround:gradle-jrebel-plugin:1.1.10'
classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.3.4.RELEASE'
classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.15.0'
classpath 'org.apache.openjpa:openjpa:3.1.2' // when upgrading, also change OpenJPA version repeated in fineract-provider/build.gradle!
classpath 'com.radcortez.gradle:openjpa-gradle-plugin:3.1.0'
classpath 'org.nosphere.apache:creadur-rat-gradle:0.7.0'
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.5.1"
classpath "gradle.plugin.com.github.andygoossens:gradle-modernizer-plugin:1.3.0"
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.3"
classpath "net.ltgt.gradle:gradle-errorprone-plugin:1.2.1"
classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.5"
classpath "gradle.plugin.org.hidetake:gradle-swagger-generator-plugin:2.18.2"
}
}
plugins {
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'com.diffplug.spotless' version '5.6.1'
}
description = '''\
Run as:
gradle clean bootRun'''
project.ext.jerseyVersion = '1.19.4'
ext['groovy.version'] = '3.0.6'
allprojects {
group = 'org.apache.fineract'
repositories { repositories {
jcenter() jcenter()
} }
apply plugin: 'io.spring.dependency-management'
apply plugin: "com.diffplug.spotless"
// Configuration for the spotless plugin
// https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
format 'misc', {
target '**/*.md', '**/*.properties', '**/.gitignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql'
targetExclude '**/build/**', '**/bin/**', '**/.settings/**', '**/.idea/**', '**/.gradle/**'
indentWithSpaces(4)
endWithNewline()
trimTrailingWhitespace()
}
groovyGradle {
target '*.gradle', '**/*.gradle'
targetExclude '**/build/**'
greclipse()
indentWithSpaces(4)
endWithNewline()
trimTrailingWhitespace()
}
if (plugins.hasPlugin('java')) {
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(' ') + ' '
}
)
}
)
}
}
if (project.hasProperty("automatedBuild")) {
dependsOn(spotlessCheck)
} else {
dependsOn(spotlessApply)
}
}
lineEndings 'UNIX'
}
} }
@@ -2,9 +2,9 @@
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"> <launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> <booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/fineract-provider/bin/main&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/fineract-provider/bin/main&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/fineract-provider/gradlew}"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/fineract/gradlew}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-x rat -x compileJava -x sql -x processResources -x generateGitProperties -Penv=eclipse enhance"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-x rat -x compileJava -x sql -x processResources -x generateGitProperties -Penv=eclipse enhance"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/fineract-provider}"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/fineract}"/>
</launchConfiguration> </launchConfiguration>
+14 -122
View File
@@ -16,55 +16,13 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
description = '''\ description = 'Fineract Provider'
Run as:
gradle clean bootRun'''
group = 'org.apache.fineract'
buildDir = new File(rootProject.projectDir, "build")
repositories {
jcenter()
}
project.ext.jerseyVersion = '1.19.4'
ext["groovy.version"] = '3.0.3'
buildscript {
ext {
jacocoVersion = '0.8.5'
}
repositories {
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'io.spring.gradle:dependency-management-plugin:1.0.10.RELEASE'
classpath 'com.bmuschko:gradle-cargo-plugin:2.7.1'
classpath 'org.zeroturnaround:gradle-jrebel-plugin:1.1.10'
classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.3.4.RELEASE'
classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.15.0'
classpath 'org.apache.openjpa:openjpa:3.1.2' // when upgrading, also change OpenJPA version repeated below in dependencyManagement!
classpath 'com.radcortez.gradle:openjpa-gradle-plugin:3.1.0'
classpath 'org.nosphere.apache:creadur-rat-gradle:0.7.0'
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.5.1"
classpath "gradle.plugin.com.github.andygoossens:gradle-modernizer-plugin:1.3.0"
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.3"
classpath "net.ltgt.gradle:gradle-errorprone-plugin:1.2.1"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.6.1"
classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.5"
classpath "gradle.plugin.org.hidetake:gradle-swagger-generator-plugin:2.18.2"
}
}
apply plugin: 'io.spring.dependency-management'
apply plugin: "org.nosphere.apache.rat" apply plugin: "org.nosphere.apache.rat"
apply plugin: 'rebel' apply plugin: 'rebel'
apply plugin: 'com.github.hierynomus.license' apply plugin: 'com.github.hierynomus.license'
apply plugin: 'war' apply plugin: 'war'
apply plugin: 'org.springframework.boot' apply plugin: 'org.springframework.boot'
apply plugin: 'eclipse'
apply plugin: 'idea' apply plugin: 'idea'
apply plugin: 'com.bmuschko.cargo' apply plugin: 'com.bmuschko.cargo'
apply plugin: 'project-report' apply plugin: 'project-report'
@@ -76,7 +34,6 @@ apply plugin: 'com.github.andygoossens.gradle-modernizer-plugin'
apply plugin: 'jacoco' apply plugin: 'jacoco'
apply plugin: "com.gorylenko.gradle-git-properties" apply plugin: "com.gorylenko.gradle-git-properties"
apply plugin: "net.ltgt.errorprone" apply plugin: "net.ltgt.errorprone"
apply plugin: "com.diffplug.spotless"
apply plugin: "io.swagger.core.v3.swagger-gradle-plugin" apply plugin: "io.swagger.core.v3.swagger-gradle-plugin"
apply plugin: "org.hidetake.swagger.generator" apply plugin: "org.hidetake.swagger.generator"
apply plugin: 'distribution' apply plugin: 'distribution'
@@ -179,13 +136,6 @@ if (project.hasProperty('env') && project.getProperty('env') == 'eclipse')
sourceSets.main.java.outputDir = new File(rootProject.projectDir, "fineract-provider/bin/main") sourceSets.main.java.outputDir = new File(rootProject.projectDir, "fineract-provider/bin/main")
} }
eclipse
{
project {
buildCommand([ LaunchConfigHandle: "<project>/.externalToolBuilders/OpenJPA Enhance Builder.launch" ], 'org.eclipse.ui.externaltools.ExternalToolBuilder')
}
}
// Configuration for the OpenJPA enhance task // Configuration for the OpenJPA enhance task
// https://github.com/radcortez/openjpa-gradle-plugin // https://github.com/radcortez/openjpa-gradle-plugin
System.setProperty("openjpa.Log", "commons") System.setProperty("openjpa.Log", "commons")
@@ -250,69 +200,11 @@ jacocoTestReport {
} }
} }
// Configuration for the spotless plugin
// https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
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 "$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'
}
// Configuration for Apache Release Audit Tool task // Configuration for Apache Release Audit Tool task
// https://github.com/eskatos/creadur-rat-gradle // https://github.com/eskatos/creadur-rat-gradle
rat { rat {
verbose = false verbose = false
reportDir = new File(buildDir,'reports/rat') reportDir = file("$buildDir/reports/rat")
excludes = [ excludes = [
'**/*.launch', '**/*.launch',
'**/licenses/**', '**/licenses/**',
@@ -612,12 +504,6 @@ modernizer {
compileJava { compileJava {
dependsOn rat dependsOn rat
finalizedBy resolve finalizedBy resolve
if (project.hasProperty("automatedBuild")) {
dependsOn(spotlessCheck)
} else {
dependsOn(spotlessApply)
}
} }
war { war {
@@ -688,6 +574,12 @@ dependencies {
cargo { cargo {
containerId "tomcat9x" containerId "tomcat9x"
// looks like Cargo doesn't detect the WAR file automatically in the multi-module setup
deployable {
file = file("${buildDir}/libs/fineract-provider.war")
context = 'fineract-provider'
}
local { local {
installer { installer {
installConfiguration = configurations.tomcat installConfiguration = configurations.tomcat
@@ -854,7 +746,7 @@ distributions {
contents { contents {
from bootJar from bootJar
from bootWar from bootWar
from("$rootDir/build/swagger-code-fineract/build/libs/") { from("$buildDir/swagger-code-fineract/build/libs/") {
include '**/*.jar' include '**/*.jar'
rename 'client-(.+)\\.jar', 'fineract-client.jar' rename 'client-(.+)\\.jar', 'fineract-client.jar'
} }
@@ -900,7 +792,7 @@ if( project.hasProperty("fineract.release") ) {
task.getFilesToSign().each { f -> task.getFilesToSign().each { f ->
new ByteArrayOutputStream().withStream { os -> new ByteArrayOutputStream().withStream { os ->
def result = exec { def result = exec {
workingDir "$rootDir/build/distributions" workingDir "$buildDir/distributions"
executable 'sh' executable 'sh'
args '-c', "gpg --verify ${f}.asc" args '-c', "gpg --verify ${f}.asc"
standardOutput = os standardOutput = os
@@ -990,7 +882,7 @@ task prepareConfigJson(dependsOn: 'generateGitProperties') {
swaggerSources { swaggerSources {
fineract { fineract {
inputFile = file("$rootDir/build/classes/java/main/static/swagger-ui/fineract.yaml") inputFile = file("$buildDir/classes/java/main/static/swagger-ui/fineract.yaml")
code { code {
language = 'java' language = 'java'
configFile = file('config/swagger/config.json') configFile = file('config/swagger/config.json')
@@ -999,15 +891,15 @@ swaggerSources {
} }
} }
generateSwaggerCodeFineract.dependsOn prepareConfigJson // had to put resolve dependency here to make this work in multi-module
generateSwaggerCodeFineract.dependsOn prepareConfigJson, resolve
// TODO: fix version information for client jar // TODO: fix version information for client jar
// TODO: refactor to multi-module project and make client a separate module; cleaner than running exec // TODO: refactor to multi-module project and make client a separate module; cleaner than running exec
task buildSwaggerCodeFineract(type:Exec, dependsOn: [ task buildSwaggerCodeFineract(type:Exec, dependsOn: [
'resolve',
'generateSwaggerCodeFineract' 'generateSwaggerCodeFineract'
]) { ]) {
workingDir "$rootDir/build/swagger-code-fineract" workingDir "$buildDir/swagger-code-fineract"
executable 'sh' executable 'sh'
args '-c', 'chmod +x gradlew && ./gradlew clean build' args '-c', 'chmod +x gradlew && ./gradlew clean build'
} }
-1
View File
@@ -1 +0,0 @@
../gradlew