Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CocoaPods] Resolve dependencies at parent level #1210

Merged
merged 2 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 8 additions & 21 deletions CodePush.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|

s.name = 'CodePush'
s.version = package['version'].gsub(/v|-beta/, '')
s.summary = package['description']
Expand All @@ -15,26 +14,14 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '9.0'
s.preserve_paths = '*.js'
s.library = 'z'
s.source_files = 'ios/CodePush/*.{h,m}'
s.public_header_files = ['ios/CodePush/CodePush.h']

# Note: Even though there are copy/pasted versions of some of these dependencies in the repo,
# we explicitly let CocoaPods pull in the versions below so all dependencies are resolved and
# linked properly at a parent workspace level.
s.dependency 'React'

s.subspec 'Core' do |ss|
ss.source_files = 'ios/CodePush/*.{h,m}'
ss.public_header_files = ['ios/CodePush/CodePush.h']
end

s.subspec 'SSZipArchive' do |ss|
ss.source_files = 'ios/CodePush/SSZipArchive/*.{h,m}', 'ios/CodePush/SSZipArchive/aes/*.{h,c}', 'ios/CodePush/SSZipArchive/minizip/*.{h,c}'
ss.private_header_files = 'ios/CodePush/SSZipArchive/*.h', 'ios/CodePush/SSZipArchive/aes/*.h', 'ios/CodePush/SSZipArchive/minizip/*.h'
end

s.subspec 'JWT' do |jwt|
jwt.source_files = 'ios/CodePush/JWT/**/*.{h,m}'
jwt.private_header_files = 'ios/CodePush/JWT/**/*.h'
end

s.subspec 'Base64' do |base64|
base64.source_files = 'ios/CodePush/Base64/**/*.{h,m}'
base64.private_header_files = 'ios/CodePush/Base64/**/*.h'
end
s.dependency 'SSZipArchive', '~> 2.1'
s.dependency 'JWT', '~> 3.0.0-beta.7'
s.dependency 'Base64', '~> 1.1'
end
16 changes: 2 additions & 14 deletions docs/setup-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,9 @@ And that's it! Isn't RNPM awesome? :)
pod 'CodePush', :path => '../node_modules/react-native-code-push'
```

CodePush depends on an internal copy of the `SSZipArchive`, `JWT` and `Base64` libraries, so if your project already includes some of them (either directly or via a transitive dependency), then you can install a version of CodePush which excludes it by depending specifically on the needed subspecs:
*NOTE: The above path needs to be relative to your app's `Podfile`, so adjust it as necessary.*

```ruby
# `SSZipArchive`, `JWT` and `Base64` already in use
pod 'CodePush', :path => '../node_modules/react-native-code-push', :subspecs => ['Core']

# or for example

# `SSZipArchive` and `Base64` already in use
pod 'CodePush', :path => '../node_modules/react-native-code-push', :subspecs => ['Core', 'JWT']
```

*NOTE: The above paths needs to be relative to your app's `Podfile`, so adjust it as neccessary.*

*NOTE: `JWT` library should be of version 3.0.x*
*NOTE: `JWT` library should be >= version 3.0.x*

2. Run `pod install`

Expand Down