Reverts "Use Gradle KTS in new Android app projects by default (#154061)" (#157194)

Reverts: flutter/flutter#154061
Initiated by: QuncCccccc
Reason for reverting: might be the reason that cause Framework tree to red
Original PR Author: bartekpacia

Reviewed By: {gmackall, reidbaker}

This change reverts the following previous change:
This PR resolves #151166
This commit is contained in:
auto-submit[bot]
2024-10-18 21:14:46 +00:00
committed by GitHub
parent d3c54a115f
commit 9a41f11610
18 changed files with 112 additions and 133 deletions

View File

@@ -467,19 +467,7 @@ class AndroidProject extends FlutterProjectPlatform {
static final RegExp _androidNamespacePattern = RegExp('android {[\\S\\s]+namespace\\s*=?\\s*[\'"](.+)[\'"]');
static final RegExp _applicationIdPattern = RegExp('^\\s*applicationId\\s*=?\\s*[\'"](.*)[\'"]\\s*\$');
static final RegExp _imperativeKotlinPluginPattern = RegExp('^\\s*apply plugin\\:\\s+[\'"]kotlin-android[\'"]\\s*\$');
/// Examples of strings that this regex matches:
/// - `id "kotlin-android"`
/// - `id("kotlin-android")`
/// - `id ( "kotlin-android" ) `
/// - `id "org.jetbrains.kotlin.android"`
/// - `id("org.jetbrains.kotlin.android")`
/// - `id ( "org.jetbrains.kotlin.android" )`
static final List<RegExp> _declarativeKotlinPluginPatterns = <RegExp>[
RegExp('^\\s*id\\s*\\(?\\s*[\'"]kotlin-android[\'"]\\s*\\)?\\s*\$'),
RegExp('^\\s*id\\s*\\(?\\s*[\'"]org.jetbrains.kotlin.android[\'"]\\s*\\)?\\s*\$'),
];
static final RegExp _declarativeKotlinPluginPattern = RegExp('^\\s*id\\s+[\'"]kotlin-android[\'"]\\s*\$');
/// Pattern used to find the assignment of the "group" property in Gradle.
/// Expected example: `group "dev.flutter.plugin"`
@@ -575,9 +563,7 @@ class AndroidProject extends FlutterProjectPlatform {
/// True, if the app project is using Kotlin.
bool get isKotlin {
final bool imperativeMatch = firstMatchInFile(appGradleFile, _imperativeKotlinPluginPattern) != null;
final bool declarativeMatch = _declarativeKotlinPluginPatterns.any((RegExp pattern) {
return (firstMatchInFile(appGradleFile, pattern) != null);
});
final bool declarativeMatch = firstMatchInFile(appGradleFile, _declarativeKotlinPluginPattern) != null;
return imperativeMatch || declarativeMatch;
}