Skip to content

[msbuild] Copy dSYMs from xcframeworks next to the app's dSYM. Fixes #23076.#25979

Draft
rolfbjarne wants to merge 7 commits into
mainfrom
dev/rolf/issue-23076-copy-dsyms-from-xcframeworks
Draft

[msbuild] Copy dSYMs from xcframeworks next to the app's dSYM. Fixes #23076.#25979
rolfbjarne wants to merge 7 commits into
mainfrom
dev/rolf/issue-23076-copy-dsyms-from-xcframeworks

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Add a new _CopyXCFrameworkDSyms MSBuild target that copies pre-existing dSYMs
from xcframeworks next to the app's dSYM, so that they're included in the
archive when the app is archived.

The target uses Inputs/Outputs for incremental build support.

Also add an ArchiveDir MSBuild property to the Archive task, which allows
specifying a custom archive directory instead of computing a unique path
under ~/Library/Developer/Xcode/Archives.

Also modify the test-libraries Makefile to run dsymutil on dynamic framework
binaries and include the resulting dSYMs in xcframeworks.

Fixes #23076

🤖 Pull request created by Copilot

…23076.

Add a new _CopyXCFrameworkDSyms MSBuild target that copies pre-existing dSYMs
from xcframeworks next to the app's dSYM, so that they're included in the
archive when the app is archived.

The target uses Inputs/Outputs for incremental build support.

Also add an ArchiveDir MSBuild property to the Archive task, which allows
specifying a custom archive directory instead of computing a unique path
under ~/Library/Developer/Xcode/Archives.

Also modify the test-libraries Makefile to run dsymutil on dynamic framework
binaries and include the resulting dSYMs in xcframeworks.

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

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

…rameworks.

The xcframeworks now include dSYMs for dynamic frameworks, so the test
verifying zip contents needs to expect the dSYM entries as well.

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

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

The previous Makefile change used $(wildcard) to conditionally pass
-debug-symbols to xcodebuild, but $(wildcard) in a recipe generated
by $(eval) is evaluated at Makefile parse time (before any targets are
built), so it never found the dSYMs.

Fix by using a shell-level 'test -d' check in the recipe instead, which
runs at recipe execution time when the dSYMs have already been built.

Also tolerate extra Relocations/ entries in dSYM bundles in the
LibraryReferencingBindingLibrary test, since dsymutil produces these
for fat (universal) binaries and the exact contents vary by architecture.

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

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

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.

Pull request overview

This PR improves archiving/debug-symbol handling for apps that consume native xcframeworks by ensuring any pre-existing framework dSYMs inside xcframeworks are copied next to the app’s dSYM so they get included in the produced .xcarchive. It also adds a way to control where the archive is created (useful for tests/CI).

Changes:

  • Add new MSBuild targets (_ComputeXCFrameworkDSyms / _CopyXCFrameworkDSyms) to copy xcframework dSYMs next to the app’s dSYM during post-processing.
  • Extend the Archive MSBuild task with an ArchiveDir property to allow specifying the archive output directory.
  • Update test infrastructure and unit tests to generate/include xcframework dSYMs and validate they end up in the archive.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test-libraries/Makefile Runs dsymutil for framework binaries and passes -debug-symbols into xcodebuild -create-xcframework so dSYMs are packaged into the xcframework.
tests/dotnet/UnitTests/ProjectTest.cs Updates expected xcframework zip contents to include dSYMs/ entries; relaxes “extra files” check within dSYM bundles.
tests/dotnet/UnitTests/PostBuildTest.cs Adds a regression test asserting xcframework dSYMs are present in the produced archive’s dSYMs directory.
msbuild/Xamarin.Shared/Xamarin.Shared.targets Adds targets to compute/copy xcframework dSYMs during post-processing; wires into post-processing dependency chain and passes ArchiveDir into the Archive task.
msbuild/Xamarin.MacDev.Tasks/Tasks/Archive.cs Adds ArchiveDir property and uses it (when set) to decide archive output location.
docs/building-apps/build-properties.md Documents the new ArchiveDir MSBuild property.

