plugins {
     id 'com.android.application'
}

def buildWithCMake = project.hasProperty('BUILD_WITH_CMAKE');

android {
    namespace = "org.libsdl.app"
    compileSdkVersion 35
    ndkVersion = "28.2.13676358"
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 35
        versionCode 1
        versionName "1.0"
        externalNativeBuild {
            ndkBuild {
                arguments "APP_PLATFORM=android-21"
                // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
                abiFilters 'arm64-v8a'
            }
            cmake {
                arguments "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_static"
                // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
                abiFilters 'arm64-v8a'
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    applicationVariants.all { variant ->
        tasks["merge${variant.name.capitalize()}Assets"]
            .dependsOn("externalNativeBuild${variant.name.capitalize()}")
    }
    if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
        sourceSets.main {
            jniLibs.srcDir 'libs'
        }
        externalNativeBuild {
            if (buildWithCMake) {
                cmake {
                    path 'jni/CMakeLists.txt'
                }
            } else {
                ndkBuild {
                    path 'jni/Android.mk'
                }
            }
        }

    }
    lint {
        abortOnError = false
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
}
