apply plugin: 'com.android.application'
apply from: '../.winboll/winboll_app_build.gradle'
apply from: '../.winboll/winboll_lint_build.gradle'

def genVersionName(def versionName){
    // 检查编译标志位配置
    assert (winbollBuildProps['stageCount'] != null)
    assert (winbollBuildProps['baseVersion'] != null)
    // 保存基础版本号
    winbollBuildProps.setProperty("baseVersion", "${versionName}");
    //保存编译标志配置
    FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile)
    winbollBuildProps.store(fos, "${winbollBuildPropsDesc}");
    fos.close();
    
    // 返回编译版本号
    return "${versionName}." + winbollBuildProps['stageCount']
}

Properties properties = new Properties()
File localFile = project.rootProject.file('local.properties')
if (localFile.exists()) {
    InputStream inputStream = localFile.newDataInputStream()
    properties.load(inputStream)
}

def mapsdkkey = properties.getProperty('mapsdk.key', "")

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"
    
    defaultConfig {
        applicationId "cc.winboll.studio.positions"
        minSdkVersion 26
        targetSdkVersion 29
        versionCode 1
        // versionName 更新后需要手动设置 
        // 项目模块目录的 build.gradle 文件的 stageCount=0
        // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
        versionName "1.0" 
        if(true) {
            versionName = genVersionName("${versionName}")
        }
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = ["TencentMapSDK_KEY": mapsdkkey]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    // 定位服务
    implementation 'com.google.android.gms:play-services-location:20.0.0'

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.viewpager:viewpager:1.0.0'
    implementation 'androidx.fragment:fragment:1.0.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'pub.devrel:easypermissions:2.0.1'
    // 地图
    implementation 'com.tencent.map:tencent-map-vector-sdk:6.2.1.250120.3f971009.140342819'
    // 基础库
    implementation 'com.tencent.openmap:foundation:0.5.6.9be4e02'
    implementation 'com.tencent.map:sdk-utilities:1.0.9'
    implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.5.4.3'
    implementation 'com.google.code.gson:gson:2.8.5'
    
    implementation 'io.github.medyo:android-about-page:2.0.0'
    implementation 'com.github.getActivity:ToastUtils:10.5'
    
    implementation 'cc.winboll.studio:libapputils:9.3.2'
    implementation 'cc.winboll.studio:libappbase:1.5.6'
}