Comment thread msbuild/Xamarin.MacDev.Tasks/Tasks/Archive.cs
Comment thread msbuild/Xamarin.Shared/Xamarin.Shared.targets Outdated
- Don't delete user-provided ArchiveDir on failure (only auto-generated
  archive directories should be cleaned up).
- Rewrite _ComputeXCFrameworkDSyms ItemGroup to avoid mixing @() item
  transforms with %() batching on different item groups, which could
  cause incorrect metadata association.

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

This comment has been minimized.

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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Comment thread tests/test-libraries/Makefile Outdated
Comment thread tests/test-libraries/Makefile Outdated
Comment thread tests/test-libraries/Makefile Outdated
Comment thread msbuild/Xamarin.Shared/Xamarin.Shared.targets
Comment thread msbuild/Xamarin.Shared/Xamarin.Shared.targets Outdated
Comment thread msbuild/Xamarin.Shared/Xamarin.Shared.targets
@vs-mobiletools-engineering-service2

This comment has been minimized.

- Remove redundant prerequisite in Makefile (dSYM already depends on
  the framework binary, so the stamp only needs to depend on the dSYM).
- Quote paths in shell loop for xcframework creation.
- Use Path.Combine instead of hardcoded '/' separators in MSBuild targets
  for cross-platform consistency.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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 previous code used %(_XCFrameworkDSymCandidate.DSymSourceDir) inside
$([System.IO.Path]::Combine(...)) in an Include attribute, which MSBuild
can't parse. Fix by using @(Items->'transform') syntax instead, which
properly resolves %(metadata) references per-item within the transform.

Also revert Inputs/Outputs to use simple path concatenation with '/' since
the target only runs on macOS.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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.

…meworkDSyms.

MSBuild can't parse %(metadata) references inside $([System.IO.Path]::Combine(...))
in Condition attributes. Since this target only runs on macOS, use simple '/'
concatenation instead of Path.Combine.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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: e96d459ca4f414f7d02892e9ed162de525c3cb54 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #e96d459] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

2 tests crashed, 3 tests failed, 192 tests passed.

Failures

❌ dotnettests tests (iOS) [attempt 2]

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppIconTest.AlternateAppIcon(iOS,"ios-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • Xamarin.Tests.AppIconTest.AlternateAppIcons(iOS,"ios-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • Xamarin.Tests.AppIconTest.AppIcon_1(iOS,"ios-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • ... and 56 more

Html Report (VSDrops) Download

❌ dotnettests tests (MacCatalyst) [attempt 2]

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppSizeTest.MonoVM_Interpreter(MacCatalyst,"maccat...: 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • Xamarin.Tests.AppSizeTest.MonoVM(MacCatalyst,"maccatalyst-arm64"...: 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • Xamarin.Tests.AppSizeTest.NativeAOT_TrimmableStatic(MacCatalyst,...: 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • ... and 5 more

Html Report (VSDrops) Download

❌ dotnettests tests (macOS)

🔥 Failed catastrophically on VSTS: test results - dotnettests_macos (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (tvOS) [attempt 2]

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppIconTest.AlternateAppIcon(TVOS,"tvos-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • Xamarin.Tests.AppIconTest.AlternateAppIcons(TVOS,"tvos-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • Xamarin.Tests.AppIconTest.AppIcon_1(TVOS,"tvos-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • ... and 26 more

Html Report (VSDrops) Download

❌ windows tests [attempt 2]

🔥 Failed catastrophically on VSTS: test results - windows (no summary found).

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 (Multiple platforms): 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. [attempt 2] Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 17 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 18 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 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 succeeded

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

Copy dSYMs from xcframeworks next to the app's dSYM

3 participants