Skip to content

Commit 043f955

Browse files
committed
Update build tool support
Tests against currently maintained build tool versions and compatible JDKs Update bundled tools in docker image
1 parent ee31653 commit 043f955

File tree

8 files changed

+356
-165
lines changed

8 files changed

+356
-165
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ on:
55
- main
66
pull_request:
77
jobs:
8-
test:
8+
gradle_8:
99
runs-on: ${{ matrix.os }}
10-
name: Tests
10+
name: Tests (Gradle 8)
1111
strategy:
1212
fail-fast: false
1313
matrix:
@@ -16,23 +16,50 @@ jobs:
1616
os: [ubuntu-latest]
1717
java: [8, 11, 17, 21]
1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v6
2020

21-
- uses: actions/setup-java@v4
21+
- uses: actions/setup-java@v5
2222
with:
2323
distribution: "temurin"
2424
cache: "sbt"
2525
java-version: ${{ matrix.java }}
2626

2727
- uses: sbt/setup-sbt@v1
2828

29-
- name: Setup Gradle 8.10
30-
uses: gradle/actions/setup-gradle@v4
29+
- name: Setup Gradle 8.14.3
30+
uses: gradle/actions/setup-gradle@v5
3131
with:
32-
gradle-version: '8.10'
32+
gradle-version: "8.14.3"
3333

3434
- name: Main project tests
35-
run: sbt test
35+
run: sbt test
36+
37+
gradle_9:
38+
runs-on: ${{ matrix.os }}
39+
name: Tests (Gradle 9)
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
os: [ubuntu-latest]
44+
java: [17, 21, 25]
45+
steps:
46+
- uses: actions/checkout@v6
47+
48+
- uses: actions/setup-java@v5
49+
with:
50+
distribution: "temurin"
51+
cache: "sbt"
52+
java-version: ${{ matrix.java }}
53+
54+
- uses: sbt/setup-sbt@v1
55+
56+
- name: Setup Gradle 9.2.1
57+
uses: gradle/actions/setup-gradle@v5
58+
with:
59+
gradle-version: "9.2.1"
60+
61+
- name: Main project tests
62+
run: sbt test
3663

3764
docker_test:
3865
runs-on: ${{ matrix.os }}
@@ -42,9 +69,9 @@ jobs:
4269
matrix:
4370
os: [ubuntu-latest]
4471
steps:
45-
- uses: actions/checkout@v2
72+
- uses: actions/checkout@v6
4673

47-
- uses: actions/setup-java@v3
74+
- uses: actions/setup-java@v5
4875
with:
4976
distribution: "temurin"
5077
cache: "sbt"
@@ -76,7 +103,7 @@ jobs:
76103
bazel:
77104
runs-on: ubuntu-latest
78105
steps:
79-
- uses: actions/checkout@v2
106+
- uses: actions/checkout@v6
80107
- run: yarn global add @bazel/bazelisk
81108
- run: bazel build //... --//semanticdb-javac:enabled=true
82109
- run: bazel run scip-semanticdb:bazel -- --sourceroot "$PWD"
@@ -91,10 +118,10 @@ jobs:
91118
bazel_aspect:
92119
runs-on: ubuntu-latest
93120
steps:
94-
- uses: actions/checkout@v2
121+
- uses: actions/checkout@v6
95122
- run: yarn global add @bazel/bazelisk
96123

97-
- uses: actions/setup-java@v3
124+
- uses: actions/setup-java@v5
98125
with:
99126
distribution: "temurin"
100127
cache: "sbt"
@@ -133,18 +160,17 @@ jobs:
133160
- name: Run sample benchmarks
134161
run: sbt --client 'bench/Jmh/run -i 1 -f1 -t1 -foe true'
135162

136-
137163
maven:
138164
runs-on: ubuntu-latest
139165
name: Maven tests
140166
strategy:
141167
fail-fast: false
142168
matrix:
143-
java: [8, 11, 17, 21]
169+
java: [8, 11, 17, 21, 25]
144170
steps:
145-
- uses: actions/checkout@v4
171+
- uses: actions/checkout@v6
146172

147-
- uses: actions/setup-java@v4
173+
- uses: actions/setup-java@v5
148174
with:
149175
distribution: "temurin"
150176
cache: "sbt"
@@ -172,4 +198,3 @@ jobs:
172198
173199
- run: du -h index.scip
174200
working-directory: examples/maven-example
175-

bin/docker-setup.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
#!/usr/bin/env bash
22
set -eux
3-
curl -fLo /usr/local/bin/coursier https://github.com/coursier/coursier/releases/download/v2.1.5/coursier
3+
curl -fLo /usr/local/bin/coursier https://github.com/coursier/coursier/releases/download/v2.1.24/coursier
44
chmod +x /usr/local/bin/coursier
55
coursier setup --yes --apps coursier,sbt
66

