Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
264 lines (228 sloc) 7.39 KB
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'org.jacoco:org.jacoco.core:0.8.1'
}
}
plugins {
id "com.github.ben-manes.versions" version "0.17.0"
id "com.github.kt3k.coveralls" version "2.8.2"
}
allprojects {
repositories {
jcenter()
google()
maven { url "https://jitpack.io" }
}
}
apply plugin: 'com.android.application'
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "de.avalax.fitbuddy"
minSdkVersion 21
targetSdkVersion 27
versionCode System.getenv("BUILD_NUMBER") as Integer ?: 0
versionName "1.0." + System.getenv("BUILD_NUMBER") as String ?: "0"
testInstrumentationRunner "de.avalax.fitbuddy.runner.MockTestRunner"
}
lintOptions {
abortOnError false
}
testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
unitTests {
includeAndroidResources = true
all {
jacoco {
includeNoLocationClasses = true
}
}
}
}
if (System.getenv("KEYSTORE") && new File(System.getenv("KEYSTORE")).exists()) {
signingConfigs {
release {
storeFile file(System.getenv("KEYSTORE"))
storePassword System.getenv("KEYSTORE_PASSWORD")
keyAlias System.getenv("KEY_ALIAS")
keyPassword System.getenv("KEY_PASSWORD")
}
}
} else {
println 'KEYSTORE not set -> release build will not signed!'
}
buildTypes {
debug {
debuggable true
testCoverageEnabled true
}
if (System.getenv("KEYSTORE") && new File(System.getenv("KEYSTORE")).exists()) {
release {
debuggable false
minifyEnabled true
zipAlignEnabled true
signingConfig signingConfigs.release
}
}
}
}
dependencies {
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.google.dagger:dagger:2.16'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation "android.arch.lifecycle:runtime:1.1.1"
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
annotationProcessor 'com.google.dagger:dagger-compiler:2.16'
androidTestAnnotationProcessor 'com.google.dagger:dagger-compiler:2.16'
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.mockito:mockito-all:1.10.19'
testImplementation 'org.assertj:assertj-core:3.10.0'
testImplementation 'de.bechte.junit:junit-hierarchicalcontextrunner:4.12.1'
testImplementation('org.robolectric:robolectric:3.6.1') {
exclude module: 'commons-logging'
exclude module: 'httpclient'
}
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-contrib:3.0.1') {
exclude module: 'support-v4'
exclude module: 'recyclerview-v7'
exclude module: 'appcompat-v7'
exclude module: 'design'
}
androidTestUtil 'com.android.support.test:orchestrator:1.0.1'
}
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.1"
}
task jacocoCombinedTestReport(type: JacocoReport, dependsOn: ['jacocoTestReport', 'createDebugCoverageReport']) {
group = "Reporting"
description = "Generate Jacoco a combined coverage report"
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
group = "Reporting"
description = "Generate Jacoco coverage reports"
classDirectories = fileTree(
dir: "${project.buildDir}/intermediates/classes/debug",
excludes: ['**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/FitbuddyModule*.*',
'**/*_MembersInjector.*',
'**/*Application*.class',
'**/*Fragment*.class',
'**/*Activity*.class',
'**/*View.class',
'**/*Adapter.class',
'**/*Holder.class',
'**/*Listener*.class',
'**/*Binding*.class',
'**/DataBinderMapperImpl*.class',
'**/BR.class']
)
sourceDirectories = files('src/main/java')
executionData = fileTree(dir: "$buildDir", includes: [
"jacoco/testDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec"
])
reports {
xml.enabled = true
html.enabled = true
xml.destination = "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml"
html.destination = "${project.buildDir}/reports/jacoco/test"
}
}
apply plugin: 'checkstyle'
checkstyle {
toolVersion = "8.8"
}
task checkstyle(type: Checkstyle) {
configFile rootProject.file('checkstyle.xml')
source 'src/main/java'
ignoreFailures true
showViolations true
include '**/*.java'
classpath = files()
}
afterEvaluate {
if (project.tasks.findByName('check')) {
check.dependsOn('checkstyle')
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
}
apply plugin: 'pmd'
pmd{
toolVersion="6.2.0"
}
task pmd(type: Pmd) {
ruleSetFiles = files("pmd.xml")
ruleSets = []
ignoreFailures = true
source 'src/main/java'
reports {
xml.enabled = true
html.enabled = true
xml.destination "$reportsDir/pmd/pmd.xml"
html.destination "$reportsDir/pmd/pmd.html"
}
}
afterEvaluate {
if (project.tasks.findByName('check')) {
check.dependsOn('pmd')
}
}
apply plugin: 'findbugs'
findbugs{
toolVersion="3.0.1"
}
task findbugs(type: FindBugs) {
ignoreFailures = true
classes = files('build/intermediates/classes/debug')
source = fileTree('src/main/java/')
classpath = files()
excludeFilter = new File("findbugs.xml")
effort = 'max'
reports {
xml.enabled = true
html.enabled = false
xml.destination "$reportsDir/findbugs/findbugs.xml"
}
}
afterEvaluate {
if (project.tasks.findByName("check")) {
check.dependsOn('findbugs')
}
}