ConnectOut-sdp/sdp2023

View on GitHub
app/build.gradle

Summary

Maintainability
Test Coverage
plugins {
    id 'com.android.application'
    id 'jacoco'
    id 'com.google.gms.google-services' //https://firebase.google.com/docs/android/setup#analytics-not-enabled and https://stackoverflow.com/a/72213149/7974174
}

android {
    namespace 'com.sdpteam.connectout'
    compileSdk 33

    defaultConfig {
        applicationId "com.sdpteam.connectout"
        minSdk 24
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    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
    }
    buildFeatures {
        viewBinding false
    }
}

dependencies {
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
    implementation 'androidx.navigation:navigation-fragment:2.5.3'
    implementation "androidx.fragment:fragment:1.5.5"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.test.espresso:espresso-contrib:3.5.1'
    // implementation 'com.google.firebase:firebase-database:20.1.0'
    implementation 'com.google.firebase:firebase-storage:20.0.0'
    implementation 'com.google.android.gms:play-services-location:19.0.1'
    implementation 'androidx.preference:preference:1.2.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    testImplementation "androidx.arch.core:core-testing:2.2.0"
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.5.1'
    debugImplementation "androidx.fragment:fragment-testing:1.5.5"
    androidTestImplementation "androidx.arch.core:core-testing:2.2.0"
    androidTestImplementation 'androidx.test:runner:1.5.2'
    androidTestImplementation 'androidx.test:rules:1.5.0'
    androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
    androidTestImplementation "androidx.arch.core:core-testing:2.2.0"

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.test.espresso:espresso-intents:3.5.1'
    implementation 'com.google.android.gms:play-services-maps:18.1.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

    implementation 'com.google.android.gms:play-services-auth:20.4.1'
    // Import the Firebase BoM
    implementation platform('com.google.firebase:firebase-bom:31.2.2')
    // When using the BoM, you don't specify versions in Firebase library dependencies
    // Add the dependencies for Firebase products you want to use
    // See https://firebase.google.com/docs/android/setup#available-libraries
    // For example, add the dependencies for Firebase Authentication and Cloud Firestore
    implementation('com.google.firebase:firebase-auth') {
//    exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
    }

    implementation 'com.google.code.gson:gson:2.8.7'

    //firebase ui is very useful for connecting firebase to List Views (notably in the ChatActivity)
    //implementation 'com.firebaseui:firebase-ui:0.6.0'
    implementation 'com.firebaseui:firebase-ui-auth:7.2.0'
    implementation 'com.firebaseui:firebase-ui-database:8.0.2'

    // qr code library
    implementation 'com.google.zxing:core:3.4.1'
    implementation 'com.journeyapps:zxing-android-embedded:4.3.0'

    // for notifications from firebase
    implementation 'com.google.firebase:firebase-messaging'
    implementation 'com.google.firebase:firebase-functions'

    // for roboelectric tests
//    testImplementation 'org.robolectric:robolectric:4.6.1'
//    testImplementation 'androidx.test:core:1.4.1'
//    testImplementation 'androidx.test:runner:1.4.1'
//    testImplementation 'androidx.test:rules:1.4.1'

    // for picasso (display images from url)
    implementation 'com.squareup.picasso:picasso:2.8'

    // for image slideshow in Post ui
    implementation("com.tbuonomo:dotsindicator:4.3")

    testImplementation 'org.mockito:mockito-core:5.3.1'
    androidTestImplementation 'org.mockito:mockito-android:2.7.15'
}

tasks.withType(Test) {
    jacoco.includeNoLocationClasses = true
    jacoco.excludes = ['jdk.internal.*']
}

task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
    reports {
        xml.required = true
        html.required = 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.setFrom(files([mainSrc]))
    classDirectories.setFrom(files([debugTree]))
    executionData.setFrom(fileTree(dir: project.buildDir, includes: [
            'outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec',
            'outputs/code_coverage/debugAndroidTest/connected/*/coverage.ec'
    ]))
}

connectedCheck {
    finalizedBy jacocoTestReport
}