Unverified Commit 3cf40b43 authored by liyuqian's avatar liyuqian Committed by GitHub

Revert "Update examples to match the new version of generated build.gradle (#25483)" (#25563)

This reverts commit 8acc058c.

Reverts #25483

Reason for revert: it seems to break the flutter_gallery_instrumentation_test post-submit test.

TBR: @sbaranov
parent b8a035a3
...@@ -13,12 +13,12 @@ if (flutterRoot == null) { ...@@ -13,12 +13,12 @@ if (flutterRoot == null) {
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
flutterVersionCode = '1' throw new GradleException("versionCode not found. Define flutter.versionCode in the local.properties file.")
} }
def flutterVersionName = localProperties.getProperty('flutter.versionName') def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) { if (flutterVersionName == null) {
flutterVersionName = '1.0' throw new GradleException("versionName not found. Define flutter.versionName in the local.properties file.")
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
......
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader -> localPropertiesFile.withInputStream { stream ->
localProperties.load(reader) localProperties.load(stream)
} }
} }
...@@ -11,16 +11,6 @@ if (flutterRoot == null) { ...@@ -11,16 +11,6 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
...@@ -35,8 +25,8 @@ android { ...@@ -35,8 +25,8 @@ android {
applicationId "io.flutter.examples.catalog" applicationId "io.flutter.examples.catalog"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 27 targetSdkVersion 27
versionCode flutterVersionCode.toInteger() versionCode 1
versionName flutterVersionName versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
......
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader -> localPropertiesFile.withInputStream { stream ->
localProperties.load(reader) localProperties.load(stream)
} }
} }
...@@ -11,25 +11,14 @@ if (flutterRoot == null) { ...@@ -11,25 +11,14 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
} }
// The Gallery app's version is defined by the Flutter framework's version.
def flutterVersion = file("$flutterRoot/version").text def flutterVersion = file("$flutterRoot/version").text
def flutterVersionComponents = flutterVersion.split(/[^0-9]+/) def flutterVersionComponents = flutterVersion.split(/[^0-9]+/)
// Let the integer version code of xx.yy.zz-pre.nnn be xxyyzznnn. // Let the integer version code of xx.yy.zz-pre.nnn be xxyyzznnn.
int flutterVersionNumber = Math.min(flutterVersionComponents[0].toInteger(), 20) * 100000000 int flutterVersionCode = Math.min(flutterVersionComponents[0].toInteger(), 20) * 100000000
flutterVersionNumber += Math.min(flutterVersionComponents[1].toInteger(), 99) * 1000000 flutterVersionCode += Math.min(flutterVersionComponents[1].toInteger(), 99) * 1000000
flutterVersionNumber += Math.min(flutterVersionComponents[2].toInteger(), 999) * 1000 flutterVersionCode += Math.min(flutterVersionComponents[2].toInteger(), 999) * 1000
if (flutterVersionComponents.length > 3) { if (flutterVersionComponents.length > 3) {
flutterVersionNumber += Math.min(flutterVersionComponents[3].toInteger(), 999) flutterVersionCode += Math.min(flutterVersionComponents[3].toInteger(), 999)
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = "$flutterVersionNumber"
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = "$flutterVersion"
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
...@@ -46,8 +35,9 @@ android { ...@@ -46,8 +35,9 @@ android {
applicationId "io.flutter.demo.gallery" applicationId "io.flutter.demo.gallery"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 27 targetSdkVersion 27
versionCode flutterVersionCode.toInteger() // The Gallery app's version is defined by the Flutter framework's version.
versionName flutterVersionName versionCode flutterVersionCode
versionName "$flutterVersion"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
...@@ -75,6 +65,6 @@ flutter { ...@@ -75,6 +65,6 @@ flutter {
dependencies { dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:rules:1.0.1' androidTestImplementation 'com.android.support.test:rules:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
} }
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader -> localPropertiesFile.withInputStream { stream ->
localProperties.load(reader) localProperties.load(stream)
} }
} }
...@@ -11,16 +11,6 @@ if (flutterRoot == null) { ...@@ -11,16 +11,6 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
...@@ -35,8 +25,8 @@ android { ...@@ -35,8 +25,8 @@ android {
applicationId "io.flutter.examples.flutter_view" applicationId "io.flutter.examples.flutter_view"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 27 targetSdkVersion 27
versionCode flutterVersionCode.toInteger() versionCode 1
versionName flutterVersionName versionName "0.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
......
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader -> localPropertiesFile.withInputStream { stream ->
localProperties.load(reader) localProperties.load(stream)
} }
} }
...@@ -11,16 +11,6 @@ if (flutterRoot == null) { ...@@ -11,16 +11,6 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
...@@ -35,8 +25,8 @@ android { ...@@ -35,8 +25,8 @@ android {
applicationId "io.flutter.examples.hello_world" applicationId "io.flutter.examples.hello_world"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 27 targetSdkVersion 27
versionCode flutterVersionCode.toInteger() versionCode 1
versionName flutterVersionName versionName "0.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
......
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader -> localPropertiesFile.withInputStream { stream ->
localProperties.load(reader) localProperties.load(stream)
} }
} }
...@@ -11,16 +11,6 @@ if (flutterRoot == null) { ...@@ -11,16 +11,6 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
...@@ -35,8 +25,8 @@ android { ...@@ -35,8 +25,8 @@ android {
applicationId "io.flutter.examples.layers" applicationId "io.flutter.examples.layers"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 27 targetSdkVersion 27
versionCode flutterVersionCode.toInteger() versionCode 1
versionName flutterVersionName versionName "0.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
......
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader -> localPropertiesFile.withInputStream { stream ->
localProperties.load(reader) localProperties.load(stream)
} }
} }
...@@ -11,16 +11,6 @@ if (flutterRoot == null) { ...@@ -11,16 +11,6 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
...@@ -35,8 +25,8 @@ android { ...@@ -35,8 +25,8 @@ android {
applicationId "io.flutter.examples.platform_channel" applicationId "io.flutter.examples.platform_channel"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 27 targetSdkVersion 27
versionCode flutterVersionCode.toInteger() versionCode 1
versionName flutterVersionName versionName "0.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
......
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader -> localPropertiesFile.withInputStream { stream ->
localProperties.load(reader) localProperties.load(stream)
} }
} }
...@@ -11,16 +11,6 @@ if (flutterRoot == null) { ...@@ -11,16 +11,6 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
...@@ -35,8 +25,8 @@ android { ...@@ -35,8 +25,8 @@ android {
applicationId "io.flutter.examples.platform_view" applicationId "io.flutter.examples.platform_view"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 27 targetSdkVersion 27
versionCode flutterVersionCode.toInteger() versionCode 1
versionName flutterVersionName versionName "0.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
......
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader -> localPropertiesFile.withInputStream { stream ->
localProperties.load(reader) localProperties.load(stream)
} }
} }
...@@ -11,16 +11,6 @@ if (flutterRoot == null) { ...@@ -11,16 +11,6 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
...@@ -35,8 +25,8 @@ android { ...@@ -35,8 +25,8 @@ android {
applicationId "io.flutter.examples.stocks" applicationId "io.flutter.examples.stocks"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 27 targetSdkVersion 27
versionCode flutterVersionCode.toInteger() versionCode 1
versionName flutterVersionName versionName "0.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment