plugins {
    id 'com.android.library'
}

android {
    namespace 'io.github.hexhacking.xdl'
    compileSdk rootProject.ext.compileSdkVersion
    buildToolsVersion = rootProject.ext.buildToolsVersion
    ndkVersion rootProject.ext.ndkVersion
    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        externalNativeBuild {
            cmake {
                abiFilters rootProject.ext.abiFilters.split(",")
                arguments "-DANDROID_STL=none"
                if(rootProject.ext.useASAN) {
                    arguments "-DANDROID_ARM_MODE=arm"
                    arguments "-DUSEASAN=ON"
                }
            }
        }
    }
    externalNativeBuild {
        cmake {
            path "src/main/cpp/CMakeLists.txt"
            version rootProject.ext.cmakeVersion
        }
    }
    compileOptions {
        sourceCompatibility rootProject.ext.javaVersion
        targetCompatibility rootProject.ext.javaVersion
    }
    buildTypes {
        debug {
            minifyEnabled false
        }
        release {
            minifyEnabled false
        }
    }
    buildFeatures {
        prefabPublishing true
        buildConfig false
    }
    prefab {
        xdl {
            headers "src/main/cpp/include"
        }
    }
    publishing {
        singleVariant('release') {
            withSourcesJar()
            withJavadocJar()
        }
    }
}

apply from: rootProject.file('gradle/publish.gradle')
