BlindlyTeam/Blindly

View on GitHub
app/build.gradle

Summary

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

Properties localProperties = new Properties()
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())

android {
    signingConfigs {
        release {
        }
    }
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "ch.epfl.sdp.blindly"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        buildConfigField "String", "OPEN_WEATHER_MAP_URL", '"https://api.openweathermap.org/data/2.5/onecall"'
        buildConfigField "String", "OPEN_WEATHER_MAP_KEY", localProperties.getProperty('OPEN_WEATHER_MAP_KEY')

        testInstrumentationRunner "ch.epfl.sdp.blindly.BlindlyTestRunner"
    }

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.android.support:appcompat-v7:30'

    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

    implementation 'com.android.support:recyclerview-v7:30'
    implementation 'androidx.viewpager2:viewpager2:1.1.0-alpha01'

    implementation 'com.google.android.material:material:1.4.0-beta01'
    implementation 'com.balysv:material-ripple:1.0.2'

    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'

    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.4.2'

    implementation 'com.google.firebase:firebase-firestore-ktx'
    implementation 'com.firebaseui:firebase-ui-auth:7.1.1'
    implementation 'com.google.firebase:firebase-firestore:22.1.2'

    implementation 'com.google.android.gms:play-services-maps:17.0.1'

    implementation 'com.android.support:recyclerview-v7:30'

    implementation 'androidx.fragment:fragment-ktx:1.3.3'
    implementation "androidx.fragment:fragment-ktx:1.3.3"

    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")

    implementation 'com.facebook.android:facebook-android-sdk:9.1.0'

    implementation 'org.hamcrest:hamcrest:2.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    testImplementation 'junit:junit:4.13.2'
    testImplementation "android.arch.core:core-testing:1.1.1"
    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.3"

    //in order to test DatePicker
    androidTestImplementation('com.android.support.test.espresso:espresso-contrib:3.0.2') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude module: 'support-annotations'
        exclude module: 'support-v4'
        exclude module: 'support-v13'
        exclude module: 'recyclerview-v7'
        exclude module: 'appcompat-v7'
    }

    // Import the BoM for the Firebase platform
    implementation platform('com.google.firebase:firebase-bom:26.7.0')
    // Declare the dependency for the Firebase Authentication library
    implementation 'com.google.firebase:firebase-auth-ktx'
    // Declare the dependency for the Realtime Database library
    implementation 'com.google.firebase:firebase-database-ktx'
    // Declare the dependency for the Cloud Storage library
    implementation 'com.google.firebase:firebase-storage-ktx'
    androidTestImplementation 'androidx.test:core-ktx:1.3.0'
    // Mockito framework
    // We have to use dexmaker version as we want to be able to mock final classes
    androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.28.1'
    androidTestImplementation "org.mockito.kotlin:mockito-kotlin:2.2.11"
    testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"

    // Hilt
    def hilt_version = '2.33-beta'
    implementation "com.google.dagger:hilt-android:$hilt_version"
    kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
    androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
    kaptAndroidTest "com.google.dagger:hilt-android-compiler:$hilt_version"

    //library for card swipes
    implementation "com.yuyakaido.android:card-stack-view:2.3.4"
    implementation "com.google.dagger:dagger:2.33"
    implementation "com.google.dagger:dagger-android-support:2.33"

    def hilt_lifecycle_viewmodel = "1.0.0-alpha03"
    implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_lifecycle_viewmodel"
    kapt "androidx.hilt:hilt-compiler:$hilt_lifecycle_viewmodel"


    //room
    def room_version = "2.3.0"
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-ktx:$room_version"
    //testImplementation "anrdoidx.room:room-testing:$room_version"

    implementation "com.squareup.okhttp3:okhttp:4.9.0"
    implementation "com.squareup.moshi:moshi-kotlin:1.12.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',
            '**/di/**',
            '**/UserHelper.*',
            '**/UserRepositoryImpl.*'
    ]
    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: [
            'jacoco/testDebugUnitTest.exec', 'outputs/code_coverage/debugAndroidTest/connected/*coverage.ec'
    ]))
}

connectedCheck {
    finalizedBy jacocoTestReport
}