Skip to content

Commit

Permalink
Remove conditionality in templates that was for AGP <= 4.2 support (f…
Browse files Browse the repository at this point in the history
…lutter#151845)

Not needed after flutter#149204 (as long as nothing has changed since the comment was made �).

Fixes flutter#145105.
  • Loading branch information
gmackall authored and TytaniumDev committed Aug 7, 2024
1 parent 7a9f0c1 commit de1c0f0
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit de1c0f0

Please sign in to comment.