Summary:
When using react-native inside a monorepo with yarn workspaces the react-native installation can get hoisted and the assumption that the project is located in the folder where node_modules is is no longer true.
To handle this case I added an option to pass the path of the project root.
For example when using yarn workspace we can use something like this in the xcode scripts:
Assumes the following folder structure
/packages/myapp
/node_modules/react-native
```sh
export NODE_BINARY=node
export PROJECT_ROOT=$PWD/..
../../../node_modules/react-native/scripts/react-native-xcode.sh
```
It could be possible to change the default to `$PWD/..` since pwd is where the xcode project is located but then it would break if the native project structure is not the one we assume. To avoid the breaking change I decided to just keep the existing behaviour and allow changing the path with `PROJECT_ROOT`.
[ios] [added] - Allow changing the project path in react-native-xcode.sh
Pull Request resolved: https://github.com/facebook/react-native/pull/23273
Differential Revision: D13941793
Pulled By: cpojer
fbshipit-source-id: f394641b1c9d01f32bc4169097e39fc14df8191f
Summary:
Latest changes inside CLI now require that Metro configuration is provided when building RNTester app. This is to let CLI know that instead of looking for "react-native" under "node_modules" (that is obviously not present since we are running from source), it should check the paths provided.
When running "npm start", it finds the configuration at the root. However, when building through Xcode (e.g. "react-native bundle" or "xcodebuild" in Release scheme), it runs "react-native-xcode.sh" that works in different folder and makes Metro not detect the configuration file.
This PR explicitly sets path to the configuration via `BUNDLE_CONFIG`.
It also removes `pwd` from being prepended to all `BUNDLE_CONFIG` values. In my case, `pwd` was `/Users/grabbou` and the RNTester files where inside `/Users/grabbou/Repositories/react-native`. I was unable to point the script to correct location without making it aware of the folder structure - which is not going to work on the CI.
Pull Request resolved: https://github.com/facebook/react-native/pull/23191
Differential Revision: D13851741
Pulled By: hramos
fbshipit-source-id: d920353fd68d39468bd33bd1ad47e03b017a7727
Summary:
Instead of using ~/.rncache use the special Caches directory designed for caching files. This fixes#21780.
Changelog:
----------
[iOS] [Changed] - Moved iOS build cache directory from ~/.rncache to ~/Library/Caches/com.facebook.ReactNativeBuild
Pull Request resolved: https://github.com/facebook/react-native/pull/22688
Differential Revision: D13817171
Pulled By: cpojer
fbshipit-source-id: af03dda66f9d49f4fe88bd050b359ccb7abb889a
Summary: Bump Android Build Tools to Version 28.0.3, Gradle to 4.10.2, and the Android Gradle Plugin to 3.2.1.
Reviewed By: mdvacca
Differential Revision: D13631120
fbshipit-source-id: 709aa25a7a8e1ff0bfc0a969ba6e7cd92850bc0f
Summary:
The following tests are disabled in this PR:
- testTimersTest is failing due to undefined this.setTimeout, probably introduced back in 61346d3. Tracking a fix in https://github.com/facebook/react-native/issues/22695
- testTheTester_ExpectError is failing as RCTTestRunner is not properly passing through the error. Tracking a fix in https://github.com/facebook/react-native/issues/22697
I've added a comment regarding testWebSocketTest and how to ensure it passes locally.
This PR also fixes all remaining snapshot tests, which were failing due to the use of iPhone XS as a iOS Simulator on Circle CI. We are using iPhone 6s for SST internally, and this allows us to be consistent.
Pull Request resolved: https://github.com/facebook/react-native/pull/22720
Differential Revision: D13532788
Pulled By: hramos
fbshipit-source-id: 75681236032839bf88180611ee68826b53cc96eb
Summary:
The iOS snapshots have been out of date for months, but the failure was not caught in open source's `test_objc` job because `xcpretty` was swallowing the non-zero error code.
To fix this, I enabled recording mode in RNTesterSnapshotTests.m temporarily, and re-ran the tests in order to update the snapshots. I've also switched the test device used by Circle CI to iPhone 6s to be consistent with the snapshot tests that run internally at Facebook.
Integration tests are not fully fixed yet, but I can confirm the following tests are fixed by this diff:
```
-[RNTesterIntegrationTests testImageSnapshotTest]
-[RNTesterIntegrationTests testSimpleSnapshotTest]
-[RNTesterSnapshotTests testARTExample]
-[RNTesterSnapshotTests testLayoutExample]
-[RNTesterSnapshotTests testSliderExample]
-[RNTesterSnapshotTests testSwitchExample]
-[RNTesterSnapshotTests testTabBarExample]
-[RNTesterSnapshotTests testTextExample]
-[RNTesterSnapshotTests testViewExample]
```
I've also fixed a few shellcheck warnings in related scripts.
Reviewed By: fkgozali
Differential Revision: D13506865
fbshipit-source-id: dab985130c2ff3cb9dea19d1f87c8ee65d8c141e
Summary:
Any failures in `test_objc` within the objc-test.sh script have been kept hidden as `xcpretty` was swallowing the exit code from xcodebuild.
Fixes the issue TheSavior brought up in #22470 where failing snapshot tests were not reflected on Circle.
Run on Circle CI and confirm `test_objc` fails (iOS tests *are* broken on master).
Pull Request resolved: https://github.com/facebook/react-native/pull/22562
Differential Revision: D13406987
Pulled By: hramos
fbshipit-source-id: 3f3da01ab4c0ad87077813b06d2fdf788f32f6b8
Summary: This removes the remaining references to `local-cli`. We already have a `cli.js` file on the root that was just forwarding to the local-cli folder, so I removed that. It also seems that `setupBabel.js` is no longer necessary in RN.
Reviewed By: TheSavior
Differential Revision: D13396218
fbshipit-source-id: a945cb91dae39c4b58c5cabcca6b0f0328fc4717
Summary: This diff moves the React Native template from `local-cli/templates/HelloWorld` to `template`. Keeping it in the react-native repo will allow us to make changes to the template and version it together with react-native, instead of moving it out into a separate repo and trying to keep the template in sync with RN.
Reviewed By: TheSavior
Differential Revision: D13372949
fbshipit-source-id: e68e267b4dcf6384535d7b48fc11e297a12e9676
Summary:
The code analysis script takes the results of `eslint .` and filters out any messages for filepaths outside of what is modified in a given pull request. This diff fixes an issue where the bot will fail to post warnings if a pull request contains multiple commits, where the most recent commit is a rebase (e.g. 63c00f20a7 in https://github.com/facebook/react-native/pull/22470). This happens because the script looks for files changed in the most recent commit in a PR.
In this diff, we switch to a new GitHub API that returns the list of all files changed by a PR, obviating the need to go through individual commits in a PR to look for changed files.
Reviewed By: TheSavior
Differential Revision: D13324154
fbshipit-source-id: f9f50028439d1969b0feea65f0b3e8bf75ac1a33
Summary:
Use Xcode 10.1 and iOS 12.1 SDK to run iOS tests on an iOS 12.1 iPhone XS Simulator, all of which are available on a default Xcode 10.1 install.
Note that we were previously running iOS tests using Xcode 10.1 and the 12.1 SDK in a separate `test_xcode10` workflow on Circle CI. This was in place to allow us to track Xcode 10 compatibility during the Xcode 10 beta. Now that Xcode 10 has been public for a while, we can drop the compatibility check and use Xcode 10 in our main iOS test workflow.
Reviewed By: TheSavior
Differential Revision: D13317891
fbshipit-source-id: 04c17bf3a2e9d3617f14a46b4ed30a5491a4f4a4
Summary:
Fixes#22421
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
_Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_
Pull Request resolved: https://github.com/facebook/react-native/pull/22423
Differential Revision: D13287099
Pulled By: TheSavior
fbshipit-source-id: e4ac0fb930107dde092541fd17d4c81907c8cc34
Summary:
Fixes lots of ESLint warnings. Many of them where in PR #20877 by janicduplessis which requested to split the linting fixes from configuration and package changes.
I solved only the issues that I was most certain about but I would love to get hands on all of them with a little bit of input.
Pull Request resolved: https://github.com/facebook/react-native/pull/22062
Differential Revision: D12889447
Pulled By: TheSavior
fbshipit-source-id: 35f7a08104a5b859c860afdde4af2b32c0685c50
Summary: Adds copyright headers to all files that are missing them.
Reviewed By: hramos
Differential Revision: D12837494
fbshipit-source-id: 6330a18919676dec9ff2c03b7c9329ed9127d930
Summary:
Fixes#20302 (For iOS)
Note:
------
1. Checked the changes did not break CocoaPods integration.
2. The change for glog copying header into exported/ is to prevent build break for folly.
`folly/detail/Demangle.h` will try to use libstdc++'s demangle.h. Unfortunately, glog also has a demangle.h in source code. So I copy exported headers and only search headers in exported/ folder during build.
Pull Request resolved: https://github.com/facebook/react-native/pull/21976
Reviewed By: hramos
Differential Revision: D12818131
Pulled By: fkgozali
fbshipit-source-id: b3c637d09d1b3adde0ea15c82eb56e28f846885b
Summary:
This was a specific check that was prone to break at some point. That time has come. Removing it as it is not providing any useful signal.
Pull Request resolved: https://github.com/facebook/react-native/pull/21998
Differential Revision: D12823839
Pulled By: hramos
fbshipit-source-id: e870670d7803af78c4559052613ea364ce1478df
Summary:
Fix build errors when path to $NODE_BINARY contains spaces:
error: Can't find '/Path/With Spaces/To/node' binary to build React Native bundle
Why would $NODE_BINARY contain spaces? In my case, I am using sentry-cli which wraps the NODE_BINARY in it's own executable. The local path to the project, and thus the $NODE_BINARY, contains a space on my GoCD build agent.
'/Users/go/Library/Application Support/Go Agent/pipelines/my-ios-app/node_modules/sentry/cli/sentry-cli
See https://github.com/getsentry/react-native-sentry/issues/484https://github.com/getsentry/react-native-sentry/issues/389
Pull Request resolved: https://github.com/facebook/react-native/pull/21383
Differential Revision: D10851141
Pulled By: yungsters
fbshipit-source-id: f46853ac8b57957864e0d1a76b8513403223fccb
Summary:
React Native needs to be updated to support XCode 10 (GitHub issue: [19573](https://github.com/facebook/react-nåative/issues/19573)). Until we make that change, our CI needs to rely on the legacy build system in XCode 10 to build `RNTester`, as opposed to the new build system made default in XCode 10. This diff uses the `-UseModernBuildSystem=NO` `xcodebuild` flag to enforce that requirement.
**Note:** I did a search within `react-native-github/scripts` for `xcodebuild` and passed in the `-UseModernBuildSystem=NO` flag. I figured that every time we use `xcodebuild`, we should enforce the build system.
� This should hopefully fix the `react-native-oss-ios` test.
Reviewed By: hramos
Differential Revision: D10456139
fbshipit-source-id: 795f32b3ceba6a5a24ab6ccbf4f5160d42746801
Summary:
Adds a new script that runs Yarn with --frozen-lockfile, and fails if Yarn finds the lockfile is out of sync.
Keeping the lockfile in sync with package.json will ensure our internal open source tests can run offline, as our offline mirror is updated whenever the lockfile changes.
Reverted yarn.lock to https://raw.githubusercontent.com/facebook/react-native/6eeff75849c9b8bf91592c1b7906b4dab8fba518/yarn.lock, then ran `scripts/circleci/validate_yarn_lockfile.sh`, and verified the script failed as expected.
I then ran Yarn without the --frozen-lockfile flag, and reran the validation script. This time, the script finished successfully.
Pull Request resolved: https://github.com/facebook/react-native/pull/21739
Differential Revision: D10365642
Pulled By: hramos
fbshipit-source-id: 9ab7f03919427a86b12901d4c422ef04dd0839f6
Summary:
Fixes#20774
The new Xcode build system uses parallel execution to run build steps that don't have an obvious dependency. Our Xcode project was written with the assumption that the **Install Third Party** build step is run _before_ compiling the `third-party` libraries. To address this issue, this PR adds dependency information to the project to teach Xcode that `ios-install-third-party.sh` is generating the files under `third-party`. With this additional information, Xcode correctly waits for `ios-install-third-party.sh` to finish before advancing to the compile step.
In addition to the Xcode project changes, I had to make some changes to the script `ios-install-third-party.sh` so that
1. it would always execute the `ios-configure-glog.sh` script regardless of how it was invoked
2. it would always install the libraries even if Xcode had partially created the tree or if a previous install was interrupted
Pull Request resolved: https://github.com/facebook/react-native/pull/21458
Differential Revision: D10365495
Pulled By: hramos
fbshipit-source-id: c88042583f21d2447a16f6ae2b6abb929c659a26
Summary:
bump Android NDK to r17c, which is only available revision to download for r17. And it includes bug fixes.
Pull Request resolved: https://github.com/facebook/react-native/pull/21628
Differential Revision: D10352162
Pulled By: hramos
fbshipit-source-id: d372e55443260242a44a1f73698977a3e361f001
Summary:
The script was moved after the original ShellCheck PR was opened, and this was lost during the rebase.
Pull Request resolved: https://github.com/facebook/react-native/pull/21443
Differential Revision: D10133498
Pulled By: hramos
fbshipit-source-id: da61b782362ab2d13cb6f0bca3fb1c9a0af08ae5
Summary:
This PR applies some fixes I made to the 0.57-stable branch to ensure we only run on commits tagged as "v0.57.1", as an example. This also ensures we only deploy after all tests pass.
Pull Request resolved: https://github.com/facebook/react-native/pull/21250
Differential Revision: D10003666
Pulled By: hramos
fbshipit-source-id: 22d5e674ca925dce53d0ddf0e12c64dc82ec7aa1
Summary:
Upgrade React Native to Android SDK 27 again, following the reversal in D9886607 (68c7999c25).
The SDK 27 is actually available internally in an alternate location that is suitable for use cases like React Native's. For future reference, SDK 28 is also available for use in this location.
Reviewed By: axe-fb
Differential Revision: D9929066
fbshipit-source-id: 9413f891d5587293a30544351340e9407a2dce55
Summary:
Android CI was failing due to that it was trying to extract major version from build tools and use it to compile ReactAndroid. Now, it'll extract compileSdkVersion from ReactAndroid/build.gradle and use it.
Issue was that 68c7999c25 dowgraded compileSdk version to 26 while retaining build tools version as 27.0.3, so CI was trying to use SDK 27.
Pull Request resolved: https://github.com/facebook/react-native/pull/21205
Differential Revision: D9943909
Pulled By: hramos
fbshipit-source-id: ec9bc0c40956a16f8088532340722fd43cadde37
Summary:
Go back to using compileSdkVersion 26 and targetSdkVersion 26, temporarily. We can re-add this once Android SDK 27 becomes available in Facebook's internal repository.
The Android SDK Build Tools 27.0.3 **are** available, so we can continue using those.
Reviewed By: axe-fb
Differential Revision: D9886607
fbshipit-source-id: 6c1c9c1e1309c3a0483cc4c0bd8dcb4a5f29fc7e
Summary: This change drops the year from the copyright headers and the LICENSE file.
Reviewed By: yungsters
Differential Revision: D9727774
fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
Summary:
One of our automated project tools noted that these were all missing their copyright headers.
Pull Request resolved: https://github.com/facebook/react-native/pull/21000
Differential Revision: D9721495
Pulled By: hramos
fbshipit-source-id: 6ccf0f37165a0fe16cf06bd996d615f2286101dc
Summary:
This script is not yet used. Regardless, Node 10 has been working fine for a while now.
Pull Request resolved: https://github.com/facebook/react-native/pull/21001
Differential Revision: D9721549
Pulled By: hramos
fbshipit-source-id: 44b5e2f9ec9b622a364491840f8bd8092f0399ff
Summary:
Use GitHub PR Reviews instead of individual comments. The result is similar to the existing implementation, but there will be a top level comment indicating possible next steps for the PR author.
Verified on Circle.
Pull Request resolved: https://github.com/facebook/react-native/pull/20927
Differential Revision: D9596595
Pulled By: hramos
fbshipit-source-id: 3628b0097aa9a21a40089f2cbe1859bd64ccd8b7
Summary:
The eslint bot has not been working since the migration to Circle 2.0.
Pull Request resolved: https://github.com/facebook/react-native/pull/20822
Differential Revision: D9492680
Pulled By: hramos
fbshipit-source-id: 7f2f9ac125b6cab1750902c485a6d27d6c3cf302
Summary:
There are some steps known to be failing on master. This pollutes checks for unrelated PRs.
This PR will make it so that PRs submitted by anyone other than myself will no-op on these steps.
Future work: Have an array of whitelisted contributors, and make it much easier to turn individual tests on and off.
Pull Request resolved: https://github.com/facebook/react-native/pull/20818
Differential Revision: D9484946
Pulled By: hramos
fbshipit-source-id: d6c187b341f13552b33d0f1d569b65f6c66ae48f
Summary:
While the original reason for this change was because of an issue #20780, with further investigation I concluded that the issue is till present for this combo of versions:
glog - 0.3.5
google-cast-sdk - 4.3.1
Downgrading google-cast-sdk to 4.3.0 fixed the build issue.
Release Notes:
--------------
Updated glog version from 0.3.4 to 0.3.5 for iOS
[IOS] [ENHANCEMENT] [GLOG]
Pull Request resolved: https://github.com/facebook/react-native/pull/20811
Differential Revision: D9485221
Pulled By: hramos
fbshipit-source-id: 65caf0839588384a5229a6165506dc6ef62e5fc5
Summary:
This pull request addresses the failing publish-npm.js script from earlier this week. For background, last month we reset all npm access tokens for any package related to Facebook, and we now require all accounts with publish permissions to have two factor enabled.
The publish-npm.js script relied on one such token that is configured in Circle CI as a envvar. The token has been updated in Circle CI, but we now need a way of passing the one time password to npm.
With this PR, we can now grab the otp from Circle CI's envvars. Considering otps are ephemeral, this requires the NPM_CONFIG_OTP envvar to be set by someone with publishing permissions anytime a new release will be pushed to npm. The token is short lived, but it would still be good to clear the envvar after the package is published. Circle CI envvars are not passed on to PR/forked builds.
This PR is effectively a breaking change for the release process, as the publish step will not succeed if the OTP is not valid.
OTPs are short-lived, and the publish_npm_package job will definitely outlive the token. Unfortunately this will require some timing to get right, but the alternative is to ssh into the Circle CI machine and re-run the `npm publish --otp` command, which again would still require someone with publish access to provide the otp.
Pull Request resolved: https://github.com/facebook/react-native/pull/20701
Differential Revision: D9478488
Pulled By: hramos
fbshipit-source-id: 6af631a9cb425271b98c03d158aec390ebc95304
Summary:
I found that android support library 27.x (874cca1ac2) requires compileSdkVersion to be 27. Also found that many FB projects use SDK 27.
Pull Request resolved: https://github.com/facebook/react-native/pull/20777
Differential Revision: D9478431
Pulled By: hramos
fbshipit-source-id: ca100f6b5b39e7d112926124423f9510a0efc291
Summary:
We have several disabled tests in Circle, and they are not running at all.
This prevents us from seeing when a disabled test might actually be fixed, as enabling the test requires uncommenting the correct line in Circle CI's config.
In this PR, we use the existing swallow_error script to run known-failing steps, without failing the job. This will let us see the step's output in CI, without polluting PRs that have not introduced new failures to CI.
Pull Request resolved: https://github.com/facebook/react-native/pull/20775
Differential Revision: D9442412
Pulled By: hramos
fbshipit-source-id: 83c930811a559fdcf6d7b926b4073343e862d2b3
Summary:
Fixes#19694 this diff adds an iOS environment validation script as requested by hramos.
A similar script for Android exists: scripts/validate-android-test-env.sh.
This script:
- Validates that the minimum required Xcode version is installed (people using Xcode 8 with a recent release may encounter cryptic build errors).
- Validates the correct Node version is installed (Node 10 is not fully supported at the time, Node 6 is no longer supported).
<!--
Required: Write your motivation here.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
Run ./scripts/validate-ios-test-env.sh on a properly setup OSX machine and verify it works, change the version comparison and make sure it fails.
<!--
Required: Write your test plan here. If you changed any code, please provide us with
clear instructions on how you verified your changes work. Bonus points for screenshots and videos!
-->
<!--
Does this PR require a documentation change?
Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->
<!--
Required.
Help reviewers and the release process by writing your own release notes. See below for an example.
-->
[INTERNAL] [ENHANCEMENT] [scripts] - Add iOS validate environment script
<!--
**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**
CATEGORY
[----------] TYPE
[ CLI ] [-------------] LOCATION
[ DOCS ] [ BREAKING ] [-------------]
[ GENERAL ] [ BUGFIX ] [ {Component} ]
[ INTERNAL ] [ ENHANCEMENT ] [ {Filename} ]
[ IOS ] [ FEATURE ] [ {Directory} ] |-----------|
[ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} |
[----------] [-------------] [-------------] |-----------|
EXAMPLES:
[IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
[ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
[CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
[DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
[GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
[INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/19750
Differential Revision: D9005151
Pulled By: hramos
fbshipit-source-id: a69ef2a6e513e580089c791fd44a0e70c2a3f240