apply plugin: "com.android.library"
apply plugin: "kotlin-android"

android {
    buildToolsVersion = versions.buildTools
    compileSdkVersion versions.compileSdk
    ndkVersion versions.ndkVersion

    defaultConfig {
        minSdkVersion versions.minSdk
        targetSdkVersion versions.targetSdk
        versionCode versions.libVersionCode
        versionName versions.libVersionName
        setProperty("archivesBaseName", "gdovrmobile.${versionName}")

        externalNativeBuild {
            cmake {
                cppFlags "-std=c++14"
            }
        }
    }

    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }

    compileOptions {
        sourceCompatibility versions.javaVersion
        targetCompatibility versions.javaVersion
    }

    flavorDimensions "functionality"
    productFlavors {
        full {
            ndk {
                abiFilters "arm64-v8a", "armeabi-v7a"
            }
            externalNativeBuild {
                cmake {
                    arguments "-DFLAVOR=FULL"
                }
            }
        }
        stub {
            externalNativeBuild {
                cmake {
                    arguments "-DFLAVOR=STUB"
                }
            }
        }
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlinVersion}"
    if (rootProject.findProject(":godot:lib") != null) {
        compileOnly(project(":godot:lib"))
    } else {
        compileOnly(fileTree(dir: "libs", include: ["godot-lib*.aar"]))
    }
}
