Repository navigation
[Xamarin.Android.Build.Tasks] Replace UnzipToFolder with built-in Unzip - #13505
Open
simonrozsival wants to merge 1 commit into
Open
simonrozsival wants to merge 1 commit into
simonrozsival wants to merge 1 commit into
Conversation
The last UnzipToFolder use extracted universal.apk from the universal .apks set and renamed it to $(_AndroidPackage)-Signed.apk. Use the built-in <Unzip/> task to extract into an intermediate directory, then <Copy/> to the renamed destination. The built-in Unzip task rejects entries that would escape DestinationFolder. SkipUnchangedFiles=false is required because bundletool writes universal.apk with a fixed ZIP timestamp. Delete the now-unused UnzipToFolder task and its UsingTask. The Files.ExtractAll/GetArchiveExtractionPath helpers remain in use by ResolveLibraryProjectImports and ExtractJarsFromAar. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the MSBuild task cleanup.
No open issues 🎉
What changed in this PR
Replaces the last use of the custom UnzipToFolder task with built-in MSBuild tasks, completing cleanup after #13490 while preserving universal APK output naming.
Changes:
- Extracts
universal.apkinto an intermediate directory, then copies it to the signed APK output path. - Forces extraction despite fixed ZIP timestamps, retains the output timestamp update, and tracks the intermediate file for cleanup.
- Removes the unused custom task and its registration.
Local validation was not run, per the PR description.
| File | Description |
|---|---|
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets |
Uses built-in Unzip and Copy for universal APK extraction and removes the custom task registration. |
src/Xamarin.Android.Build.Tasks/Tasks/UnzipToFolder.cs |
Deletes the now-unused extraction task. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: #13490
#13490 removed
Xamarin.Android.Bindings.Documentation.targetsand two of the three uses of the<UnzipToFolder/>task. The only remaining use is in_CreateUniversalApkFromBundle. That target extractsuniversal.apkfrom the bundletool.apksset ($(_UniversalApkSetIntermediate)) and renames it to$(OutDir)$(_AndroidPackage)-Signed.apkthrough the%(DestinationFileName)metadata.MSBuild's built-in
<Unzip/>and<Copy/>tasks can do the same job, so the custom task is no longer needed:<Unzip Include="universal.apk"/>extracts the entry into a new intermediate directory,$(IntermediateOutputPath)android\bin\universal-apk\. The built-inUnziptask rejects archive entries that would land outsideDestinationFolder, which replaces theFiles.GetArchiveExtractionPath()checks thatUnzipToFolderdid.<Copy/>then writes the file to$(OutDir)$(_AndroidPackage)-Signed.apk.SkipUnchangedFiles="false"is set on<Unzip/>. bundletool writesuniversal.apkwith a fixed ZIP timestamp, so the default size/timestamp check could skip a changed file. For the same reason, the existing<Touch/>is kept.@(FileWrites).Delete
UnzipToFolder.csand its<UsingTask/>. The task had no tests.Files.ExtractAll()andFiles.GetArchiveExtractionPath()stay, becauseResolveLibraryProjectImports,ExtractJarsFromAar, andFilesTestsstill use them.This PR is stacked on #13490.
Testing: Not run locally. Builds and tests were skipped for this batch to save local disk space, so CI validates the change. In particular, CI needs to confirm that
AndroidPackageFormat=aabbuilds that also produce an APK still create-Signed.apk, and that incremental builds still behave correctly.