apply plugin: 'com.android.library'

android {
    // If you want to use the debugger for JNI code, you want to debug this lib-project in Debug!
    // And due to gradle limitations/bugs, the best way is to always debug it in debug.
    // See https://code.google.com/p/android/issues/detail?id=52962
    // and http://stackoverflow.com/questions/27277433/why-does-gradle-build-my-module-in-release-mode-when-the-app-is-in-debug
    // defaultPublishConfig "debug"
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        compileSdkVersion 28
        buildToolsVersion "28.0.3"
        minSdkVersion 14
        resValue "bool", "embed", "false"
        externalNativeBuild {
            ndkBuild {
                arguments "-j4"
            }
        }
        ndk {
            // Specifies the ABI configurations of your native
            // libraries Gradle should build and package with your APK.
            abiFilters 'armeabi-v7a', 'arm64-v8a'
        }
        targetSdkVersion 29
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions 'mode'
    productFlavors {
        normal {
            dimension 'mode'
        }
        playstore {
            dimension 'mode'
        }
        embed {
            dimension 'mode'
            resValue "bool", "embed", "true"
        }
    }
    sourceSets {
        main {
            java {
                srcDir 'src/jni/SDL2/android-project/app/src/main/java'
                srcDir 'src/main/java'
            }
        }
        playstore {
            java {
                srcDir 'src/normal/java'
            }
        }
    }
    externalNativeBuild {
        ndkBuild {
            path "src/jni/Android.mk"
        }
    }
    lintOptions {
        abortOnError false
    }
    packagingOptions {
        exclude 'lib/arm64-v8a/libSDL2.so'
        exclude 'lib/armeabi-v7a/libSDL2.so'
    }
}

dependencies {
    api fileTree(dir: 'libs', include: ['*.jar'])
    api 'androidx.appcompat:appcompat:1.1.0-alpha01'
}
