Skip to content

[mtouch] Make mtouch work without Xcode, since we don't really need Xcode for what mtouch currently does.#25430

Draft
rolfbjarne wants to merge 2 commits into
mainfrom
dev/rolf/mtouch-no-xcode
Draft

[mtouch] Make mtouch work without Xcode, since we don't really need Xcode for what mtouch currently does.#25430
rolfbjarne wants to merge 2 commits into
mainfrom
dev/rolf/mtouch-no-xcode

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

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.

…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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 ValidateXcode invocation from mtouch entrypoint to avoid requiring an installed Xcode.
  • Added a new --xcode-version command-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.

Comment thread tools/mtouch/mtouch.cs
@@ -22,8 +22,6 @@ static int Main2 (string [] args)
var os = new OptionSet ();
ParseOptions (app, os, args);

Comment thread tools/common/Driver.cs
app.RuntimeIdentifier = v;
});
options.Add ("xcode-version=", "The Xcode version we're building with", v => {
Driver.XcodeVersion = Version.Parse (v);
Comment thread tools/common/Driver.cs
Comment on lines 233 to +240
static Version? xcode_version;
public static Version XcodeVersion {
get {
return xcode_version!;
}
set {
xcode_version = value;
}
Comment on lines +266 to 273
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.
Comment thread tools/mtouch/Makefile
Comment on lines +41 to +42
no-xcode-build:: .libs/Microsoft.$(9).registrar.$(10).m .libs/Microsoft.$(9).registrar.$(10).h

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

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>
@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #29abe1f] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 29abe1fddebda7e8227dfd6e564508b792c49f8d [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #29abe1f] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 29abe1fddebda7e8227dfd6e564508b792c49f8d [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 29abe1fddebda7e8227dfd6e564508b792c49f8d [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #29abe1f] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 29abe1fddebda7e8227dfd6e564508b792c49f8d [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🔥 [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

  • monotouch-test/tvOS - simulator/Debug (interpreter): Failed
  • monotouch-test/tvOS - simulator/Release (strict inline dlfcn, link sdk): Failed

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 16 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build failed

Pipeline on Agent
Hash: 29abe1fddebda7e8227dfd6e564508b792c49f8d [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants