From b15d839a9c02cbeb9cdb49bedf0cd69dc0c5973d Mon Sep 17 00:00:00 2001 From: Harry Tormey Date: Fri, 15 Jun 2018 20:18:30 -0700 Subject: [PATCH 1/3] Add iOS Validate Environment Script --- scripts/validate-ios-test-env.sh | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 scripts/validate-ios-test-env.sh diff --git a/scripts/validate-ios-test-env.sh b/scripts/validate-ios-test-env.sh new file mode 100755 index 00000000000000..7c314f8784c97a --- /dev/null +++ b/scripts/validate-ios-test-env.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# This script validates that iOS is set up correctly for the +# testing environment. +# +# In particular, it checks that the minimum required Xcode version is installed. +# It also checks that the correct Node version is installed. Node 10 is not fully +# supported at the time and Node 6 is no longer supported. + +# Check that node is installed. +if [ -z "$(which node)" ]; then + echo "You need to install nodejs." + echo "Note: Node 10 is not fully supported at the time and Node 6 is no longer supported." + echo "See https://nodejs.org/en/download/ for instructions." + exit 1 +fi + +# Check that the correct version of node is installed +NODE_VERSION="$(command node --version | sed 's/[-/a-zA-Z]//g' |sed 's/.\{2\}$//')" + +if (( $(echo "${NODE_VERSION} <= 6.0" | bc -l) )); then + echo "Node ${NODE_VERSION} detected. This version of Node is not supported." + echo "Note: Node 10 is not fully supported at the time and Node 6 is no longer supported." + echo "See https://nodejs.org/en/download/ for instructions." + exit 1 +fi + +if (( $(echo "${NODE_VERSION} == 10.0" | bc -l) )); then + echo "Node ${NODE_VERSION} detected. This version of Node is not supported." + echo "Note: Node 10 is not fully supported at the time and Node 6 is no longer supported." + echo "See https://nodejs.org/en/download/ for instructions." + exit 1 +fi + +# Check that Xcode is installed. +if [ -z "$(which xcodebuild)" ]; then + echo "You need to install nodejs." + echo "Note: Node 10 is not fully supported at the time, Node 6 is no longer supported" + echo "See https://nodejs.org/en/download/ for instructions." + exit 1 +fi + +# Check that the correct version of Xcode is installed +XCODE_VERSION="$(command xcodebuild -version | sed '$ d' | sed 's/[-/a-zA-Z]//g')" +if (( $(echo "${XCODE_VERSION} <= 8.0" | bc -l) )); then + echo "Xcode ${XCODE_VERSION} detected. Please upgrade to a later version using the AppStore." + echo "Older versions of Xcode may cause cryptic build errors." + exit 1 +fi \ No newline at end of file From 2a14985ce6ebde486a45763510f5d5939bd38058 Mon Sep 17 00:00:00 2001 From: Harry Tormey Date: Wed, 25 Jul 2018 14:54:43 -0700 Subject: [PATCH 2/3] Fix issue with comparison --- scripts/validate-ios-test-env.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/validate-ios-test-env.sh b/scripts/validate-ios-test-env.sh index 7c314f8784c97a..b4f1c2b2c1527b 100755 --- a/scripts/validate-ios-test-env.sh +++ b/scripts/validate-ios-test-env.sh @@ -7,6 +7,9 @@ # It also checks that the correct Node version is installed. Node 10 is not fully # supported at the time and Node 6 is no longer supported. +# Function used to compare dot seperated version numbers +function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } + # Check that node is installed. if [ -z "$(which node)" ]; then echo "You need to install nodejs." @@ -40,9 +43,10 @@ if [ -z "$(which xcodebuild)" ]; then exit 1 fi +MIN_XCODE_VERSION=8.0 # Check that the correct version of Xcode is installed XCODE_VERSION="$(command xcodebuild -version | sed '$ d' | sed 's/[-/a-zA-Z]//g')" -if (( $(echo "${XCODE_VERSION} <= 8.0" | bc -l) )); then +if (version_gt $MIN_XCODE_VERSION $XCODE_VERSION) && [ "$XCODE_VERSION" != "$MIN_XCODE_VERSION" ]; then echo "Xcode ${XCODE_VERSION} detected. Please upgrade to a later version using the AppStore." echo "Older versions of Xcode may cause cryptic build errors." exit 1 From 529b19da46e83178cd88e77c6b6de604c119906f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= <165856+hramos@users.noreply.github.com> Date: Wed, 1 Aug 2018 19:21:40 -0700 Subject: [PATCH 3/3] Update validate-ios-test-env.sh --- scripts/validate-ios-test-env.sh | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/scripts/validate-ios-test-env.sh b/scripts/validate-ios-test-env.sh index b4f1c2b2c1527b..d52bb9d7552300 100755 --- a/scripts/validate-ios-test-env.sh +++ b/scripts/validate-ios-test-env.sh @@ -12,9 +12,8 @@ function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$ # Check that node is installed. if [ -z "$(which node)" ]; then - echo "You need to install nodejs." - echo "Note: Node 10 is not fully supported at the time and Node 6 is no longer supported." - echo "See https://nodejs.org/en/download/ for instructions." + echo "Could not find Node binary. Please check your nodejs install." + echo "See http://facebook.github.io/react-native/docs/getting-started.html for instructions." exit 1 fi @@ -29,25 +28,24 @@ if (( $(echo "${NODE_VERSION} <= 6.0" | bc -l) )); then fi if (( $(echo "${NODE_VERSION} == 10.0" | bc -l) )); then - echo "Node ${NODE_VERSION} detected. This version of Node is not supported." - echo "Note: Node 10 is not fully supported at the time and Node 6 is no longer supported." - echo "See https://nodejs.org/en/download/ for instructions." + echo "Node ${NODE_VERSION} detected. This version of Node is not fully supported at this time." + echo "See /~https://github.com/facebook/react-native/issues/19229 for more information." exit 1 fi # Check that Xcode is installed. if [ -z "$(which xcodebuild)" ]; then - echo "You need to install nodejs." - echo "Note: Node 10 is not fully supported at the time, Node 6 is no longer supported" - echo "See https://nodejs.org/en/download/ for instructions." + echo "Could not find Xcode build tools. Please check your Xcode install." + echo "See http://facebook.github.io/react-native/docs/getting-started.html for instructions." exit 1 fi -MIN_XCODE_VERSION=8.0 +MIN_XCODE_VERSION=9.4 # Check that the correct version of Xcode is installed XCODE_VERSION="$(command xcodebuild -version | sed '$ d' | sed 's/[-/a-zA-Z]//g')" if (version_gt $MIN_XCODE_VERSION $XCODE_VERSION) && [ "$XCODE_VERSION" != "$MIN_XCODE_VERSION" ]; then - echo "Xcode ${XCODE_VERSION} detected. Please upgrade to a later version using the AppStore." + echo "Xcode ${XCODE_VERSION} detected. React Native requires ${MIN_XCODE_VERSION} or newer." echo "Older versions of Xcode may cause cryptic build errors." + echo "See http://facebook.github.io/react-native/docs/getting-started.html for instructions." exit 1 -fi \ No newline at end of file +fi