Skip to content

Conversation

@vashworth
Copy link
Contributor

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. a: desktop Running on desktop team-ios Owned by iOS platform team labels Aug 6, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant and well-structured refactoring for deploying and debugging apps on iOS 17+ devices (CoreDevices) by leveraging devicectl and lldb. The new IOSCoreDeviceLauncher and LLDB classes effectively encapsulate complex interactions, improving modularity and maintainability. The changes also include a fallback mechanism to the existing Xcode automation flow, which adds resilience. Overall, this is a great improvement. I have a couple of minor suggestions to improve code clarity and consistency.

/// Pattern of lldb log when the process is stopped.
///
/// Example: (lldb) Process 6152 stopped
static final _lldbProcessStopped = RegExp(r'Process \d* stopped');
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The _lldbProcessStopped regex uses \d*, which matches zero or more digits. This is inconsistent with _lldbProcessResuming on line 42, which uses \d+. If a process ID is always expected in the 'stopped' message, using \d+ would be more robust and consistent.

  static final _lldbProcessStopped = RegExp(r'Process \d+ stopped');

Comment on lines +1176 to +1183
factory IOSCoreDeviceRunningProcess.fromJson(Map<String, Object?> data) {
return IOSCoreDeviceRunningProcess._(
executable: data['executable']?.toString(),
processIdentifier: data['processIdentifier'] is int?
? data['processIdentifier'] as int?
: null,
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For clarity and improved readability, this casting logic can be simplified. Using a local variable and a type check makes the intent clearer, which aligns with the Flutter Style Guide's principle of optimizing for readability.1

  factory IOSCoreDeviceRunningProcess.fromJson(Map<String, Object?> data) {
    final Object? processId = data['processIdentifier'];
    return IOSCoreDeviceRunningProcess._(
      executable: data['executable']?.toString(),
      processIdentifier: processId is int ? processId : null,
    );
  }

Style Guide References

Footnotes

  1. Code is read more often than it is written, so it should be optimized for readability. (link)

@vashworth
Copy link
Contributor Author

This change needs to be cherry-picked into beta/stable. To make that easier, the plan is to split this into 3 PRs.

1 - Adds new classes and methods but will not be called or used yet. This will be large, but safe to cherry-pick since the new code will not be used.
2 - Use the new code. This will be smaller and more risky to cherry-pick, but also easier to revert if needed.
3 - Adds telemetry to track usage

@vashworth vashworth closed this Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop platform-ios iOS applications specifically team-ios Owned by iOS 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.

1 participant