[msbuild] Improve how we handle the path to Xcode.#24021
[msbuild] Improve how we handle the path to Xcode.#24021rolfbjarne wants to merge 7 commits intomainfrom
Conversation
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.
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.
There was a problem hiding this comment.
Pull request overview
This PR migrates Xcode discovery and configuration away from static, file-based mechanisms and the MD_APPLE_SDK_ROOT environment variable to a new XcodeLocator-based flow, driven primarily by the XcodeLocation MSBuild property and DEVELOPER_DIR. It updates tasks, tests, and documentation to align with the new behavior and deprecation plan.
Changes:
- Introduce
XcodeLocatorusage intoXamarinTask/DetectSdkLocationand wireSdkDevPaththrough MSBuild targets, removing the staticSdkshelper. - Replace
MD_APPLE_SDK_ROOTusage withDEVELOPER_DIR/XcodeLocationacross build scripts and tests, and add deprecation warnings for the old environment variable and settings files. - Update tests and docs to validate the new Xcode selection behavior and reflect the new configuration options.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/xharness/Jenkins/TestTasks/AppleTestTask.cs | Switch test harness env var from MD_APPLE_SDK_ROOT to DEVELOPER_DIR. |
| tests/package-mac-tests.sh | Update packaging script to export DEVELOPER_DIR instead of MD_APPLE_SDK_ROOT. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/IBToolTaskTests.cs | Update IBTool tests to use CurrentSdk instead of the removed static Sdks helper and shared execution helper. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_tvOS.cs | Use Task.CurrentSdk for tvOS default SDK version resolution. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_iOS.cs | Use Task.CurrentSdk for iOS default SDK version resolution. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs | Ensure TargetFrameworkMoniker is set based on Platform in core plist tests. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileAppManifestTaskTests.cs | Adjust CompileAppManifest tests to use CurrentSdk for installed SDK versions. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ACToolTaskTest.cs | Update ACTool tests to create the task earlier and avoid Sdks. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/AssemblySetup.cs | Use DEVELOPER_DIR instead of MD_APPLE_SDK_ROOT in MSBuild test setup. |
| tests/dotnet/UnitTests/XcodeVersionTest.cs | Drive Xcode selection via the XcodeLocation MSBuild property instead of MD_APPLE_SDK_ROOT. |
| tests/common/Configuration.cs | Set DEVELOPER_DIR instead of MD_APPLE_SDK_ROOT in common test build environment. |
| tests/common/BinLog.cs | Filter out deprecation noise from settings-file-related warnings in binlog parsing. |
| msbuild/Xamarin.Shared/Xamarin.Shared.targets | Thread SdkDevPath into tasks and pass XcodeLocation into DetectSdkLocations. |
| msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs | Add XcodeLocator and CurrentSdk instance-level handling and improve logging signatures. |
| msbuild/Xamarin.MacDev.Tasks/Tasks/ReadAppManifest.cs | Use CurrentSdk for Mac Catalyst iOS-version conversion. |
| msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentity.cs | Resolve codesign_allocate via CurrentSdk.DeveloperRoot. |
| msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSdkLocation.cs | Rework SDK detection to use XcodeLocator, emit deprecation warnings, and rely on CurrentSdk. |
| msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlements.cs | Resolve default entitlements path via CurrentSdk. |
| msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs | Use CurrentSdk and XcodeLocator when validating SDKs and populating Xcode-related plist keys. |
| msbuild/Xamarin.MacDev.Tasks/Sdks.cs | Remove the static Sdks helper in favor of instance-based CurrentSdk. |
| msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx | Add new warning/error messages for Xcode detection and deprecations. |
| external/Xamarin.MacDev | Bump Xamarin.MacDev submodule to gain XcodeLocator support. |
| docs/building-apps/build-properties.md | Document the new XcodeLocation build property and Xcode resolution precedence. |
| Make.config | Stop exporting MD_APPLE_SDK_ROOT at the root make level in favor of DEVELOPER_DIR. |
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileAppManifestTaskTests.cs
Show resolved
Hide resolved
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.
✅ [CI Build #f9b9cfc] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #f9b9cfc] Build passed (Detect API changes) ✅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 |
✅ [CI Build #f9b9cfc] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #f9b9cfc] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #f9b9cfc] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #f9b9cfc] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #f9b9cfc] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #f9b9cfc] Tests on macOS arm64 - Mac Tahoe (26) passed 💻✅ All tests on macOS arm64 - Mac Tahoe (26) passed. Pipeline on Agent |
🔥 [CI Build #f9b9cfc] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 116 tests passed. Failures❌ monotouch tests (MacCatalyst)1 tests failed, 10 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Misc improvements:
This will hopefully remove some confusion about which Xcode is being used; now we just look at the system's Xcode, unless it's overridden by the MSBuild property 'XcodeLocation'.
Fixes #3931.
Fixes #11172.
Fixes #21762.