plugins {
    id 'com.android.application'
}

android {
    namespace 'io.github.hexhacking.xdl.sample'
    compileSdk rootProject.ext.compileSdkVersion
    buildToolsVersion = rootProject.ext.buildToolsVersion
    ndkVersion rootProject.ext.ndkVersion
    defaultConfig {
        applicationId "io.github.hexhacking.xdl.sample"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters rootProject.ext.abiFilters.split(",")
        }
        externalNativeBuild {
            cmake {
                abiFilters rootProject.ext.abiFilters.split(",")
                if(rootProject.ext.dependencyOnLocalLibrary) {
                    arguments "-DDEPENDENCY_ON_LOCAL_LIBRARY=ON"
                }
            }
        }
    }
    externalNativeBuild {
        cmake {
            path "src/main/cpp/CMakeLists.txt"
            version rootProject.ext.cmakeVersion
        }
//        ndkBuild {
//            path "src/main/cpp/Android.mk"
//        }
    }
    compileOptions {
        sourceCompatibility rootProject.ext.javaVersion
        targetCompatibility rootProject.ext.javaVersion
    }
    buildTypes {
        debug {
            minifyEnabled false
        }
        release {
            minifyEnabled false
        }
    }
    packagingOptions {
        jniLibs {
            pickFirsts += ['**/libxdl.so']
        }
        if (rootProject.ext.useASAN) {
            doNotStrip "**/*.so"
        }
    }
    buildFeatures {
        prefab true
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.11.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

    if (rootProject.ext.dependencyOnLocalLibrary) {
        implementation project(':xdl')
    } else {
        implementation 'io.github.hexhacking:xdl:' + rootProject.ext.xdlVersion
    }
}

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