Skip to content

Conversation

@jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Dec 11, 2019

Context: #3918

In 2c6f5cd, we added support for the official Google/Android Manifest
Merger. After further QA testing, it seems that a reasonable number of
existing apps require code changes to appease the new manifest
merger.

This is a similar situation we were in compared to aapt2, where the
suggested changes are good (and usually problems). I think we should
add a feature flag, so we can gradually turn this on. We could add the
feature off by default for one release, and then turn it on by default
for the next.

This PR adds:

  • $(AndroidManifestMerger) with enum-style values of legacy and
    manifestmerger.jar.
  • Updated a few tests to leverage both code paths.

@jonpryor
Copy link
Contributor

Name suggestions welcome

My "concern" with managed and android is that in other contexts, "managed" is the good version, e.g. the ManagedResourceParser, which we have delusions of taking over everything at some point.

In this context, "managed" would be the bad version.

"managed" also precludes us from doing a different implementation from C# in the future which follows the Android Studio semantics.

I thus propose the alternate names:

  • legacy for existing Xamarin.Android v10.1 and earlier behavior
  • manifestmerger.jar for the new behavior.

This "nicely" has a clear "old and busted" value, and if (when?) Google comes out with a different native tool, we'll be able to reasonably distinguish between them.

@brendanzagaeski
Copy link
Contributor

Using legacy as the name for the old approach sounds good to me. That would match up roughly with the naming scheme used for values of $(AndroidTlsProvider), where one of the values is likewise legacy. And $(AndroidUseLegacyVersionCode) also uses the term "legacy" in a similar way.

…rger

Context: dotnet#3918

In 2c6f5cd, we added support for the official Google/Android Manifest
Merger. After further QA testing, it seems that a reasonable number of
existing apps require code changes to *appease* the new manifest
merger.

This is a similar situation we were in compared to `aapt2`, where the
suggested changes are good (and usually problems). I think we should
add a feature flag, so we can gradually turn this on. We could add the
feature off by default for one release, and then turn it on by default
for the next.

This PR adds:

* `$(AndroidManifestMerger)` with enum-style values of `legacy` and
  `manifestmerger.jar`.
* Updated a few tests to leverage both code paths.
@jonathanpeppers jonathanpeppers force-pushed the manifest-merger-feature-flag branch from 5f495d3 to 40946ef Compare December 12, 2019 04:13
Copy link
Member

@pjcollins pjcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at 2c6f5cd, I think this may also need changes in
src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets?

We likely need to add the MergedManifestDocuments parameter back (and maybe rely on the new path property) here:
https://github.com/xamarin/xamarin-android/blob/2c6f5cd16fb5087731107c1defa13ebb56cf63df/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets#L79

I think we also need to add a condition here:
Condition=" '$(AndroidManifestMerger)' == 'manifestmerger.jar' "

https://github.com/xamarin/xamarin-android/blob/2c6f5cd16fb5087731107c1defa13ebb56cf63df/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets#L89

@JonDouglas
Copy link
Contributor

👍 to legacy. 👎 to managed.

I like the idea that we would in the future use whatever the new tooling name is as the replacement to manifestmerger.jar.

Add a 👍 to the current proposal from me.

@jonathanpeppers
Copy link
Member Author

I think the failures here are ignorable, this one has started popping up again randomly:

Xamarin.Android.Common.targets(2916,2): error ANDKT0000: keytool error: java.io.EOFException 

Copy link
Member

@pjcollins pjcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated naming schema and latest changes LGTM 👍

