Update the Android development enviornment setup

1. Update `ANDROID_SDK_ROOT` to `ANDROID_HOME`. The former variable is
   deprecated. (see https://developer.android.com/tools/variables#envar)
2. Remove `ANDROID_NDK_HOME` environment variable. This should allow the
   build script to work out of the box for more folks.
3. Check that Java is on the `PATH` as opposed to just installing it.
   `asdf` and other runtime management tools are pretty popular, and all
   we care about is that the Java version is accessible.
4. Remove calls to `sudo`. Check to see if CocoaPods exists, if it
   doesn't install it using Homebrew which doesn't require `sudo`.
This commit is contained in:
Salvatore Testa
2023-11-12 13:47:17 -08:00
parent 7d1b789d38
commit 38d9610c6b
8 changed files with 69 additions and 81 deletions

View File

@@ -59,26 +59,13 @@ if [ "$OS" == "linux" ]; then
flutter config --enable-linux-desktop --enable-android
elif [ "$OS" == "macos" ]; then
# # ensure x86_64 homebrew is installed
# if [ -f /usr/local/bin/brew ] &> /dev/null; then
# echo '[X] x86_64 homebrew is available'
# else
# echo 'x86_64 homebrew is not available, run this:'
# echo 'arch -x86_64 zsh'
# echo '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
# exit 1
# fi
# ensure packages are installed
# if [ "$BREW_USER" == "" ]; then
# BREW_USER=`ls -lad /usr/local/bin/. | cut -d\ -f4`
# echo "Must sudo to homebrew user \"$BREW_USER\" to install LLVM package:"
# fi
# sudo -H -u $BREW_USER arch -x86_64 /usr/local/bin/brew install llvm
echo "Must sudo to root to install CocoaPods gem:"
# sudo arch -x86_64 gem install ffi
sudo arch -x86_64 gem install cocoapods
# check if cocoapods is installed, if its not, install it
if command -v pod &> /dev/null; then
echo '[X] CocoaPods is available in the path'
else
echo 'CocoaPods is not available in the path, installing it now'
brew install cocoapods
fi
if [ "$(uname -p)" == "arm" ]; then
sudo softwareupdate --install-rosetta --agree-to-license