The app continues to run successfully.
Error when the app tries to run:
dyld: Library not loaded: @rpath/SwiftGraph.framework/Versions/A/SwiftGraph Referenced from: /Users/zeisenberg/Library/Developer/Xcode/DerivedData/Pather-apyisjedacufuxbmjgfvcjuwgkwk/Build/Products/Debug/Pather.app/Contents/MacOS/Pather Reason: image not found
CocoaPods : 1.6.0.beta.1
Ruby : ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin17]
RubyGems : 2.7.7
Host : Mac OS X 10.13.6 (17G2208)
Xcode : 9.4.1 (9F2000)
Git : git version 2.18.0
Ruby lib dir : /Users/zeisenberg/.rvm/rubies/ruby-2.4.4/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 445478b05500b7362bb4f7796d489574e791a90e
Executable Path: /Users/zeisenberg/.rvm/gems/ruby-2.4.4/bin/pod
cocoapods-deintegrate : 1.0.2
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.1
cocoapods-try : 1.1.0
# Uncomment the next line to define a global platform for your project
target 'Utilities' do
platform :macos, '10.13'
use_frameworks!
pod 'SwiftGraph', :git => "https://github.com/ZevEisenberg/SwiftGraph.git"
target 'Pather' do
inherit! :search_paths
end
end
Project includes Git repository with commits that demonstrate the bug.
Note: I don't remember why I had the targets nested the way I do, with the main app nested inside the utilities target. I think it was to work around a bug at some point, but since I don't understand what target nesting signifies in CocoaPods, the answer here may be that I'm "holding it wrong." Still, it appears to be a regression.
Confirmed that if I nest in the other direction, with Pather containing Utilities, then the app runs correctly. i.e. this Podfile works:
target 'Pather' do
platform :macos, '10.13'
use_frameworks!
target 'Utilities' do
inherit! :search_paths
pod 'SwiftGraph', :git => "https://github.com/ZevEisenberg/SwiftGraph.git"
end
end
Thanks for report and sample app.
Oh, and I thought it might be related to https://github.com/CocoaPods/CocoaPods/issues/7985 but not sure
Confirmed regression, not related to #7985.
It might actually not be a regression and we are now doing the correct thing I will need to investigate further.
@ZevEisenberg this seems intentional
https://github.com/CocoaPods/CocoaPods/pull/7992
It appears that since your target has inherit! :search_paths it will no longer copy the targets of your framework into the App.
CocoaPods has logic to "transfer" dependencies of embedded targets (extensions, dynamic frameworks (although for these maybe it shouldnt) into the app thats hosting them.
I think your best bet is to turn the relationship around as you did.
@ZevEisenberg with all due respect I am going to close this one. The PR has even a test case similar to yours (except it uses static library)
Alternatively you can remove the inherit! :search_paths entry and I believe should work.
@dnkoutso thanks for the reply - sounds like I am indeed "holding it wrong." I'll invert the dependencies, and if that creates problems, I'll file a new bug. Is there a rule of thumb for how targets should be nested? Since CocoaPods 1.5.x didn't seem to care, but 1.6 does, what's the heuristic here?
Generally this is more of the standard practice but it could work the other way around (removing inheritance).
I think CP1.6.0 honors this entry more correct.
I guess I don鈥檛 understand what inherit! :search_paths does, since I think I鈥檓 not alone in being an iOS developer who doesn鈥檛 understand how search paths work, what they mean for CocoaPods, and why I might want to inherit them (or not). The CocoaPods docs on this just say that it allows you to control what gets inherited, without explaining the implications of that decision. Might be a nice area for some improved documentation. Also might be nice to catch it at pod install time, if there鈥檚 any way to tell that a configuration like the one I had couldn鈥檛 possibly work. But I don鈥檛 know if you can reliably determine that.
The latter part will be difficult.
Inherit search paths basically means "from my parent targets only bring in the search paths and nothing else, like linker flags". This effectively means that the nested target will not link the dependencies of the parent because the parent will link them.
This is common for test targets where the tests are hosted by the app target and therefore there is no need to double link dependencies (otherwise you get warnings).
Now again, CocoaPods has since early days (way before I was involved) some logic to automatically link pods from targets that are meant to be embedded like extensions of frameworks to their host target which is exactly your case here but we now properly honor that setting.
Its definitely in need of better docs I agree and can be folder under https://github.com/CocoaPods/CocoaPods/issues/7579
Most helpful comment
The latter part will be difficult.
Inherit search paths basically means "from my parent targets only bring in the search paths and nothing else, like linker flags". This effectively means that the nested target will not link the dependencies of the parent because the parent will link them.
This is common for test targets where the tests are hosted by the app target and therefore there is no need to double link dependencies (otherwise you get warnings).
Now again, CocoaPods has since early days (way before I was involved) some logic to automatically link pods from targets that are meant to be embedded like extensions of frameworks to their host target which is exactly your case here but we now properly honor that setting.
Its definitely in need of better docs I agree and can be folder under https://github.com/CocoaPods/CocoaPods/issues/7579