SmashKs/OneShoot

View on GitHub
data/build.gradle

Summary

Maintainability
Test Coverage
/*
 * Copyright (C) 2018 The Smash Ks Open Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import dependenices.Deps.Data
import dependenices.Deps.Global
import dependenices.Deps.GlobalTest
import dependenices.Versions.Android

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco'

android {
    compileSdkVersion Android.compileSdk
    defaultConfig {
        minSdkVersion Android.minSdk
        targetSdkVersion Android.targetSdk
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            testCoverageEnabled true
        }
    }
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
    lintOptions { abortOnError false }
    ext { coverageSourceDirs = 'src/test/java' }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation project(':domain')
    implementation project(':ext')

    implementation Global.kotlin
    implementation Global.coroutine

    implementation Global.rxJava2
    implementation Global.rxKotlin

    implementation Global.shaver

    implementation Data.mapper

    //region DBFlow
    kapt Data.dbflowProcessor
    implementation(Data.dbflowCore) {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    implementation(Data.dbflow) {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    implementation(Data.dbflowKotlinExt) {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    implementation(Data.dbflowRxJava2) {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    implementation(Data.dbflowRxJava2KotlinExt) {
        exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jre7'
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    // sql-cipher database encryption (optional)
//    implementation(Data.dbflowSqlEncrypt) {
//        exclude group: 'com.android.support', module: 'support-annotations'
//    }
//    implementation(Data.dbflowSqlCipher) {
//        exclude group: 'com.android.support', module: 'support-annotations'
//    }
    //endregion

    implementation(Data.firebaseDB) {
        exclude group: 'com.android.support'
    }
    implementation(Data.firebaseVision) {
        exclude group: 'com.android.support'
    }
    implementation(Data.firebaseMLImageLabel) {
        exclude group: 'com.android.support'
    }

    implementation Data.cloudinary

    implementation Data.retrofit2
    implementation Data.retrofit2AdapterRxJava2

    //region Test Libraries
    testImplementation GlobalTest.kotlin
    testImplementation GlobalTest.junit
    testImplementation(GlobalTest.mockito) {
        exclude group: 'org.mockito', module: 'mockito-core'
    }
    testImplementation GlobalTest.assertj
    testImplementation GlobalTest.powerMockJunit
    testImplementation GlobalTest.powerMockito
    //region For the the newest version.
    testImplementation GlobalTest.byteBuddyAgent
    testImplementation GlobalTest.byteBuddyAndroid
    //endregion
    //endregion
}

tasks.withType(Test) { jacoco.includeNoLocationClasses = true }
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
    reports {
        xml.enabled = true
        html.enabled = 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/kotlin"

    sourceDirectories = files([mainSrc])
    classDirectories = files([debugTree])
    executionData = fileTree(dir: project.buildDir, includes: [
            'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
    ])
}