vidakovic commented on a change in pull request #1402:
URL: https://github.com/apache/fineract/pull/1402#discussion_r504676675



##########
File path: build.gradle
##########
@@ -85,51 +218,235 @@ allprojects  {
             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(' ') 
+ ' '
-                        }
-                        )
+        lineEndings 'UNIX'
+    }
+
+    // Configuration for Gradle license plug-in
+    // https://github.com/hierynomus/license-gradle-plugin
+    license {
+        header rootProject.file("$rootDir/APACHE_LICENSETEXT.md")
+        excludes([
+            "**/git.properties",
+            "**/*.html",
+            "**/*.mustache",
+            "**/package-info.java",
+            "**/keystore.jks",
+            "**/static/swagger-ui/**",
+            "**/api-docs/**",
+        ])
+        strictCheck true
+    }
+
+    task licenseFormatBuildScripts 
(type:nl.javadude.gradle.plugins.license.License) {
+        source = fileTree(dir: "$rootDir/", includes: [
+            '**/*.bat',
+            '**/*.sh',
+            '**/*.sql'
+        ])
+    }
+    licenseFormat.dependsOn licenseFormatBuildScripts
+
+    // 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',
+            '**/*.github/**',
+            '**/MANIFEST.MF',
+            '**/*.json',
+            '**/*.json.template',
+            '**/*.txt',
+            '**/*.log',
+            '**/fineractdev-eclipse-preferences.epf',
+            '**/template-expected.html',
+            '**/template.mustache',
+            '**/.classpath',
+            '**/.project',
+            '**/.idea/**',
+            '**/*.ipr',
+            '**/*.iws',
+            '**/.settings/**',
+            '**/bin/**',
+            '**/.git/**',
+            '**/.gitignore',
+            '**/.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",
+        ]
+    }
+}
+
+configure(project.fineractJavaProjects) {
+    // NOTE: order matters!
+
+    apply plugin: 'java-library'
+    apply plugin: 'idea'
+
+    /* define the valid syntax level for source files */
+    sourceCompatibility = JavaVersion.VERSION_11
+    /* define binary compatibility version */
+    targetCompatibility = JavaVersion.VERSION_11
+
+    /* 
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
+
+    sourceSets {
+        integrationTest {
+            compileClasspath += main.output + test.output
+            runtimeClasspath += main.output + test.output
+        }
+    }
+
+    configurations {
+        implementation.setCanBeResolved(true)
+        api.setCanBeResolved(true)
+
+        integrationTestCompile.extendsFrom testImplementation
+        integrationTestRuntime.extendsFrom testRuntime
+    }
+
+    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: @vidakovic fix this
+        ]
+        // TODO FINERACT-959 (gradually) enable -Xlint:all (see "javac -help 
-X")
+
+        options.deprecation = true
+
+        options.compilerArgs +=[
+            "-Xmaxwarns",
+            1500,
+            "-Xmaxerrs",
+            1500
+        ]
+    }
+
+    // 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(' ') + ' 
'
                     }
                     )
                 }
-            }
-
-            if (project.hasProperty("automatedBuild")) {
-                dependsOn(spotlessCheck)
-            } else {
-                dependsOn(spotlessApply)
+                )
             }
         }
 
+        // TODO: @vidakovic why do we need this again? Spotless is checking 
anyway
+        // if (project.hasProperty("automatedBuild")) {
+        //     dependsOn(spotlessCheck)
+        // } else {
+        //     dependsOn(spotlessApply)
+        // }

Review comment:
       Found a solutions:
   
   *   automatic spotlessApply works again as before
   *   I found a way to express the dependency of fineract-client on 
fineract-provider; works like a charm; no hard copy of fineract.yaml in 
fineract-client needed anymore




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to