2018-05-16 19:22:16 +00:00
|
|
|
#!/bin/bash
|
2019-02-02 10:19:11 +00:00
|
|
|
set -euo pipefail
|
2018-04-30 13:41:30 +00:00
|
|
|
|
2018-05-16 19:22:16 +00:00
|
|
|
ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2019-10-04 18:43:36 +00:00
|
|
|
REPO_DIR="$ASSET_DIR/.."
|
2018-04-30 13:41:30 +00:00
|
|
|
|
2019-09-27 19:43:11 +00:00
|
|
|
# Ensure submodules are initialized.
|
2019-10-04 18:43:36 +00: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 19:43:11 +00:00
|
|
|
|
2018-10-10 19:49:03 +00:00
|
|
|
# Always remove the local cache to avoid any confusion
|
|
|
|
bat cache --clear
|
|
|
|
|
2018-10-04 08:16:53 +00:00
|
|
|
# TODO: Remove this (and the reverse part below) when
|
2018-11-11 09:14:18 +00:00
|
|
|
# https://github.com/trishume/syntect/issues/222 has been fixed
|
2020-03-21 22:16:37 +00:00
|
|
|
JAVADOC_FILE="${ASSET_DIR}/syntaxes/01_Packages/Java/JavaDoc.sublime-syntax"
|
2018-10-04 08:16:53 +00:00
|
|
|
JAVADOC_PATCH="${ASSET_DIR}/JavaDoc.sublime-syntax.patch"
|
|
|
|
patch "$JAVADOC_FILE" "$JAVADOC_PATCH"
|
|
|
|
|
2019-02-07 21:31:37 +00:00
|
|
|
bat cache --build --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
|
2018-10-04 08:16:53 +00:00
|
|
|
|
|
|
|
patch -R "$JAVADOC_FILE" "$JAVADOC_PATCH"
|