Skip to content

[msbuild] Add extra arguments for ibtool and actool. Fixes #25677. - #26641

Open
rolfbjarne wants to merge 4 commits into
mainfrom
dev/rolf/fix-issue-25677
Open

rolfbjarne wants to merge 4 commits into
mainfrom
dev/rolf/fix-issue-25677

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Add ACToolExtraArgs and IBToolExtraArgs MSBuild properties so applications can pass additional command-line arguments to actool and ibtool. This enables scenarios such as opting out of Xcode 27's toolchain-based Interface Builder compilation mode.

Parse quoted arguments through the existing StringUtils helper and report invalid values as MSBuild errors. Track each property's value as an incremental-build input so changing additional arguments recompiles the affected resources instead of reusing stale outputs.

Document both properties and add focused coverage for quoted and invalid argument values.

Fixes #25677.

🤖 Pull request created by Copilot

rolfbjarne and others added 2 commits September 16, 2026 16:10
Add ACToolExtraArgs and IBToolExtraArgs properties, parse and forward their values to the corresponding Xcode tools, and invalidate incremental resource caches when they change. Document the new properties and cover argument parsing.

Fixes #25677

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Follow the MSBuild task nullability convention for optional inputs and snapshot the property before parsing so netstandard flow analysis can prove it is non-null.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 16, 2026 14:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

IBToolExtraArgs changes can leave stale outputs; incremental-build coverage and a clearer parsing diagnostic are also needed.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds ACToolExtraArgs and IBToolExtraArgs MSBuild properties for passing additional arguments to Xcode tools.

Changes:

  • Parses and validates quoted arguments.
  • Tracks extra arguments for incremental builds.
  • Documents both properties and adds parser tests.
File summaries
File Review summary
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/IBToolTaskTests.cs Adds quoted and invalid argument tests. Incremental-build regression coverage is still needed.
msbuild/Xamarin.Shared/Xamarin.Shared.targets Moderate bug: changing IBToolExtraArgs can leave stale compiled outputs. Additional incremental-build coverage is needed for both tools.
msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs Nit: unmatched-quote errors reference internal AdditionalArguments instead of the public MSBuild property.
docs/building-apps/build-properties.md Documents both new properties.
Review details

Suppressed comments (3)

msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs:152

  • ⚠️ error_message — When IBToolExtraArgs or ACToolExtraArgs contains an unmatched quote, this reports Unable to parse the 'AdditionalArguments' value. AdditionalArguments is only the task's internal property, not the MSBuild setting the user must fix, so the diagnostic is misleading. Pass the public property name into the helper (or use a generic localized message) so the error identifies the setting that needs correction.
				Log.LogError (MSBStrings.E7132 /* Unable to parse the 'AdditionalArguments' value: {0} */, additionalArgumentsValue);

msbuild/Xamarin.Shared/Xamarin.Shared.targets:925

  • ⚠️ test_coverage — This new stamp file is the mechanism that promises changing IBToolExtraArgs invalidates the cached compiler output, but the added tests only exercise argument parsing and never build twice with a changed property. Add an incremental-build regression that verifies _CoreCompileInterfaceDefinitions reruns after IBToolExtraArgs changes (and covers the analogous ACToolExtraArgs path) so this cache invalidation cannot silently regress.
		Inputs="@(InterfaceDefinition);$(_IBToolExtraArgsInput)"
		Outputs="$(_IBToolCache)"
		DependsOnTargets="_WriteIBToolExtraArgsInput">

msbuild/Xamarin.Shared/Xamarin.Shared.targets:1054

  • ⚠️ test_coverage — The ACToolExtraArgs stamp and deletion path is also new, but no test changes exercise an incremental build where this property changes and confirm _CoreCompileImageAssets reruns. Add coverage for this target in the same regression suite so stale actool outputs are detected.
		Inputs="@(ImageAsset);$(_TemporaryAppManifest);$(_ACToolExtraArgsInput)"
		Outputs="$(_ACTool_PartialAppManifestCache);$(_ACTool_BundleResourceCache)"
		DependsOnTargets="_ReadAppManifest;_WriteACToolExtraArgsInput"
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread msbuild/Xamarin.Shared/Xamarin.Shared.targets
@vs-mobiletools-engineering-service2

