def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
//if (flutterVersionCode == null) {
flutterVersionCode = '103'
//}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
//if (flutterVersionName == null) {
flutterVersionName = '1.0.3'
//}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 29

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.ruedy.flutter_base_lib"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

//
//    signingConfigs {
//
//        release {
//            storeFile file("baseFlutter.keystore")    //key存放位置
//            storePassword "123123"          //打开key的密码
//            keyAlias "baselib"        //key 别名
//            keyPassword "123123"    //key的密码
//        }
//        //微信分享需要签名，所以在debug下方便测试，打上签名
//        debug {
//            storeFile file("baseFlutter.keystore")    //key存放位置
//            storePassword "123123"          //打开key的密码
//            keyAlias "baselib"        //key 别名
//            keyPassword "123123"    //key的密码
//        }
//    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
        debug {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
//
//    android {
//        //...
//        compileOptions {
//            sourceCompatibility JavaVersion.VERSION_1_8
//            targetCompatibility JavaVersion.VERSION_1_8
//        }
}

flutter {
    source '../..'
}
