2021-01-18 06:46:57 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-06-07 23:40:02 +03:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# DEBUG
|
|
|
|
# set -o xtrace
|
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
QUALITY="stable"
|
|
|
|
|
|
|
|
while getopts ":i" opt; do
|
|
|
|
case "$opt" in
|
|
|
|
i)
|
|
|
|
export QUALITY="insider"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-01-18 06:46:57 +03:00
|
|
|
check_programs() {
|
2021-06-07 23:40:02 +03:00
|
|
|
for arg in "$@"
|
|
|
|
do
|
2022-06-05 22:30:23 +03:00
|
|
|
if ! command -v "${arg}" >/dev/null 2>&1
|
2021-06-07 23:40:02 +03:00
|
|
|
then
|
2022-06-05 22:30:23 +03:00
|
|
|
echo "${arg} could not be found"
|
2021-06-07 23:40:02 +03:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
done
|
2021-01-18 06:46:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
check_programs "icns2png" "composite" "convert" "png2icns" "icotool"
|
|
|
|
|
2021-06-07 23:40:02 +03:00
|
|
|
SRC_PREFIX=""
|
|
|
|
VSCODE_PREFIX=""
|
|
|
|
|
|
|
|
build_darwin_types() {
|
2022-06-05 22:30:23 +03:00
|
|
|
for file in "${VSCODE_PREFIX}"vscode/resources/darwin/*
|
2021-06-07 23:40:02 +03:00
|
|
|
do
|
2022-06-05 22:30:23 +03:00
|
|
|
if [ -f "${file}" ]; then
|
|
|
|
name=$(basename "${file}" '.icns')
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
if [[ ${name} != 'code' ]] && [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/darwin/${name}.icns" ]; then
|
2022-06-05 22:30:23 +03:00
|
|
|
icns2png -x -s 512x512 "${file}" -o .
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
composite -blend 100% -geometry +323+365 "icons/corner_512.png" "${name}_512x512x32.png" "${name}.png"
|
|
|
|
composite "icons/${QUALITY}/code_darwin.png" "${name}.png" "${name}.png"
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-06-05 22:30:23 +03:00
|
|
|
convert "${name}.png" -resize 256x256 "${name}_256.png"
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
png2icns "${SRC_PREFIX}src/${QUALITY}/resources/darwin/${name}.icns" "${name}.png" "${name}_256.png"
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-06-05 22:30:23 +03:00
|
|
|
rm "${name}_512x512x32.png" "${name}.png" "${name}_256.png"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
build_darwin_main() {
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/darwin/code.icns" ]; then
|
|
|
|
convert "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" -resize 512x512 code_512.png
|
|
|
|
convert "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" -resize 256x256 code_256.png
|
|
|
|
convert "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" -resize 128x128 code_128.png
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
png2icns "${SRC_PREFIX}src/${QUALITY}/resources/darwin/code.icns" code_512.png code_256.png code_128.png
|
2021-06-07 23:40:02 +03:00
|
|
|
|
|
|
|
rm code_512.png code_256.png code_128.png
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
build_win32() {
|
2022-08-26 02:35:26 +03:00
|
|
|
mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/win32"
|
|
|
|
|
2022-06-05 22:30:23 +03:00
|
|
|
for file in "${VSCODE_PREFIX}"vscode/resources/win32/*.ico
|
2021-06-07 23:40:02 +03:00
|
|
|
do
|
2022-06-05 22:30:23 +03:00
|
|
|
if [ -f "${file}" ]; then
|
|
|
|
name=$(basename "${file}" '.ico')
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
if [[ ${name} != 'code' ]] && [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/${name}.ico" ]; then
|
2022-06-05 22:30:23 +03:00
|
|
|
icotool -x -w 256 "${file}"
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
composite -geometry +150+185 "icons/${QUALITY}/code_64.png" "${name}_1_256x256x32.png" "${name}.png"
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
convert "${name}.png" -define icon:auto-resize=256,128,96,64,48,32,24,20,16 "${SRC_PREFIX}src/${QUALITY}/resources/win32/${name}.ico"
|
2021-06-07 23:40:02 +03:00
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
rm "${name}_1_256x256x32.png" "${name}.png"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/code.ico" ]; then
|
|
|
|
convert "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" -define icon:auto-resize=256,128,96,64,48,32,24,20,16 "${SRC_PREFIX}src/${QUALITY}/resources/win32/code.ico"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-100.bmp" ]; then
|
|
|
|
convert -size 164x314 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-100.bmp"
|
|
|
|
composite -size 126x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-100.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-100.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-125.bmp" ]; then
|
|
|
|
convert -size 192x386 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-125.bmp"
|
|
|
|
composite -size 147x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-125.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-125.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-150.bmp" ]; then
|
|
|
|
convert -size 246x459 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-150.bmp"
|
|
|
|
composite -size 190x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-150.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-150.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-175.bmp" ]; then
|
|
|
|
convert -size 273x556 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-175.bmp"
|
|
|
|
composite -size 211x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-175.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-175.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-200.bmp" ]; then
|
|
|
|
convert -size 328x604 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-200.bmp"
|
|
|
|
composite -size 255x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-200.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-200.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-225.bmp" ]; then
|
|
|
|
convert -size 355x700 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-225.bmp"
|
|
|
|
composite -size 273x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-225.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-225.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-250.bmp" ]; then
|
|
|
|
convert -size 410x797 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-250.bmp"
|
|
|
|
composite -size 317x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-250.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-250.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
|
|
|
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-100.bmp" ]; then
|
|
|
|
convert -size 55x55 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-100.bmp"
|
|
|
|
composite -size 44x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-100.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-100.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-125.bmp" ]; then
|
|
|
|
convert -size 64x68 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-125.bmp"
|
|
|
|
composite -size 52x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-125.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-125.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-150.bmp" ]; then
|
|
|
|
convert -size 83x80 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-150.bmp"
|
|
|
|
composite -size 63x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-150.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-150.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-175.bmp" ]; then
|
|
|
|
convert -size 92x97 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-175.bmp"
|
|
|
|
composite -size 76x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-175.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-175.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-200.bmp" ]; then
|
|
|
|
convert -size 110x106 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-200.bmp"
|
|
|
|
composite -size 86x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-200.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-200.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-225.bmp" ]; then
|
|
|
|
convert -size 119x123 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-225.bmp"
|
|
|
|
composite -size 103x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-225.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-225.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2022-08-26 02:35:26 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-250.bmp" ]; then
|
|
|
|
convert -size 138x140 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-250.bmp"
|
|
|
|
composite -size 116x -gravity center "icons/${QUALITY}/codium_only.svg" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-250.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-250.bmp"
|
2021-06-07 23:40:02 +03:00
|
|
|
fi
|
2021-09-09 02:38:07 +03:00
|
|
|
if [ ! -f "${SRC_PREFIX}build/windows/msi/resources/wix-banner.bmp" ]; then
|
|
|
|
convert -size 493x58 xc:white "${SRC_PREFIX}build/windows/msi/resources/wix-banner.bmp"
|
2022-08-26 02:35:26 +03:00
|
|
|
composite -geometry +438+6 \( "icons/${QUALITY}/codium_only.svg" -resize 50x50 \) "${SRC_PREFIX}build/windows/msi/resources/wix-banner.bmp" "${SRC_PREFIX}build/windows/msi/resources/wix-banner.bmp"
|
2021-09-09 02:38:07 +03:00
|
|
|
fi
|
|
|
|
if [ ! -f "${SRC_PREFIX}build/windows/msi/resources/wix-dialog.bmp" ]; then
|
|
|
|
convert -size 493x312 xc:white "${SRC_PREFIX}build/windows/msi/resources/wix-dialog.bmp"
|
2022-08-26 02:35:26 +03:00
|
|
|
composite -geometry +22+152 \( "icons/${QUALITY}/codium_only.svg" -resize 120x90 \) "${SRC_PREFIX}build/windows/msi/resources/wix-dialog.bmp" "${SRC_PREFIX}build/windows/msi/resources/wix-dialog.bmp"
|
2021-09-09 02:38:07 +03:00
|
|
|
fi
|
2021-06-07 23:40:02 +03:00
|
|
|
}
|
|
|
|
|
2022-06-05 22:30:23 +03:00
|
|
|
if [ "${0}" == "${BASH_SOURCE}" ];
|
2021-06-07 23:40:02 +03:00
|
|
|
then
|
|
|
|
build_darwin_types
|
|
|
|
build_win32
|
2021-06-07 23:47:56 +03:00
|
|
|
fi
|