-
Notifications
You must be signed in to change notification settings - Fork 534
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
$(AndroidUseAapt2) runs ConvertResourcesCases a lot #2356
Comments
When Now we could make use of the new logic to Skip |
What I'm seeing from these logs, if I just pick one of the files
So it would be ok for I'm wondering if |
Ah right, yes. That is probably it. |
…new target Fixes: dotnet#2356 When `$(AndroidUseAapt2)=True`, if you look for a log entry of a file that is processed: Processing: C:\Users\myuser\Desktop\Git\xamarin-android\tests\Xamarin.Forms-Performance-Integration\Droid\obj\Debug\90\lp\22\jl\res\values\values.xml 10/30/2018 4:28:18 PM > 1/1/0001 12:00:00 AM You will see this repeated several times (9 in case of a Xamarin.Forms project). It turns out, since the `_CompileAndroidLibraryResources` target is batched, it is called once per item of `@(_LibraryResourceHashDirectories)`: <Target Name="_CompileAndroidLibraryResources" DependsOnTargets="_CollectLibraryResourceDirectories" Condition="'$(_AndroidUseAapt2)' == 'True'" Inputs="%(_LibraryResourceHashDirectories.FileFound)" Outputs="$(_AndroidLibraryFlatArchivesDirectory)%(_LibraryResourceHashDirectories.Hash).stamp"> ... <ConvertResourcesCases ... /> <Aapt2Compile ... /> ... </Target> It calls `ConvertResourcesCases` for each call, which is not ideal. `ConvertResourcesCases` operates on the whole tree of resources, so it really should just run once: *before* `<Aapt2Compile/>`. I think the fix here is: - Move `ConvertResourcesCases` to a new `_ConvertLibraryResourcesCases` target - The new target's `Inputs` should be `@(_LibraryResourceHashDirectories.FileFound)` and *not* batched. - The new target's `Outputs` should be a new stamp file following our new convention. - The new stamp file should also be used as `AndroidConversionFlagFile`. - `_CompileAndroidLibraryResources` now depends on `_ConvertLibraryResourcesCases`, and it should only run on the first batched instance of `_CompileAndroidLibraryResources`.
…new target Fixes: dotnet#2356 When `$(AndroidUseAapt2)=True`, if you look for a log entry of a file that is processed: Processing: C:\Users\myuser\Desktop\Git\xamarin-android\tests\Xamarin.Forms-Performance-Integration\Droid\obj\Debug\90\lp\22\jl\res\values\values.xml 10/30/2018 4:28:18 PM > 1/1/0001 12:00:00 AM You will see this repeated several times (9 in case of a Xamarin.Forms project). It turns out, since the `_CompileAndroidLibraryResources` target is batched, it is called once per item of `@(_LibraryResourceHashDirectories)`: <Target Name="_CompileAndroidLibraryResources" DependsOnTargets="_CollectLibraryResourceDirectories" Condition="'$(_AndroidUseAapt2)' == 'True'" Inputs="%(_LibraryResourceHashDirectories.FileFound)" Outputs="$(_AndroidLibraryFlatArchivesDirectory)%(_LibraryResourceHashDirectories.Hash).stamp"> ... <ConvertResourcesCases ... /> <Aapt2Compile ... /> ... </Target> It calls `ConvertResourcesCases` for each call, which is not ideal. `ConvertResourcesCases` operates on the whole tree of resources, so it really should just run once: *before* `<Aapt2Compile/>`. I think the fix here is: - Move `ConvertResourcesCases` to a new `_ConvertLibraryResourcesCases` target - The new target's `Inputs` should be `@(_LibraryResourceHashDirectories->'%(FileFound)')` and *not* batched. - The new target's `Outputs` should be a new stamp file following our new convention. - The new stamp file should also be used as `AndroidConversionFlagFile`. - `_CompileAndroidLibraryResources` now depends on `_ConvertLibraryResourcesCases`, and it should only run on the first batched instance of `_CompileAndroidLibraryResources`.
…new target (#2367) Fixes: #2356 When `$(AndroidUseAapt2)=True`, if you look for a log entry of a file that is processed: Processing: C:\Users\myuser\Desktop\Git\xamarin-android\tests\Xamarin.Forms-Performance-Integration\Droid\obj\Debug\90\lp\22\jl\res\values\values.xml 10/30/2018 4:28:18 PM > 1/1/0001 12:00:00 AM You will see this repeated several times (9 in case of a Xamarin.Forms project). It turns out, since the `_CompileAndroidLibraryResources` target is batched, it is called once per item of `@(_LibraryResourceHashDirectories)`: <Target Name="_CompileAndroidLibraryResources" DependsOnTargets="_CollectLibraryResourceDirectories" Condition="'$(_AndroidUseAapt2)' == 'True'" Inputs="%(_LibraryResourceHashDirectories.FileFound)" Outputs="$(_AndroidLibraryFlatArchivesDirectory)%(_LibraryResourceHashDirectories.Hash).stamp"> ... <ConvertResourcesCases ... /> <Aapt2Compile ... /> ... </Target> It calls `ConvertResourcesCases` for each call, which is not ideal. `ConvertResourcesCases` operates on the whole tree of resources, so it really should just run once: *before* `<Aapt2Compile/>`. I think the fix here is: - Move `ConvertResourcesCases` to a new `_ConvertLibraryResourcesCases` target - The new target's `Inputs` should be `@(_LibraryResourceHashDirectories->'%(FileFound)')` and *not* batched. - The new target's `Outputs` should be a new stamp file following our new convention. - The new stamp file should also be used as `AndroidConversionFlagFile`. - `_CompileAndroidLibraryResources` now depends on `_ConvertLibraryResourcesCases`, and it should only run on the first batched instance of `_CompileAndroidLibraryResources`.
Steps to Reproduce
$(AndroidUseAapt2)
in a Xamarin.Forms projectConvertResourcesCases
run ~9 timesSee #2348, where I saw this firsthand. I think if we fixed this,
$(AndroidUseAapt2)
could possibly be enabled by default?Expected Behavior
With
$(AndroidUseAapt2)
,ConvertResourcesCases
should take approximately the same amount of time as a build without$(AndroidUseAapt2)
.Actual Behavior
$(AndroidUseAapt2)
runsConvertResourcesCases
a bit too much.Version Information
Reports of this in the 15.9 preview, and I have reproduced on master.
Log File
ConvertResourcesCases3.zip
The text was updated successfully, but these errors were encountered: