Skip to content

Commit d16df28

Browse files
authored
Try different jdk versions in sequence (#583)
Also: * Install Gradle the same way as Maven, for consistency * Pre-download JDK 8, 11, 17 * DRY docker CLI tests, add indeedeng/proctor
1 parent f0e6f46 commit d16df28

File tree

4 files changed

+50
-14
lines changed

4 files changed

+50
-14
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ jobs:
4545
run: sbt cli/docker
4646

4747
- run: |
48-
git clone https://github.com/circe/circe.git
48+
set -eu
49+
for REPO in circe/circe indeedeng/proctor
50+
do
51+
mkdir -p .repos/$REPO
52+
git clone https://github.com/$REPO.git .repos/$REPO
4953
50-
docker run -v $PWD:/sources -w /sources sourcegraph/scip-java:latest scip-java index --cwd circe
51-
file circe/index.scip || (echo "circe SCIP index doesn't exist!"; exit 1)
54+
docker run -v $PWD/.repos/$REPO:/sources -w /sources sourcegraph/scip-java:latest scip-java index
55+
file .repos/$REPO/index.scip || (echo "$REPO SCIP index doesn't exist!"; exit 1)
56+
done
5257
5358
bazel:
5459
runs-on: ubuntu-latest

bin/docker-setup.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ coursier setup --yes
66

77
curl -fLo maven.zip https://archive.apache.org/dist/maven/maven-3/3.9.1/binaries/apache-maven-3.9.1-bin.zip
88
unzip -d /opt/maven maven.zip
9+
rm maven.zip
910
mv /opt/maven/*/* /opt/maven
1011

11-
rm maven.zip
12+
curl -fLo gradle.zip https://services.gradle.org/distributions/gradle-7.6.1-bin.zip
13+
unzip -d /opt/gradle gradle.zip
14+
rm gradle.zip
15+
mv /opt/gradle/*/* /opt/gradle
16+
17+
# pre-install JDK for all major versions
18+
for JVM_VERSION in 17 11 8
19+
do
20+
coursier java --jvm $JVM_VERSION --jvm-index https://github.com/coursier/jvm-index/blob/master/index.json -- -version
21+
done

bin/scip-java-docker-script.sh

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# version. It assumes that `coursier` is available on the `$PATH` and that the
44
# `scip-java` binary is already installed at `/app/scip-java/bin/scip-java`.
55
set -eu
6-
JVM_VERSION="${JVM_VERSION:-17}"
6+
JVM_VERSION="${JVM_VERSION:-17,11,8}"
77
FILE="$PWD/lsif-java.json"
88
if test -f "$FILE"; then
99
FROM_CONFIG=$(jq -r '.jvm' "$FILE")
@@ -12,13 +12,33 @@ if test -f "$FILE"; then
1212
fi
1313
fi
1414

15-
echo "Using JVM version '$JVM_VERSION'"
15+
JVM_VERSIONS=$(echo $JVM_VERSION | tr "," "\n")
1616

17-
if [ "$JVM_VERSION" = "17" ]; then
18-
export JAVA_OPTS="--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
19-
# No need to download Java 17 because it's pre-installed.
20-
else
21-
eval "$(coursier java --jvm "$JVM_VERSION" --env --jvm-index https://github.com/coursier/jvm-index/blob/master/index.json)"
22-
fi
17+
LAST_CODE="-1"
18+
19+
ARGS=$@
20+
21+
for JVM_VERSION in $JVM_VERSIONS
22+
do
23+
if [ "$LAST_CODE" != "0" ]; then
24+
echo "Using JVM version '$JVM_VERSION'"
25+
26+
if [ "$JVM_VERSION" = "17" ]; then
27+
export JAVA_OPTS="--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
28+
else
29+
export JAVA_OPTS=""
30+
fi
31+
32+
eval "$(coursier java --jvm "$JVM_VERSION" --env --jvm-index https://github.com/coursier/jvm-index/blob/master/index.json)"
33+
34+
java -version
35+
if /app/scip-java/bin/scip-java "$@"; then
36+
LAST_CODE="0"
37+
else
38+
LAST_CODE=$?
39+
fi
40+
41+
fi
42+
done
2343

24-
/app/scip-java/bin/scip-java "$@"
44+
exit $LAST_CODE

build.sbt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ lazy val cli = project
284284
val dockerSetup = (ThisBuild / baseDirectory).value / "bin" /
285285
"docker-setup.sh"
286286
new Dockerfile {
287-
from("gradle:7.2.0-jdk17")
287+
from("eclipse-temurin:17")
288288

289289
// Setup system dependencies.
290290
run("apt-get", "update")
@@ -316,6 +316,7 @@ lazy val cli = project
316316
run("bash", "/docker-setup.sh")
317317

318318
env("PATH", "/opt/maven/bin:${PATH}")
319+
env("PATH", "/opt/gradle/bin:${PATH}")
319320
env("PATH", "/root/.local/share/coursier/bin:${PATH}")
320321

321322
// Mark all directories as safe for Git, so that it doesn't

0 commit comments

Comments
 (0)