This comment has been minimized.

Include the extra-arguments stamp in IBTool's per-resource freshness check so changing IBToolExtraArgs recompiles interface definitions instead of retaining outputs produced with the previous arguments. Add focused timestamp coverage for the regression.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The critical Windows-to-Mac stamp issue must be fixed, and focused ACTool coverage should be added.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (2)

msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs:152

  • ⚠️ error_message — When a project sets IBToolExtraArgs or ACToolExtraArgs to an invalid quoted string, this reports AdditionalArguments instead of the property the user configured. That name is only the internal task parameter, so the diagnostic is misleading and cannot be searched back to either documented MSBuild property; use a tool-specific property name or a generic localized message for the public setting.
				Log.LogError (MSBStrings.E7132 /* Unable to parse the 'AdditionalArguments' value: {0} */, additionalArgumentsValue);

msbuild/Xamarin.Shared/Xamarin.Shared.targets:1099

  • 💡 test_coverage — The new ACTool wiring is not exercised by the added tests: they invoke AppendAdditionalArguments through TestIBTool, so a regression that stops forwarding ACToolExtraArgs at this call site would still pass. Add a focused ACTool task test that verifies the generated command arguments (including a quoted value and an invalid value).
			AdditionalArguments="$(ACToolExtraArgs)"
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread msbuild/Xamarin.Shared/Xamarin.Shared.targets
Run the IBTool and ACTool extra-argument stamp writers through the remote build session and copy the files back to Windows so both remote task execution and local incremental checks observe the same inputs. Improve invalid-argument diagnostics to name the public MSBuild property and add focused ACTool coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Two review findings remain regarding diagnostics and ACTool incremental-build coverage.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (1)

msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs:156

  • ⚠️ error_message — This diagnostic only echoes the raw property value and drops the FormatException returned by StringUtils, so an unmatched quote is reported without the actionable “No matching quote found” reason. Keep the property name, but include ex.Message in the MSBuild error.
			if (!StringUtils.TryParseArguments (additionalArgumentsValue, out var additionalArguments, out var _)) {
				var propertyName = AdditionalArgumentsPropertyName ?? nameof (AdditionalArguments);
				Log.LogError ("Unable to parse the '{0}' value: {1}", propertyName, additionalArgumentsValue);
				return false;
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines +1060 to +1062
Inputs="@(ImageAsset);$(_TemporaryAppManifest);$(_ACToolExtraArgsInput)"
Outputs="$(_ACTool_PartialAppManifestCache);$(_ACTool_BundleResourceCache)"
DependsOnTargets="_ReadAppManifest"
DependsOnTargets="_ReadAppManifest;_WriteACToolExtraArgsInput"
@vs-mobiletools-engineering-service2

This comment has been minimized.

@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: 0fb2e83f82d29353e7de0195cba6ee9792f4595c [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #0fb2e83] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 1 tests failed, 263 tests passed.

Failures

❌ xtro tests

1 tests failed, 0 tests passed.

Failed tests

  • Xtro: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.Xtro.RunTest: ExitCode
      Assert.That(rv, Is.EqualTo (0))
      Expected: 0
      But was: 2

Html Report (VSDrops) Download

Successes

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ 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 7 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 31 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 25 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

macOS tests

✅ 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
⚠️ Tests on macOS Golden Gate (27): Tests skipped, incorrect beta version. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 0fb2e83f82d29353e7de0195cba6ee9792f4595c [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.

Add support for passing additional arguments to IBTool/ACTool

3 participants