Skip to content

Add CpuArch to the Device class#189207

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
chingjun:cpuarch
Jul 14, 2026
Merged

Add CpuArch to the Device class#189207
auto-submit[bot] merged 5 commits into
flutter:masterfrom
chingjun:cpuarch

Conversation

@chingjun

@chingjun chingjun commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Android and iOS devices have AndroidArch and DarwinArch respectively, and the other TargetPlatforms are cpu architecture specific (e.g. linux_arm64).

Adding the CpuArch is an attempt to consolidate the information, and have a targetPlatform-agnostic way to determine the cpu architecture of the device.

@chingjun
chingjun requested review from a team as code owners July 9, 2026 18:23
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jul 9, 2026
@github-actions github-actions Bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. platform-macos Building on or for macOS specifically a: desktop Running on desktop team-ios Owned by iOS platform team team-macos Owned by the macOS platform team labels Jul 9, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@chingjun chingjun changed the title Add CpuArch to devices to replace AndroidArch and DarwinArch Add CpuArch to the Device class Jul 9, 2026
};
}

String get name => switch (this) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive by nit: Enums get a name that resolves to the symbol of the enum value, so this is redundant?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about that. Removed, thanks!

@bkonyi bkonyi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

x86_64,
riscv64;

factory CpuArch.fromName(String name) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: consider making String name -> String? name and mapping null to CpuArch.unknown.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only place that needs to handle null cpuArch now is in proxied_device, and that's only for backward compatibility. I've added a comment there explaining this. Keeping this non-null here for now unless there is a strong reason to accept null String.

};
}

String get name => switch (this) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Future<TargetPlatform> get targetPlatform;

/// The CPU architecture of the device.
Future<CpuArch> get cpuArch async => _cpuArchForTargetPlatform(await targetPlatform);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be worth leaving this unimplemented for the abstract Device class so that platform-specific devices have to implement this, especially since iOS / Darwin devices already need to override it to provide a valid result. This will make it easier when we eventually move each platform into their own isolated extension that won't know anything about the other platforms.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@chingjun
chingjun requested review from a team as code owners July 10, 2026 19:12
@chingjun
chingjun requested review from camsim99 and removed request for a team July 10, 2026 19:12
@github-actions github-actions Bot added platform-windows Building on or for Windows specifically platform-linux Building on or for Linux specifically team-android Owned by Android platform team team-windows Owned by the Windows platform team team-linux Owned by the Linux platform team labels Jul 10, 2026
@chingjun chingjun added CICD Run CI/CD and removed CICD Run CI/CD labels Jul 10, 2026
@chingjun
chingjun removed request for a team July 10, 2026 19:13
bkonyi
bkonyi previously approved these changes Jul 14, 2026
/// The [CpuArch] of the given [hostPlatform].
factory CpuArch.fromHostPlatform(HostPlatform hostPlatform) {
return switch (hostPlatform) {
HostPlatform.darwin_x64 || HostPlatform.linux_x64 || HostPlatform.windows_x64 =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: is it possible to use dot shorthands here? If we can do that for even just the patterns, it would make these lines a lot shorter.

@chingjun chingjun added CICD Run CI/CD and removed CICD Run CI/CD labels Jul 14, 2026
@chingjun chingjun added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 14, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 14, 2026
@auto-submit

auto-submit Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/189207, because - The status or check suite Linux web_canvaskit_tests_1 has failed. Please fix the issues identified (or deflake) before re-applying this label.

@chingjun chingjun added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 14, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Jul 14, 2026
Merged via the queue into flutter:master with commit c7d4687 Jul 14, 2026
176 of 177 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 14, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jul 15, 2026
flutter/flutter@846664b...fc1ad95

2026-07-15 [email protected] [iOS] Migrate FlutterKeyboardInsetManager to Swift (flutter/flutter#189425)
2026-07-15 [email protected] Roll Dart SDK from 05bf153370c4 to 0c408ff6dce9 (4 revisions) (flutter/flutter#189487)
2026-07-15 [email protected] Implement UberSDF lines to replace LineContents-based AA lines (flutter/flutter#188514)
2026-07-15 [email protected] Fix stale eagerWinner reference in GestureArenaManager when rejected before arena close (flutter/flutter#187008)
2026-07-15 [email protected] Disable some Windows tests that are flaking on CI (flutter/flutter#189477)
2026-07-15 dmgr Added unified check-run user manual (flutter/flutter#189453)
2026-07-15 [email protected] Roll Skia from 88954ef8f36d to ab2410bc857c (9 revisions) (flutter/flutter#189474)
2026-07-14 [email protected] [agents] Refactor shepherd-prs skill into a pure Markdown runbook using native gh CLI (flutter/flutter#189095)
2026-07-14 [email protected] Add missing name to mirroring workflow (flutter/flutter#189439)
2026-07-14 [email protected] Add support for WASM deferred loading. (flutter/flutter#189308)
2026-07-14 [email protected] fix `templateDefaultGradleVersion` todo (flutter/flutter#189466)
2026-07-14 [email protected] Roll Fuchsia Linux SDK from oOETA0ISPouDt2xBo... to lLFbh5kFWbUGgC9Ek... (flutter/flutter#189469)
2026-07-14 [email protected] Use ServicesBinding.instance.exitApplication instead of exit(0) in multiple_windows example (flutter/flutter#189364)
2026-07-14 [email protected] Add CpuArch to the Device class (flutter/flutter#189207)
2026-07-14 [email protected] Fix space formatting in cherry-pick label for flutter_cp.dart (flutter/flutter#189463)
2026-07-14 [email protected] Roll pub packages (flutter/flutter#189454)
2026-07-14 [email protected] [flutter_tools] Format plugin example template to match dart format (flutter/flutter#188382)
2026-07-14 [email protected] Move renamed x64->ARM benchmarks out of bringup (flutter/flutter#189400)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD platform-ios iOS applications specifically platform-linux Building on or for Linux specifically platform-macos Building on or for macOS specifically platform-windows Building on or for Windows specifically team-android Owned by Android platform team team-ios Owned by iOS platform team team-linux Owned by the Linux platform team team-macos Owned by the macOS platform team team-windows Owned by the Windows platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants