procrastinot-team/procrastinot

View on GitHub
app/build.gradle

Summary

Maintainability
Test Coverage
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'jacoco'
    id 'com.google.gms.google-services'
    id 'kotlin-kapt'
    id 'com.google.dagger.hilt.android'
    id 'org.jetbrains.kotlin.plugin.serialization' version '1.5.21'
}

android {
    namespace 'com.github.mateo762.myapplication'
    compileSdk 33

    packagingOptions {
        exclude("META-INF/DEPENDENCIES")
        exclude("META-INF/LICENSE.md")
        exclude("META-INF/LICENSE-notice.md")
        exclude("META-INF/license.txt")
        exclude("META-INF/NOTICE")
        exclude("META-INF/NOTICE.txt")
        exclude("META-INF/notice.txt")
        exclude("META-INF/ASL2.0")
        exclude("META-INF/*.kotlin_module")
    }

    defaultConfig {
        applicationId "com.github.mateo762.myapplication"
        minSdk 24
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "com.github.mateo762.myapplication.CustomTestRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            testCoverageEnabled true
        }
    }



    buildFeatures {
        compose true
        viewBinding true
    }

    composeOptions {
        kotlinCompilerExtensionVersion = "1.4.1"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}


dependencies {
    implementation "com.google.dagger:hilt-android:2.44"
    kapt "com.google.dagger:hilt-compiler:2.44"
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation platform('com.google.firebase:firebase-bom:31.2.3')
    implementation 'androidx.navigation:navigation-fragment:2.5.3'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
    implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
    implementation 'com.google.firebase:firebase-database-ktx:20.1.0'
    implementation 'com.google.accompanist:accompanist-coil:0.14.0'
    implementation 'com.google.firebase:firebase-storage-ktx'
    implementation 'androidx.navigation:navigation-fragment:2.5.3'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0'
    implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
    implementation 'com.google.firebase:firebase-database-ktx:20.1.0'
    def composeBom = platform('androidx.compose:compose-bom:2023.01.00')
    implementation composeBom
    androidTestImplementation composeBom
    def room_version = "2.5.0"
    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"

    implementation 'com.google.code.gson:gson:2.9.0'
    kapt "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-rxjava3:$room_version"
    implementation "androidx.room:room-guava:$room_version"
    testImplementation "androidx.room:room-testing:$room_version"
    implementation "androidx.room:room-paging:$room_version"
    implementation 'androidx.compose.material3:material3-window-size-class'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0'
    // Optional - Integration with activities
    implementation 'androidx.activity:activity-compose:1.6.1'
    // optional - RxJava2 support for Room
    implementation "androidx.room:room-rxjava2:$room_version"
    // Choose one of the following:
    // Material Design 3
    implementation 'androidx.compose.material3:material3'
    // or Material Design 2
    implementation 'androidx.compose.material:material'
    // or skip Material Design and build directly on top of foundational components
    implementation 'androidx.compose.foundation:foundation'
    // or only import the main APIs for the underlying toolkit systems,
    // such as input and measurement/layout
    implementation 'androidx.compose.ui:ui'

    // Android Studio Preview support
    implementation 'androidx.compose.ui:ui-tooling-preview'
    debugImplementation 'androidx.compose.ui:ui-tooling'

    // UI Tests
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
    debugImplementation 'androidx.compose.ui:ui-test-manifest'

    // Kotlin Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4'

    // ViewModel
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'

    // Optional - Included automatically by material, only add when you need
    // the icons but not the material library (e.g. when using Material3 or a
    // custom design system based on Foundation)
    implementation 'androidx.compose.material:material-icons-core'
    // Optional - Add full set of material icons
    implementation 'androidx.compose.material:material-icons-extended'
    // Optional - Add window size utils
    implementation 'androidx.compose.material3:material3-window-size-class'

    // Optional - Integration with activities
    implementation 'androidx.activity:activity-compose:1.6.1'
    // Optional - Integration with ViewModels
    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0'
    // Optional - Integration with LiveData
    implementation 'androidx.compose.runtime:runtime-livedata'
    // Optional - Integration with RxJava
    implementation 'androidx.compose.runtime:runtime-rxjava2'
    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    // Import the BoM for the Firebase platform
    implementation platform('com.google.firebase:firebase-bom:31.2.3')
    implementation 'com.google.firebase:firebase-auth-ktx:21.1.0'
    implementation 'com.google.firebase:firebase-auth:21.1.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.firebaseui:firebase-ui-auth:8.0.2'
    implementation 'com.github.quivr:android-week-view:2.3.3'
    implementation 'androidx.fragment:fragment-ktx:1.5.5'
    testImplementation 'org.hamcrest:java-hamcrest:2.0.0.0'
    testImplementation 'org.mockito:mockito-core:4.5.1'
    androidTestImplementation 'org.mockito:mockito-android:5.2.0'
    androidTestImplementation "io.mockk:mockk-android:1.13.5"
    androidTestImplementation 'io.mockk:mockk:1.13.5'
    androidTestImplementation "io.mockk:mockk-agent:1.13.5"
    implementation 'androidx.test.espresso:espresso-core:3.5.1'
    testImplementation 'junit:junit:4.13.2'
    implementation 'androidx.test.uiautomator:uiautomator:2.2.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1'
    androidTestImplementation 'androidx.test:runner:1.5.2'
    androidTestImplementation 'androidx.test:rules:1.5.0'
    androidTestImplementation 'androidx.test:core-ktx:1.5.0'
    androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
    debugImplementation "androidx.fragment:fragment-testing:1.5.5"
    debugImplementation "androidx.test:monitor:1.6.1"
    implementation 'com.google.dagger:hilt-android:2.45'
    kapt 'com.google.dagger:hilt-compiler:2.45'

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

    // For local unit tests
    testImplementation 'com.google.dagger:hilt-android-testing:2.45'
    kaptTest 'com.google.dagger:hilt-compiler:2.45'
    implementation 'com.github.bumptech.glide:glide:4.15.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'

    testImplementation "androidx.arch.core:core-testing:2.2.0"
    androidTestImplementation 'androidx.arch.core:core-testing:2.2.0'
    androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
}

// Allow references to generated code
kapt {
    correctErrorTypes true
}


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/**/*.*',

            // Exclude DAO interface files from coverage report
            '**room/*Dao*.*',
            // Exclude manually since the above line seems to not work?
            '**room/HabitDao*.*',
            '**room/HabitImageDao*.*',
            '**room/PostDao*.*',
            '**room/UserDao*.*',

            // Exclude Hilt generated classes
            '**/*Hilt*.*',
            'hilt_aggregated_deps/**',
            '**/*_Factory.class',
            '**/*_MembersInjector.class',
            // Exclude Hilt modules
            '**/di/**',

            //Exclude objects and data class
            '**authentication/PreferenceHelper.kt',
            '**/HardCodedValues.kt'
    ]
    def debugTree = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/debug", 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
}