11apply plugin : ' com.android.application'
2- apply plugin : ' jacoco'
3- // apply from: "https://raw.githubusercontent.com/monstar-lab/gradle-android-ci-check/1.2.0/ci.gradle"
2+ apply plugin : ' jacoco-everywhere'
43
54def gitSha = ' git rev-parse --short HEAD' . execute([], project. rootDir). text. trim()
65def buildTime = new Date (). format(" yyyy-MM-dd'T'HH:mm'Z'" , TimeZone . getTimeZone(" UTC" ))
@@ -18,6 +17,10 @@ android {
1817 preDexLibraries = preDexEnabled && ! isTravis
1918 }
2019
20+ testOptions {
21+ unitTests. returnDefaultValues = true
22+ }
23+
2124 defaultConfig {
2225 applicationId " org.fossasia.openevent"
2326 minSdkVersion 15
@@ -80,9 +83,11 @@ dependencies {
8083 fdroidCompile ' org.apache.directory.studio:org.slf4j.api:1.7.2'
8184 fdroidCompile ' org.slf4j:slf4j-simple:1.7.14'
8285
83- // Testing
86+ // Unit Test
8487 testCompile ' junit:junit:4.12'
8588 testCompile " org.robolectric:robolectric:3.0"
89+
90+ // Instrumentation Test
8691 androidTestCompile ' com.android.support.test.espresso:espresso-core:2.2'
8792 androidTestCompile(' com.android.support.test:runner:0.4' ) {
8893 exclude group : ' com.android.support' , module : ' support-annotations'
@@ -103,38 +108,3 @@ dependencies {
103108 releaseCompile ' com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' // or 1.4-beta1
104109 testCompile ' com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' // or 1.4-beta1
105110}
106-
107- jacoco {
108- toolVersion " 0.7.1.201405082137"
109- }
110-
111- def coverageSourceDirs = [
112- ' src/main/java' ,
113- ]
114-
115- task jacocoTestReport (type : JacocoReport ) {
116- group = " Reporting"
117- description = " Generate Jacoco coverage reports after running tests."
118- reports {
119- xml. enabled = true
120- html. enabled = true
121- }
122- classDirectories = fileTree(
123- dir : ' ./build/intermediates/classes/debug' ,
124- excludes : [' **/R*.class' ,
125- ' **/*$InjectAdapter.class' ,
126- ' **/*$ModuleAdapter.class' ,
127- ' **/*$ViewInjector*.class'
128- ])
129- sourceDirectories = files(coverageSourceDirs)
130- executionData = files(" $buildDir /jacoco/testDebug.exec" )
131- // Bit hacky but fixes https://code.google.com/p/android/issues/detail?id=69174.
132- // We iterate through the compiled .class tree and rename $$ to $.
133- doFirst {
134- new File (" $buildDir /intermediates/classes/" ). eachFileRecurse { file ->
135- if (file. name. contains(' $$' )) {
136- file. renameTo(file. path. replace(' $$' , ' $' ))
137- }
138- }
139- }
140- }
0 commit comments