Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] Fix Library Resource ordering. #3862

Merged
merged 1 commit into from
Dec 3, 2019

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Oct 31, 2019

Context http://work.azdo.io//1009593

Both aapt and aapt2 will use overlay semantics when deciding
which final resource to use. The order in which the resources
are passed to the tooling is important.

For aapt the it used the FIRST item it came across, this is
why we always passed the Application resource directory in first.
For aapt2 the LAST item is used... this is why we always pass
the Application resoruce directory last.

However we still use the same ordering for the references as
we do for aapt. As a result if you have duplicate resources
in two library projects aapt and aapt2 will use different
files.

This PR reverses the order of the libraries we use for aapt2.
This ensures that the behaviour we see in aapt2 is consistent
with aapt.

Future work we need to find a way to allow users to change the
ordering of these referenes. In AndroidStudio the order of the
files in the gradle config is used. So users can change the order.
However in MSBuild the order is controlled by MSBuild itself,
and there is no way to override it.

@dellis1972 dellis1972 added the do-not-merge PR should not be merged. label Oct 31, 2019
@dellis1972 dellis1972 force-pushed the libraryresources branch 2 times, most recently from 6284134 to 435e2d9 Compare November 6, 2019 14:10
@dellis1972 dellis1972 removed the do-not-merge PR should not be merged. label Nov 7, 2019
Context http://work.azdo.io/1009593

Both aapt and aapt2 will use overlay semantics when deciding
which final resource to use. The order in which the resources
are passed to the tooling is important.

For `aapt` the it used the FIRST item it came across, this is
why we always passed the Application resource directory in first.
For `aapt2` the LAST item is used... this is why we always pass
the Application resoruce directory last.

However we still use the same ordering for the references as
we do for `aapt`. As a result if you have duplicate resources
in two library projects `aapt` and `aapt2` will use different
files.

This PR reverses the order of the libraries we use for `aapt2`.
This ensures that the behaviour we see in `aapt2` is consistent
with `aapt`.

Future work we need to find a way to allow users to change the
ordering of these referenes. In AndroidStudio the order of the
files in the gradle config is used. So users can change the order.
However in MSBuild the order is controlled by MSBuild itself,
and there is no way to override it.
@jonpryor jonpryor merged commit a7aa610 into dotnet:master Dec 3, 2019
jonpryor pushed a commit that referenced this pull request Dec 12, 2019
Fixes: http://work.azdo.io/1009593

Both `aapt` and `aapt2` will use overlay semantics when deciding
which final resource to use.  The order in which the resources are
passed to the tooling is important.

`aapt` uses the *first* item it came across; this is why we always
passed the Application resource directory in first.
For `aapt2` the *last* item is used, and is why we always pass the
Application resource directory last.

However we still use the same ordering for the references as we do
for `aapt`.  As a result if you have duplicate resources in two
library projects, `aapt` and `aapt2` will use different files.

Reverse the order of the libraries we use for `aapt2`.  This ensures
that the behaviour we see in `aapt2` is consistent with `aapt`.

Future work we need to find a way to allow users to change the
ordering of these references.  In Android Studio the order of the
files in the gradle config is used, so users can change the order.
However in MSBuild the order is controlled by MSBuild itself,
and there is no way to override it.
@brendanzagaeski
Copy link
Contributor

Release status update

A new Preview version has now been published that includes the fix from this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix.

Fix included in Xamarin.Android 10.2.0.84.

Fix included on Windows in Visual Studio 2019 version 16.5 Preview 2. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.

Fix included on macOS in Visual Studio 2019 for Mac version 8.5 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.

@brendanzagaeski
Copy link
Contributor

Release status update

A new Release version has now been published on Windows that includes the fix from this item. The fix is not yet published in a Release version on macOS. I will update this item again when a Release version is available on macOS that includes the fix.

Fix included in Xamarin.Android 10.2.0.100.

Fix included on Windows in Visual Studio 2019 version 16.5. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.

(Fix also included on macOS in Visual Studio 2019 for Mac version 8.5 Preview 1 and higher. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.)

@brendanzagaeski
Copy link
Contributor

Release status update

A new Release version has now been published on macOS that includes the fix from this item.

Fix included in Xamarin.Android 10.2.0.100.

Fix included on macOS in Visual Studio 2019 for Mac version 8.5. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.

(Fix also included on Windows in Visual Studio 2019 version 16.5 and higher. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.)

@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.

None yet

4 participants