7-
curl -fLo maven.zip https://archive.apache.org/dist/maven/maven-3/3.9.1/binaries/apache-maven-3.9.1-bin.zip
7+
curl -fLo maven.zip https://archive.apache.org/dist/maven/maven-3/3.9.12/binaries/apache-maven-3.9.12-bin.zip
88
unzip -d /opt/maven maven.zip
99
rm maven.zip
1010
mv /opt/maven/*/* /opt/maven
1111

12-
curl -fLo gradle.zip https://services.gradle.org/distributions/gradle-7.6.1-bin.zip
13-
unzip -d /opt/gradle gradle.zip
12+
curl -fLo gradle.zip https://services.gradle.org/distributions/gradle-9.2.1-bin.zip
13+
unzip -d /opt/gradle gradle.zip
1414
rm gradle.zip
1515
mv /opt/gradle/*/* /opt/gradle
1616

1717
# pre-install JDK for all major versions
18-
for JVM_VERSION in 21 17 11 8
19-
do
18+
for JVM_VERSION in 25 21 17 11 8; do
2019
coursier java --jvm $JVM_VERSION --jvm-index https://github.com/coursier/jvm-index/blob/master/index.json -- -version
2120
done

scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/JavaVersion.java

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.sourcegraph.scip_semanticdb;
22

3-
import java.io.DataInputStream;
43
import java.io.IOException;
54
import java.io.InputStream;
65
import java.nio.file.FileSystems;
@@ -11,18 +10,19 @@
1110
import java.util.Optional;
1211
import java.util.jar.JarEntry;
1312
import java.util.jar.JarFile;
13+
import java.io.DataInputStream;
1414

1515
public class JavaVersion {
1616
public final boolean isJava8;
1717
public final JdkPackage pkg;
18-
private static final PathMatcher CLASS_PATTERN =
19-
FileSystems.getDefault().getPathMatcher("glob:**.class");
20-
private static final PathMatcher JAR_PATTERN =
21-
FileSystems.getDefault().getPathMatcher("glob:**.jar");
18+
private static final PathMatcher CLASS_PATTERN = FileSystems.getDefault().getPathMatcher("glob:**.class");
19+
private static final PathMatcher JAR_PATTERN = FileSystems.getDefault().getPathMatcher("glob:**.jar");
2220

2321
public static final int JAVA8_VERSION = 8;
2422
public static final int JAVA11_VERSION = 11;
2523
public static final int JAVA17_VERSION = 17;
24+
public static final int JAVA21_VERSION = 21;
25+
public static final int JAVA25_VERSION = 25;
2626
public static final int DEFAULT_JAVA_VERSION = JAVA8_VERSION;
2727

2828
@SuppressWarnings("FieldCanBeLocal")
@@ -38,28 +38,41 @@ public JavaVersion(String version) {
3838
}
3939

4040
private String javaVersion(String version) {
41-
if (version.startsWith("1.8")) return "8";
41+
if (version.startsWith("1.8"))
42+
return "8";
4243
String[] parts = version.split("\\.");
43-
if (parts.length > 0) return parts[0];
44-
else return version;
44+
if (parts.length > 0)
45+
return parts[0];
46+
else
47+
return version;
4548
}
4649

4750
@SuppressWarnings("ManualMinMaxCalculation")
4851
public static int roundToNearestStableRelease(int version) {
49-
if (version <= JAVA8_VERSION) return JAVA8_VERSION;
50-
if (version <= JAVA11_VERSION) return JAVA11_VERSION;
51-
if (version <= JAVA17_VERSION) return JAVA17_VERSION;
52+
if (version <= JAVA8_VERSION)
53+
return JAVA8_VERSION;
54+
if (version <= JAVA11_VERSION)
55+
return JAVA11_VERSION;
56+
if (version <= JAVA17_VERSION)
57+
return JAVA17_VERSION;
58+
if (version <= JAVA21_VERSION)
59+
return JAVA21_VERSION;
60+
if (version <= JAVA25_VERSION)
61+
return JAVA25_VERSION;
5262
return version;
5363
}
5464

5565
/**
5666
* Return the JVM version of the given jar/class file.
5767
*
58-
* <p>The JVM version is determined by reading the 5-8th bytes of classfiles, according to the
68+
* <p>
69+
* The JVM version is determined by reading the 5-8th bytes of classfiles,
70+
* according to the
5971
* Java Language spec. See
6072
* https://docs.oracle.com/javase/specs/jvms/se16/html/jvms-4.html#jvms-4.1
6173
*
62-
* @return the JVM version such as <code>8</code> for Java 8 and <code>11</code> for Java 11.
74+
* @return the JVM version such as <code>8</code> for Java 8 and <code>11</code>
75+
* for Java 11.
6376
*/
6477
public static Optional<Integer> classfileJvmVersion(Path file) {
6578
try {
@@ -92,7 +105,8 @@ private static int classfileMajorVersion(InputStream classfileBytes) throws IOEx
92105
DataInputStream in = new DataInputStream(classfileBytes);
93106
// See https://docs.oracle.com/javase/specs/jvms/se16/html/jvms-4.html#jvms-4.1
94107
int magic = in.readInt(); // u4 magic
95-
if (magic != 0xCAFEBABE) return -1;
108+
if (magic != 0xCAFEBABE)
109+
return -1;
96110
in.readUnsignedShort(); // u2 minor_version
97111
return in.readUnsignedShort(); // u2 major_version
98112
}

0 commit comments

Comments
 (0)