app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'jacoco'
apply plugin: 'com.google.gms.google-services'
def apikeyPropertiesFile = rootProject.file("app/secrets.properties")
def apikeyProperties = new Properties()
apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))
jacoco {
toolVersion = "0.8.4"
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
signingConfigs {
release {
if (project.hasProperty('RELEASE_STORE_FILE')) {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
debug {
if (project.hasProperty('DEBUG_STORE_FILE')) {
storeFile file(DEBUG_STORE_FILE)
storePassword DEBUG_STORE_PASSWORD
keyAlias DEBUG_KEY_ALIAS
keyPassword DEBUG_KEY_PASSWORD
}
}
}
defaultConfig {
applicationId "ch.epfl.sdp"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
buildConfigField("String", "mapboxAPIKey", apikeyProperties['mapboxAPIKey'])
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.debug
}
buildTypes {
debug {
testCoverageEnabled true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
androidTestImplementation 'org.mockito:mockito-android:3.3.3'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' //for google play authentication
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.biometric:biometric:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.2.2'
implementation 'androidx.navigation:navigation-ui:2.2.2'
implementation 'androidx.test.espresso:espresso-idling-resource:3.2.0'
implementation 'com.github.AppIntro:AppIntro:5.1.0' // App intro slides
implementation 'de.hdodenhof:circleimageview:3.1.0' // Circle profile pictures
implementation 'com.github.bumptech.glide:glide:4.11.0' // Profile image retrieval
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' // Charts
implementation 'com.github.wangjiegulu:rfab:2.0.0' // RapidFloatingActionButton for showing paths
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
implementation 'com.google.android.gms:play-services-games:19.0.0'
implementation 'com.google.firebase:firebase-analytics:17.4.2'
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.firebase:firebase-firestore:21.4.3'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.0.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v8:0.7.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:3.3.3'
//androidTestImplementation 'org.awaitility:awaitility:4.0.2'
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
def adb = android.getAdbExe().toString()
tasks.whenTaskAdded { task ->
if (task.name.startsWith('jacocoDebug')) {
task.doLast {
android.applicationVariants.all { variant ->
"${adb} devices".execute().text.eachLine {
if (it.endsWith("device")) {
def device = it.split()[0]
println "Granting test permissions on device ${device}\n"
"${adb} shell appops set ${variant.applicationId} android:mock_location allow".execute()
}
}
}
}
}
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/classes", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code_coverage/debugAndroidTest/connected/*coverage.ec'
])
}