Skip to content

Instantly share code, notes, and snippets.

@xdtianyu
Created September 25, 2018 09:14
Show Gist options
  • Save xdtianyu/01a2093c0c3fdbc16cf7a320f3ddf6f8 to your computer and use it in GitHub Desktop.
Save xdtianyu/01a2093c0c3fdbc16cf7a320f3ddf6f8 to your computer and use it in GitHub Desktop.
coverage,checkstyle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha08'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
ext {
compileSdkVersion = 28
targetSdkVersion = 28
minSdkVersion = 21
supportLibVersion = "1.0.0-rc01"
constraintVersion = "2.0.0-alpha2"
requeryVersion = "1.5.1"
glideVersion = "4.8.0"
rxjavaVersion = "2.2.0"
rxandroidVersion = "2.1.0"
lottieVersion = "2.6.0"
multitypeVersion = "3.4.4"
gsonVersion = "2.8.5"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
plugins.apply('android-reporting')
subprojects() {
plugins.apply("pmd")
pmd {
toolVersion '6.6.0'
}
task('pmd', type: Pmd) {
group 'verification'
ruleSetFiles = files("$project.rootDir/pmd.xml")
source = fileTree('src/main/java')
include '**/*.java'
exclude '**/gen/**'
consoleOutput true
ignoreFailures true
reports {
xml.enabled = false
html.enabled = true
}
}
plugins.apply("findbugs")
task('findbugs', type: FindBugs) {
group 'verification'
classes = files("${project.rootDir}/app/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes")
source = fileTree('src/main/java')
effort 'max'
reportLevel = "high"
classpath = files()
ignoreFailures true
reports {
xml.enabled = false
html.enabled = true
}
}
plugins.apply('checkstyle')
checkstyle {
toolVersion '8.12'
}
task('checkstyle', type: Checkstyle) {
description 'Check code standard'
group 'verification'
configFile file("${project.rootDir}/checkstyle.xml")
source fileTree('src/main/java')
include '**/*.java'
exclude '**/gen/**'
classpath = files()
showViolations true
ignoreFailures true
reports {
xml.enabled = false
html.enabled = true
}
}
plugins.apply("jacoco")
task('coverage', type: JacocoReport) {
group 'verification'
def excludes = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'android/**/*.*'
]
sourceDirectories = files(['src/main/java', 'src/main/kotlin'])
classDirectories = fileTree(
dir: "$project.buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes",
excludes: excludes
) + fileTree(
dir: "$project.buildDir/tmp/kotlin-classes/debug",
excludes: excludes
)
executionData = fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec',
'outputs/code-coverage/connected/*coverage.ec'
])
reports {
xml.enabled = true
html.enabled = true
csv.enabled = true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment