forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon
executable file
·26 lines (17 loc) · 862 Bytes
/
common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
# Wrapper for the published dotc/dotr script that check for file changes
# and use sbt to re build the compiler as needed.
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >& /dev/null && pwd)/.."
target="$1"
shift # Mutates $@ by deleting the first element ($1)
# set the $DIST_PROJECT and $DIST_DIR variables
source "$ROOT/bin/common-platform"
# Marker file used to obtain the date of latest call to sbt-back
version="$ROOT/$DIST_DIR/target/universal/stage/VERSION"
# Create the target if absent or if file changed in ROOT/compiler
new_files="$(find "$ROOT/compiler" \( -iname "*.scala" -o -iname "*.java" \) -newer "$version" 2> /dev/null)"
if [ ! -f "$version" ] || [ ! -z "$new_files" ]; then
echo "Building Dotty..."
(cd $ROOT && sbt "$DIST_PROJECT/Universal/stage")
fi
"$ROOT/$DIST_DIR/target/universal/stage/bin/$target" "$@"