plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android' version '1.8.22'
}

Properties props = new Properties()
props.load(new FileInputStream(rootProject.file('release.properties')))

android {
    compileSdkVersion 34

    defaultConfig {
        versionCode 62

        minSdkVersion 21
        targetSdkVersion 34

        multiDexEnabled true
    }

    signingConfigs {
        release {
            storeFile file(props.keyStore)
            storePassword props.keyStorePassword
            keyAlias props.keyAlias
            keyPassword props.keyAliasPassword
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.release
        }
    }

    flavorDimensions = ['machine']
    productFlavors {
        macPlus {
            dimension 'machine'
            applicationId 'name.osher.gil.minivmac'
            versionName '1.7.2'

            externalNativeBuild {
                ndkBuild {
                    arguments "NDK_FLAVOR=macPlus"
                }
            }
        }

        macII {
            dimension 'machine'
            applicationId 'ninja.gil.miniv.ii'
            versionName '2.7.2'

            externalNativeBuild {
                ndkBuild {
                    arguments "NDK_FLAVOR=macII"
                }
            }
        }
    }

    splits {
        abi {
            enable true
            reset()
            include 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
            universalApk true
        }
    }

    externalNativeBuild {
        ndkBuild {
            path 'src/Android.mk'
        }
    }
    buildFeatures {
        viewBinding true
        buildConfig true
    }
    namespace 'name.osher.gil.minivmac'
}

dependencies {
    implementation 'com.android.support:multidex:1.0.3'

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'com.google.android.material:material:1.12.0'

    implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
    implementation 'androidx.navigation:navigation-fragment:2.8.7'
    implementation 'androidx.navigation:navigation-ui:2.8.7'
    implementation 'androidx.preference:preference:1.2.1'
}
