Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Only show iOS simulators, reduce output spew in verbose #108345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 26, 2022

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Jul 26, 2022

Reduce a lot of the verbose flutter run/test/drive spew by only querying for available, booted iOS simulators since that's the only way these simulators are used. This also avoids showing watchOS/tvOS running simulators as available targets in the IDE.

This should make verbose logging easier to read and more concise. Bonus: less data to upload in LUCI.

Before (2300 lines)

After (80 lines)
[   +2 ms] xcrun simctl list devices booted iOS --json
[        ] executing: xcrun simctl list devices booted iOS --json
[   +5 ms] executing: xcrun simctl list devices booted
[ +245 ms] Exit code 0 from: xcrun simctl list devices booted
[        ] == Devices ==
           -- iOS 12.4 --
           -- iOS 13.0 --
           -- iOS 14.0 --
               iPhone 11 (9EC90A99-6924-472D-8CDD-4D8234AB4779) (Booted)
           -- iOS 16.0 --
               Phone w Watch (C82680B9-9C3B-41F8-A0B9-4441E64DC209) (Booted)
               iPhone 13 (C5CA91DB-9D86-4934-AB78-2628C2734F96) (Booted)
           -- tvOS 16.0 --
           -- watchOS 9.0 --
               Apple Watch Series 7 - 45mm (3766BB11-4E3D-409C-AC38-262037345CD7) (Booted)
[  +67 ms] List of devices attached
[ +239 ms] {
                      "devices" : {
                        "com.apple.CoreSimulator.SimRuntime.iOS-14-0" : [
                          {
                            "lastBootedAt" : "2022-07-26T02:43:00Z",
                            "dataPath" : "\/Users\/magder\/Library\/Developer\/CoreSimulator\/Devices\/9EC90A99-6924-472D-8CDD-4D8234AB4779\/data",
                            "dataPathSize" : 1734352896,
                            "logPath" : "\/Users\/magder\/Library\/Logs\/CoreSimulator\/9EC90A99-6924-472D-8CDD-4D8234AB4779",
                            "udid" : "9EC90A99-6924-472D-8CDD-4D8234AB4779",
                            "isAvailable" : true,
                            "logPathSize" : 9502720,
                            "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-11",
                            "state" : "Booted",
                            "name" : "iPhone 11"
                          }
                        ],
                        "com.apple.CoreSimulator.SimRuntime.iOS-13-0" : [

                        ],
                        "com.apple.CoreSimulator.SimRuntime.iOS-12-4" : [

                        ],
                        "com.apple.CoreSimulator.SimRuntime.tvOS-16-0" : [

                        ],
                        "com.apple.CoreSimulator.SimRuntime.watchOS-9-0" : [

                        ],
                        "com.apple.CoreSimulator.SimRuntime.iOS-16-0" : [
                          {
                            "lastBootedAt" : "2022-07-26T02:50:32Z",
                            "dataPath" : "\/Users\/magder\/Library\/Developer\/CoreSimulator\/Devices\/C82680B9-9C3B-41F8-A0B9-4441E64DC209\/data",
                            "dataPathSize" : 427372544,
                            "logPath" : "\/Users\/magder\/Library\/Logs\/CoreSimulator\/C82680B9-9C3B-41F8-A0B9-4441E64DC209",
                            "udid" : "C82680B9-9C3B-41F8-A0B9-4441E64DC209",
                            "isAvailable" : true,
                            "logPathSize" : 90112,
                            "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-11",
                            "state" : "Booted",
                            "name" : "Phone w Watch"
                          },
                          {
                            "lastBootedAt" : "2022-07-26T02:43:06Z",
                            "dataPath" : "\/Users\/magder\/Library\/Developer\/CoreSimulator\/Devices\/C5CA91DB-9D86-4934-AB78-2628C2734F96\/data",
                            "dataPathSize" : 2183602176,
                            "logPath" : "\/Users\/magder\/Library\/Logs\/CoreSimulator\/C5CA91DB-9D86-4934-AB78-2628C2734F96",
                            "udid" : "C5CA91DB-9D86-4934-AB78-2628C2734F96",
                            "isAvailable" : true,
                            "logPathSize" : 151552,
                            "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-13",
                            "state" : "Booted",
                            "name" : "iPhone 13"
                          }
                        ]
                      }
                    }
  • Deleted some dead code.
  • Stop checking for Xcode minimum version just to list devices. It will immediately fail if you try to run on one if the version is too low.

Fixes #108342

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

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

@jmagman jmagman added the t: xcode "xcodebuild" on iOS and general Xcode project management label Jul 26, 2022
@jmagman jmagman self-assigned this Jul 26, 2022
@flutter-dashboard flutter-dashboard bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels Jul 26, 2022
@jmagman jmagman changed the title Limit simulator output spew Limit iOS simulator output spew in verbose Jul 26, 2022
@jmagman jmagman changed the title Limit iOS simulator output spew in verbose Only show iOS simulators, reduce output spew in verbose Jul 26, 2022
///
/// Simulated device types can be listed using the command
/// `xcrun simctl list devicetypes`.
class SimDeviceType {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is dead. Introduced in #2682 usage removed in #10780.


final String name;

static const SimControlListSection devices = SimControlListSection._('devices');
Copy link
Member Author

Choose a reason for hiding this comment

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

Only devices was used, remove this class and use the string instead.


final List<String> command = <String>[
..._xcode.xcrunCommand(),
'simctl',
'list',
'devices',
'booted',
Copy link
Member Author

Choose a reason for hiding this comment

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

Limiting to booted iOS devices since that's all we care about.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@@ -156,30 +170,24 @@ class SimControl {
}
}

/// Returns a list of all available devices, both potential and connected.
Future<List<SimDevice>> getDevices() async {
Copy link
Member Author

Choose a reason for hiding this comment

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

getDevices was only used by getConnectedDevices and tests, so remove the former.

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

Nice, LGTM!

@jmagman jmagman added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 26, 2022
@auto-submit auto-submit bot merged commit 167655e into flutter:master Jul 26, 2022
@jmagman jmagman deleted the simctl-output branch July 26, 2022 19:09
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jul 28, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flutter devices is showing running watchOS simulators
2 participants