plugins {
    id 'com.android.application'
}

def AppMajorVersion = 1
def AppMinorVersion = 0
def AppBuildNumber = 18

def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber
def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.xypower.mpmaster"
        minSdk 25
        targetSdk 28
        versionCode AppVersionCode
        versionName AppVersionName

        buildConfigField "long","BUILD_TIMESTAMP", System.currentTimeMillis() + "L"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            jniDebuggable true
            android.applicationVariants.all { variant ->
                variant.outputs.all { output ->
                    if (outputFileName.endsWith('.apk')) {
                        def fileName = "MpMaster_v${defaultConfig.versionName}_${new Date(System.currentTimeMillis()).format("yyyyMMdd")}.apk"
                        outputFileName = fileName
                    }
                }
            }
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildFeatures {
        viewBinding true
    }

    signingConfigs {
        release{
            storeFile file('../sign.jks')
            storePassword 'XyMpApp'
            keyAlias 'xymp'
            keyPassword 'XyMpApp'
        }
        debug{
            storeFile file('../sign.jks')
            storePassword 'XyMpApp'
            keyAlias 'xymp'
            keyPassword 'XyMpApp'
        }
    }

}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.annotation:annotation:+'
    implementation 'com.linkedin.dexmaker:dexmaker:2.28.3'
    implementation project(path: ':common')
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation files('libs/devapi.aar')
}