From 2959a38e5ee0bd9dd3cc46882d96a68eee659dd9 Mon Sep 17 00:00:00 2001 From: Martin Gamwell Dawids <728722+martingd@users.noreply.github.com> Date: Mon, 4 May 2020 23:48:31 +0200 Subject: [PATCH] Allowing setup on macOS/Darwin for Android only. New option to dev_setup.sh, --skip-ios, to skip configuration related to iOS. If Xcode is not installed, configuring without this option is not allowed. ### Testing Notes ### Please run ./dev-setup.sh on a Mac without Xcode. Result should be: Xcode must be installed to develop for iOS. Use option '--skip-ios' to setup development for Android only. (exit code 1) Add option --skip-ios and script should complete setting up development for Android only. Please run ./dev-setup on Mac _with_ Xcode and the script should run like before and setup for both Android and iOS development. ### Fixed Issues ### Setup script dev_setup.sh failed on macOS/Darwin if tools for iOS development were not installed. --- dev_setup.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dev_setup.sh b/dev_setup.sh index 69c9e1f928..ae07d45fd7 100755 --- a/dev_setup.sh +++ b/dev_setup.sh @@ -7,6 +7,7 @@ Usage: dev_setup.sh [options] Configures a Linux or MacOS machine for working with the code in this repo. Options: -ni Non-interactive mode, auto answers Yes to all questions. + --skip-ios Skip configuring for iOS development. -h, --help Show this message " } @@ -17,6 +18,8 @@ for var in "$@"; do exit 0 elif [[ $var == '-ni' ]]; then non_interactive="Y" + elif [[ $var == '--skip-ios' ]]; then + skip_ios="Y" else echo "Unknown option: $var" show_help @@ -97,6 +100,13 @@ if [[ "$OSTYPE" == "darwin"* ]]; then echo "${YELLOW}Homebrew is required to install dependencies: https://docs.brew.sh/Installation${RESET}" exit 1 fi + + # Unless configuring for iOS is skipped, Xcode must be installed. + if [[ $skip_ios != "Y" ]] && ! xcodebuild -version > /dev/null 2> /dev/null; then + echo "${YELLOW}Xcode must be installed to develop for iOS." + echo "${YELLOW}Use option '--skip-ios' to setup development for Android only." + exit 1 + fi fi # Need Node.js (8.3 or newer) @@ -190,7 +200,7 @@ fi # Install ruby bundler and cocoapods for iOS only, because they're only necessary for iOS development # Mac OS comes with ruby out of the box. -if [[ "$OSTYPE" == "darwin"* ]]; then +if [[ "$OSTYPE" == "darwin"* ]] && [[ "$skip_ios" != "Y" ]]; then if ! gem list '^bundler$' -i --version 2.1.4; then echo "${BLUE}Installing Ruby bundler for Cocoapod management...${RESET}" sudo gem install bundler