-
Notifications
You must be signed in to change notification settings - Fork 524
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
Conversation
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/DeviceTest.cs
Outdated
Show resolved
Hide resolved
6284134
to
435e2d9
Compare
a3885d7
to
9e633f7
Compare
d651696
to
a3296a9
Compare
a3296a9
to
f2dc7d8
Compare
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.
f2dc7d8
to
7f5d578
Compare
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.
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. |
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.) |
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/.) |
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 iswhy we always passed the Application resource directory in first.
For
aapt2
the LAST item is used... this is why we always passthe 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 resourcesin two library projects
aapt
andaapt2
will use differentfiles.
This PR reverses the order of the libraries we use for
aapt2
.This ensures that the behaviour we see in
aapt2
is consistentwith
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.