Fix XCFramework output path conflicts for same-named libraries #993
+201
−114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes swiftlang/swift-package-manager#9157
This change addresses an issue where multiple XCFrameworks containing libraries with the same name would cause build failures. When building a project that uses packages like Sentry.xcframework and Sentry-Dynamic.xcframework, both containing Sentry.framework internally, the build system would produce "Multiple commands produce" errors because they were all outputting to the same path in the build directory.
The fix modifies the output directory computation to include the xcframework name as a subdirectory. This ensures each xcframework outputs to its own isolated location. For example, Sentry.xcframework now outputs to
build/Debug/Sentry/Sentry.frameworkwhile Sentry-Dynamic.xcframework outputs tobuild/Debug/Sentry-Dynamic/Sentry.framework. This is a minimal change that resolves the conflict without affecting the existing linking and embedding behavior.Note
Backward Compatibility Consideration
This change modifies the output directory structure for all XCFrameworks, not just those with conflicting library names. Projects with scripts, caches, or tooling that depend on the previous output paths (e.g.,
build/Debug/Sentry.frameworkinstead ofbuild/Debug/Sentry/Sentry.framework) may need updates.Is this acceptable, or should we consider an alternative approach that only adds the subdirectory when there's an actual conflict? The current approach is simpler and provides consistent, predictable output paths.