-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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] Make podspec great again. #12089
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2aca977
[podspec] Make all subspecs build as frameworks and static libs.
alloy 3b93936
[podspec] Format consistently.
alloy f8f8661
[podspec] Add version constraint to Yoga dependency.
alloy a6a1730
[podspec] Exclude C++ bridge.
alloy eea174f
[podspec] Vendor Yoga podspec.
alloy ba7fced
[podspec] Bump CP requirement to non-beta.
alloy 3fb23af
[podspec] Make Yoga spec work when used from RN repo, RN node module,…
alloy 8650707
[podspec] Add script to lint the podspecs.
alloy fac5c1b
[travis] Lint podspecs.
alloy 036f57d
[podspec] Only lint important subspecs to cut down on run time.
alloy f41c30a
[travis] Fix shell syntax.
alloy ad667a8
[travis] Podspecs should only lint on merged code.
alloy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,140 +1,138 @@ | ||
require 'json' | ||
require "json" | ||
|
||
package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) | ||
package = JSON.parse(File.read(File.join(__dir__, "package.json"))) | ||
|
||
Pod::Spec.new do |s| | ||
s.name = "React" | ||
s.version = package['version'] | ||
s.summary = package['description'] | ||
s.description = <<-DESC | ||
React Native apps are built using the React JS | ||
framework, and render directly to native UIKit | ||
elements using a fully asynchronous architecture. | ||
There is no browser and no HTML. We have picked what | ||
we think is the best set of features from these and | ||
other technologies to build what we hope to become | ||
the best product development framework available, | ||
with an emphasis on iteration speed, developer | ||
delight, continuity of technology, and absolutely | ||
beautiful and fast products with no compromises in | ||
quality or capability. | ||
DESC | ||
s.homepage = "http://facebook.github.io/react-native/" | ||
s.license = package['license'] | ||
s.author = "Facebook" | ||
s.source = { :git => "https://github.com/facebook/react-native.git", :tag => "v#{s.version}" } | ||
s.default_subspec = 'Core' | ||
s.requires_arc = true | ||
s.platform = :ios, "8.0" | ||
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" } | ||
s.header_dir = 'React' | ||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-CustomComponents", "PATENTS" | ||
s.name = "React" | ||
s.version = package["version"] | ||
s.summary = package["description"] | ||
s.description = <<-DESC | ||
React Native apps are built using the React JS | ||
framework, and render directly to native UIKit | ||
elements using a fully asynchronous architecture. | ||
There is no browser and no HTML. We have picked what | ||
we think is the best set of features from these and | ||
other technologies to build what we hope to become | ||
the best product development framework available, | ||
with an emphasis on iteration speed, developer | ||
delight, continuity of technology, and absolutely | ||
beautiful and fast products with no compromises in | ||
quality or capability. | ||
DESC | ||
s.homepage = "http://facebook.github.io/react-native/" | ||
s.license = package["license"] | ||
s.author = "Facebook" | ||
s.source = { :git => "https://github.com/facebook/react-native.git", :tag => "v#{s.version}" } | ||
s.default_subspec = "Core" | ||
s.requires_arc = true | ||
s.platform = :ios, "8.0" | ||
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" } | ||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-CustomComponents", "PATENTS" | ||
s.cocoapods_version = ">= 1.2.0" | ||
|
||
s.subspec 'Core' do |ss| | ||
ss.dependency 'React/yoga' | ||
ss.dependency 'React/cxxreact' | ||
ss.source_files = "React/**/*.{c,h,m,mm,S}" | ||
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/**/RCTTVView.*", "ReactCommon/yoga/*" | ||
ss.frameworks = "JavaScriptCore" | ||
ss.libraries = "stdc++" | ||
s.subspec "Core" do |ss| | ||
ss.dependency "Yoga", "#{package["version"]}.React" | ||
ss.dependency "React/cxxreact" | ||
ss.source_files = "React/**/*.{c,h,m,mm,S}" | ||
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/**/RCTTVView.*", "ReactCommon/yoga/*", "React/Cxx*/*" | ||
ss.framework = "JavaScriptCore" | ||
ss.libraries = "stdc++" | ||
end | ||
|
||
s.subspec 'tvOS' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "React/**/RCTTVView.{h, m}" | ||
s.subspec "tvOS" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "React/**/RCTTVView.{h, m}" | ||
end | ||
|
||
s.subspec 'jschelpers' do |ss| | ||
ss.source_files = 'ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.{cpp,h}' | ||
ss.header_dir = 'jschelpers' | ||
s.subspec "jschelpers" do |ss| | ||
ss.source_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.{cpp,h}" | ||
ss.private_header_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.h" | ||
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "$(PODS_TARGET_SRCROOT)/ReactCommon" } | ||
ss.framework = "JavaScriptCore" | ||
end | ||
|
||
s.subspec 'cxxreact' do |ss| | ||
ss.dependency 'React/jschelpers' | ||
ss.source_files = 'ReactCommon/cxxreact/{JSBundleType,oss-compat-util}.{cpp,h}' | ||
ss.header_dir = 'cxxreact' | ||
s.subspec "cxxreact" do |ss| | ||
ss.dependency "React/jschelpers" | ||
ss.source_files = "ReactCommon/cxxreact/{JSBundleType,oss-compat-util}.{cpp,h}" | ||
ss.private_header_files = "ReactCommon/cxxreact/{JSBundleType,oss-compat-util}.h" | ||
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "$(PODS_TARGET_SRCROOT)/ReactCommon" } | ||
end | ||
|
||
s.subspec 'yoga' do |ss| | ||
ss.source_files = 'ReactCommon/yoga/**/*.{c,h}' | ||
ss.header_dir = 'yoga' | ||
s.subspec "ART" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/ART/**/*.{h,m}" | ||
end | ||
|
||
s.subspec 'ART' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/ART/**/*.{h,m}" | ||
s.subspec "RCTActionSheet" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/ActionSheetIOS/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTActionSheet' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/ActionSheetIOS/*.{h,m}" | ||
s.subspec "RCTAdSupport" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/AdSupport/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTAdSupport' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/AdSupport/*.{h,m}" | ||
s.subspec "RCTAnimation" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/NativeAnimation/{Drivers/*,Nodes/*,*}.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTAnimation' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/NativeAnimation/{Drivers/*,Nodes/*,*}.{h,m}" | ||
s.subspec "RCTCameraRoll" do |ss| | ||
ss.dependency "React/Core" | ||
ss.dependency "React/RCTImage" | ||
ss.source_files = "Libraries/CameraRoll/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTCameraRoll' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.dependency 'React/RCTImage' | ||
ss.source_files = "Libraries/CameraRoll/*.{h,m}" | ||
s.subspec "RCTGeolocation" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/Geolocation/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTGeolocation' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/Geolocation/*.{h,m}" | ||
s.subspec "RCTImage" do |ss| | ||
ss.dependency "React/Core" | ||
ss.dependency "React/RCTNetwork" | ||
ss.source_files = "Libraries/Image/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTImage' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.dependency 'React/RCTNetwork' | ||
ss.source_files = "Libraries/Image/*.{h,m}" | ||
s.subspec "RCTNetwork" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/Network/*.{h,m,mm}" | ||
end | ||
|
||
s.subspec 'RCTNetwork' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/Network/*.{h,m,mm}" | ||
s.subspec "RCTPushNotification" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/PushNotificationIOS/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTPushNotification' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/PushNotificationIOS/*.{h,m}" | ||
s.subspec "RCTSettings" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/Settings/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTSettings' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/Settings/*.{h,m}" | ||
s.subspec "RCTText" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/Text/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTText' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/Text/*.{h,m}" | ||
s.subspec "RCTVibration" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/Vibration/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTVibration' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/Vibration/*.{h,m}" | ||
s.subspec "RCTWebSocket" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/WebSocket/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTWebSocket' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/WebSocket/*.{h,m}" | ||
s.subspec "RCTLinkingIOS" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/LinkingIOS/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTLinkingIOS' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/LinkingIOS/*.{h,m}" | ||
end | ||
|
||
s.subspec 'RCTTest' do |ss| | ||
ss.dependency 'React/Core' | ||
ss.source_files = "Libraries/RCTTest/**/*.{h,m}" | ||
ss.frameworks = "XCTest" | ||
s.subspec "RCTTest" do |ss| | ||
ss.dependency "React/Core" | ||
ss.source_files = "Libraries/RCTTest/**/*.{h,m}" | ||
ss.frameworks = "XCTest" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package = JSON.parse(File.read(File.expand_path('../../package.json', __dir__))) | ||
version = package['version'] | ||
|
||
source = { :git => 'https://github.com/facebook/react-native.git' } | ||
if version == '1000.0.0' | ||
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. | ||
source[:commit] = `git rev-parse HEAD`.strip | ||
else | ||
source[:tag] = "v#{version}" | ||
end | ||
|
||
Pod::Spec.new do |spec| | ||
spec.name = 'Yoga' | ||
spec.version = "#{version}.React" | ||
spec.license = { :type => 'BSD' } | ||
spec.homepage = 'https://facebook.github.io/yoga/' | ||
spec.documentation_url = 'https://facebook.github.io/yoga/docs/api/c/' | ||
|
||
spec.summary = 'Yoga is a cross-platform layout engine which implements Flexbox.' | ||
spec.description = 'Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.' | ||
|
||
spec.authors = 'Facebook' | ||
spec.source = source | ||
|
||
spec.module_name = 'yoga' | ||
spec.requires_arc = false | ||
spec.compiler_flags = [ | ||
'-fno-omit-frame-pointer', | ||
'-fexceptions', | ||
'-Wall', | ||
'-Werror', | ||
'-std=c11', | ||
'-fPIC' | ||
] | ||
|
||
# Pinning to the same version as React.podspec. | ||
spec.platform = :ios, "8.0" | ||
|
||
# Set this environment variable when not using the `:path` option to install the pod. | ||
# E.g. when publishing this spec to a spec repo. | ||
source_files = 'yoga/**/*.{c,h}' | ||
source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION'] | ||
spec.source_files = source_files | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
ROOT=$(dirname $SCRIPTS) | ||
YOGA_ROOT="$ROOT/ReactCommon/yoga" | ||
|
||
# Specify `SPEC_REPO` as an env variable if you want to push to a specific spec repo. | ||
# Defaults to `react-test`, which is meant to be a dummy repo used to test that the specs fully lint. | ||
: ${SPEC_REPO:="react-test"} | ||
SPEC_REPO_DIR="$HOME/.cocoapods/repos/$SPEC_REPO" | ||
|
||
# If the `SPEC_REPO` does not exist yet, assume this is purely for testing and create a dummy repo. | ||
if ! [ -d "$SPEC_REPO_DIR" ]; then | ||
mkdir -p "$SPEC_REPO_DIR" | ||
cd "$SPEC_REPO_DIR" | ||
echo "testing" > .gitkeep | ||
git init | ||
git add .gitkeep | ||
git commit -m "init" | ||
git remote add origin "https://example.com/$SPEC_REPO.git" | ||
fi | ||
|
||
cd "$SPEC_REPO_DIR" | ||
SPEC_REPO_REMOTE=$(git remote get-url origin) | ||
|
||
POD_LINT_OPT="--verbose --no-subspecs --allow-warnings --fail-fast --private --swift-version=3.0 --sources=$SPEC_REPO_REMOTE" | ||
|
||
# Get the version from a podspec. | ||
version() { | ||
ruby -rcocoapods-core -rjson -e "puts Pod::Specification.from_file('$1').version" | ||
} | ||
|
||
# Lint both framework and static library builds. | ||
lint() { | ||
pod lib lint $POD_LINT_OPT | ||
pod lib lint $POD_LINT_OPT --use-libraries | ||
} | ||
|
||
# Push the spec in arg `$1`, which is expected to be in the cwd, to the `SPEC_REPO` in JSON format. | ||
push() { | ||
local SPEC_NAME=$1 | ||
local POD_NAME=$(basename $SPEC_NAME .podspec) | ||
local SPEC_DIR="$SPEC_REPO_DIR/$POD_NAME/$(version $SPEC_NAME)" | ||
local SPEC_PATH="$SPEC_DIR/$SPEC_NAME.json" | ||
mkdir -p $SPEC_DIR | ||
env INSTALL_YOGA_WITHOUT_PATH_OPTION=1 pod ipc spec $SPEC_NAME > $SPEC_PATH | ||
} | ||
|
||
# Perform linting and publishing of podspec in cwd. | ||
# Skip linting with `SKIP_LINT` if e.g. publishing to a private spec repo. | ||
process() { | ||
cd $1 | ||
if [ -z "$SKIP_LINT" ]; then | ||
lint | ||
fi | ||
local SPEC_NAME=(*.podspec) | ||
push $SPEC_NAME | ||
} | ||
|
||
process $YOGA_ROOT | ||
process $ROOT |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will work for now, but it doesn't match the xcode behaviour in terms of recursion. For now, we can try not include any subfolders in these directors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean you would add subfolders but not include them with the same path, but rather all under the ‘namespace’?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our xcode setup, a header like
ReactCommon/jschelpers/foo/bar.h
would be includable as<jschelpers/bar.h>
, which won't work this setup as I understand it.In the short term, we can avoid any adding new subfolders under these ReactCommon targets