apply plugin: 'com.android.application'

dependencies {
    compile project(':support-v4')
    compile project(':support-appcompat-v7')
    compile project(':extern:AndroidPinning')
    compile project(':extern:UniversalImageLoader:library')
    compile project(':extern:MemorizingTrustManager')
    compile project(':extern:libsuperuser:libsuperuser')
    compile project(':extern:nanohttpd:core')
    compile project(':extern:jmdns')
    compile project(':extern:zipsigner')
    compile project(':extern:zxing-core')
    compile( project(':extern:android-support-v4-preferencefragment') ) {
        exclude module: 'support-v4'
    }
}

android {
    compileSdkVersion 21
    buildToolsVersion '21.1.2'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        instrumentTest.setRoot('test')
    }

    buildTypes {
        release {
            minifyEnabled false
        }
    }

    compileOptions.encoding = "UTF-8"

    // Enable all Android lint warnings
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:all"
        }
    }

    lintOptions {
        abortOnError false
        textReport true
        textOutput file("build/outputs/lint-results.txt")
    }

}

// TODO: This person took the example code below from another blogpost online, however
// I lost the reference to it:
// http://stackoverflow.com/questions/23297562/gradle-javadoc-and-android-documentation
android.applicationVariants.all { variant ->

    task("generate${variant.name}Javadoc", type: Javadoc) {
        title = "$name $version API"
        description "Generates Javadoc for F-Droid."
        source = variant.javaCompile.source
        ext.androidJar = "${android.plugin.sdkFolder}/platforms/${android.compileSdkVersion}/android.jar"
        classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
        options.links("http://docs.oracle.com/javase/7/docs/api/");
        options.links("http://d.android.com/reference/");
        exclude '**/BuildConfig.java'
        exclude '**/R.java'
    }
}
