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

targetCompatibility = '1.7'
sourceCompatibility = '1.7'

version = '1.4.2'
group = 'com.facebook.yoga'

// We currently build the native libraries with buck and bundle them together
// at this point into the AAR
task buckBuildAndCopy(type: Exec) {
    commandLine "$rootDir/scripts/build_natives_for_gradle.sh"
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 19
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    sourceSets {
        main {
            java.srcDir 'com'
            manifest.srcFile 'AndroidManifest.xml'
            res.srcDirs = ['res']
            jniLibs.srcDirs = ['build/buck-out/jniLibs']
        }
    }
}

preBuild.dependsOn buckBuildAndCopy

dependencies {
    compile(name: 'jsr305')
    compile(name: 'soloader-0.1.0', ext: 'aar')
    provided(project(':yoga:proguard-annotations'))
}

task sourcesJar(type: Jar) {
    classifier = 'source'
    from android.sourceSets.main.java.srcDirs
}

task javadoc(type: Javadoc) {
    failOnError false
    source = android.sourceSets.main.java.sourceFiles
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    classpath += configurations.compile
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

ext {
    bintrayName = "com.facebook.yoga:yoga"
}

apply from: rootProject.file('gradle/android-jcenter-install.gradle')
