Fix xcframework extraction when a project refers to a missing build directory#3135
Conversation
…irectory
Projects may search a directory like Carthage/Build/iOS, but under
--use-xcframeworks that platform-specific folder ("iOS") might not
exist. resolvingSymlinksInPath() follows realpath(3) semantics and will
not resolve symlinks in the components of a non-existant URL.
Fixed in extractXCFrameworks() by truncating the given URL down to its
extant portion. Since we only care about prefix matching, and since the
Carthage/Build URL will exists at build time due to
symlinkBuildPathIfNeeded, this is safe.
Fixes Carthage#3122 and testing using the Cartfile in the issue.
|
Are we sure this will end resolution to Carthage/Build/ and not chop backwards more than that? |
@tmspzz I think so! When symlinkBuildPathIfNeeded is called at the start of the build process, it creates Carthage/Build/ if needed. So this is always being called when Carthage/Build exists.
We ought to be able to write a unit test for this without too much effort. I'll see if I can do that soon. |
Based on the way XcodeSpec is set up, I'm having trouble writing a test like this without being able to pass |
|
@elliottwilliams @tmspzz When can we expect a patch release that includes those changes? A lot of projects using Carthage can't build with 0.37 without this. Thank you! |
Projects with Cartfile dependencies typically contain a FRAMEWORKS_SEARCH_PATH entry like
Carthage/Build/iOS. With--use-xcframeworks, that platform-specific folder ("iOS") might not exist. This makes the predicate in extractXCFrameworks fail, because resolvingSymlinksInPath() has realpath(3) semantics and will not resolve symlinks for a non-existant path.Fixed by truncating the given URL down to its extant portion. Since we only care about matching the prefix, and since the
Carthage/Builddirectory should always exist because symlinkBuildPathIfNeeded was called, this should be safe.Fixes #3122. I tested using the Cartfile in this issue.