-
Notifications
You must be signed in to change notification settings - Fork 34
/
.build.sh
executable file
·87 lines (65 loc) · 2.9 KB
/
.build.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# Uses `bash` rather than `sh` because of use of [[ ... ]] for boolean tests.
echo "Entering $(cd "$(dirname "$0")" && pwd -P)/$(basename "$0") in $(pwd)"
# Optional argument $1 is one of:
# all, test, typecheck, misc, downstream
# It defaults to "all".
export GROUP="$1"
if [[ "${GROUP}" == "" ]]; then
export GROUP=all
fi
if [[ "${GROUP}" != "all" && "${GROUP}" != "test" && "${GROUP}" != "typecheck" && "${GROUP}" != "misc" && "${GROUP}" != "downstream" ]]; then
echo "Bad argument '${GROUP}'; should be omitted or one of: all, test, misc, downstream."
exit 1
fi
# Fail the whole script if any command fails
set -e
## Diagnostic output
# Output lines of this script as they are read.
set -o verbose
# Output expanded lines of this script as they are executed.
set -o xtrace
# Don't use "-d" to debug ant, because that results in a log so long
# that Travis truncates the log and terminates the job.
export SHELLOPTS
./.build-without-test.sh
set -e
if [ -d "/tmp/git-scripts" ] ; then
(cd /tmp/git-scripts && (git pull -q || true)) > /dev/null 2>&1
else
(cd /tmp && git clone --depth=1 -q https://github.com/plume-lib/git-scripts.git)
fi
if [[ "${GROUP}" == "test" || "${GROUP}" == "all" ]]; then
(cd annotation-file-utilities && ./gradlew build)
fi
if [[ "${GROUP}" == "typecheck" || "${GROUP}" == "all" ]]; then
if [ -z "${CHECKERFRAMEWORK}" ] ; then
CHECKERFRAMEWORK=$(realpath ../checker-framework)
export CHECKERFRAMEWORK
/tmp/git-scripts/git-clone-related typetools checker-framework "${CHECKERFRAMEWORK}"
(cd "${CHECKERFRAMEWORK}" && ./.build-without-test.sh downloadjdk)
fi
(cd annotation-file-utilities && ./gradlew checkSignature)
fi
if [[ "${GROUP}" == "misc" || "${GROUP}" == "all" ]]; then
## jdkany tests: miscellaneous tests that shouldn't depend on JDK version.
set -e
# As of version 2.38.0 (2023-04-06), Spotless does not run under JDK 20.
JAVA_VER=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1 | sed 's/-ea//') && \
if [ "$JAVA_VER" = "20" ] ; then
echo "Skipping spotlessCheck on JDK 20"
else
(cd annotation-file-utilities && ./gradlew spotlessCheck)
fi
(cd annotation-file-utilities && ./gradlew htmlValidate)
(cd annotation-file-utilities && ./gradlew javadoc)
fi
if [[ "${GROUP}" == "downstream" || "${GROUP}" == "all" ]]; then
# checker-framework and its downstream tests
/tmp/git-scripts/git-clone-related typetools checker-framework
(cd ../checker-framework/framework && (../gradlew --write-verification-metadata sha256 help --dry-run || (sleep 60s && ../gradlew --write-verification-metadata sha256 help --dry-run)))
(cd ../checker-framework/framework && ../gradlew ainferTest)
# /tmp/git-scripts/git-clone-related typetools checker-framework-inference
# (cd ../checker-framework-inference && ./.build.sh)
fi
echo "Exiting $(cd "$(dirname "$0")" && pwd -P)/$(basename "$0") in $(pwd)"