在Cocoapods podspec中递归包含文件 [英] include files recursively in Cocoapods podspec
问题描述
我想创建基于某些私有代码的本地podspec。我似乎无法使用'source'属性,因为该属性不起作用。我可以使用 source_files属性,但该属性不包含递归文件。因此,使用这样的目录
I want to create a local podspec that is based on some private code. I can't seem to use the 'source' attribute, as that is not working. I can use the 'source_files' attribute, but it does not include files recursively. So with a directory that looks like this
Library
/src
/Core
/Audio
/Graphics
我的podspec看起来像这样:
And my podspec looks like this:
Pod::Spec.new do |s|
...
s.source = 'src' # this does not work.
s.source_files = 'src' # this only includes the files in src, and not in any of the Core, Audio or Graphics folders.
我有点想指定一个-r标志。我尝试使用通配符,但没有运气。
I kind of want to specify a '-r' flag. I have tried using wildcards but no luck.
推荐答案
source_files
属性使用 Ruby文件Glob语法。该模式必须相对于项目的根目录(即podspec文件),因此它应该对您有用:
The source_files
attribute uses Ruby file glob syntax. The pattern must be relative to the root of your project (i.e., the podspec file), so this should work for you:
s.source_files = 'Library/src/**/*.{h,m}'
source
属性不是用于源代码文件,而是用于应从中检索代码的远程存储库(最常见的是Git存储库URL和标签)。有关更多信息,请参见 CocoaPods规范文档。
The source
attribute is not for source code files, but rather for the remote repository from which the code should be retrieved (most commonly a Git repository URL and tag). See the CocoaPods specification docs for more info.
这篇关于在Cocoapods podspec中递归包含文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!