-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdemo
executable file
·50 lines (44 loc) · 2.21 KB
/
demo
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
#!/bin/sh
# A quick and easy way to run the reference checker on some standalone code.
# If you set the CLASSPATH environment variable it will use it, adding its own entries to that list.
# To integrate the checker into a more complex build, reading the below should give you what you need to know.
dir=$(dirname $0)
jspecify="${dir}/../jspecify/build/libs/jspecify-0.0.0-SNAPSHOT.jar"
if [ ! -e "${jspecify}" ]; then
version=1.0.0
jspecify="${dir}/build/jspecify-${version}.jar"
if [ ! -e "${jspecify}" ]; then
echo "Downloading $(basename "${jspecify}") from Maven central"
mvn -q org.apache.maven.plugins:maven-dependency-plugin:3.7.1:copy \
-Dartifact="org.jspecify:jspecify:${version}" \
-DoutputDirectory="$(dirname "${jspecify}")"
fi
fi
checkerFrameworkDir="${dir}/../checker-framework/"
checkerFrameworkJar="${checkerFrameworkDir}/checker/dist/checker.jar"
if [ ! -e "${checkerFrameworkJar}" ]; then
cfVersion="3.42.0-eisop4"
checkerFrameworkJar="${dir}/build/checker-${cfVersion}-all.jar"
if [ ! -e "${checkerFrameworkJar}" ]; then
echo "Downloading $(basename "${checkerFrameworkJar}") from Maven central"
mvn -q org.apache.maven.plugins:maven-dependency-plugin:3.7.1:copy \
-Dartifact="io.github.eisop:checker:${cfVersion}:jar:all" \
-DoutputDirectory="$(dirname "${checkerFrameworkJar}")"
fi
fi
jspecify_reference_checker="${dir}/build/libs/jspecify-reference-checker-0.0.0-SNAPSHOT.jar"
if [ ! -e "${jspecify_reference_checker}" ]; then
echo "Assembling jspecify-reference-checker"
./gradlew assemble
fi
ourclasspath="${jspecify}:${jspecify_reference_checker}"
export CLASSPATH="${ourclasspath}:$CLASSPATH"
java -jar "${checkerFrameworkJar}" \
-processorpath "${ourclasspath}" \
-processor com.google.jspecify.nullness.NullSpecChecker \
-checkerQualJar "${checkerFrameworkJar}" \
-checkerUtilJar "${checkerFrameworkJar}" \
-AcheckImpl \
-AassumePure \
-AsuppressWarnings=contracts.conditional.postcondition.false.methodref,contracts.conditional.postcondition.false.override,contracts.conditional.postcondition.true.methodref,contracts.conditional.postcondition.true.override,purity.methodref,purity.overriding,type.anno.before.decl.anno,type.anno.before.modifier \
"$@"