Skip to content

Commit 57aa70c

Browse files
barbierifacebook-github-bot
authored andcommitted
Introduce Gemfile, ruby-version (#32303)
Summary: Implement par of the discussion react-native-community/discussions-and-proposals#411, except the `.nvmrc` part, this includes: - Setting `.ruby-version` in the main project and also `template/` - Fixing the CocoaPods version with a project-level `Gemfile` and also `template/Gemfile` - Using all `pod` executions from `bundle exec pod`, using the determined version - Script to manage and update the ruby version ## Changelog [iOS] [Added] - Gemfile with CocoaPods 1.11 and ruby-version (2.7.4) Pull Request resolved: #32303 Test Plan: Build for iOS and run all CircleCI tests to see if nothing changed Reviewed By: RSNara Differential Revision: D31344686 Pulled By: fkgozali fbshipit-source-id: 25c63131ca9b16d3cf6341019548e0d63bdcaefe
1 parent d8931e2 commit 57aa70c

18 files changed

+335
-43
lines changed

.bundle/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

.circleci/config.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ commands:
6565
name: Initial Setup
6666
command: mkdir -p ./reports/{buck,build,junit,outputs}
6767

68+
setup_ruby:
69+
steps:
70+
- restore_cache:
71+
key: 1-gems-{{ checksum "Gemfile.lock" }}
72+
- run: bundle check || bundle install --path vendor/bundle --clean
73+
- save_cache:
74+
key: 1-gems-{{ checksum "Gemfile.lock" }}
75+
paths:
76+
- vendor/bundle
77+
6878
run_yarn:
6979
steps:
7080
- restore_cache:
@@ -356,6 +366,7 @@ jobs:
356366
steps:
357367
- checkout
358368
- setup_artifacts
369+
- setup_ruby
359370
- run_yarn
360371

361372
- run: |
@@ -407,7 +418,7 @@ jobs:
407418

408419
- run:
409420
name: Setup the CocoaPods environment
410-
command: pod setup
421+
command: bundle exec pod setup
411422

412423
- with_rntester_pods_cache_span:
413424
steps:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ package-lock.json
9191
/React/FBReactNativeSpec/**/*.xcodeproj
9292
/packages/react-native-codegen/**/*.xcodeproj
9393

94+
# Ruby Gems (Bundler)
95+
/vendor
96+
/template/vendor
97+
9498
# CocoaPods
9599
/template/ios/Pods/
96100
/template/ios/Podfile.lock

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.4

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby '2.7.4'
5+
6+
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

Gemfile.lock

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.4)
5+
rexml
6+
activesupport (6.1.4.1)
7+
concurrent-ruby (~> 1.0, >= 1.0.2)
8+
i18n (>= 1.6, < 2)
9+
minitest (>= 5.1)
10+
tzinfo (~> 2.0)
11+
zeitwerk (~> 2.3)
12+
addressable (2.8.0)
13+
public_suffix (>= 2.0.2, < 5.0)
14+
algoliasearch (1.27.5)
15+
httpclient (~> 2.8, >= 2.8.3)
16+
json (>= 1.5.1)
17+
atomos (0.1.3)
18+
claide (1.0.3)
19+
cocoapods (1.11.2)
20+
addressable (~> 2.8)
21+
claide (>= 1.0.2, < 2.0)
22+
cocoapods-core (= 1.11.2)
23+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
24+
cocoapods-downloader (>= 1.4.0, < 2.0)
25+
cocoapods-plugins (>= 1.0.0, < 2.0)
26+
cocoapods-search (>= 1.0.0, < 2.0)
27+
cocoapods-trunk (>= 1.4.0, < 2.0)
28+
cocoapods-try (>= 1.1.0, < 2.0)
29+
colored2 (~> 3.1)
30+
escape (~> 0.0.4)
31+
fourflusher (>= 2.3.0, < 3.0)
32+
gh_inspector (~> 1.0)
33+
molinillo (~> 0.8.0)
34+
nap (~> 1.0)
35+
ruby-macho (>= 1.0, < 3.0)
36+
xcodeproj (>= 1.21.0, < 2.0)
37+
cocoapods-core (1.11.2)
38+
activesupport (>= 5.0, < 7)
39+
addressable (~> 2.8)
40+
algoliasearch (~> 1.0)
41+
concurrent-ruby (~> 1.1)
42+
fuzzy_match (~> 2.0.4)
43+
nap (~> 1.0)
44+
netrc (~> 0.11)
45+
public_suffix (~> 4.0)
46+
typhoeus (~> 1.0)
47+
cocoapods-deintegrate (1.0.5)
48+
cocoapods-downloader (1.5.1)
49+
cocoapods-plugins (1.0.0)
50+
nap
51+
cocoapods-search (1.0.1)
52+
cocoapods-trunk (1.6.0)
53+
nap (>= 0.8, < 2.0)
54+
netrc (~> 0.11)
55+
cocoapods-try (1.2.0)
56+
colored2 (3.1.2)
57+
concurrent-ruby (1.1.9)
58+
escape (0.0.4)
59+
ethon (0.14.0)
60+
ffi (>= 1.15.0)
61+
ffi (1.15.4)
62+
fourflusher (2.3.1)
63+
fuzzy_match (2.0.4)
64+
gh_inspector (1.1.3)
65+
httpclient (2.8.3)
66+
i18n (1.8.10)
67+
concurrent-ruby (~> 1.0)
68+
json (2.5.1)
69+
minitest (5.14.4)
70+
molinillo (0.8.0)
71+
nanaimo (0.3.0)
72+
nap (1.1.0)
73+
netrc (0.11.0)
74+
public_suffix (4.0.6)
75+
rexml (3.2.5)
76+
ruby-macho (2.5.1)
77+
typhoeus (1.4.0)
78+
ethon (>= 0.9.0)
79+
tzinfo (2.0.4)
80+
concurrent-ruby (~> 1.0)
81+
xcodeproj (1.21.0)
82+
CFPropertyList (>= 2.3.3, < 4.0)
83+
atomos (~> 0.1.3)
84+
claide (>= 1.0.2, < 2.0)
85+
colored2 (~> 3.1)
86+
nanaimo (~> 0.3.0)
87+
rexml (~> 3.2.4)
88+
zeitwerk (2.4.2)
89+
90+
PLATFORMS
91+
ruby
92+
93+
DEPENDENCIES
94+
cocoapods (~> 1.11, >= 1.11.2)
95+
96+
RUBY VERSION
97+
ruby 2.7.4p191
98+
99+
BUNDLED WITH
100+
2.2.28

