[msbuild/dotnet] Use 'SdkIsSimulator' instead of 'ComputedPlatform'.#25234
[msbuild/dotnet] Use 'SdkIsSimulator' instead of 'ComputedPlatform'.#25234rolfbjarne wants to merge 7 commits intomainfrom
Conversation
This simplifies the code, since we only have a single property as the source of truth whether we're building for the simulator or not.
There was a problem hiding this comment.
Pull request overview
This PR replaces uses of $(ComputedPlatform) with $(SdkIsSimulator) across MSBuild and SDK-style targets to make simulator-vs-device detection rely on a single source of truth.
Changes:
- Updated multiple MSBuild target conditions to use
$(SdkIsSimulator)instead of$(ComputedPlatform). - Moved/added
ComputedPlatformdefinition intodotnet/targets/Xamarin.Shared.Sdk.propsfor compatibility with external consumers. - Removed the old
ComputedPlatforminitialization snippet fromXamarin.Shared.Sdk.DefaultItems.targets.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/monotouch-test/dotnet/shared.csproj | Uses SdkIsSimulator for defining AOT in test builds. |
| tests/ComputeRegistrarConstant.targets | Uses SdkIsSimulator to compute dynamic registrar constant for iOS/tvOS. |
| msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets | Uses SdkIsSimulator to gate IPA/dSYM copy-back steps from the Mac build host. |
| msbuild/Xamarin.Shared/Xamarin.iOS.Common.targets | Uses SdkIsSimulator to gate iTunes metadata/artwork targets. |
| msbuild/Xamarin.Shared/Xamarin.Shared.targets | Uses SdkIsSimulator to gate _PrepareResourceRules. |
| msbuild/Xamarin.Shared/Xamarin.Shared.props | Removes ComputedPlatform computation and switches certain defaults to SdkIsSimulator. |
| dotnet/targets/Xamarin.Shared.Sdk.targets | Uses SdkIsSimulator for link-mode defaults previously keyed off ComputedPlatform. |
| dotnet/targets/Xamarin.Shared.Sdk.props | Exposes SdkIsSimulator and redefines ComputedPlatform for compatibility. |
| dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets | Removes the previous ComputedPlatform initialization block. |
| </Target> | ||
|
|
||
| <Target Name="CopyIpaFromMac" Condition="'$(OutputType)' == 'Exe' And '$(ComputedPlatform)' == 'iPhone' And '$(BuildIpa)' == 'true'"> | ||
| <Target Name="CopyIpaFromMac" Condition="'$(OutputType)' == 'Exe' And '$(SdkIsSimulator)' != 'true' And '$(BuildIpa)' == 'true'"> |
| </Target> | ||
|
|
||
| <Target Name="CopyDSYMFromMac" DependsOnTargets="_SayHello" Condition="'$(IsMacEnabled)' == 'true' And '$(IsAppExtension)' == 'false' And '$(ComputedPlatform)' == 'iPhone' And '$(CopyDSYM)' == 'true' And ('$(BuildIpa)' == 'true' Or '$(CopyAppBundle)' == 'true')" BeforeTargets="BeforeDisconnect"> | ||
| <Target Name="CopyDSYMFromMac" DependsOnTargets="_SayHello" Condition="'$(IsMacEnabled)' == 'true' And '$(IsAppExtension)' == 'false' And '$(SdkIsSimulator)' != 'true' And '$(CopyDSYM)' == 'true' And ('$(BuildIpa)' == 'true' Or '$(CopyAppBundle)' == 'true')" BeforeTargets="BeforeDisconnect"> |
| <ComputedPlatform Condition="'$(SdkIsSimulator)' == 'true'">iPhoneSimulator</ComputedPlatform> | ||
| <ComputedPlatform Condition="'$(ComputedPlatform)' == ''">iPhone</ComputedPlatform> |
| <Target Name="_CompileITunesMetadata" Condition="'$(SdkIsSimulator)' != 'true' And '$(IsAppExtension)' == 'false' And '$(IsWatchApp)' == 'false'" | ||
| DependsOnTargets="$(_CompileITunesMetadataDependsOn)" | ||
| Inputs="@(ITunesMetadata)" |
| <Target Name="_CollectITunesArtwork" Condition="'$(SdkIsSimulator)' != 'true' And '$(IsAppExtension)' == 'false' And '$(IsWatchApp)' == 'false'"> | ||
| <CollectITunesArtwork | ||
| SessionId="$(BuildSessionId)" |
| <Target Name="_CopyITunesArtwork" Condition="'$(SdkIsSimulator)' != 'true' And '$(IsAppExtension)' == 'false' And '$(IsWatchApp)' == 'false'" | ||
| DependsOnTargets="_CollectITunesArtwork" | ||
| Inputs="@(_ITunesArtworkWithLogicalName)" Outputs="$(DeviceSpecificOutputPath)%(_ITunesArtworkWithLogicalName.LogicalName)"> |
| <PrepareResourceRules | ||
| SessionId="$(BuildSessionId)" | ||
| Condition="'$(IsMacEnabled)' == 'true' And '$(CodesignResourceRules)' != '' And '$(ComputedPlatform)' == 'iPhone'" | ||
| Condition="'$(IsMacEnabled)' == 'true' And '$(CodesignResourceRules)' != '' And '$(SdkIsSimulator)' != 'true'" |
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.
Only set ComputedPlatform for iOS and tvOS (like the old behavior). Introduce a new SdkIsDevice property that's set to true when building for device (iOS and tvOS only), and use it to retain the original behavior of ComputedPlatform == 'iPhone' wherever needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
✅ [PR Build #1892441] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #1892441] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ 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 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #1892441] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🔥 [CI Build #1892441] Test results 🔥Test results❌ Tests failed on VSTS: test results 3 tests crashed, 1 tests failed, 144 tests passed. Failures❌ framework tests🔥 Failed catastrophically on VSTS: test results - framework (no summary found). Html Report (VSDrops) Download ❌ introspection tests🔥 Failed catastrophically on VSTS: test results - introspection (no summary found). Html Report (VSDrops) Download ❌ windows tests🔥 Failed catastrophically on VSTS: test results - windows (no summary found). Html Report (VSDrops) Download ❌ Tests on macOS Tahoe (26) tests1 tests failed, 4 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
This simplifies the code, since we only have a single property as the source
of truth whether we're building for the simulator or not.