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:
parent
6e189a7452
commit
8c5fbb4021
@ -24,11 +24,7 @@ apply plugin: "com.android.library"
|
|||||||
apply plugin: "kotlin-android"
|
apply plugin: "kotlin-android"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
// Conditional for compatibility with AGP <4.2.
|
namespace = "{{androidIdentifier}}"
|
||||||
if (project.android.hasProperty("namespace")) {
|
|
||||||
namespace = "{{androidIdentifier}}"
|
|
||||||
}
|
|
||||||
|
|
||||||
compileSdk = {{compileSdkVersion}}
|
compileSdk = {{compileSdkVersion}}
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdk = {{minSdkVersion}}
|
minSdk = {{minSdkVersion}}
|
||||||
|
@ -3,11 +3,7 @@ def flutterPluginVersion = "managed"
|
|||||||
apply plugin: "com.android.application"
|
apply plugin: "com.android.application"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
// Conditional for compatibility with AGP <4.2.
|
namespace = "{{androidIdentifier}}.host"
|
||||||
if (project.android.hasProperty("namespace")) {
|
|
||||||
namespace = "{{androidIdentifier}}.host"
|
|
||||||
}
|
|
||||||
|
|
||||||
compileSdk = {{compileSdkVersion}}
|
compileSdk = {{compileSdkVersion}}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
@ -30,11 +30,7 @@ group = "{{androidIdentifier}}"
|
|||||||
version = "1.0"
|
version = "1.0"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
// Conditional for compatibility with AGP <4.2.
|
namespace = "{{androidIdentifier}}"
|
||||||
if (project.android.hasProperty("namespace")) {
|
|
||||||
namespace = "{{androidIdentifier}}"
|
|
||||||
}
|
|
||||||
|
|
||||||
compileSdk = flutter.compileSdkVersion
|
compileSdk = flutter.compileSdkVersion
|
||||||
ndkVersion = flutter.ndkVersion
|
ndkVersion = flutter.ndkVersion
|
||||||
|
|
||||||
|
@ -3054,8 +3054,6 @@ void main() {
|
|||||||
final String buildGradleContent = await buildGradleFile.readAsString();
|
final String buildGradleContent = await buildGradleFile.readAsString();
|
||||||
|
|
||||||
expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true);
|
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 {
|
testUsingContext('Android FFI plugin contains namespace', () async {
|
||||||
@ -3077,8 +3075,6 @@ void main() {
|
|||||||
final String buildGradleContent = await buildGradleFile.readAsString();
|
final String buildGradleContent = await buildGradleFile.readAsString();
|
||||||
|
|
||||||
expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true);
|
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 {
|
testUsingContext('Android Kotlin plugin contains namespace', () async {
|
||||||
@ -3101,8 +3097,6 @@ void main() {
|
|||||||
final String buildGradleContent = await buildGradleFile.readAsString();
|
final String buildGradleContent = await buildGradleFile.readAsString();
|
||||||
|
|
||||||
expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true);
|
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 {
|
testUsingContext('Flutter module Android project contains namespace', () async {
|
||||||
@ -3128,13 +3122,6 @@ void main() {
|
|||||||
expect(moduleFlutterBuildGradleFileContent.contains(expectedNameSpace), true);
|
expect(moduleFlutterBuildGradleFileContent.contains(expectedNameSpace), true);
|
||||||
const String expectedHostNameSpace = 'namespace = "com.bar.foo.flutter_project.host"';
|
const String expectedHostNameSpace = 'namespace = "com.bar.foo.flutter_project.host"';
|
||||||
expect(moduleAppBuildGradleFileContent.contains(expectedHostNameSpace), true);
|
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>{
|
}, overrides: <Type, Generator>{
|
||||||
Pub: () => Pub.test(
|
Pub: () => Pub.test(
|
||||||
fileSystem: globals.fs,
|
fileSystem: globals.fs,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user