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

Use v0.60.0 patch from jtreanor/react-native #1184

Merged
merged 8 commits into from
Jul 5, 2019
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
19 changes: 8 additions & 11 deletions Gutenberg.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
# Use the same RN version that the JS tools use
react_native_version = package['dependencies']['react-native']
# Extract the tagged version if package.json points to a tag
react_native_version = react_native_version.split("#v").last if react_native_version.include? "#v"

Pod::Spec.new do |s|
s.name = 'Gutenberg'
Expand All @@ -14,19 +16,14 @@ Pod::Spec.new do |s|
s.source_files = 'react-native-gutenberg-bridge/ios/*.{h,m,swift}'
s.requires_arc = true
s.preserve_paths = 'bundle/ios/*'
s.swift_version = '4.2'

s.dependency 'React/Core', react_native_version
s.dependency 'React/CxxBridge', react_native_version
s.dependency 'React/RCTAnimation', react_native_version
s.dependency 'React/RCTImage', react_native_version
s.dependency 'React/RCTLinkingIOS', react_native_version
s.dependency 'React/RCTNetwork', react_native_version
s.dependency 'React/RCTText', react_native_version
s.dependency 'React/RCTActionSheet', react_native_version
s.dependency 'React/DevSupport', react_native_version
s.dependency 'React-Core', react_native_version
s.dependency 'React-DevSupport', react_native_version
s.dependency 'React-RCTImage', react_native_version
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reducing these to only what we need means that the build will be leaner and hopefully faster. Transitive dependencies (such as yoga) will still be resolved.

s.dependency 'React-RCTText', react_native_version
s.dependency 'React-RCTWebSocket', react_native_version

s.dependency 'WordPress-Aztec-iOS'
s.dependency 'RNTAztecView'

s.dependency 'yoga', "#{react_native_version}.React"
end
3 changes: 2 additions & 1 deletion RNTAztecView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ Pod::Spec.new do |s|
s.public_header_files = 'react-native-aztec/ios/RNTAztecView/*.h'
s.requires_arc = true
s.platforms = { :ios => "10.0" }
s.swift_version = '4.2'
s.xcconfig = {'OTHER_LDFLAGS' => '-lxml2',
'HEADER_SEARCH_PATHS' => '/usr/include/libxml2'}
s.dependency 'React'
s.dependency 'React-Core'
s.dependency 'WordPress-Aztec-iOS'

end
53 changes: 39 additions & 14 deletions bin/generate-podspecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,48 @@ set -e
cd "$( dirname $0 )"
cd ..

# Check for cocoapods
# Check for cocoapods & jq
command -v pod > /dev/null || ( echo Cocoapods is required to generate podspecs; exit 1 )
command -v jq > /dev/null || ( echo jq is required to generate podspecs; exit 1 )

PODSPECS=$(cat <<EOP
node_modules/react-native/React.podspec
node_modules/react-native/ReactCommon/yoga/yoga.podspec
node_modules/react-native/third-party-podspecs/Folly.podspec
node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
node_modules/react-native/third-party-podspecs/glog.podspec
EOP
)
WD=$(pwd)
DEST="${WD}/react-native-gutenberg-bridge/third-party-podspecs"

DEST="react-native-gutenberg-bridge/third-party-podspecs"
# Generate the external (non-RN podspecs)
EXTERNAL_PODSPECS=$(find "node_modules/react-native/third-party-podspecs" \
"node_modules/react-native-svg" \
"node_modules/react-native-keyboard-aware-scroll-view" \
"node_modules/react-native-recyclerview-list" \
"node_modules/react-native-safe-area" -type f -name "*.podspec" -print)

for podspec in $PODSPECS
for podspec in $EXTERNAL_PODSPECS
do
pod=`basename $podspec .podspec`
pod=$(basename "$podspec" .podspec)

echo "Generating podspec for $pod"
INSTALL_YOGA_WITHOUT_PATH_OPTION=1 pod ipc spec $podspec > "$DEST/$pod.podspec.json"
done
pod ipc spec $podspec > "$DEST/$pod.podspec.json"
done

# Generate the React Native podspecs
# Change to the React Native directory to get relative paths for the RN podspecs
cd "node_modules/react-native"

RN_PODSPECS=$(find * -type f -name "*.podspec" -not -path "third-party-podspecs/*" -print)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now using find to generate all the podspecs in react-native. This means we have a lot more podspecs in the repo (hence the big diff).

TMP_DEST=$(mktemp -d)

for podspec in $RN_PODSPECS
do
pod=$(basename "$podspec" .podspec)
path=$(dirname "$podspec")

echo "Generating podspec for $pod with path $path"
pod ipc spec $podspec > "$TMP_DEST/$pod.podspec.json"
cat "$TMP_DEST/$pod.podspec.json" | jq > "$DEST/$pod.podspec.json"

