[mtouch] Remove unused code from mtouch#25428
Conversation
Remove GatherFrameworks and ValidateAssembliesBeforeLink which are dead code (never called by anyone). Guard AddAssembly, ExtractNativeLinkInfo, and ComputeLinkerFlags with #if !LEGACY_TOOLS since they are only called from dotnet-linker. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Guard methods only called from dotnet-linker with #if !LEGACY_TOOLS: CreateCache, ParseCustomLinkFlags, ParseInterpreter, UnsetInterpreter, IsTodayExtension, IsTVExtension, ExtensionIdentifier, InfoPListPath, RequiresPInvokeWrappers, TryParseManagedExceptionMode, TryParseObjectiveCExceptionMode, ValidateAbi, ClearAbi, MonoGCParams, LibMonoLinkMode, LibXamarinLinkMode, LibMonoNativeLinkMode, and VerifyDynamicFramework. Delete GetArchitectures (dead code - never called by anyone). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Guard methods only called from dotnet-linker with #if !LEGACY_TOOLS: ValidateXcode, FindSystemXcode, FromPList, XcodeProductVersion, FindTool, XcrunFind, RunXcodeTool, RunClang, RunInstallNameTool, RunBitcodeStrip, RunLipo, RunLipoAndCreateDsym, CreateDsym, RunDsymUtil, and RunStrip. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove dead code that is never called from any project: - Assembly.cs: ReadManifest, ParseAttributeWithDefault - cache.cs: CompareDirectories, CompareAssemblies, AssemblyReader class - MachO.cs: GetNativeDependencies + native_dependencies field, SelectArchitectures (was behind #if MTOUCH which is never defined) 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.
Un-guard ValidateXcode, FindSystemXcode, FromPList, and XcodeProductVersion so they compile for mtouch (LEGACY_TOOLS). Restore the ValidateXcode call in mtouch.cs. 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.
There was a problem hiding this comment.
Pull request overview
This PR trims dead or non-mtouch code from shared tooling so the legacy mtouch registrar path carries less unused functionality.
Changes:
- Removes unused assembly/cache/Mach-O helper code.
- Wraps dotnet-linker-only
Application,Target, andDriverfunctionality in#if !LEGACY_TOOLS. - Keeps the remaining common code focused on mtouch’s static registrar usage.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tools/common/Target.cs |
Removes obsolete link-time assembly/framework helpers and guards non-legacy linker APIs. |
tools/common/MachO.cs |
Removes unused native dependency and architecture selection helpers. |
tools/common/Driver.cs |
Guards Xcode tool execution helpers for non-legacy builds. |
tools/common/cache.cs |
Removes unused directory/assembly comparison support and AssemblyReader. |
tools/common/Assembly.cs |
Removes unused native reference manifest parsing helpers. |
tools/common/Application.cs |
Guards linker/bundling-only properties and helpers away from legacy mtouch. |
| return result; | ||
| } | ||
|
|
||
| #if !LEGACY_TOOLS |
✅ [PR Build #6dc8708] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #6dc8708] 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 #6dc8708] Build passed (Build macOS tests) ✅Pipeline on Agent |
🔥 [CI Build #6dc8708] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 4 tests failed, 171 tests passed. Failures❌ fsharp tests2 tests failed, 2 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (iOS)1 tests failed, 15 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (tvOS)1 tests failed, 15 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 |
The mtouch tool is only ever invoked with
--runregistrar, so a lot of code in the sharedtools/common/files is never executed by mtouch. This PR removes ~520 lines of dead code.Changes
Fully deleted (dead code with no callers anywhere):
GatherFrameworks(91 lines),ValidateAssembliesBeforeLinkGetArchitecturesReadManifest,ParseAttributeWithDefaultCompareDirectories,CompareAssemblies,AssemblyReaderclass (~230 lines)GetNativeDependencies+native_dependenciesfield,SelectArchitectures(was behind#if MTOUCHwhich is never defined)Guarded with
#if !LEGACY_TOOLS(used by dotnet-linker but not mtouch):AddAssembly,ExtractNativeLinkInfo,ComputeLinkerFlagsCreateCache,ParseCustomLinkFlags,ParseInterpreter,ValidateAbi,MonoGCParams,LibMonoLinkMode, etc.ValidateXcode,FindTool,XcrunFind,RunClang,RunLipo,CreateDsym,RunStrip, etc.Build infrastructure:
--ignore-xcodeconfigure optionVerification
make all install -C tools✅make all install -C msbuild✅🤖 Pull request created by Copilot