SymphonyElectron/scripts/build-mac.sh
Vishwas Shashidhar 7d773abad3
feat: upgrade Electron to 9.x (#1008)
* add support for electron 8.x

* update node-abi to latest

* 8.x: fix unit tests

* upgrade to electron 9.x

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* rebase 9.x against master

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* 9.x: fix windows installer files

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* rebase 9.x against master and fix issues

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* 9.x - update aip file

* 9.x -> downgrade to electron 9.0.0-beta.22

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* bump up electron version to 9.0.0

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* upgrade node-abi to support electron 9

* update package-lock.json

* 9.x -> enable signing on aip

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* 9.x -> update package-lock.json

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* 9.x -> fix screen share indicator mac script issue

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* SDA-2080 - Target jss class name instead of dev defined

* SDA-2080: fix title bar issue with 9.x

* SDA-2080 - Make text notification black for 1.5 and update style template

* 9.x: add electron-osx-sign to fix 9.x build issues

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* SDA-2091 - Only pass required data via IPC

* SDA-2092 - prevent notifications from opening in fullscreen state in MacOS

* remove post build script and upgrade electron-builder to fix os x depth first signing issues

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

Co-authored-by: Kiran Niranjan <kiran.niranjan@symphony.com>
2020-06-01 18:08:01 +05:30

116 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
NODE_REQUIRED_VERSION=v12.13.1
SNYK_ORG=sda
# Check basic dependencies
if ! [ -x "$(command -v git)" ]; then
echo 'GIT does not exist! Please set it up before running this script!' >&2
exit 1
fi
# Switch to the appropriate node version for the branch using NVM
if [ -x "$(command -v nvm)" ]; then
echo 'NVM does not not exist! Install it to switch to the appropriate node version!' >&2
exit 1
fi
# Source all the profile files to ensure nvm is in path
source $HOME/.nvm/nvm.sh
NODE_CURRENT_VERSION=$(nvm current)
if [ "$NODE_REQUIRED_VERSION" != "$NODE_CURRENT_VERSION" ]; then
echo 'Node version does not match required version! Installing the required version' >&2
nvm install $NODE_REQUIRED_VERSION
nvm use $NODE_REQUIRED_VERSION
fi
if ! [ -x "$(command -v node)" ]; then
echo 'NODE does not exist! Please set it up before running this script!' >&2
exit 1
fi
if ! [ -x "$(command -v npm)" ]; then
echo 'NPM does not exist! Please set it up before running this script!' >&2
exit 1
fi
if ! [ -x "$(command -v gulp)" ]; then
echo 'Gulp does not exist! Installing it!' >&2
npm install -g gulp gulp-cli
fi
if ! [ -x "$(command -v snyk)" ]; then
echo 'Snyk does not exist! Installing and setting it up' >&2
npm install -g snyk
fi
echo "Setting snyk org to $SNYK_ORG and api token to $SNYK_API_TOKEN"
snyk config set org="$SNYK_ORG"
snyk config set api="$SNYK_API_TOKEN"
if ! [ -x "$(command -v /usr/local/bin/packagesbuild)" ]; then
echo 'Packages build does not exist! Please set it up before running this script!' >&2
exit 1
fi
# If we don't get parent build number from parent job, set it to 0
if [ -z "$PARENT_BUILD_VERSION" ]; then
echo "PARENT_BUILD_VERSION is empty, setting default"
PARENT_BUILD_VERSION="0"
fi
NODE_VERSION=$(node --version)
echo "Executing using Node Version: ${NODE_VERSION}"
# We need to include swift search libraries to build SDA
if [ ! -d "$HOME/tronlibraries/library" ]; then
echo 'Search libraries do not exist! Not building with swift search' >&2
else
cp -r "$HOME/tronlibraries/library" .
echo 'Copied search libraries'
ls -lrth $HOME/tronlibraries/library
fi
codesign --force --options runtime -s "Developer ID Application: Symphony Communication Services LLC" library/lz4.exec
codesign --force --options runtime -s "Developer ID Application: Symphony Communication Services LLC" library/indexvalidator.exec
PKG_VERSION=$(node -e "console.log(require('./package.json').version);")
# Install app dependencies
echo "Installing dependencies"
npm install
echo "Signing screen share indicator"
codesign --force --options runtime -s "Developer ID Application: Symphony Communication Services LLC" node_modules/screen-share-indicator-frame/SymphonyScreenShareIndicator
# Run Snyk Security Tests
echo "Running snyk security tests"
snyk test --file=package.json --org="$SNYK_ORG"
# Replace url in config
echo "Setting default pod url to https://my.symphony.com"
sed -i -e 's/\"url\"[[:space:]]*\:[[:space:]]*\".*\"/\"url\":\"https:\/\/my.symphony.com\"/g' config/Symphony.config
# Setup the build version
echo "Setting build version to ${PARENT_BUILD_VERSION}"
sed -i -e "s/\"buildNumber\"[[:space:]]*\:[[:space:]]*\".*\"/\"buildNumber\":\" ${PARENT_BUILD_VERSION}\"/g" package.json
# Replace version number in pre-install script
echo "Setting package version in pre install script to ${PKG_VERSION}"
sed -i -e "s/CURRENT_VERSION=APP_VERSION/CURRENT_VERSION=${PKG_VERSION}/g" ./installer/mac/preinstall.sh
# Set expiry period for TTL builds
if [ "$EXPIRY_PERIOD" == "0" ] || [ "$EXPIRY_PERIOD" == 0 ]; then
echo 'Expiry period not set, so, not creating expiry for the build'
else
gulp setExpiry --period ${EXPIRY_PERIOD}
fi
# Build the app
echo "Running tests, code coverage, linting and building..."
npm run unpacked-mac
# Create .pkg installer
echo "Creating .pkg"
/usr/local/bin/packagesbuild -v installer/mac/symphony-mac-packager.pkgproj