/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

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

group = GROUP
version = VERSION_NAME

android {
    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion rootProject.buildToolsVersion

    defaultConfig {
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion

        ndk {
            abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }

        externalNativeBuild {
            cmake {
                arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static'
            }
        }
    }

    externalNativeBuild {
        cmake {
            path 'CMakeLists.txt'
            version '3.6.0-rc2'
        }
    }

    compileOptions {
        targetCompatibility rootProject.targetCompatibilityVersion
        sourceCompatibility rootProject.sourceCompatibilityVersion
    }

    sourceSets {
        main {
            java.srcDir 'com'
            manifest.srcFile 'AndroidManifest.xml'
            res.srcDirs = ['res']
        }

        test {
            java.srcDirs 'tests'
        }
    }
}

dependencies {
    implementation 'com.google.code.findbugs:jsr305:3.0.1'
    implementation project(':yoga:proguard-annotations')
    implementation 'com.facebook.soloader:soloader:0.5.1'
    testImplementation 'junit:junit:4.12'
    testImplementation project(':testutil')
}

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/release.gradle')
