Files
openide/platform/build-scripts/tools/mac/scripts/build-template.sh
Dmitriy.Panov eaa07bcc6c IJI-932 required Python dependencies are now installed in a virtual environment
GitOrigin-RevId: 8def868c87acdd853dbb3b66e02b7ce67bd3d578
2023-03-29 08:31:08 +00:00

65 lines
1.6 KiB
Bash

#!/bin/bash
# Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
set -euo pipefail
# %templates% should be replaced with default values or overridden via environment variables
export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-%buildDateInSeconds%}"
staple="${STAPLE:-%staple%}"
appName="${APP_NAME:-%appName%}"
contentSigned="${CONTENT_SIGNED:-%contentSigned%}"
explodedSitDir='exploded'
cleanUpExploded='true'
function buildDmg() {
sit="$1"
dmgName="${sit%".sit"}"
dmg="$dmgName.dmg"
buildDir="$dmgName"
mkdir -p "$buildDir/$explodedSitDir"
for buildFile in *; do
name="${buildFile##*.}"
if [[ -f $buildFile && "$name" != "sit" && "$name" != "dmg" ]]; then
cp "$buildFile" "$buildDir"
fi
done
echo "Extracting $sit.."
unzip -q -o "$sit" -d "$buildDir/$explodedSitDir"
(
cd "$buildDir"
trap 'cd .. && rm -rf "$buildDir"' EXIT
# set -e doesn't have any effect in here
bash ./staple.sh $explodedSitDir "$staple" &&
bash ./makedmg.sh "$dmgName" "$appName" "$dmg" $explodedSitDir $cleanUpExploded "$contentSigned" &&
mv "$dmg" "../$dmg"
)
}
# clean up failure-marker files from previous runs if any
for failure in *.failure; do
if [ -e "$failure" ]; then
rm "$failure"
fi
done
for sit in *.sit; do
if [ ! -e "$sit" ]; then
echo "No .sit found"
exit 0
fi
# building all .dmg in parallel
if ! buildDmg "$sit"; then
# saving failure-marker file
touch "$sit.failure"
fi &
done
wait
for failure in *.failure; do
if [ -e "$failure" ]; then
# failing if any failure is detected
exit 1
fi
done