Remove conditionality in templates that was for AGP <= 4.2 support (#151845)

Not needed after https://github.com/flutter/flutter/pull/149204 (as long as nothing has changed since the comment was made 🙂).

Fixes https://github.com/flutter/flutter/issues/145105.
This commit is contained in:
Gray Mackall 2024-07-16 15:33:24 -07:00 committed by GitHub
parent 6e189a7452
commit 8c5fbb4021
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 3 additions and 28 deletions

View File

@ -24,11 +24,7 @@ apply plugin: "com.android.library"
apply plugin: "kotlin-android"
android {
// Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) {
namespace = "{{androidIdentifier}}"
}
namespace = "{{androidIdentifier}}"
compileSdk = {{compileSdkVersion}}
defaultConfig {
minSdk = {{minSdkVersion}}

View File

@ -3,11 +3,7 @@ def flutterPluginVersion = "managed"
apply plugin: "com.android.application"
android {
// Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) {
namespace = "{{androidIdentifier}}.host"
}
namespace = "{{androidIdentifier}}.host"
compileSdk = {{compileSdkVersion}}
compileOptions {

View File

@ -30,11 +30,7 @@ group = "{{androidIdentifier}}"
version = "1.0"
android {
// Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) {
namespace = "{{androidIdentifier}}"
}
namespace = "{{androidIdentifier}}"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

View File

@ -3054,8 +3054,6 @@ void main() {
final String buildGradleContent = await buildGradleFile.readAsString();
expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true);
// The namespace should be conditionalized for AGP <4.2.
expect(buildGradleContent.contains('if (project.android.hasProperty("namespace")) {'), true);
});
testUsingContext('Android FFI plugin contains namespace', () async {
@ -3077,8 +3075,6 @@ void main() {
final String buildGradleContent = await buildGradleFile.readAsString();
expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true);
// The namespace should be conditionalized for AGP <4.2.
expect(buildGradleContent.contains('if (project.android.hasProperty("namespace")) {'), true);
});
testUsingContext('Android Kotlin plugin contains namespace', () async {
@ -3101,8 +3097,6 @@ void main() {
final String buildGradleContent = await buildGradleFile.readAsString();
expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true);
// The namespace should be conditionalized for AGP <4.2.
expect(buildGradleContent.contains('if (project.android.hasProperty("namespace")) {'), true);
});
testUsingContext('Flutter module Android project contains namespace', () async {
@ -3128,13 +3122,6 @@ void main() {
expect(moduleFlutterBuildGradleFileContent.contains(expectedNameSpace), true);
const String expectedHostNameSpace = 'namespace = "com.bar.foo.flutter_project.host"';
expect(moduleAppBuildGradleFileContent.contains(expectedHostNameSpace), true);
// The namespaces should be conditionalized for AGP <4.2.
const String expectedConditional = 'if (project.android.hasProperty("namespace")) {';
expect(moduleBuildGradleFileContent.contains(expectedConditional), true);
expect(moduleAppBuildGradleFileContent.contains(expectedConditional), true);
expect(moduleFlutterBuildGradleFileContent.contains(expectedConditional), true);
}, overrides: <Type, Generator>{
Pub: () => Pub.test(
fileSystem: globals.fs,