app/build.gradle
plugins {
id 'jacoco'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: "androidx.navigation.safeargs"
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "ch.epfl.sdp.appart"
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "ch.epfl.sdp.appart.CustomTestRunner"
//testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" //replaced when using hilt
Properties properties = new Properties();
if(rootProject.file("local.properties").exists()) {
//For the map api key
properties.load(rootProject.file("local.properties").newDataInputStream())
manifestPlaceholders = [ mapsApiKey : properties.getProperty("MAPS_API_KEY", "")]
resValue "string", "maps_api_key", properties.getProperty("MAPS_API_KEY", "")
} else {
//for the map api key
manifestPlaceholders = [ mapsApiKey : System.getenv("MAPS_API_KEY")]
resValue "string", "maps_api_key", System.getenv("MAPS_API_KEY")
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
animationsDisabled = true
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//implementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.github.bumptech.glide:annotations:4.12.0'
implementation 'com.google.firebase:firebase-storage:19.2.2'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
testImplementation 'junit:junit:4.13.2'
testImplementation "org.mockito:mockito-core:2.+"
androidTestImplementation "org.mockito:mockito-core:2.+"
implementation 'org.hamcrest:hamcrest:2.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
implementation platform('com.google.firebase:firebase-bom:26.6.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.firebaseui:firebase-ui-storage:4.3.2'
implementation "com.google.dagger:hilt-android:$hilt_version"
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
annotationProcessor "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
androidTestAnnotationProcessor "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation 'com.google.vr:sdk-panowidget:1.180.0'
implementation 'com.github.hannesa2:panoramagl:1.5'
androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
implementation 'com.google.android.gms:play-services-location:18.0.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.android.volley:volley:1.2.0'
def nav_version = "2.3.5"
// Java language implementation
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
// Feature module Support
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
// Testing Navigation
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
// Jetpack Compose Integration
implementation "androidx.navigation:navigation-compose:2.4.0-alpha02"
androidTestImplementation('com.android.support.test.espresso:espresso-intents:3.0.2') {
// Necessary to avoid version conflicts
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation('com.android.support.test.espresso:espresso-contrib:3.0.2') {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
implementation 'com.google.android.libraries.places:places:2.4.0'
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'android/**/*.*',
// Exclude Hilt generated classes
'**/*Hilt*.*',
'hilt_aggregated_deps/**',
'**/*_Factory.class',
'**/*_MembersInjector.class',
"**/LoginCallback.java",
"**/LoginService.java",
"**/Database.java",
"**/User.java",
"**/LocationModule_ProvideGeocoderFactory.java",
"**/LocationModule_ProvideLocationProviderFactory.java",
"**/FireBaseModule.java",
"**/DatabaseVisitorHost.java",
"**/GlideLoaderVisitor.java",
"**/DataBaseModule.java",
"**/LoginModule.java",
"**/LocationModule.java",
"**/MockLoginServiceException.java",
"**/FirebaseEmulatorLoginServiceWrapper.java",
"**/glide/**",
"**/appart/hilt/**"
]
//"$project.buildDir/intermediates/javac/debug/classes"
//"$project.buildDir/generated/ap_generated_sources/debug/out"
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/classes", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories.setFrom(files([mainSrc]))
classDirectories.setFrom(files([debugTree]))
executionData.setFrom(fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code_coverage/debugAndroidTest/connected/*coverage.ec'
]))
/*
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: [
]
)
}))
}
*/
}
connectedCheck {
finalizedBy jacocoTestReport
}
hilt {
enableTransformForLocalTests = true
}