buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
    }
}
apply plugin: 'android-library'
apply plugin: 'maven-publish'

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
}

//'com.github.amigold.fundapter:library:1.01'
version '1.03'
group 'com.github.amigold.fundapter'

android.libraryVariants
publishing {
    publications {
        maven(MavenPublication) {
            artifact './build/bundles/debug/classes.jar'
//            artifact './build/libs/library-debug.aar'
        }
    }
}

android {

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

    }
    compileSdkVersion 10
    buildToolsVersion "19.1.0"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    lintOptions {
        // set to true to turn off analysis progress reporting by lint
        quiet true
        // if true, stop the gradle build if errors are found
        abortOnError true
        // if true, only report errors
        ignoreWarnings false
        // if true, check all issues, including those that are off by default
        checkAllWarnings true
        // if true, treat all warnings as errors
        warningsAsErrors true
        // turn off checking the given issue id's
        // disable 'TypographyFractions','TypographyQuotes'
        // turn on the given issue id's
        // enable 'RtlHardcoded','RtlCompat', 'RtlEnabled'
        // check *only* the given issue id's
        // check 'NewApi', 'InlinedApi'
        // if true, don't include source code lines in the error output
        noLines false
        // if true, show all locations for an error, do not truncate lists, etc.
        showAll true
        // if true, generate a text report of issues (false by default)
        textReport true
        // location to write the output; can be a file or 'stdout'
        textOutput 'stdout'
        // if true, generate an XML report for use by for example Jenkins
        xmlReport false
        // file to write report to (if not specified, defaults to lint-results.xml)
        xmlOutput file("build/lint/lint-results.xml")
        // if true, generate an HTML report (with issue explanations, sourcecode, etc)
        htmlReport true
        htmlOutput file("build/lint/lint-results.html")

    }
}

android.libraryVariants.all { variant ->
    def name = variant.buildType.name

    def checkstyle = project.tasks.create "checkstyle${name.capitalize()}", Checkstyle
    checkstyle.dependsOn variant.javaCompile
    checkstyle.source variant.javaCompile.source
    checkstyle.classpath = project.fileTree(variant.javaCompile.destinationDir)
    checkstyle.exclude('**/BuildConfig.java')
    project.tasks.getByName("check").dependsOn checkstyle

    // Only attach a jar for non-debug build types.
//    if (!name.equals(com.android.builder.BuilderConstants.DEBUG)) {
    def task = project.tasks.create "jar${name.capitalize()}", Jar
    task.dependsOn variant.javaCompile
    task.from variant.javaCompile.destinationDir
    artifacts.add('archives', task);
//    }
}

apply from: '../maven_push.gradle'