apply plugin: 'com.android.library'
apply plugin: 'jacoco'

def projectName="clean-simple-calendar"

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


    buildTypes {
        debug {
            testCoverageEnabled true
        }
    }

    testOptions {
        unitTests {
            returnDefaultValues = true
        }
    }

    libraryVariants.all { variant ->
        variant.outputs.each { output ->
            def outputFile = output.outputFile
            if (outputFile != null && outputFile.name.endsWith('.aar')) {
                def fileName = "${projectName}-${defaultConfig.versionName}.aar"
                output.outputFile = new File(outputFile.parent, fileName)
            }
        }
    }
}


dependencies {
    compile 'com.android.support:recyclerview-v7:23.2.1'
    compile 'com.android.support:support-annotations:23.2.1'

    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'
    testCompile 'org.easytesting:fest-assert-core:2.0M10'

}
jacoco {
    toolVersion = "0.7.9"
}

task codeCoverageReport(type: JacocoReport, dependsOn: ["testDebug"]) {

    group = "Reporting"
    description = "Generate Jacoco coverage reports for Debug build"

    reports {
        xml.enabled = true
        xml.destination "${buildDir}/reports/jacoco/report.xml"
        html.enabled = true
    }

    // what to exclude from coverage report
    // UI, "noise", generated classes, platform classes, etc.
    def excludes = [
            '**/R.class',
            '**/R$*.class',
            '**/BuildConfig.*',
            '**/Manifest*.*',
            '**/*Test*.*',
            '**/*Fragment.*',
            '**/*Activity.*'
    ]
    // generated classes
    classDirectories = fileTree(
            dir: "$buildDir/intermediates/classes/debug",
            excludes: excludes
    )

    // sources
    sourceDirectories = files([android.sourceSets.main.java.srcDirs])
    executionData = files("$buildDir/jacoco/testDebug.exec")
}

apply from: 'https://raw.githubusercontent.com/shamanland/gradle-mvn-push/cc18d56549cdea03f744b6fff27911569394073e/gradle-mvn-push.gradle'



