{{ message }}
[flutter_tools] Extract Windows archives using native tar with PowerShell fallback - #192298
Open
bkonyi wants to merge 5 commits into
Open
[flutter_tools] Extract Windows archives using native tar with PowerShell fallback#192298bkonyi wants to merge 5 commits into
bkonyi wants to merge 5 commits into
Conversation
…d test manual pins Decouples WindowsApp.fromPrebuiltApp from package:archive by catching general Exception rather than ArchiveException when unzipping prebuilt archives, eliminating an unused dependency import. Adds regression and invariant tests in update_packages_test to verify that package:archive is explicitly pinned to 3.6.1 in kManuallyPinnedDependencies to prevent unwanted transitive dependencies (package:posix). Fixes flutter#115660
…hell fallback Replaces in-memory extraction via package:archive in _WindowsUtils with native tar (available on Windows 10 build 17063+) and PowerShell Expand-Archive fallback (powershell / pwsh) for backwards compatibility. This eliminates out-of-memory crashes on Windows when extracting large archives and removes all package:archive dependencies from packages/flutter_tools/lib/src/base/os.dart. Fixes flutter#133371 Part of flutter#115660
Reverts changes to update_packages_test.dart which added test assertions for package:archive in kManuallyPinnedDependencies and macro packages, keeping the PR focused strictly on the Windows archive extraction optimization.
bkonyi
marked this pull request as ready for review
September 4, 2026 19:58
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes the dependency on the archive package in flutter_tools on Windows, replacing it with native system tools like tar and PowerShell's Expand-Archive. Feedback on these changes includes ensuring that ToolExit is not swallowed when catching exceptions during unzipping in application_package.dart (which requires importing ../base/common.dart), and using single quotes for 'Stop' in the PowerShell script to avoid escaping issues.
- Rethrow ToolExit when unzipping in application_package to avoid masking missing extraction tools as invalid archives. - Add test verifying ToolExit rethrow in application_package_test. - Use single quotes for 'Stop' in PowerShell error action preference script.
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.

Description
Today,
flutter_toolsextracts archives on Windows usingpackage:archivein memory because historically Windows lacked a built-in unzipping CLI tool. This causes high memory consumption, slow extraction speeds, and out-of-memory crashes on large archives (#133371). Furthermore,package:archive4.x introduced a dependency onpackage:posixwhich relies on native FFI and cannot execute on Windows (#115660).This PR:
_WindowsUtils.unzipand_WindowsUtils.unpackinos.dartto use native%WINDIR%\System32\tar.exe(available on Windows 10 build 17063+ / version 1803 and Windows 11). This streams extraction directly from disk to disk, eliminating OOM crashes and providing significantly faster throughput.Expand-Archive(checkingpowershellthenpwsh) with verbatim single-quote escaping and$ErrorActionPreference = "Stop"for older Windows 10 versions.WindowsApp.fromPrebuiltAppinapplication_package.dartfrompackage:archiveby handling generalException.package:archivefromos.dartandos_test.dart.tarunzipping, target directory creation, PowerShell fallback, PowerShell Core (pwsh) fallback, and tool-missing error exits.Related Issues
Tests
packages/flutter_tools/test/general.shard/base/os_test.dartpackages/flutter_tools/test/general.shard/windows/application_package_test.dartflutter testand cleandart analyze --fatal-infos