apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'

check.dependsOn 'checkstyle', 'findbugs'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "org.somenet.android.helloworld2"
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 12
        versionName "2.1.3a"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    if (new File("${System.properties['user.home']}/.android/release.gradle").exists()) {
        apply from: "${System.properties['user.home']}/.android/release.gradle";
    } else {
        logger.warn('SigningConfig not found!')
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.+'
}


task checkstyle(type: Checkstyle) {
    source 'src'
    include '**/*.java'
    exclude '**/gen/**'
    classpath = files()

    configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
}

task findbugs(type: FindBugs) {
    source 'src'
    include '**/*.java'
    exclude '**/gen/**'
    classpath = files()

    excludeFilter file("${project.rootDir}/config/findbugs/findbugs-filter.xml")
    classes = files("${project.rootDir}/app/build/intermediates/classes/")

    ignoreFailures = true

    reports {
        xml.enabled = true
        html.enabled = false
    }
}