fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fineract] ptuomola commented on a change in pull request #1402: FINERACT-1189: fineract client as a separate module
Date Wed, 14 Oct 2020 11:29:59 GMT

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



##########
File path: fineract-client/src/main/templates/java/retrofit2/ApiClient.mustache
##########
@@ -0,0 +1,468 @@
+{{>licenseInfo}}
+package {{invokerPackage}};

Review comment:
       These files look like boilerplate... have we modified them? If not, is there a possibility
to have them as dependency we download rather than something we check into git? 

##########
File path: build.gradle
##########
@@ -63,14 +74,136 @@ allprojects  {
     }
 
     apply plugin: 'io.spring.dependency-management'
-    apply plugin: "com.diffplug.spotless"
+    apply plugin: 'com.diffplug.spotless'
+    apply plugin: 'com.github.hierynomus.license'
+    apply plugin: 'org.nosphere.apache.rat'
+
+    // Configuration for the dependency management plugin
+    // https://github.com/spring-gradle-plugins/dependency-management-plugin
+    dependencyManagement {
+        imports {
+            mavenBom 'org.springframework:spring-framework-bom:5.2.9.RELEASE'
+        }
+
+        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.springframework.security.oauth:spring-security-oauth2:2.5.0.RELEASE'
+            dependency 'org.apache.openjpa:openjpa:3.1.2' // when upgrading, also change
OpenJPA version repeated above in buildscript!
+            dependency 'com.squareup.retrofit:retrofit:1.9.0'
+            dependency 'com.squareup.okhttp:okhttp:2.7.5'
+            dependency 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
+            dependency 'com.google.guava:guava:29.0-jre'
+            dependency 'com.google.code.gson:gson:2.8.6'
+            dependency 'org.apache.commons:commons-email:1.5'
+            dependency 'commons-io:commons-io:2.8.0'
+            dependency 'org.drizzle.jdbc:drizzle-jdbc:1.4'
+            dependency 'com.github.librepdf:openpdf:1.3.22'
+            dependency 'org.mnode.ical4j:ical4j:3.0.20'
+            dependency 'org.quartz-scheduler:quartz:2.3.2'
+            dependency 'com.amazonaws:aws-java-sdk-s3:1.11.874'
+            dependency 'org.ehcache:ehcache:3.9.0'
+            dependency 'com.github.spullara.mustache.java:compiler:0.9.6'
+            dependency 'com.jayway.jsonpath:json-path:2.4.0'
+            dependency 'org.apache.tika:tika-core:1.24.1'
+            dependency 'org.apache.httpcomponents:httpclient:4.5.13'
+            dependency 'io.swagger.core.v3:swagger-annotations:2.1.5'
+            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'
+            dependency 'jakarta.validation:jakarta.validation-api:3.0.0'
+            dependency 'org.apache.activemq:activemq-broker:5.16.0'
+            dependency 'org.apache.bval:org.apache.bval.bundle:2.0.4'
+            dependency 'org.mockito:mockito-core:3.5.13'
+            dependency 'org.mockito:mockito-junit-jupiter:3.5.13'
+            dependency 'io.github.classgraph:classgraph:4.8.90'
+            dependency 'org.awaitility:awaitility:4.0.3'
+            dependency 'com.github.spotbugs:spotbugs-annotations:4.1.3'
+            dependency 'javax.cache:cache-api:1.1.1'
+            dependency 'org.mock-server:mockserver-junit-jupiter:5.11.1'
+            dependency 'org.webjars.npm:swagger-ui-dist:3.35.1'
+            dependency 'org.webjars:webjars-locator-core:0.46'
+
+            // fineract client dependencies
+            dependency "com.squareup.retrofit2:retrofit:$retrofitVersion"

Review comment:
       It's going to be pretty big list to have all dependencies in a single list covering
all possible future subprojects. Is there any way to make these lists subproject-specific,
and only keep any common dependencies here? 

##########
File path: build.gradle
##########
@@ -46,6 +56,7 @@ buildscript {
 plugins {
     id 'io.spring.dependency-management' version '1.0.10.RELEASE'
     id 'com.diffplug.spotless' version '5.6.1'
+    id 'org.openapi.generator' version '4.3.1'

Review comment:
       Hmm... I thought we wanted to only have "common" plugins in the main Gradle file. But
the OpenAPI one is only needed / used on the client project. Is there any way to make it specific
for that subproject only?

##########
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:
       There was a bit of a debate about this earlier. Initially we just had spotlessCheck
which complained about any formatting issues, and then people had to manually run spotlessApply
to fix them. There was a fair bit of dissatisfaction about this - and hence this was introduced:
if you run build manually it will automatically fix any spotless issues with spotlessApply
- but when you run the build in Travis, it just checks and doesn't modify the code. If we
want to change that behaviour now that should be a different JIRA & PR up for discussion...




----------------------------------------------------------------
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:
users@infra.apache.org



Mime
View raw message