@jonpryor jonpryor merged commit f7ea4a3 into dotnet:master Dec 17, 2019
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Dec 17, 2019
…rger (dotnet#4022)

Context: xamarin/QualityAssurance@a01b7d9

In commit 2c6f5cd, we added support for using the official
Google/Android [Manifest Merger][0].  After further QA testing, it
seems that a reasonable number of existing apps require code changes
to *appease* the new manifest merger:

	error AMM0000: …/QualityAssurance/Samples/android/XAQA.Bug28816/obj/Release/AndroidManifest.xml:4:3-42 Error:
	error AMM0000: 	uses-sdk:minSdkVersion 10 cannot be smaller than version 14 declared in library …/QualityAssurance/Samples/android/XAQA.Bug28816/obj/Release/lp/6/jl/AndroidManifest.xml as the library might be using APIs not available in 10
	error AMM0000: 	Suggestion: use a compatible library with a minSdk of at most 10,
	error AMM0000: 		or increase this project's minSdk version to at least 14,
	error AMM0000: 		or use tools:overrideLibrary="android.support.v4" to force usage (may lead to runtime failures)

This is a similar situation we were in compared to `aapt2`, where the
suggested changes are good (and usually fix problems).  I think we
should add a feature flag, so we can gradually turn this on.
We could add the feature off by default for one release, and then
turn it on by default for the next.

Add a new `$(AndroidManifestMerger)` MSBuild property to control
which `AndroidManifest.xml` merger is used.  The values are:

  * `legacy`: Merge `AndroidManifest.xml` files in the same way we
    did before commit 2c6f5cd.
  * `manifestmerger.jar`: Use Android's Manifest Merger.

The default value for `$(AndroidManifestMerger)` is `legacy`.

This will change in a future release.

[0]: https://developer.android.com/studio/build/manifest-merge
@jonathanpeppers jonathanpeppers deleted the manifest-merger-feature-flag branch December 17, 2019 18:29
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Dec 17, 2019
…rger (dotnet#4022)

Context: xamarin/QualityAssurance@a01b7d9

In commit 2c6f5cd, we added support for using the official
Google/Android [Manifest Merger][0].  After further QA testing, it
seems that a reasonable number of existing apps require code changes
to *appease* the new manifest merger:

	error AMM0000: …/QualityAssurance/Samples/android/XAQA.Bug28816/obj/Release/AndroidManifest.xml:4:3-42 Error:
	error AMM0000: 	uses-sdk:minSdkVersion 10 cannot be smaller than version 14 declared in library …/QualityAssurance/Samples/android/XAQA.Bug28816/obj/Release/lp/6/jl/AndroidManifest.xml as the library might be using APIs not available in 10
	error AMM0000: 	Suggestion: use a compatible library with a minSdk of at most 10,
	error AMM0000: 		or increase this project's minSdk version to at least 14,
	error AMM0000: 		or use tools:overrideLibrary="android.support.v4" to force usage (may lead to runtime failures)

This is a similar situation we were in compared to `aapt2`, where the
suggested changes are good (and usually fix problems).  I think we
should add a feature flag, so we can gradually turn this on.
We could add the feature off by default for one release, and then
turn it on by default for the next.

Add a new `$(AndroidManifestMerger)` MSBuild property to control
which `AndroidManifest.xml` merger is used.  The values are:

  * `legacy`: Merge `AndroidManifest.xml` files in the same way we
    did before commit 2c6f5cd.
  * `manifestmerger.jar`: Use Android's Manifest Merger.

The default value for `$(AndroidManifestMerger)` is `legacy`.

This will change in a future release.

[0]: https://developer.android.com/studio/build/manifest-merge
jonpryor pushed a commit that referenced this pull request Dec 18, 2019
…rger (#4022)

Context: https://github.com/xamarin/QualityAssurance/commit/a01b7d9d6a724523878236e49dbb8f69c6dfedc8

In commit 2c6f5cd, we added support for using the official
Google/Android [Manifest Merger][0].  After further QA testing, it
seems that a reasonable number of existing apps require code changes
to *appease* the new manifest merger:

	error AMM0000: …/QualityAssurance/Samples/android/XAQA.Bug28816/obj/Release/AndroidManifest.xml:4:3-42 Error:
	error AMM0000: 	uses-sdk:minSdkVersion 10 cannot be smaller than version 14 declared in library …/QualityAssurance/Samples/android/XAQA.Bug28816/obj/Release/lp/6/jl/AndroidManifest.xml as the library might be using APIs not available in 10
	error AMM0000: 	Suggestion: use a compatible library with a minSdk of at most 10,
	error AMM0000: 		or increase this project's minSdk version to at least 14,
	error AMM0000: 		or use tools:overrideLibrary="android.support.v4" to force usage (may lead to runtime failures)

This is a similar situation we were in compared to `aapt2`, where the
suggested changes are good (and usually fix problems).  I think we
should add a feature flag, so we can gradually turn this on.
We could add the feature off by default for one release, and then
turn it on by default for the next.

Add a new `$(AndroidManifestMerger)` MSBuild property to control
which `AndroidManifest.xml` merger is used.  The values are:

  * `legacy`: Merge `AndroidManifest.xml` files in the same way we
    did before commit 2c6f5cd.
  * `manifestmerger.jar`: Use Android's Manifest Merger.

The default value for `$(AndroidManifestMerger)` is `legacy`.

This will change in a future release.

[0]: https://developer.android.com/studio/build/manifest-merge
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants