|
@@ -1,10 +1,11 @@
|
|
|
|
+import com.github.spotbugs.snom.SpotBugsTask
|
|
|
|
+
|
|
// Gradle build file
|
|
// Gradle build file
|
|
//
|
|
//
|
|
// This project was started in Eclipse and later moved to Android Studio. In the transition, both IDEs were supported.
|
|
// This project was started in Eclipse and later moved to Android Studio. In the transition, both IDEs were supported.
|
|
// Due to this, the files layout is not the usual in new projects created with Android Studio / gradle. This file
|
|
// Due to this, the files layout is not the usual in new projects created with Android Studio / gradle. This file
|
|
// merges declarations usually split in two separates build.gradle file, one for global settings of the project in
|
|
// merges declarations usually split in two separates build.gradle file, one for global settings of the project in
|
|
// its root folder, another one for the app module in subfolder of root.
|
|
// its root folder, another one for the app module in subfolder of root.
|
|
-import com.github.spotbugs.SpotBugsTask
|
|
|
|
|
|
|
|
buildscript {
|
|
buildscript {
|
|
ext.kotlin_version = '1.3.72'
|
|
ext.kotlin_version = '1.3.72'
|
|
@@ -20,11 +21,9 @@ buildscript {
|
|
mavenCentral()
|
|
mavenCentral()
|
|
}
|
|
}
|
|
dependencies {
|
|
dependencies {
|
|
- classpath 'com.android.tools.build:gradle:3.6.3'
|
|
|
|
- classpath('com.dicedmelon.gradle:jacoco-android:0.1.4') {
|
|
|
|
- exclude group: 'org.codehaus.groovy', module: 'groovy-all'
|
|
|
|
- }
|
|
|
|
- classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6'
|
|
|
|
|
|
+ classpath 'com.android.tools.build:gradle:4.0.0'
|
|
|
|
+ classpath('com.hiya:jacoco-android:0.2')
|
|
|
|
+ classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.3.0'
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.9.1"
|
|
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.9.1"
|
|
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
|
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
|
@@ -39,7 +38,7 @@ apply plugin: 'kotlin-android-extensions'
|
|
apply plugin: 'kotlin-kapt'
|
|
apply plugin: 'kotlin-kapt'
|
|
apply plugin: 'checkstyle'
|
|
apply plugin: 'checkstyle'
|
|
apply plugin: 'pmd'
|
|
apply plugin: 'pmd'
|
|
-apply plugin: 'jacoco-android'
|
|
|
|
|
|
+apply plugin: 'com.hiya.jacoco-android'
|
|
apply plugin: 'com.github.spotbugs'
|
|
apply plugin: 'com.github.spotbugs'
|
|
apply plugin: 'io.gitlab.arturbosch.detekt'
|
|
apply plugin: 'io.gitlab.arturbosch.detekt'
|
|
apply plugin: 'shot'
|
|
apply plugin: 'shot'
|
|
@@ -51,7 +50,7 @@ configurations {
|
|
exclude group: 'com.google.firebase', module: 'firebase-core'
|
|
exclude group: 'com.google.firebase', module: 'firebase-core'
|
|
exclude group: 'com.google.firebase', module: 'firebase-analytics'
|
|
exclude group: 'com.google.firebase', module: 'firebase-analytics'
|
|
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
|
|
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
|
|
- exclude group: 'org.jetbrains', module: 'annotations-java5' // via prism4j, already using annotations explicitely
|
|
|
|
|
|
+ exclude group: 'org.jetbrains', module: 'annotations-java5' // via prism4j, already using annotations explicitly
|
|
|
|
|
|
// check for updates every build
|
|
// check for updates every build
|
|
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
|
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
|
@@ -67,8 +66,8 @@ ext {
|
|
|
|
|
|
travisBuild = System.getenv("TRAVIS") == "true"
|
|
travisBuild = System.getenv("TRAVIS") == "true"
|
|
|
|
|
|
- // allows for -Dpre-dex=false to be set
|
|
|
|
- preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
|
|
|
|
|
|
+ // allows for -D pre-dex=false to be set
|
|
|
|
+ preDexEnabled = "true" == System.getProperty("pre-dex", "true")
|
|
}
|
|
}
|
|
|
|
|
|
repositories {
|
|
repositories {
|
|
@@ -99,9 +98,7 @@ for (TaskExecutionRequest tr : getGradle().getStartParameter().getTaskRequests()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-spotbugs {
|
|
|
|
- toolVersion = '3.1.12'
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
|
|
android {
|
|
android {
|
|
lintOptions {
|
|
lintOptions {
|
|
@@ -196,7 +193,7 @@ android {
|
|
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
|
|
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
|
|
|
|
|
|
dexOptions {
|
|
dexOptions {
|
|
- // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
|
|
|
|
|
|
+ // Skip pre-dexing when running on Travis CI or when disabled via -D pre-dex=false.
|
|
preDexLibraries = preDexEnabled && !travisBuild
|
|
preDexLibraries = preDexEnabled && !travisBuild
|
|
}
|
|
}
|
|
|
|
|
|
@@ -238,41 +235,33 @@ android {
|
|
android.applicationVariants.all { variant ->
|
|
android.applicationVariants.all { variant ->
|
|
String variantName = variant.name
|
|
String variantName = variant.name
|
|
String capVariantName = variantName.substring(0, 1).toUpperCase() + variantName.substring(1)
|
|
String capVariantName = variantName.substring(0, 1).toUpperCase() + variantName.substring(1)
|
|
- tasks.register("spotbugs${capVariantName}", SpotBugsTask) {
|
|
|
|
|
|
+ tasks.register("spotbugs${capVariantName}Report", SpotBugsTask) {
|
|
ignoreFailures = true // should continue checking
|
|
ignoreFailures = true // should continue checking
|
|
effort = "max"
|
|
effort = "max"
|
|
reportLevel = "medium"
|
|
reportLevel = "medium"
|
|
classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/classes/")
|
|
classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/classes/")
|
|
excludeFilter = file("${project.rootDir}/spotbugs-filter.xml")
|
|
excludeFilter = file("${project.rootDir}/spotbugs-filter.xml")
|
|
- pluginClasspath = project.configurations.spotbugsPlugins
|
|
|
|
- source = fileTree('src/main/java')
|
|
|
|
- classpath = files()
|
|
|
|
- include '**/*.java'
|
|
|
|
- exclude '**/gen/**'
|
|
|
|
|
|
|
|
reports {
|
|
reports {
|
|
xml.enabled = false
|
|
xml.enabled = false
|
|
- html.enabled = true
|
|
|
|
html {
|
|
html {
|
|
|
|
+ enabled = true
|
|
destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
|
|
destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- check.dependsOn 'checkstyle', 'spotbugsGplayDebug', 'pmd', 'lint', 'ktlint', 'detekt'
|
|
|
|
|
|
+ check.dependsOn 'checkstyle', 'spotbugsGplayDebugReport', 'pmd', 'lint', 'ktlint', 'detekt'
|
|
|
|
|
|
compileOptions {
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
}
|
|
|
|
|
|
- dataBinding {
|
|
|
|
- enabled true
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- viewBinding {
|
|
|
|
- enabled true
|
|
|
|
|
|
+ buildFeatures {
|
|
|
|
+ dataBinding true
|
|
|
|
+ viewBinding true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -423,17 +412,15 @@ android.applicationVariants.all { variant ->
|
|
tasks.register("combinedTestReport", JacocoReport) {
|
|
tasks.register("combinedTestReport", JacocoReport) {
|
|
|
|
|
|
reports {
|
|
reports {
|
|
- xml.enabled = true
|
|
|
|
- html.enabled = true
|
|
|
|
|
|
+ xml.enabled true
|
|
|
|
+ html.enabled true
|
|
|
|
+ csv.enabled false
|
|
}
|
|
}
|
|
|
|
|
|
- def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
|
|
|
|
- def debugTree = fileTree(dir: "$project.buildDir/intermediates/classes/gplay/debug", excludes: fileFilter)
|
|
|
|
- def mainSrc = "$project.projectDir/src/main/java"
|
|
|
|
-
|
|
|
|
- sourceDirectories = files([mainSrc])
|
|
|
|
- classDirectories = files([debugTree])
|
|
|
|
- executionData = fileTree(dir: project.buildDir, includes: [
|
|
|
|
|
|
+ additionalSourceDirs.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
|
|
|
|
+ sourceDirectories.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
|
|
|
|
+ classDirectories.setFrom files(subprojects.sourceSets.main.output)
|
|
|
|
+ executionData.setFrom project.fileTree(dir: project.buildDir, includes: [
|
|
'jacoco/testGplayDebugUnitTest.exec', 'outputs/code-coverage/connected/flavors/GPLAY/*coverage.ec'
|
|
'jacoco/testGplayDebugUnitTest.exec', 'outputs/code-coverage/connected/flavors/GPLAY/*coverage.ec'
|
|
])
|
|
])
|
|
}
|
|
}
|