rkuenzi-epfl/Wnder

View on GitHub
app/build.gradle

Summary

Maintainability
Test Coverage
plugins {
    id 'com.android.application'
    id 'dagger.hilt.android.plugin'
    id 'jacoco'
    id 'com.google.gms.google-services'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.github.wnder"
        minSdkVersion 24
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "com.github.wnder.CustomTestRunner"
    }

    buildTypes {

    debug {
            testCoverageEnabled true
        }

        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
    implementation "androidx.camera:camera-camera2:1.0.0"
    implementation "androidx.camera:camera-lifecycle:1.0.0"
    implementation "androidx.camera:camera-view:1.0.0-alpha24"

    // Hilt, dependencies injection
    implementation 'com.google.dagger:hilt-android:2.35'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
    annotationProcessor 'com.google.dagger:hilt-compiler:2.35'

    // For instrumentation tests
    androidTestImplementation  'com.google.dagger:hilt-android-testing:2.35'
    androidTestAnnotationProcessor 'com.google.dagger:hilt-compiler:2.35'

    // For local unit tests
    testImplementation 'com.google.dagger:hilt-android-testing:2.35'
    testAnnotationProcessor 'com.google.dagger:hilt-compiler:2.35'

    annotationProcessor 'androidx.hilt:hilt-compiler:1.0.0'
    //implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03'

    //Firebase
    implementation platform('com.google.firebase:firebase-bom:26.6.0')
    implementation 'com.google.firebase:firebase-firestore'
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.firebase:firebase-storage'
    implementation 'com.firebaseui:firebase-ui-storage:6.4.0'

    testImplementation 'junit:junit:4.13.2'
    implementation 'com.google.android.gms:play-services-auth:19.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.1'
    testImplementation 'junit:junit:4.13.2'
    testImplementation "org.mockito:mockito-core:3.8.0"
    testImplementation "org.mockito:mockito-inline:3.8.0"
    testImplementation 'org.robolectric:robolectric:4.4'
    androidTestImplementation "org.mockito:mockito-android:3.8.0"
    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'

    debugImplementation "androidx.fragment:fragment-testing:1.3.4"

    //Add library for mapbox
    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.1'
    implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:5.8.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.8.0'

    //for pictures from url
    implementation 'com.squareup.picasso:picasso:2.71828'

}

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'
    ]
    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'
    ]))
}

connectedCheck {
    finalizedBy jacocoTestReport
}