milosmns/silly-android

View on GitHub
sillyandroid/build.gradle

Summary

Maintainability
Test Coverage
apply plugin: 'com.android.library'
apply plugin: 'checkstyle'
apply plugin: 'jacoco-android'

/*
 * To upload to Bintray, run:
 * .\gradlew sillyandroid:clean sillyandroid:install
 * .\gradlew sillyandroid:bintrayUpload
 * More information on http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
 * Configuration is in gradle.properties, secures are in local.properties
 */

android {
    compileSdkVersion COMPILE_SDK
    buildToolsVersion BUILD_TOOLS

    defaultConfig {
        minSdkVersion MINIMUM_SDK
        targetSdkVersion TARGET_SDK
        versionCode VERSION_CODE
        versionName VERSION_NAME
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    // this is a demo app, don't worry about signing :)
    signingConfigs {
        release {
            keyAlias 'sillyandroid'
            keyPassword 'sillyandroid'
            storeFile file('../signing/keystore.jks')
            storePassword 'sillyandroid'
        }
    }

    // specific options for TravisCI emulators (they take a while to start)
    adbOptions {
        timeOutInMs 20 * 60 * 1000 // 20 minutes
        installOptions "-d", "-t"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }

    lintOptions {
        quiet false // turn off analysis progress reporting by lint
        abortOnError true // stop the gradle build if errors are found
        ignoreWarnings false // report all issues
        absolutePaths true // emit full/absolute paths to files with errors
        checkAllWarnings false // don't check all issues, including those that are off by default
        warningsAsErrors true // treat all warnings as errors
        disable 'UnusedResources', 'UnusedIds' // turn off checking for these
        // enable 'RtlHardcoded','RtlCompat', 'RtlEnabled' # don't re-enable anything, keep default config
        // check 'NewApi', 'InlinedApi' # don't check *only* these issues
        noLines false // include source code lines in the error output
        showAll true // show all locations for an error, do not truncate lists, etc.
        // lintConfig file("default-lint.xml") # don't use fallback lint configuration (default severities, etc.)
        textReport true // generate a text report of issues
        textOutput 'stdout' // location to write the output; can be a file or 'stdout'
        xmlReport false // don't generate an XML report for use by for example Jenkins
        // xmlOutput file("lint-report.xml") # don't change the file to write report to (if not specified, defaults to lint-results.xml)
        htmlReport true // generate an HTML report (with issue explanations, sourcecode, etc)
        // htmlOutput file("lint-report.html") # don't change the path to report (default will be lint-results.html in the build_dir)

        checkReleaseBuilds true // run lint on all release builds for issues with severity=fatal; abort the build (check 'abortOnError') if any are found
        // fatal 'NewApi', 'InlineApi' # don't change issue severities
        // error 'Wakelock', 'TextViewEdits' # don't change issue severities
        // warning 'ResourceAsColor' # don't change issue severities
        // ignore 'TypographyQuotes' # don't change issue severities
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

jacocoAndroidUnitTestReport {
    csv.enabled false
    html.enabled true
    xml.enabled true
}

dependencies {
    api fileTree(dir: 'libs', include: ['*.jar'])
    compileOnly "com.android.support:appcompat-v7:$APPCOMPAT"

    testImplementation "com.android.support:appcompat-v7:$APPCOMPAT"
    testImplementation "org.mockito:mockito-core:$MOCKITO"
    testImplementation 'junit:junit:4.12'
}

// Maven push plugin
apply from: '../gradle/gradle-mvn-push.gradle'