Skip to content

Commit

Permalink
fix (cli): Improve ./enola dev script launch performance further
Browse files Browse the repository at this point in the history
  • Loading branch information
vorburger committed Jun 27, 2024
1 parent 871530c commit ccea777
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
26 changes: 21 additions & 5 deletions enola
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,30 @@ ROOT="$(realpath "$(dirname "$0")")"
cd "$ROOT"
LOG=$(mktemp)

# TODO Skip if not required, to optimize; see https://github.com/enola-dev/enola/issues/753
tools/distro/build-execjar.bash >"$LOG" 2>&1
exit_code="$?"
if [[ "$exit_code" == "0" ]]; then
if [ -x "$(command -v hashdir)" ]; then
mkdir -p "$ROOT"/.cache
mv "$ROOT"/.cache/java.hash "$ROOT"/.cache/java.hash.previous 2>/dev/null || true
hashdir --quiet java/ > "$ROOT"/.cache/java.hash
set +e
diff "$ROOT"/.cache/java.hash "$ROOT"/.cache/java.hash.previous 2>/dev/null
DIFF="$?"
set -e
else
DIFF=3
fi

if [ "$DIFF" -ne 0 ]; then
tools/distro/build-execjar.bash >"$LOG" 2>&1
exit_code="$?"
rm "$LOG"
else
exit_code=0
fi

if [[ "$exit_code" == "0" ]]; then
source "$ROOT"/tools/bazel-java-tool-chain/bazel-java-tool-chain.bash
JAVA=$(java_home)
PATH="$JAVA"/bin:"$PATH" site/download/latest/enola
PATH="$JAVA"/bin:"$PATH" site/download/latest/enola "$@"

else
cat "$LOG" && echo >&2 && echo >&2
Expand Down
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# PLEASE only use fixed (package)==(version)

# https://pre-commit.com
pre-commit==3.7.1

# https://github.com/fcivaner/hashdir
hashdir==0.24

# MkDocs
mkdocs-material==9.5.25
mkdocs-git-committers-plugin-2==2.3.0
mkdocs-git-revision-date-localized-plugin==1.2.6
Expand Down

0 comments on commit ccea777

Please sign in to comment.