apply plugin: 'com.android.application'

def keyStorePropertiesFile = rootProject.file('local.static.properties')
def keyStoreProperties = new Properties()
keyStoreProperties.load(new FileInputStream(keyStorePropertiesFile))

def projectPropertiesFile = rootProject.file('project.properties')
def projectProperties = new Properties()
projectProperties.load(new FileInputStream(projectPropertiesFile))

android {
    compileSdk = 34
    buildToolsVersion = '34.0.0'
    def appIdParts = projectProperties['applicationId'].split(/\./)
    def nameCount = appIdParts.size()
    def appIdLastPart = appIdParts[nameCount-1]

    assetPacks = [":game"]

    defaultConfig {
        applicationId projectProperties['applicationId']
        archivesBaseName = "app-" + appIdLastPart
        minSdkVersion 19
        targetSdkVersion 33
        versionCode Integer.parseInt(projectProperties.getProperty('versionCode'))
        versionName projectProperties['versionName']
    }
    
    sourceSets.main {
        jniLibs.srcDir '../../plugins'
    }

    androidResources {
        noCompress = ['ags', 'vox']
    }

    signingConfigs {
        release {
            storeFile file(keyStoreProperties['storeFile'])
            storePassword keyStoreProperties['storePassword']
            keyAlias keyStoreProperties['keyAlias']
            keyPassword keyStoreProperties['keyPassword']
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            signingConfig signingConfigs.release
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    namespace 'com.mystudioname.mygamename'
}

dependencies {
    api project(':runtime')
    implementation 'androidx.core:core:1.3.2'
}