Libraries/Animated/NativeAnimatedHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ function shouldUseNativeDriver(
355355
'animated module is missing. Falling back to JS-based animation. To ' +
356356
'resolve this, add `RCTAnimation` module to this app, or remove ' +
357357
'`useNativeDriver`. ' +
358-
'Make sure to run `pod install` first. Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md',
358+
'Make sure to run `bundle exec pod install` first. Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md',
359359
);
360360
_warnedMissingNativeAnimated = true;
361361
}

scripts/bump-oss-version.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ let numberOfChangedLinesWithNewVersion = exec(
172172
{silent: true},
173173
).stdout.trim();
174174

175+
// Make sure to update ruby version
176+
if (exec('scripts/update-ruby.sh').code) {
177+
echo('Failed to update Ruby version');
178+
exit(1);
179+
}
180+
175181
// Release builds should commit the version bumps, and create tags.
176182
// Nightly builds do not need to do that.
177183
if (!nightlyBuild) {

scripts/process-podspecs.sh

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
set -ex
88

9-
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
10-
ROOT=$(dirname $SCRIPTS)
9+
SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10+
ROOT="$(dirname "$SCRIPTS")"
1111

1212
# Specify `SPEC_REPO` as an env variable if you want to push to a specific spec repo.
1313
# Defaults to `react-test`, which is meant to be a dummy repo used to test that the specs fully lint.
14-
: ${SPEC_REPO:="react-test"}
14+
: "${SPEC_REPO:=react-test}"
1515
SPEC_REPO_DIR="$HOME/.cocoapods/repos/$SPEC_REPO"
1616

1717
# If the `SPEC_REPO` does not exist yet, assume this is purely for testing and create a dummy repo.
@@ -28,7 +28,7 @@ fi
2828
cd "$SPEC_REPO_DIR"
2929
SPEC_REPOS="$(git remote get-url origin),https://github.com/CocoaPods/Specs.git"
3030

31-
POD_LINT_OPT="--verbose --allow-warnings --fail-fast --private --swift-version=3.0 --sources=$SPEC_REPOS"
31+
POD_LINT_OPT=(--verbose --allow-warnings --fail-fast --private "--swift-version=3.0" "--sources=$SPEC_REPOS")
3232

3333
# Get the version from a podspec.
3434
version() {
@@ -37,33 +37,34 @@ version() {
3737

3838
# Lint both framework and static library builds.
3939
lint() {
40-
local SUBSPEC=$1
40+
local SUBSPEC="$1"
4141
if [ "${SUBSPEC:-}" ]; then
4242
local SUBSPEC_OPT="--subspec=$SUBSPEC"
4343
fi
44-
pod lib lint $SUBSPEC_OPT $POD_LINT_OPT
45-
pod lib lint $SUBSPEC_OPT $POD_LINT_OPT --use-libraries
44+
bundle exec pod lib lint "$SUBSPEC_OPT" "${POD_LINT_OPT[@]}"
45+
bundle exec pod lib lint "$SUBSPEC_OPT" "${POD_LINT_OPT[@]}" --use-libraries
4646
}
4747

4848
# Push the spec in arg `$1`, which is expected to be in the cwd, to the `SPEC_REPO` in JSON format.
4949
push() {
50-
local SPEC_NAME=$1
51-
local POD_NAME=$(basename $SPEC_NAME .podspec)
52-
local SPEC_DIR="$SPEC_REPO_DIR/$POD_NAME/$(version $SPEC_NAME)"
53-
local SPEC_PATH="$SPEC_DIR/$SPEC_NAME.json"
54-
mkdir -p $SPEC_DIR
55-
env INSTALL_YOGA_WITHOUT_PATH_OPTION=1 INSTALL_YOGA_FROM_LOCATION="$ROOT" pod ipc spec $SPEC_NAME > $SPEC_PATH
50+
local SPEC_NAME POD_NAME SPEC_DIR SPEC_PATH
51+
SPEC_NAME="$1"
52+
POD_NAME=$(basename "$SPEC_NAME" .podspec)
53+
SPEC_DIR="$SPEC_REPO_DIR/$POD_NAME/$(version "$SPEC_NAME")"
54+
SPEC_PATH="$SPEC_DIR/$SPEC_NAME.json"
55+
mkdir -p "$SPEC_DIR"
56+
env INSTALL_YOGA_WITHOUT_PATH_OPTION=1 INSTALL_YOGA_FROM_LOCATION="$ROOT" bundle exec pod ipc spec "$SPEC_NAME" > "$SPEC_PATH"
5657
}
5758

5859
# Perform linting and publishing of podspec in cwd.
5960
# Skip linting with `SKIP_LINT` if e.g. publishing to a private spec repo.
6061
process() {
61-
cd $1
62+
cd "$1"
6263
if [ -z "$SKIP_LINT" ]; then
63-
lint $2
64+
lint "$2"
6465
fi
6566
local SPEC_NAME=(*.podspec)
66-
push $SPEC_NAME
67+
push "${SPEC_NAME[0]}"
6768
}
6869

6970
# Make third-party deps accessible

scripts/react-native-xcode.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fi
9696

9797
if [[ $USE_HERMES == true && ! -f "$HERMES_CLI_PATH" ]]; then
9898
echo "error: USE_HERMES is set to true but the hermesc binary could not be " \
99-
"found at ${HERMES_CLI_PATH}. Perhaps you need to run pod install or otherwise " \
99+
"found at ${HERMES_CLI_PATH}. Perhaps you need to run 'bundle exec pod install' or otherwise " \
100100
"point the HERMES_CLI_PATH variable to your custom location." >&2
101101
exit 2
102102
fi

0 commit comments

Comments
 (0)