diff --git a/android-base/build.gradle b/android-base/build.gradle index 9501f86de..128998dd4 100644 --- a/android-base/build.gradle +++ b/android-base/build.gradle @@ -1,19 +1,18 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" - + compileSdkVersion COMPILE_SDK_VERSION as Integer + buildToolsVersion BUILD_TOOLS_VERSION defaultConfig { - minSdkVersion 19 - targetSdkVersion 25 + minSdkVersion MIN_SDK_VERSION as Integer + targetSdkVersion TARGET_SDK_VERSION as Integer versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } + buildTypes { release { minifyEnabled false @@ -28,19 +27,20 @@ android { } dependencies { - implementation 'com.google.dagger:dagger:2.9' - implementation 'com.android.support:design:25.3.1' - implementation 'com.android.support:appcompat-v7:25.3.1' - implementation 'org.apache.commons:commons-lang3:3.5' + implementation "com.google.dagger:dagger:$DAGGER_VERSION" + implementation "com.android.support:design:$SUPPORT_LIBRARY_VERSION" + implementation "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION" + implementation "org.apache.commons:commons-lang3:3.5" - annotationProcessor 'com.google.dagger:dagger-compiler:2.9' - androidTestAnnotationProcessor 'com.google.dagger:dagger-compiler:2.9' - androidTestImplementation 'com.google.dagger:dagger:2.9' - testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.9' + annotationProcessor "com.google.dagger:dagger-compiler:$DAGGER_VERSION" + androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:$DAGGER_VERSION" + androidTestImplementation "com.google.dagger:dagger:$DAGGER_VERSION" + testAnnotationProcessor "com.google.dagger:dagger-compiler:$DAGGER_VERSION" + testImplementation "junit:junit:4.12" androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - testImplementation 'junit:junit:4.12' + } diff --git a/android-pickers/build.gradle b/android-pickers/build.gradle index 68ee1e42d..fc75627d8 100644 --- a/android-pickers/build.gradle +++ b/android-pickers/build.gradle @@ -1,19 +1,17 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 25 - buildToolsVersion "25.0.3" - + compileSdkVersion COMPILE_SDK_VERSION as Integer + buildToolsVersion BUILD_TOOLS_VERSION defaultConfig { - minSdkVersion 19 - targetSdkVersion 25 + minSdkVersion MIN_SDK_VERSION as Integer + targetSdkVersion TARGET_SDK_VERSION as Integer versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } + buildTypes { release { minifyEnabled false @@ -23,5 +21,5 @@ android { } dependencies { - implementation 'com.android.support:appcompat-v7:25.3.1' + implementation "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION" } diff --git a/build.gradle b/build.gradle index 7d8de18e5..d455f59d0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,4 @@ buildscript { - ext.kotlin_version = '1.1.2-4' repositories { jcenter() maven { url 'https://maven.google.com' } @@ -11,7 +10,7 @@ buildscript { classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.4' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'org.jacoco:org.jacoco.core:+' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION" } } diff --git a/gradle.properties b/gradle.properties index 2c6d0198f..7c2f57865 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,12 @@ +MIN_SDK_VERSION = 19 +TARGET_SDK_VERSION = 25 +COMPILE_SDK_VERSION = 25 + +DAGGER_VERSION = 2.9 +BUILD_TOOLS_VERSION = 26.0.0 +KOTLIN_VERSION = 1.1.2-4 +SUPPORT_LIBRARY_VERSION = 25.3.1 + org.gradle.parallel=false org.gradle.daemon=true org.gradle.jvmargs=-Xms2048m -Xmx2048m -XX:MaxPermSize=2048m diff --git a/uhabits-android/build.gradle b/uhabits-android/build.gradle index dbe78ee6d..75618bebe 100644 --- a/uhabits-android/build.gradle +++ b/uhabits-android/build.gradle @@ -5,13 +5,13 @@ apply plugin: 'kotlin-kapt' apply plugin: 'jacoco' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion COMPILE_SDK_VERSION as Integer + buildToolsVersion BUILD_TOOLS_VERSION defaultConfig { applicationId "org.isoron.uhabits" - minSdkVersion 19 - targetSdkVersion 25 + minSdkVersion MIN_SDK_VERSION as Integer + targetSdkVersion TARGET_SDK_VERSION as Integer testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" javaCompileOptions { @@ -26,6 +26,7 @@ android { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } + debug { testCoverageEnabled true } @@ -47,6 +48,7 @@ android { outputs.upToDateWhen { false } showStandardStreams = true } + jacoco { includeNoLocationClasses = true } @@ -63,37 +65,37 @@ dependencies { implementation project(":android-base") implementation project(":android-pickers") - implementation 'com.android.support:appcompat-v7:25.3.1' - implementation 'com.android.support:design:25.3.1' - implementation 'com.android.support:preference-v14:25.3.1' - implementation 'com.android.support:support-v4:25.3.1' - implementation 'com.getpebble:pebblekit:3.0.0' - implementation 'com.github.paolorotolo:appintro:3.4.0' - implementation 'com.google.dagger:dagger:2.9' - implementation 'com.jakewharton:butterknife:8.6.1-SNAPSHOT' - implementation 'org.apmem.tools:layouts:1.10' - implementation 'com.google.code.gson:gson:2.7' - implementation 'com.google.code.findbugs:jsr305:3.0.2' - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" - - compileOnly 'javax.annotation:jsr250-api:1.0' - compileOnly 'com.google.auto.factory:auto-factory:1.0-beta3' - kapt 'com.google.dagger:dagger-compiler:2.9' - kapt 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT' - kapt 'com.google.auto.factory:auto-factory:1.0-beta3' - - androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:2.2.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2' - androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1' - androidTestImplementation 'com.google.dagger:dagger:2.9' - androidTestImplementation 'com.linkedin.testbutler:test-butler-library:1.3.1' - androidTestCompileOnly 'com.google.auto.factory:auto-factory:1.0-beta3' - androidTestImplementation 'com.android.support:support-annotations:25.3.1' - androidTestImplementation 'com.android.support.test:rules:0.5' - androidTestImplementation 'com.android.support.test:runner:0.5' - androidTestImplementation 'com.google.guava:guava:20.0' + implementation "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION" + implementation "com.android.support:design:$SUPPORT_LIBRARY_VERSION" + implementation "com.android.support:preference-v14:$SUPPORT_LIBRARY_VERSION" + implementation "com.android.support:support-v4:$SUPPORT_LIBRARY_VERSION" + implementation "com.getpebble:pebblekit:3.0.0" + implementation "com.github.paolorotolo:appintro:3.4.0" + implementation "com.google.dagger:dagger:$DAGGER_VERSION" + implementation "com.jakewharton:butterknife:8.6.1-SNAPSHOT" + implementation "org.apmem.tools:layouts:1.10" + implementation "com.google.code.gson:gson:2.7" + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$KOTLIN_VERSION" + + compileOnly "javax.annotation:jsr250-api:1.0" + compileOnly "com.google.auto.factory:auto-factory:1.0-beta3" + kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION" + kapt "com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT" + kapt "com.google.auto.factory:auto-factory:1.0-beta3" + + androidTestImplementation "com.android.support.test.espresso:espresso-contrib:2.2.2" + androidTestImplementation "com.android.support.test.espresso:espresso-core:2.2.2" + androidTestImplementation "com.android.support.test.uiautomator:uiautomator-v18:2.1.1" + androidTestImplementation "com.google.dagger:dagger:$DAGGER_VERSION" + androidTestImplementation "com.linkedin.testbutler:test-butler-library:1.3.1" + androidTestCompileOnly "com.google.auto.factory:auto-factory:1.0-beta3" + androidTestImplementation "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION" + androidTestImplementation "com.android.support.test:rules:0.5" + androidTestImplementation "com.android.support.test:runner:0.5" + androidTestImplementation "com.google.guava:guava:20.0" androidTestImplementation project(":uhabits-core") - kaptAndroidTest 'com.google.dagger:dagger-compiler:2.9' + kaptAndroidTest "com.google.dagger:dagger-compiler:$DAGGER_VERSION" // mockito-android 2+ includes net.bytebuddy, which causes tests to fail. // Excluding the package net.bytebuddy on AndroidManifest.xml breaks some @@ -101,10 +103,10 @@ dependencies { androidTestImplementation "org.mockito:mockito-core:1+" androidTestImplementation "com.google.dexmaker:dexmaker-mockito:+" - testImplementation 'com.google.dagger:dagger:2.9' + testImplementation "com.google.dagger:dagger:$DAGGER_VERSION" testImplementation "org.mockito:mockito-core:2.8.9" testImplementation "org.mockito:mockito-inline:2.8.9" - testImplementation 'junit:junit:4+' + testImplementation "junit:junit:4+" implementation('com.opencsv:opencsv:3.9') { exclude group: 'commons-logging', module: 'commons-logging' @@ -123,14 +125,6 @@ kapt { } task coverageReport(type: JacocoReport) { - - jacocoClasspath = configurations['androidJacocoAnt'] - - reports { - html.enabled = true - xml.enabled = true - } - def excludes = [ '**/R.class', '**/R$*.class', @@ -146,14 +140,18 @@ task coverageReport(type: JacocoReport) { '**/*Dagger*', '**/*_Factory*' ] - def androidSrc = "${project.projectDir}/src/main/java" def androidClasses = "${buildDir}/intermediates/classes/debug" def jvmExecData = "${buildDir}/jacoco/testDebugUnitTest.exec" def connectedExecData = "${buildDir}/outputs/code-coverage/connected/coverage.ec" - sourceDirectories = files(androidSrc) classDirectories = files(fileTree(dir: androidClasses, excludes: excludes)) executionData = files(jvmExecData, connectedExecData) + jacocoClasspath = configurations['androidJacocoAnt'] + + reports { + html.enabled = true + xml.enabled = true + } } diff --git a/uhabits-core/build.gradle b/uhabits-core/build.gradle index 7abc3f1b4..88518d3d5 100644 --- a/uhabits-core/build.gradle +++ b/uhabits-core/build.gradle @@ -14,7 +14,7 @@ dependencies { compileOnly 'com.google.auto.factory:auto-factory:1.0-beta3' compileOnly 'com.google.dagger:dagger:2.11-rc2' - implementation 'com.android.support:support-annotations:25.3.1' + implementation "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION" implementation 'com.google.code.findbugs:jsr305:3.0.2' implementation 'org.apache.commons:commons-lang3:3.5' implementation 'com.google.code.gson:gson:2.7'