[mtouch] Make mtouch work without Xcode, since we don't really need Xcode for what mtouch currently does.#25430
[mtouch] Make mtouch work without Xcode, since we don't really need Xcode for what mtouch currently does.#25430rolfbjarne wants to merge 2 commits into
Conversation
…code for what mtouch currently does. mtouch only needs to know the Xcode version to do what it currently does (create the partial static registrar code during our build), so just pass that instead of the path to Xcode.
There was a problem hiding this comment.
Pull request overview
This PR aims to let mtouch run its registrar-generation workflow without requiring an Xcode installation by passing the Xcode version (instead of an Xcode path) through the build.
Changes:
- Removed
ValidateXcodeinvocation frommtouchentrypoint to avoid requiring an installed Xcode. - Added a new
--xcode-versioncommand-line option and plumbed it through the mtouch build Makefile. - Added a partial fallback for Mac Catalyst macOS→iOS version mapping when Xcode isn’t configured.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| tools/mtouch/mtouch.cs | Stops validating/finding Xcode before running registrar generation. |
| tools/mtouch/Makefile | Passes --xcode-version $(XCODE_VERSION) to mtouch and adds a Linux-oriented no-xcode-build path. |
| tools/common/Driver.cs | Adds --xcode-version parsing and exposes a setter for Driver.XcodeVersion. |
| tools/common/Application.cs | Adds a warning+fallback path for Mac Catalyst version mapping when Xcode isn’t configured. |
| @@ -22,8 +22,6 @@ static int Main2 (string [] args) | |||
| var os = new OptionSet (); | |||
| ParseOptions (app, os, args); | |||
|
|
|||
| app.RuntimeIdentifier = v; | ||
| }); | ||
| options.Add ("xcode-version=", "The Xcode version we're building with", v => { | ||
| Driver.XcodeVersion = Version.Parse (v); |
| static Version? xcode_version; | ||
| public static Version XcodeVersion { | ||
| get { | ||
| return xcode_version!; | ||
| } | ||
| set { | ||
| xcode_version = value; | ||
| } |
| if (macOSVersion.Major >= 26 && Driver.SdkRoot is null) { | ||
| // this shouldn't happen for normal builds, nor for customers, so just show a internal 99 warning. | ||
| ErrorHelper.Warning (99, Errors.MX0099, $"No Xcode configured, assuming the macOS version {macOSVersion} is identical to the Mac Catalyst/iOS version."); | ||
| return macOSVersion; | ||
| } | ||
|
|
||
| if (!MacCatalystSupport.TryGetiOSVersion (Driver.GetFrameworkDirectory (this), macOSVersion, out var value, out var knownMacOSVersions)) | ||
| throw ErrorHelper.CreateError (184, Errors.MX0184 /* Could not map the macOS version {0} to a corresponding Mac Catalyst version. Valid macOS versions are: {1} */, macOSVersion.ToString (), string.Join (", ", knownMacOSVersions.OrderBy (v => v))); |
| public Version GetMacCatalystiOSVersion (Version macOSVersion) | ||
| { | ||
| if (macOSVersion.Major >= 26 && Driver.SdkRoot is null) { | ||
| // this shouldn't happen for normal builds, nor for customers, so just show a internal 99 warning. |
| no-xcode-build:: .libs/Microsoft.$(9).registrar.$(10).m .libs/Microsoft.$(9).registrar.$(10).h | ||
|
|
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.
The hardcoded macOS dylib path does not exist on Linux. Using "libc" as the library name lets the .NET runtime resolve the correct native library on both macOS and Linux. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ [PR Build #29abe1f] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #29abe1f] Build passed (Build packages) ✅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 |
✅ [PR Build #29abe1f] Build passed (Build macOS tests) ✅Pipeline on Agent |
🔥 [CI Build #29abe1f] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 2 tests failed, 173 tests passed. Failures❌ monotouch tests (tvOS)2 tests failed, 14 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 |
mtouch only needs to know the Xcode version to do what it currently does
(create the partial static registrar code during our build), so just pass that
instead of the path to Xcode.