Tarjetakuna/Tarjetakuna

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

android {
    namespace 'com.github.sdp.tarjetakuna'
    compileSdk 33

    defaultConfig {
        applicationId "com.github.sdp.tarjetakuna"
        minSdk 28
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        debug {
            storeFile file("external/debug.keystore")
        }
    }

    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
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        viewBinding true
    }


    // allow to use assets folder in application and in tests
    sourceSets {
        main {
            assets {
                srcDirs 'src\\main\\assets'
            }
        }
        test {
            resources {
                srcDirs 'src\\test\\assets'
            }
        }
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.10.1'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.9.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

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

    implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
    implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
    implementation "androidx.fragment:fragment-ktx:1.5.7"
    implementation 'androidx.recyclerview:recyclerview:1.3.0'

    // local database
    implementation "androidx.room:room-runtime:2.5.1"
    implementation "androidx.room:room-ktx:2.5.1"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    kapt "androidx.room:room-compiler:2.5.1"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
    // json - java to kotlin serialization
    implementation 'com.google.code.gson:gson:2.9.0'


    implementation "androidx.navigation:navigation-compose:2.5.3"

    //glide
    implementation 'com.github.bumptech.glide:glide:4.15.0'
    kapt 'com.github.bumptech.glide:compiler:4.15.0'

    // webapi dependencies
    //noinspection GradleDependency If you use a version >2.8 of retrofit2, this warning appears: An illegal reflective access operation has occurred
    implementation 'com.squareup.retrofit2:retrofit:2.7.0'
    //noinspection GradleDependency If you use a version >2.8 of retrofit2, this warning appears: An illegal reflective access operation has occurred
    implementation 'com.squareup.retrofit2:converter-gson:2.7.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
    implementation "com.squareup.okhttp3:okhttp:4.10.0"
    implementation 'androidx.navigation:navigation-testing:2.5.3'

    // mock webserver dependencies for tests
    androidTestImplementation "com.squareup.okhttp3:mockwebserver:4.10.0"
    androidTestImplementation 'androidx.test:core-ktx:1.5.0'
    testImplementation "com.squareup.okhttp3:mockwebserver:4.10.0"

    //tests
    debugImplementation 'androidx.test:monitor:1.6.1'
    debugImplementation 'androidx.fragment:fragment-testing:1.5.7'
    testImplementation 'junit:junit:4.13.2'
    implementation 'androidx.test.ext:junit:1.1.5'
    implementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation 'androidx.test:runner:1.5.2'
    implementation 'androidx.test:rules:1.5.0'
    androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1'
    androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.5.1'
    testImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
    testImplementation 'androidx.test.espresso:espresso-contrib:3.5.1'
    testImplementation 'androidx.test.espresso:espresso-idling-resource:3.5.1'


    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation 'com.google.firebase:firebase-database-ktx:20.2.1' //added to make set work
    // Add the dependency for the Firebase SDK for Google Analytics
    implementation 'com.google.firebase:firebase-analytics-ktx:21.2.2'

    // TODO: Add the dependencies for any other 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-ktx:22.0.0'
    implementation 'com.google.firebase:firebase-firestore-ktx:24.6.0'
    implementation 'com.firebaseui:firebase-ui-auth:7.2.0'
    implementation 'com.google.gms:google-services:4.3.15'

    implementation 'io.magicthegathering:kotlinsdk:1.0.4'

    // Library to read and write Excel files
    implementation 'org.apache.poi:poi:5.2.2'
    implementation 'org.apache.poi:poi-ooxml:5.2.2'

    // google sign in testing dependencies
    testImplementation 'org.mockito:mockito-core:3.5.10'
    testImplementation "org.mockito:mockito-android:3.5.10"
    androidTestImplementation 'org.mockito:mockito-core:3.5.10'
    androidTestImplementation "org.mockito:mockito-android:3.5.10"
}

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/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
}