[WIP] Use shared SimctlOutputParser from Xamarin.MacDev for simctl JSON parsing#24812
[WIP] Use shared SimctlOutputParser from Xamarin.MacDev for simctl JSON parsing#24812
Conversation
|
Updated to use ALL shared parsers — now zero inline JSON parsing remains:
System.Text.Json and Xamarin.Utils imports removed from GetAvailableDevices.cs. Depends on dotnet/macios-devtools#158 (which now includes ParseDeviceTypes and DeviceCtlOutputParser). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d76976e to
b31f386
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b31f386 to
324c76e
Compare
✅ [CI Build #324c76e] Build passed (Build packages) ✅Pipeline on Agent |
✅ [CI Build #324c76e] Build passed (Detect API changes) ✅Pipeline on Agent |
🔥 [CI Build #324c76e] Build failed (Build macOS tests) 🔥Build failed for the job 'Build macOS tests' (with job status 'Failed') Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
Refactor GetAvailableDevices.RunSimCtlAsync to use the shared SimctlOutputParser from the Xamarin.MacDev submodule instead of inline JSON parsing. This: - Reuses tested parsing logic (65+ unit tests in macios-devtools) - Shares the parser across both MSBuild tasks and the MAUI CLI tool - Keeps devicetypes parsing inline (not yet in shared parser) - Preserves all MSBuild metadata, filtering, and discarding logic Depends on dotnet/macios-devtools PR #158 being merged to main. The submodule currently points to feature/simulator-management. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refactor GetAvailableDevices to use all three shared parsers: - SimctlOutputParser.ParseDevices: simulator device extraction - SimctlOutputParser.ParseRuntimes: runtime extraction - SimctlOutputParser.ParseDeviceTypes: devicetypes extraction - DeviceCtlOutputParser.ParseDevices: physical device extraction This eliminates all inline JSON parsing (System.Text.Json and Xamarin.Utils JsonExtensions no longer needed in this file). The only remaining code is MSBuild-specific TaskItem mapping, platform filtering, RuntimeIdentifier computation, and CanRunArm64. Net result: -45 lines, zero inline JSON parsing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix NU1605 package downgrade error: Xamarin.MacDev references System.Text.Json 9.0.4, while Xamarin.MacDev.Tasks pinned 8.0.5. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- XamarinTask: match ICustomLogger nullable signatures (Exception?, object?[]) - GetAvailableDevices: add using Xamarin.Utils for ApplePlatform - Update submodule to latest (6a2d99b) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AppleSdkSettings was marked [Obsolete] in macios-devtools PR #140 (XcodeLocator). Existing usages in Sdks.cs, CompileAppManifest.cs, and DetectSdkLocation.cs are intentional pending full migration. TreatWarningsAsErrors=true promotes the warning to an error. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Point submodule from feature/simulator-management branch to main, which now includes the merged simulator management APIs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
324c76e to
492716e
Compare
|
Superseded by #24856 — recreated under |
Summary
This PR refactors
GetAvailableDevices.RunSimCtlAsyncto use the sharedSimctlOutputParserfrom theXamarin.MacDevsubmodule (dotnet/macios-devtools) instead of inline JSON parsing.Plan
We're building shared Apple CLI library APIs in dotnet/macios-devtools to support the
mauiCLI commands (spec: dotnet/maui#34217). Sincemaciosalready usesmacios-devtoolsas a submodule atexternal/Xamarin.MacDev, we can share the parsing logic between the MSBuild tasks and the CLI tool.What this PR does
SimctlOutputParserand model classesRunSimCtlAsyncwith:SimctlOutputParser.ParseDevices(json)— returns typedSimulatorDeviceInfoobjects with UDID, Name, State, IsAvailable, AvailabilityError, Platform, OSVersionSimctlOutputParser.ParseRuntimes(json)— returns typedSimulatorRuntimeInfoobjects with SupportedArchitecturesBenefits
mauiCLIDependencies
mainFuture work
devicetypesparsing into the shared parser (productFamily, minRuntime, maxRuntime)devicectlphysical device parsing to the shared parserParseDeviceTypesmethod toSimctlOutputParsercc @rolfbjarne