fix(shared-core): keep symlinks in the macOS XCFramework zip - #1422
Merged
Conversation
KMMBridge's zipXCFramework task is a bare Gradle Zip task, and Gradle's Zip/CopySpec machinery dereferences symlinks instead of storing them. A macOS framework bundle is built entirely from symlinks (Versions/Current -> A, and Headers/Modules/Resources/binary each pointing into Versions/Current/*), so the archive KMMBridge produced for the macOS slice shipped three duplicate copies of the same content instead of the real bundle layout. iOS bundles are flat, which is why this went unnoticed until the macOS targets landed (#1402). Confirmed against the published 0.5.0 release: unzipping it and listing the macOS slice shows Versions/Current, Headers, Modules, Resources, and the binary as full duplicated files rather than symlinks, which fails codesign on anything that builds against that slice ("code object is not signed at all" on the nested framework). KMMBridge 1.2.1 is still the newest release and its tracker has nothing open about this, so there's no upstream fix to pick up. Once KMMBridge's own zipXCFramework runs, doLast deletes the result and re-zips the same source directory with `zip -y`, which stores symlinks as symlinks. The reconfiguration only touches the task when KMMBridge registers it, so it's a no-op on any build where publishing isn't enabled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
KMMBridge's
zipXCFrameworktask is a bare GradleZiptask, and Gradle'sZip/CopySpecmachinery dereferences symlinks instead of storing them. A macOS framework bundle is built entirely from symlinks —Versions/Current -> A, and the top-levelHeaders/Modules/Resources/binary each symlinking intoVersions/Current/*— so the archive KMMBridge produces for the macOS slice ships three literal duplicate copies of the same content instead of the real bundle layout. iOS framework bundles are flat, which is why this was invisible until the macOS targets landed (#1402).The published
0.5.0release confirms it: unzipping the release asset and listing the macOS slice showsVersions/Current,Headers,Modules,Resources, and the binary as full duplicated files rather than symlinks. Any consumer that builds and codesigns against the macOS slice fails withcode object is not signed at allon the nested framework, because codesign's recursive bundle signing needs the real symlinked structure.KMMBridge 1.2.1 is still the newest release (checked the Gradle Plugin Portal and GitHub releases) and its issue tracker has nothing open about this, so there is no upstream fix to pick up. This reconfigures the existing
zipXCFrameworktask: once KMMBridge's own zip runs,doLastdeletes the result and re-zips the same source directory withzip -y, which stores symlinks as symlinks instead of following them. The reconfiguration only touches the task when KMMBridge registers it (matching {}), so it stays a no-op on any build where publishing is not enabled.Verified locally by running
:kmp:shared-core:zipXCFrameworkdirectly (placeholderlocal.propertiesandspmRepoDir, no real publish) and extracting the resulting archive: the macOS slice now has real symlinks (Headers -> Versions/Current/Headers,Current -> A, etc.) instead of duplicated files.This unblocks a
0.5.1release offlipcash-shared-core-spm— needed before code-ios-app#725 can adopt shared mnemonic derivation against a macOS-capable build.