Files
lila/lila.sh
T
Thibault Duplessis 8610e6fa44 rename lila to lila.sh
Works around a weird scalac(?) bug where compilation fails when LANGUAGE
is not set to `en_US`, on some environments.

To reproduce:
```
export LANGUAGE=fr
./lila clean
./lila compile
```

Stacktrace:
https://gist.github.com/ornicar/4a7b136d2220f4c1fd43e920956f67b4

The bug was reproduced on a Debian GNU/Linux 12 (bookworm) x86_64.
It could not be reproduced on NixOS 24.11 (Vicuna) x86_64
2024-09-22 20:23:17 +02:00

55 lines
1.3 KiB
Bash
Executable File

#!/bin/sh -e
# Starts a dev console to compile and run lichess.
# Usage:
# ./lila
# Then in the sbt console:
# run
# We use .sbtopts instead
export SBT_OPTS=""
if [ ! -f ".sbtopts" ]; then
cp .sbtopts.default .sbtopts
fi
if [ ! -f "conf/application.conf" ]; then
cp conf/application.conf.default conf/application.conf
fi
java_env="-Dreactivemongo.api.bson.document.strict=false"
cat << "BANNER"
|\_ _ _ _
/o \ | (_) ___| |__ ___ ___ ___ ___ _ __ __ _
(_. || | | |/ __| '_ \ / _ \/ __/ __| / _ \| '__/ _` |
/__\ | | | (__| | | | __/\__ \__ \| (_) | | | (_| |
)___( |_|_|\___|_| |_|\___||___/___(_)___/|_| \__, |
|___/
BANNER
if ! command -v java; then
echo "Cannot find Java, is it installed?"
exit 1
fi
version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo Java "$version"
javabin=$(which java)
if [ -z "$JAVA_HOME" ]; then
echo "Warning, JAVA_HOME is unset"
elif [ "$JAVA_HOME/bin/java" != "$javabin" ]; then
echo "Warning, JAVA_HOME [$JAVA_HOME] is not the same as java on PATH [$javabin]"
fi
if ! $(java --list-modules | grep -q jdk.compiler -); then
echo Warning, $javabin is missing module jdk.compiler - this can happen if you mistakenly use a JRE instead of a JDK.
fi
command="sbt $java_env $@"
echo $command
$command