如何构建依赖于特定 react-native 版本的私有 CocoaPod?
How to build a private CocoaPod with dependency on specific react-native version?
我正在尝试为我的 Cocoa Touch 框架(swift 版本 4.0)构建一个私有 cocoapod,它依赖于 React-Native v0.46.4 和 Yoga,使用这个 podspec :
react_native_version = '0.46.4'
Pod::Spec.new do |s|
s.name = 'MyLibrary'
s.version = '0.1.0'
s.source = { :git => 'https://github.com/mylibrary.git', :tag => s.version.to_s,
:git => 'https://github.com/facebook/react-native.git', :tag => "v#{react_native_version}"
}
s.platform = :ios, '11.0'
s.requires_arc = true
s.source_files = 'MyLibrary/Classes/**/*.swift'
s.resources = 'MyLibrary/Assets/*.{png,storyboard}'
s.public_header_files = 'MyLibrary/Classes/**/*.h'
s.frameworks = 'UIKit', 'ARKit', 'SceneKit', 'SpriteKit'
s.dependency 'ADAL', '~> 2.2'
s.dependency 'Yoga', "#{react_native_version}.React"
s.dependency 'React/Core', react_native_version
s.dependency 'React/BatchedBridge', react_native_version
s.dependency 'React/DevSupport', react_native_version
s.dependency 'React/RCTText', react_native_version
s.dependency 'React/RCTImage', react_native_version
s.dependency 'React/RCTLinkingIOS', react_native_version
s.dependency 'React/RCTSettings', react_native_version
s.dependency 'React/RCTVibration', react_native_version
s.dependency 'React/RCTGeolocation', react_native_version
s.dependency 'React/RCTActionSheet', react_native_version
s.dependency 'React/RCTAnimation', react_native_version
s.dependency 'React/RCTNetwork', react_native_version
s.dependency 'React/RCTWebSocket', react_native_version
End
当我像这样 运行 pod lib lint 时,我无法通过 linter 检查:
pod lib lint MyLibrary.podspec --sources=https://github.com/facebook/react-native.git,master
-> MyLibrary (0.1.0)
- WARN | source: The version should be included in the Git tag.
- ERROR | [iOS] unknown: Encountered an unknown error (An
unexpected version directory `Base` was encountered for the
`/Users/administrator/.cocoapods/repos/facebook/React` Pod in the
`React` > repository.
我已经阅读了关于 https://guides.cocoapods.org 的文档并进行了大量浏览,但仍然不确定这是否是正确的 podspec 语法来引用特定版本的存储库,或者这是否受支持?
(我正在使用 CocoaPods 1.3.1 XCode9 和 Swift 4。)
Podfile 能够覆盖 where 以查找依赖项。例如。 git repo/tag。例如。 pod 'React', :git => 'https://github.com/artsy/React.git', :tag => '0.7.0'
Podspec 规定了依赖项是什么。例如s.dependency 'React'
我正在尝试为我的 Cocoa Touch 框架(swift 版本 4.0)构建一个私有 cocoapod,它依赖于 React-Native v0.46.4 和 Yoga,使用这个 podspec :
react_native_version = '0.46.4'
Pod::Spec.new do |s|
s.name = 'MyLibrary'
s.version = '0.1.0'
s.source = { :git => 'https://github.com/mylibrary.git', :tag => s.version.to_s,
:git => 'https://github.com/facebook/react-native.git', :tag => "v#{react_native_version}"
}
s.platform = :ios, '11.0'
s.requires_arc = true
s.source_files = 'MyLibrary/Classes/**/*.swift'
s.resources = 'MyLibrary/Assets/*.{png,storyboard}'
s.public_header_files = 'MyLibrary/Classes/**/*.h'
s.frameworks = 'UIKit', 'ARKit', 'SceneKit', 'SpriteKit'
s.dependency 'ADAL', '~> 2.2'
s.dependency 'Yoga', "#{react_native_version}.React"
s.dependency 'React/Core', react_native_version
s.dependency 'React/BatchedBridge', react_native_version
s.dependency 'React/DevSupport', react_native_version
s.dependency 'React/RCTText', react_native_version
s.dependency 'React/RCTImage', react_native_version
s.dependency 'React/RCTLinkingIOS', react_native_version
s.dependency 'React/RCTSettings', react_native_version
s.dependency 'React/RCTVibration', react_native_version
s.dependency 'React/RCTGeolocation', react_native_version
s.dependency 'React/RCTActionSheet', react_native_version
s.dependency 'React/RCTAnimation', react_native_version
s.dependency 'React/RCTNetwork', react_native_version
s.dependency 'React/RCTWebSocket', react_native_version
End
当我像这样 运行 pod lib lint 时,我无法通过 linter 检查:
pod lib lint MyLibrary.podspec --sources=https://github.com/facebook/react-native.git,master
-> MyLibrary (0.1.0)
- WARN | source: The version should be included in the Git tag.
- ERROR | [iOS] unknown: Encountered an unknown error (An
unexpected version directory `Base` was encountered for the
`/Users/administrator/.cocoapods/repos/facebook/React` Pod in the
`React` > repository.
我已经阅读了关于 https://guides.cocoapods.org 的文档并进行了大量浏览,但仍然不确定这是否是正确的 podspec 语法来引用特定版本的存储库,或者这是否受支持?
(我正在使用 CocoaPods 1.3.1 XCode9 和 Swift 4。)
Podfile 能够覆盖 where 以查找依赖项。例如。 git repo/tag。例如。 pod 'React', :git => 'https://github.com/artsy/React.git', :tag => '0.7.0'
Podspec 规定了依赖项是什么。例如s.dependency 'React'