The source_files
attribute does not match relative paths using ..
, e.g. ../Classes/ExampleLib.{m,h}
Ran pod install
on a Podspec that located its source_files
using a relative path, "../Classes/ExampleLib.{m,h}"
.
pod install
installed the source files into the Xcode project
pod install
didn't install the source files, though it did create Pods targets, dummy files, xcconfig files, etc.
Initially @dstumm had this issue when using the path ../GraphicServices.framework
for the vendored_frameworks
attribute, and I replicated the issue in the Cocoapods Example Library for the regular source_files
attribute. The example project replicating the issue is here. (You'll need to pod install
from within the Example/
directory to replicate).
Cocoapods: I replicated this issue on 0.22.3 and 0.23.0.rc1
Ruby: ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.3.0]
RubyGems: 1.8.25
OS: OS X 10.8.4 Build 12E55
Xcode: 4.6.3 (4H1503)
Pod::Spec.new do |s|
s.name = 'ExampleLib'
s.version = '1.0'
s.license = { :type => 'MIT', :file => '../LICENSE' }
s.homepage = 'http://github.com/orta/ExampleLib'
s.authors = { 'orta' => '[email protected]' }
s.source = { :git => 'https://github.com/orta/ExampleLib.git', :tag => s.version.to_s }
s.summary = 'Just a simple podspec, no working code.'
s.description = 'Just a simple podspec for 2 files.'
s.source_files = "../Classes/ExampleLib.{m,h}"
end
pod lib lint
-> ExampleLib (1.0)
- WARN | The description is shorter than the summary.
- ERROR | The `source_files` pattern did not match any file.
[!] ExampleLib did not pass validation.
While I agree that in theory relative paths should work, it鈥檚 never a good idea to move a podspec out of the repo root, because then people won鈥檛 be able to use CocoaPods to install it directly from your repo (which is where it expects it). Henceforth, I鈥檓 not so sure we have to fix this. @irrationalfab do you have any thoughts?
PS: Can you point me to @dstumm鈥檚 ticket regarding vendored_frameworks
?
As @alloy says the podspec should be in the root of the repo. This is done to simplify the usage of the pod directly from the repo (otherwise it would be necessary to specify the path of the podspec) and for technical reasons as CocoaPods caches the list of the paths of the Pod.
The behavior discussed in the ticket would not allow to assume the root of the pod and thus to support it it would be necessary to introduce an alternative and dedicated logic (which doesn't relies in caching) in CocoaPods. In my opinion the benefit over cost of development is very low (but it might be the case that I'm missing an important usage scenario).
I'm very sorry to close an issue which such a great description/example. However I think that this feature should not be considered for CocoaPods 1.0. Later it can be discussed if there is enough demand for it.
Yeah that's fine -- using the parent directory isn't important to us, it's just how @dstumm was organizing his repo. I submitted a PR for the file_patterns
section of the docs to note that the parent directory isn't supported, and a recommendation to put the Podspec at the root of the repo:
@alloy, @dstumm didn't submit a separate ticket as it all looked to be the same hting
You can save much time to many developers if you add some kind of a warning about this unintuitive behaviour
the parent directory isn't supported
Here is a use-case I hope you'll find valid:
We're developing a framework to be distributed as a binary. We have the main (private) repo containing a framework project with the source code, and a folder inside it is organized as a submodule which points to a public repo, which contains the built framework, a demo app, and the podspec so that consumers would point to the public repo to use it.
To ease development/testing, I want to just change the line in the podspec saying s.vendored_frameworks = ...
to s.source_files = '../Source/*.swift'
to reference the sources from the parent directory (and repository).
So please, please fix this.
Ran into this same issue today. Would really like to have this working, without excuses of how it "should" be done.
Another use case - we have two different podspec files, one for iOS, one for macOS, and thus two different pod repo root directories, but the code for them is the same. Would rather not have to duplicate the code.
Was any workaround found so far?
Most helpful comment
You can save much time to many developers if you add some kind of a warning about this unintuitive behaviour