mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
![]() When performing artifact lookups for `Artifact.genSnapshot` for macOS desktop builds, a `TargetPlatform` is used to determine the name of the tool, typically `gen_snapshot_$TARGET_ARCH`. Formerly, this tool was always named `gen_snapshot`. The astute reader may ask "but Chris, didn't we support TWO target architectures on iOS and therefore need TWO `gen_snapshot` binaries?" Yes, we did support both armv7 and arm64 target architectures on iOS. But no, we didn't initially have two `gen_snapshot` binaries. We did *build* two `gen_snapshots`: * A 32-bit x86 binary that emitted armv7 AOT code * A 64-bit x64 binary that emitted arm64 AOT code At the time, the bitness of the `gen_snapshot` tool needed to match the bitness of the target architecture, and to avoid having to do a lot of work plumbing through suffixed `gen_snapshot` names, the author of that work (who, as evidenced by this patch, is still paying for his code crimes) elected to "cleverly" lipo the two together into a single multi-architecture macOS binary still named `gen_snapshot`. See: https://github.com/flutter/engine/pull/4948 This was later remediated over the course of several patches, including: * https://github.com/flutter/engine/pull/10430 * https://github.com/flutter/engine/pull/22818 * https://github.com/flutter/flutter/pull/37445 However, there were still cases (notably `--local-engine` workflows in the tool) where we weren't computing the target platform and thus referenced the generic `gen_snapshot` tool. See: https://github.com/flutter/flutter/issues/38933 Fixed in: https://github.com/flutter/engine/pull/28345 The test removed in this PR, which ensured that null `SnapshotType.platform` was supported was introduced in https://github.com/flutter/flutter/pull/11924 as a followup to https://github.com/flutter/flutter/pull/11820 when the snapshotting logic was originally extracted to the `GenSnapshot` class, and most invocations still passed a null target platform. Since there are no longer any cases where `TargetPlatform` isn't passed when looking up `Artifact.genSnapshot`, we can safely make the platform non-nullable and remove the test. This is pre-factoring towards the removal of the generic `gen_snapshot` artifact from the macOS host binaries (which are currently unused since we never pass a null `TargetPlatform`), which is pre-factoring towards the goal of building `gen_snapshot` binaries with an arm64 host architecture, and eliminate the need to use Rosetta during iOS and macOS Flutter builds. Part of: https://github.com/flutter/flutter/issues/101138 Umbrella issue: https://github.com/flutter/flutter/issues/103386 Umbrella issue: https://github.com/flutter/flutter/issues/69157 No new tests since the behaviour is enforced by the compiler. |
||
---|---|---|
.. | ||
analyze_size_test.dart | ||
async_guard_test.dart | ||
bot_detector_test.dart | ||
build_test.dart | ||
command_help_test.dart | ||
common_test.dart | ||
context_test.dart | ||
deferred_component_test.dart | ||
error_handling_io_test.dart | ||
file_system_test.dart | ||
fingerprint_test.dart | ||
io_test.dart | ||
logger_test.dart | ||
multi_root_file_system_test.dart | ||
net_test.dart | ||
os_test.dart | ||
os_utils_test.dart | ||
platform_test.dart | ||
process_test.dart | ||
signals_test.dart | ||
task_queue_test.dart | ||
terminal_test.dart | ||
user_messages_test.dart |