2018-05-16 21:22:16 +02:00
|
|
|
#!/bin/bash
|
2019-02-02 11:19:11 +01:00
|
|
|
set -euo pipefail
|
2018-04-30 15:41:30 +02:00
|
|
|
|
2018-05-16 21:22:16 +02:00
|
|
|
ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2019-10-04 20:43:36 +02:00
|
|
|
REPO_DIR="$ASSET_DIR/.."
|
2018-04-30 15:41:30 +02:00
|
|
|
|
2019-09-27 21:43:11 +02:00
|
|
|
# Ensure submodules are initialized.
|
2019-10-04 20:43:36 +02:00
|
|
|
function update_submodules() {
|
|
|
|
local submodule
|
|
|
|
local submodule_prompt=unspecified
|
|
|
|
local submodule_path
|
|
|
|
|
|
|
|
{
|
|
|
|
while { read -r submodule && read -r submodule_path; } <&3; do
|
|
|
|
if ! [[ -d "${REPO_DIR}/.git/modules/${submodule}" ]] && [[ -d "${REPO_DIR}/${submodule_path}" ]]; then
|
|
|
|
if [[ "$submodule_prompt" = "unspecified" ]]; then
|
|
|
|
echo "One or more submodules were found to be uninitialized."
|
|
|
|
printf "Initialize and update them? [Y/n] "
|
|
|
|
read -r submodule_prompt
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$submodule_prompt" in
|
|
|
|
y|yes|'') {
|
|
|
|
git -C "$REPO_DIR" submodule update --init "$submodule_path"
|
|
|
|
};;
|
|
|
|
n|no) {
|
|
|
|
return
|
|
|
|
};;
|
|
|
|
*) {
|
|
|
|
echo "Unknown answer. Not updating submodules."
|
|
|
|
};;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
} 3< <(git config --file "${REPO_DIR}/.gitmodules" --null --get-regexp path | xargs -0 printf "%s\n" | sed 's/^submodule.//;s/.path$//')
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -t 0 ]; then
|
|
|
|
update_submodules
|
|
|
|
fi
|
2019-09-27 21:43:11 +02:00
|
|
|
|
2018-10-10 21:49:03 +02:00
|
|
|
# Always remove the local cache to avoid any confusion
|
|
|
|
bat cache --clear
|
|
|
|
|
2018-10-04 10:16:53 +02:00
|
|
|
# TODO: Remove this (and the reverse part below) when
|
2018-11-11 10:14:18 +01:00
|
|
|
# https://github.com/trishume/syntect/issues/222 has been fixed
|
2020-03-21 23:16:37 +01:00
|
|
|
JAVADOC_FILE="${ASSET_DIR}/syntaxes/01_Packages/Java/JavaDoc.sublime-syntax"
|
2018-10-04 10:16:53 +02:00
|
|
|
JAVADOC_PATCH="${ASSET_DIR}/JavaDoc.sublime-syntax.patch"
|
|
|
|
patch "$JAVADOC_FILE" "$JAVADOC_PATCH"
|
|
|
|
|
2019-02-07 22:31:37 +01:00
|
|
|
bat cache --build --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
|
2018-10-04 10:16:53 +02:00
|
|
|
|
|
|
|
patch -R "$JAVADOC_FILE" "$JAVADOC_PATCH"
|