apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

dependencies {
    api project(':vtm')
    api 'com.caverock:androidsvg:1.2.2-beta-1'
}

android {
    compileSdkVersion androidCompileSdk()
    buildToolsVersion "$androidBuildVersionTools"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    defaultConfig {
        versionCode versionCode()
        versionName versionName()
        minSdkVersion androidMinSdk()
        targetSdkVersion androidTargetSdk()
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
        }
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }

    lintOptions { abortOnError false }
}

android.libraryVariants.all { variant ->
    def name = variant.buildType.name
    if (name == "debug")
        return

    def jar = project.tasks.create "jar${name.capitalize()}", Jar
    jar.dependsOn variant.javaCompiler
    jar.from variant.javaCompiler.destinationDir
    artifacts.add('archives', jar)

    file('natives').eachDir() { dir ->
        def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
        nativesJar.classifier = "natives-${dir.name}"
        nativesJar.from(dir.path)
        artifacts.add('archives', nativesJar)
    }
}

if (project.hasProperty("SONATYPE_USERNAME")) {
    afterEvaluate {
        project.apply from: "${rootProject.projectDir}/deploy.gradle"
    }
}
