From 9a9370481fb909a6e2f1066e98092b7dbd3237b9 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Mon, 28 Jan 2019 20:09:55 -0800 Subject: [PATCH] Fix Detox tests after upgrading to latest CLI (#23191) 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 --- RNTester/RNTester.xcodeproj/project.pbxproj | 2 ++ scripts/react-native-xcode.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RNTester/RNTester.xcodeproj/project.pbxproj b/RNTester/RNTester.xcodeproj/project.pbxproj index eb5cf560353f18..370d12836e1146 100644 --- a/RNTester/RNTester.xcodeproj/project.pbxproj +++ b/RNTester/RNTester.xcodeproj/project.pbxproj @@ -1880,6 +1880,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + BUNDLE_CONFIG = "$(SRCROOT)/../rn-cli.config.js"; DEVELOPMENT_TEAM = VYK7DLU38Z; INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -1895,6 +1896,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + BUNDLE_CONFIG = "$(SRCROOT)/../rn-cli.config.js"; DEVELOPMENT_TEAM = VYK7DLU38Z; INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index 8bb6caaf959df0..65404cc6864260 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -99,7 +99,7 @@ fi if [[ -z "$BUNDLE_CONFIG" ]]; then CONFIG_ARG="" else - CONFIG_ARG="--config $(pwd)/$BUNDLE_CONFIG" + CONFIG_ARG="--config $BUNDLE_CONFIG" fi nodejs_not_found()