patrickfav/under-the-hood

View on GitHub
hood-core/build.gradle

Summary

Maintainability
Test Coverage
import com.android.builder.core.BuilderConstants

apply plugin: 'com.android.library'
apply plugin: 'de.mobilej.unmock'
apply plugin: 'com.vanniktech.android.junit.jacoco'
apply plugin: "com.github.kt3k.coveralls"
apply from: "$rootDir/gradle/checkstyle.gradle"
apply from: "$rootDir/gradle/jacoco-utils.gradle"

Properties localProps = rootProject.getSigningProperties()

android {
    defaultPublishConfig "release"
    testBuildType "release"

    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    signingConfigs {
        release {
            storeFile file(localProps.getProperty('RELEASE_KEYSTORE_PATH', 'fillhere'))
            storePassword localProps.getProperty('RELEASE_KEYSTORE_PW', '')
            keyAlias localProps.getProperty('RELEASE_KEY_ALIAS', '')
            keyPassword localProps.getProperty('RELEASE_KEY_PW', '')
        }
    }

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.versionCode
        versionName rootProject.ext.versionNameLib

        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

        buildConfigField "String", "BUILD_NUMBER", "\"" + getCiBuildNumber() + "\""
        buildConfigField "String", "BUILD_DATE", "\"" + getBuildTime() + "\""
        buildConfigField "boolean", "NO_OP", "false"

        consumerProguardFiles 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }

    buildTypes {
        noop {
            minifyEnabled false
            buildConfigField "boolean", "NO_OP", "true"
            consumerProguardFiles 'proguard-rules.pro', 'proguard-noop.pro'
        }

        release {
            minifyEnabled false
        }
    }

    unMock {
        keepStartingWith "android.util"
        keepStartingWith "com.android.internal"
        keep "android.view.MotionEvent"
    }

    lintOptions {
        abortOnError false
    }

    libraryVariants.all { variant ->
        variant.outputs.all {
            outputFileName = "${project.name}-${variant.name}-${version}.aar"
        }
    }
}

android.variantFilter { variant ->
    if (variant.buildType.name == BuilderConstants.DEBUG) {
        variant.setIgnore(true)
    }
}

dependencies {
    implementation 'androidx.core:core:1.3.0'
    implementation "androidx.recyclerview:recyclerview:$rootProject.ext.dependencies.androidx"
    implementation 'androidx.viewpager:viewpager:1.0.0'
    implementation "com.jakewharton.timber:timber:$rootProject.ext.dependencies.timber"
    implementation 'com.squareup:seismic:1.0.2'

    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    testImplementation "junit:junit:$rootProject.ext.dependencies.junit"
    unmock 'org.robolectric:android-all:4.3_r2-robolectric-0'
}

apply from: "$rootDir/gradle/publish.gradle"