# Add a "prepare_command" entry to each podspec so that 'pod install' will fetch sources from the correct directory
# and retains the existing prepare_command if it exists
prepare_command="TMP_DIR=\$(mktemp -d); mv * \$TMP_DIR; cp -R \"\$TMP_DIR/${path}\"/* ."
cat "$TMP_DEST/$pod.podspec.json" | jq --arg CMD "$prepare_command" '.prepare_command = "\($CMD) && \(.prepare_command // true)"
# Point to React Native fork. To be removed once https://github.com/facebook/react-native/issues/25349 is closed
| .source.git = "https://github.com/jtreanor/react-native.git"' > "$DEST/$pod.podspec.json"
done
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@
"node-libs-react-native": "^1.0.2",
"node-sass": "^4.8.3",
"react": "16.8.6",
"react-native": "0.60.0-rc.3",
"react-native": "jtreanor/react-native#v0.60.0-patched",
"react-native-hr": "git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3",
"react-native-keyboard-aware-scroll-view": "git+https://github.com/wordpress-mobile/react-native-keyboard-aware-scroll-view.git#gb-v0.8.7",
"react-native-keyboard-aware-scroll-view": "git+https://github.com/wordpress-mobile/react-native-keyboard-aware-scroll-view.git#382ae9b44e2baa650838c703b969c26ecd64bf97",
"react-native-modal": "^6.5.0",
"react-native-recyclerview-list": "git+https://github.com/wordpress-mobile/react-native-recyclerview-list.git#eadaa2f62d2f488d4dc80f9148e52b62047297ab",
"react-native-safe-area": "^0.5.0",
"react-native-svg": "git+https://github.com/wordpress-mobile/react-native-svg.git#55244dc79ab876550599c82dca763c3eba0153c5",
"react-native-video": "git+https://github.com/wordpress-mobile/react-native-video.git#3a0e2fa6fc6bf1fe1a54adb2dbf94545b28c2bc4",
"react-native-recyclerview-list": "git+https://github.com/wordpress-mobile/react-native-recyclerview-list.git#afeed73685b5ffde4f70431ececb7fcb9e96b6b6",
"react-native-safe-area": "git+https://github.com/wordpress-mobile/react-native-safe-area#ff1002a03e34bfabf0bb65da0644af8f1b31fb87",
"react-native-svg": "git+https://github.com/wordpress-mobile/react-native-svg.git#466a40ec77080e1b64b5a1a3c779cdfdc04b3abe",
"react-native-video": "git+https://github.com/wordpress-mobile/react-native-video.git#6223b6213a017a2e8b7b8f940fa14760625c87f6",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"redux-multi": "^0.1.12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@
#import <React/RCTViewManager.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

