import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "net.named_data.nfd"
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 2001
        versionName "0.2.1"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            jniDebuggable true
        }
    }
    sourceSets {
        main {
            java.srcDirs "src/main/java"
            res.srcDirs "src/main/res"
            jniLibs.srcDir 'src/main/libs'
            jni.srcDirs = [] //disable automatic ndk-build call
        }
        androidTest.setRoot('tests')
        androidTest.java.srcDirs = ['tests/src']
    }

    splits {
        abi {
            enable true // enable ABI split feature to create one APK per ABI
            universalApk true //generate an additional APK that targets all the ABIs
        }
    }

    // map for the version code
    // versionCode digit for each supported ABI, with 64bit>32bit and x86>armeabi-*
    project.ext.versionCodes = ['armeabi': 1,
                                'armeabi-v7a': 2,
                                'arm64-v8a': 3,
                                'mips': 5,
                                'mips64': 6,
                                'x86': 8,
                                'x86_64': 9]

    android.applicationVariants.all { variant ->
        // assign different version code for each output
        variant.outputs.each { output ->
            output.versionCodeOverride = project.ext.versionCodes.get(
                    output.getFilter(
                            com.android.build.OutputFile.ABI), 0) * 1000000 +
                    defaultConfig.versionCode
        }
    }

    // call regular ndk-build(.cmd) script from app directory
    task ndkBuild(type: Exec) {
        def args = [getNdkBuildCmd(), '-C', file('src/main').absolutePath]

        if (System.env.NDK_BUILD_PARALLEL != null) {
           args.add("-j" + System.env.NDK_BUILD_PARALLEL)
        }
        else {
           args.add("-j" + Runtime.runtime.availableProcessors())
        }

        if (System.env.NDK_BUILD_ABI != null) {
           args.add("APP_ABI=" + System.env.NDK_BUILD_ABI)
        }

        if (System.env.NDK_DEBUG != null) {
           args.add("NDK_DEBUG=1")
        }
        commandLine args
    }

    tasks.withType(JavaCompile) {
        compileTask -> compileTask.dependsOn ndkBuild
    }

    task cleanNative(type: Exec) {
        commandLine getNdkBuildCmd(), '-C', file('src/main').absolutePath, 'clean'
    }

    clean.dependsOn cleanNative
}

def getNdkBuildCmd() {
    def ndk_build = getNdkDir() + "/ndk-build"
    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
        ndk_build += ".cmd"
    }

    return ndk_build
}

def getNdkDir() {
    if (System.env.ANDROID_NDK_ROOT != null)
        return System.env.ANDROID_NDK_ROOT

    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    def ndk_dir = properties.getProperty('ndk.dir', null)
    if (ndk_dir == null) {
        throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")
    }
    return ndk_dir
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.android.support:support-v4:21.0.3'
}
