-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify android and ios setup scripts #1177
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
897ec87
unify native setup into one script
catarial f86391b
delete unneeded scripts
catarial 9f65709
delete whitespace
catarial d47773c
Merge branch 'master' into unify-setup-native
catarial 3a40e90
update CI
catarial 2e4f969
fix android build
catarial File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
echo "Ensure we exit on error" | ||
set -e | ||
|
||
source setup/setup_shared.sh | ||
|
||
export PLATFORMS="" | ||
|
||
if [ $SETUP_IOS ] || ( [ !$SETUP_ANDROID ] && [ !$SETUP_IOS ] ); then | ||
OSX_MAJOR_VERSION=`sw_vers | grep ProductVersion | cut -d ':' -f 2 | cut -d '.' -f 1` | ||
echo "Found OSX major version" $OSX_MAJOR_VERSION | ||
|
||
# The Homebrew pac-man is installed in different locations, depending on whether the processor | ||
# is an Intel or Apple Silicone chip. Intel uses x86_64, Apple chips are amd64, so we can | ||
# check the chip type using these hardware platforms. | ||
CHIP_ARC=`uname -m` | ||
INTEL="x86_64" | ||
APPLE_SILICONE="arm64" | ||
WORKING_DIR="" | ||
|
||
if [ $CHIP_ARC == $INTEL ]; then | ||
echo "Found "$INTEL" chip" | ||
WORKING_DIR="/usr/local/" | ||
else | ||
if [ $CHIP_ARC == $APPLE_SILICONE ]; then | ||
echo "Found "$APPLE_SILICONE" chip" | ||
WORKING_DIR=$HOMEBREW_PREFIX | ||
fi | ||
fi | ||
|
||
CURR_RUBY_VERSION=`ruby --version | cut -d ' ' -f 2 | cut -d '.' -f 1-2` | ||
echo "Found ruby version "$CURR_RUBY_VERSION | ||
|
||
if [ $CURR_RUBY_VERSION == $RUBY_VERSION ]; then | ||
echo "Found ruby version "$CURR_RUBY_VERSION" expected "$RUBY_VERSION" no need to upgrade" | ||
else | ||
if [ -x "${WORKING_DIR}/bin/brew" ]; then | ||
echo "Found brew installation with version" ` brew --version` | ||
echo "Installing ruby version to brew" $RUBY_VERSION | ||
brew install ruby@$RUBY_VERSION | ||
else | ||
if [ $OSX_MAJOR_VERSION -ge $OSX_EXP_VERSION ]; then | ||
echo "No brew installation found, but OSX major version "$OSX_MAJOR_VERSION" and expected version "$OSX_EXP_VERSION" so CocoaPods should work" | ||
else | ||
echo "No brew installation found, but OSX major version "$OSX_MAJOR_VERSION" != expected version "$OSX_EXP_VERSION" CocoaPods install will likely fail" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit, future fix: we might as well remove this as well, if we are going to make |
||
echo "Found ruby version "`ruby --version` | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
echo "Adding $RUBY_PATH to the path before the install" | ||
export PATH=$RUBY_PATH:$PATH | ||
|
||
echo "Installing cocoapods" | ||
${WORKING_DIR}/opt/ruby@$RUBY_VERSION/bin/gem install --no-document --user-install cocoapods -v $COCOAPODS_VERSION | ||
|
||
export PLATFORMS+=" ios" | ||
fi | ||
|
||
if [ $SETUP_ANDROID ] || ( [ !$SETUP_ANDROID ] && [ !$SETUP_IOS ] ); then | ||
# we can build android on both ubuntu and OSX | ||
# should try both since there may be subtle differences | ||
PLATFORM=`uname -a` | ||
|
||
# both of these have java on Github Actions | ||
# but may not in docker, for example | ||
# should check for the existence of java and die if it doesn't exist | ||
echo "Checking for java in the path" | ||
JAVA_VERSION=`javac -version` | ||
echo "Found java in the path with version $JAVA_VERSION" | ||
|
||
echo "Setting up SDK environment" | ||
MIN_SDK_VERSION=21 | ||
TARGET_SDK_VERSION=28 | ||
|
||
if [ -z $ANDROID_HOME ] && [ -z $ANDROID_SDK_ROOT ]; | ||
then | ||
echo "ANDROID_HOME and ANDROID_SDK_ROOT not set, android SDK not found, exiting" | ||
exit 1 | ||
else | ||
echo "ANDROID_HOME = $ANDROID_HOME; ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" | ||
fi | ||
|
||
echo "Setting up sdkman" | ||
curl -s "https://get.sdkman.io" | bash | ||
source ~/.sdkman/bin/sdkman-init.sh | ||
|
||
CURR_GRADLE_VER=`sdk current gradle | cut -d " " -f 4 | xargs` | ||
|
||
echo "CURR_GRADLE_VER = '$CURR_GRADLE_VER', expected $GRADLE_VERSION" | ||
|
||
if [[ $CURR_GRADLE_VER == $GRADLE_VERSION ]]; then | ||
echo "Already have gradle version $GRADLE_VERSION" | ||
else | ||
echo "Setting up gradle using SDKMan" | ||
sdk install gradle $GRADLE_VERSION | ||
fi | ||
|
||
export PLATFORMS+=" android" | ||
fi | ||
|
||
./bin/configure_xml_and_json.js cordovabuild | ||
|
||
echo "Copying fake FCM configurations for android and iOS" | ||
cp setup/GoogleService-Info.fake.for_ci.plist GoogleService-Info.plist | ||
cp setup/google-services.fake.for_ci.json google-services.json | ||
|
||
echo "Setting up all npm packages" | ||
npm install | ||
|
||
# By default, node doesn't fail if any of the steps fail. This makes it hard to | ||
# use in a CI environment, and leads to people reporting the node error rather | ||
# than the underlying error. One solution is to pass in a command line argument to node | ||
# to turn off that behavior. However, the cordova script automatically invokes node | ||
# and I don't see a .noderc to pass in the config option for all runs | ||
# So for now, I am going to hack this by adding the command line argument to | ||
# the cordova script. If anybody has a better option, they are welcome to share | ||
# it with us! | ||
echo "hack to make the local cordova fail on error" | ||
sed -i -e "s|/usr/bin/env node|/usr/bin/env node --unhandled-rejections=strict|" node_modules/cordova/bin/cordova | ||
|
||
npx cordova prepare$PLATFORMS | ||
|
||
EXPECTED_COUNT=25 | ||
INSTALLED_COUNT=`npx cordova plugin list | wc -l` | ||
echo "Found $INSTALLED_COUNT plugins, expected $EXPECTED_COUNT" | ||
if [ $INSTALLED_COUNT -lt $EXPECTED_COUNT ]; | ||
then | ||
echo "Found $INSTALLED_COUNT plugins, expected $EXPECTED_COUNT, retrying" | ||
sleep 5 | ||
npx cordova prepare$PLATFORMS | ||
elif [ $INSTALLED_COUNT -gt $EXPECTED_COUNT ]; | ||
then | ||
echo "Found extra plugins!" | ||
npx cordova plugin list | ||
echo "Failing for investigation" | ||
exit 1 | ||
else | ||
echo "All plugins installed successfully!" | ||
fi | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; future fix: I think we should remove this check. Per @iantei, it doesn't actually work on recent versions of android. We should just say that brew is a requirement.