// This is needed until gutenberg.xcodeproj is migrated to use CocoaPods
// Or the React projects update their namespacing
#if __has_include(<RCTImage/RCTImageLoader.h>)
#import <RCTImage/RCTImageLoader.h>
#else
#import <React/RCTImageLoader.h>
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"tag": "v1.1.6"
},
"module_name": "DoubleConversion",
"header_dir": "double-conversion",
"source_files": "double-conversion/*.{h,cc}",
"compiler_flags": "-Wno-unreachable-code",
"platforms": {
"ios": "9.0",
"tvos": "9.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

]
},
"compiler_flags": "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
"compiler_flags": "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_HAVE_PTHREAD=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-documentation",
"source_files": [
"folly/String.cpp",
"folly/Conv.cpp",
Expand Down Expand Up @@ -59,8 +59,33 @@
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
"HEADER_SEARCH_PATHS": "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\""
},
"default_subspecs": "Default",
"platforms": {
"ios": "9.0",
"tvos": "9.2"
}
},
"subspecs": [
{
"name": "Default"
},
{
"name": "Fabric",
"source_files": [
"folly/portability/SysUio.cpp",
"folly/FileUtil.cpp",
"folly/SharedMutex.cpp",
"folly/concurrency/CacheLocality.cpp",
"folly/detail/Futex.cpp",
"folly/lang/SafeAssert.cpp",
"folly/synchronization/ParkingLot.cpp",
"folly/portability/Malloc.cpp"
],
"preserve_paths": [
"folly/concurrency/CacheLocality.h",
"folly/synchronization/ParkingLot.h",
"folly/synchronization/SanitizeThread.h",
"folly/system/ThreadId.h"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "RNReactNativeRecyclerviewList",
"version": "1.0.0",
"summary": "RNReactNativeRecyclerviewList",
"description": "RNReactNativeRecyclerviewList",
"homepage": "",
"license": "MIT",
"authors": {
"author": "author@domain.cn"
},
"platforms": {
"ios": "7.0"
},
"source": {
"git": "https://github.com/author/RNReactNativeRecyclerviewList.git",
"tag": "master"
},
"source_files": "RNReactNativeRecyclerviewList/**/*.{h,m}",
"requires_arc": true,
"dependencies": {
"React-Core": [

]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "RNSVG",
"version": "9.3.3",
"summary": "SVG library for react-native",
"license": "MIT",
"homepage": "https://github.com/react-native-community/react-native-svg",
"authors": "Horcrux Chen",
"source": {
"git": "https://github.com/react-native-community/react-native-svg.git",
"tag": "9.3.3"
},
"source_files": "ios/**/*.{h,m}",
"requires_arc": true,
"platforms": {
"ios": "8.0",
"tvos": "9.2"
},
"dependencies": {
"React-Core": [

],
"React-RCTImage": [

]
},
"prepare_command": "sed -i \"\" \"s/React\\/RCTImageLoader.h/RCTImage\\/RCTImageLoader.h/g\" ios/Elements/RNSVGImage.m"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "React-ART",
"version": "0.60.0-patched",
"summary": "A library for drawing vector graphics.",
"homepage": "http://facebook.github.io/react-native/",
"license": "MIT",
"authors": "Facebook, Inc. and its affiliates",
"platforms": {
"ios": "9.0",
"tvos": "9.2"
},
"source": {
"git": "https://github.com/jtreanor/react-native.git",
"tag": "v0.60.0-patched"
},
"source_files": "**/*.{h,m}",
"preserve_paths": [
"package.json",
"LICENSE",
"LICENSE-docs"
],
"header_dir": "ART",
"dependencies": {
"React-Core": [
"0.60.0-patched"
]
},
"prepare_command": "TMP_DIR=$(mktemp -d); mv * $TMP_DIR; cp -R \"$TMP_DIR/Libraries/ART\"/* . && true"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name": "React-Core",
"version": "0.60.0-patched",
"summary": "The core of React Native.",
"homepage": "http://facebook.github.io/react-native/",
"license": "MIT",
"authors": "Facebook, Inc. and its affiliates",
"platforms": {
"ios": "9.0",
"tvos": "9.2"
},
"source": {
"git": "https://github.com/jtreanor/react-native.git",
"tag": "v0.60.0-patched"
},
"source_files": "**/*.{c,h,m,mm,S,cpp}",
"exclude_files": [
"DevSupport/**/*",
"Fabric/**/*",
"Inspector/**/*"
],
"ios": {
"exclude_files": "**/RCTTV*.*"
},
"tvos": {
"exclude_files": [
"Modules/RCTClipboard*",
"Views/RCTDatePicker*",
"Views/RCTPicker*",
"Views/RCTRefreshControl*",
"Views/RCTSlider*",
"Views/RCTSwitch*"
]
},
"private_header_files": "Cxx*/*.h",
"compiler_flags": "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-documentation",
"header_dir": "React",
"frameworks": "JavaScriptCore",
"libraries": "stdc++",
"pod_target_xcconfig": {
"HEADER_SEARCH_PATHS": "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Folly\""
},
"default_subspecs": "Default",
"dependencies": {
"Folly": [
"2018.10.22.00"
],
"React-cxxreact": [
"0.60.0-patched"
],
"React-jsi": [
"0.60.0-patched"
],
"React-jsiexecutor": [
"0.60.0-patched"
],
"yoga": [
"0.60.0-patched.React"
],
"glog": []
},
"subspecs": [
{
"name": "Default"
},
{
"name": "CxxBridge",
"public_header_files": "**/*.{h}"
}
],
"prepare_command": "TMP_DIR=$(mktemp -d); mv * $TMP_DIR; cp -R \"$TMP_DIR/React\"/* . && true"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "React-DevSupport",
"version": "0.60.0-patched",
"summary": "-",
"homepage": "http://facebook.github.io/react-native/",
"license": "MIT",
"authors": "Facebook, Inc. and its affiliates",
"platforms": {
"ios": "9.0",
"tvos": "9.2"
},
"source": {
"git": "https://github.com/jtreanor/react-native.git",
"tag": "v0.60.0-patched"
},
"source_files": [
"DevSupport/*",
"Inspector/*"
],
"header_dir": "DevSupport",
"dependencies": {
"React-Core": [
"0.60.0-patched"
],
"React-jsinspector": [
"0.60.0-patched"
],
"React-RCTWebSocket": [
"0.60.0-patched"
]
},
"prepare_command": "TMP_DIR=$(mktemp -d); mv * $TMP_DIR; cp -R \"$TMP_DIR/React\"/* . && true"
}
Loading