From cd3fd475d8ebdf63a0142db0773f48514ca7be6f Mon Sep 17 00:00:00 2001 From: Jakob Andersen Date: Tue, 14 Feb 2017 13:48:14 +0000 Subject: [PATCH] Don't update Android SDK settings in build.gradle (#8089) --- .../flutter_tools/lib/src/android/gradle.dart | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/packages/flutter_tools/lib/src/android/gradle.dart b/packages/flutter_tools/lib/src/android/gradle.dart index b9035bb7c3b..0c4626835df 100644 --- a/packages/flutter_tools/lib/src/android/gradle.dart +++ b/packages/flutter_tools/lib/src/android/gradle.dart @@ -145,16 +145,6 @@ Future ensureGradlew() async { printTrace('Using gradle from $gradle.'); } - // Stamp the android/app/build.gradle file with the current android sdk and build tools version. - File appGradleFile = fs.file('android/app/build.gradle'); - if (appGradleFile.existsSync()) { - _GradleFile gradleFile = new _GradleFile.parse(appGradleFile); - AndroidSdkVersion sdkVersion = androidSdk.latestVersion; - gradleFile.replace('compileSdkVersion', "${sdkVersion.sdkLevel}"); - gradleFile.replace('buildToolsVersion', "'${sdkVersion.buildToolsVersionName}'"); - gradleFile.writeContents(appGradleFile); - } - // Run 'gradle wrapper'. List command = logger.isVerbose ? [gradle, 'wrapper'] @@ -255,26 +245,3 @@ Future buildGradleProjectV2(String gradlew, String buildModeName) async { apkFile.copySync('$gradleAppOutDir/app.apk'); printStatus('Built $apkFilename (${getSizeAsMB(apkFile.lengthSync())}).'); } - -class _GradleFile { - _GradleFile.parse(File file) { - contents = file.readAsStringSync(); - } - - String contents; - - void replace(String key, String newValue) { - // Replace 'ws key ws value' with the new value. - final RegExp regex = new RegExp('\\s+$key\\s+(\\S+)', multiLine: true); - Match match = regex.firstMatch(contents); - if (match != null) { - String oldValue = match.group(1); - int offset = match.end - oldValue.length; - contents = contents.substring(0, offset) + newValue + contents.substring(match.end); - } - } - - void writeContents(File file) { - file.writeAsStringSync(contents); - } -}