mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
70 lines
2.3 KiB
Groovy
70 lines
2.3 KiB
Groovy
def localProperties = new Properties()
|
|
def localPropertiesFile = rootProject.file('local.properties')
|
|
if (localPropertiesFile.exists()) {
|
|
localPropertiesFile.withInputStream { stream ->
|
|
localProperties.load(stream)
|
|
}
|
|
}
|
|
|
|
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 flutterVersion = file("$flutterRoot/version").text
|
|
def flutterVersionComponents = flutterVersion.split(/[^0-9]+/)
|
|
// Let the integer version code of xx.yy.zz-pre.nnn be xxyyzznnn.
|
|
int flutterVersionCode = Math.min(flutterVersionComponents[0].toInteger(), 20) * 100000000
|
|
flutterVersionCode += Math.min(flutterVersionComponents[1].toInteger(), 99) * 1000000
|
|
flutterVersionCode += Math.min(flutterVersionComponents[2].toInteger(), 999) * 1000
|
|
if (flutterVersionComponents.length > 3) {
|
|
flutterVersionCode += Math.min(flutterVersionComponents[3].toInteger(), 999)
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
|
|
android {
|
|
compileSdkVersion 27
|
|
|
|
lintOptions {
|
|
disable 'InvalidPackage'
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId "io.flutter.demo.gallery"
|
|
minSdkVersion 16
|
|
targetSdkVersion 27
|
|
// The Gallery app's version is defined by the Flutter framework's version.
|
|
versionCode flutterVersionCode
|
|
versionName "$flutterVersion"
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|
|
|
|
aaptOptions {
|
|
// TODO(goderbauer): remove when https://github.com/flutter/flutter/issues/8986 is resolved.
|
|
if(System.getenv("FLUTTER_CI_WIN")) {
|
|
println "AAPT cruncher disabled when running on Win CI."
|
|
cruncherEnabled false
|
|
}
|
|
}
|
|
}
|
|
|
|
flutter {
|
|
source '../..'
|
|
}
|
|
|
|
dependencies {
|
|
testImplementation 'junit:junit:4.12'
|
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
|
}
|