Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 43 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:
- main
pull_request:
jobs:
test:
gradle_8:
runs-on: ${{ matrix.os }}
name: Tests
name: Tests (Gradle 8)
strategy:
fail-fast: false
matrix:
Expand All @@ -16,23 +16,50 @@ jobs:
os: [ubuntu-latest]
java: [8, 11, 17, 21]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
distribution: "temurin"
cache: "sbt"
java-version: ${{ matrix.java }}

- uses: sbt/setup-sbt@v1

- name: Setup Gradle 8.10
uses: gradle/actions/setup-gradle@v4
- name: Setup Gradle 8.14.3
uses: gradle/actions/setup-gradle@v5
with:
gradle-version: '8.10'
gradle-version: "8.14.3"

- name: Main project tests
run: sbt test
run: sbt test

gradle_9:
runs-on: ${{ matrix.os }}
name: Tests (Gradle 9)
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
java: [17, 21, 25]
steps:
- uses: actions/checkout@v6

- uses: actions/setup-java@v5
with:
distribution: "temurin"
cache: "sbt"
java-version: ${{ matrix.java }}

- uses: sbt/setup-sbt@v1

- name: Setup Gradle 9.2.1
uses: gradle/actions/setup-gradle@v5
with:
gradle-version: "9.2.1"

- name: Main project tests
run: sbt test

docker_test:
runs-on: ${{ matrix.os }}
Expand All @@ -42,9 +69,9 @@ jobs:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6

- uses: actions/setup-java@v3
- uses: actions/setup-java@v5
with:
distribution: "temurin"
cache: "sbt"
Expand Down Expand Up @@ -76,7 +103,7 @@ jobs:
bazel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- run: yarn global add @bazel/bazelisk
- run: bazel build //... --//semanticdb-javac:enabled=true
- run: bazel run scip-semanticdb:bazel -- --sourceroot "$PWD"
Expand All @@ -91,10 +118,10 @@ jobs:
bazel_aspect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- run: yarn global add @bazel/bazelisk

- uses: actions/setup-java@v3
- uses: actions/setup-java@v5
with:
distribution: "temurin"
cache: "sbt"
Expand Down Expand Up @@ -133,18 +160,17 @@ jobs:
- name: Run sample benchmarks
run: sbt --client 'bench/Jmh/run -i 1 -f1 -t1 -foe true'


maven:
runs-on: ubuntu-latest
name: Maven tests
strategy:
fail-fast: false
matrix:
java: [8, 11, 17, 21]
java: [8, 11, 17, 21, 25]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
distribution: "temurin"
cache: "sbt"
Expand Down Expand Up @@ -172,4 +198,3 @@ jobs:

- run: du -h index.scip
working-directory: examples/maven-example

11 changes: 5 additions & 6 deletions bin/docker-setup.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
#!/usr/bin/env bash
set -eux
curl -fLo /usr/local/bin/coursier https://github.com/coursier/coursier/releases/download/v2.1.5/coursier
curl -fLo /usr/local/bin/coursier https://github.com/coursier/coursier/releases/download/v2.1.24/coursier
chmod +x /usr/local/bin/coursier
coursier setup --yes --apps coursier,sbt

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

curl -fLo gradle.zip https://services.gradle.org/distributions/gradle-7.6.1-bin.zip
unzip -d /opt/gradle gradle.zip
curl -fLo gradle.zip https://services.gradle.org/distributions/gradle-9.2.1-bin.zip
unzip -d /opt/gradle gradle.zip
rm gradle.zip
mv /opt/gradle/*/* /opt/gradle

# pre-install JDK for all major versions
for JVM_VERSION in 21 17 11 8
do
for JVM_VERSION in 25 21 17 11 8; do
coursier java --jvm $JVM_VERSION --jvm-index https://github.com/coursier/jvm-index/blob/master/index.json -- -version
done
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.sourcegraph.scip_semanticdb;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileSystems;
Expand All @@ -11,18 +10,19 @@
import java.util.Optional;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.io.DataInputStream;

public class JavaVersion {
public final boolean isJava8;
public final JdkPackage pkg;
private static final PathMatcher CLASS_PATTERN =
FileSystems.getDefault().getPathMatcher("glob:**.class");
private static final PathMatcher JAR_PATTERN =
FileSystems.getDefault().getPathMatcher("glob:**.jar");
private static final PathMatcher CLASS_PATTERN = FileSystems.getDefault().getPathMatcher("glob:**.class");
private static final PathMatcher JAR_PATTERN = FileSystems.getDefault().getPathMatcher("glob:**.jar");

public static final int JAVA8_VERSION = 8;
public static final int JAVA11_VERSION = 11;
public static final int JAVA17_VERSION = 17;
public static final int JAVA21_VERSION = 21;
public static final int JAVA25_VERSION = 25;
public static final int DEFAULT_JAVA_VERSION = JAVA8_VERSION;

@SuppressWarnings("FieldCanBeLocal")
Expand All @@ -38,28 +38,41 @@ public JavaVersion(String version) {
}

private String javaVersion(String version) {
if (version.startsWith("1.8")) return "8";
if (version.startsWith("1.8"))
return "8";
String[] parts = version.split("\\.");
if (parts.length > 0) return parts[0];
else return version;
if (parts.length > 0)
return parts[0];
else
return version;
}

@SuppressWarnings("ManualMinMaxCalculation")
public static int roundToNearestStableRelease(int version) {
if (version <= JAVA8_VERSION) return JAVA8_VERSION;
if (version <= JAVA11_VERSION) return JAVA11_VERSION;
if (version <= JAVA17_VERSION) return JAVA17_VERSION;
if (version <= JAVA8_VERSION)
return JAVA8_VERSION;
if (version <= JAVA11_VERSION)
return JAVA11_VERSION;
if (version <= JAVA17_VERSION)
return JAVA17_VERSION;
if (version <= JAVA21_VERSION)
return JAVA21_VERSION;
if (version <= JAVA25_VERSION)
return JAVA25_VERSION;
return version;
}

/**
* Return the JVM version of the given jar/class file.
*
* <p>The JVM version is determined by reading the 5-8th bytes of classfiles, according to the
* <p>
* The JVM version is determined by reading the 5-8th bytes of classfiles,
* according to the
* Java Language spec. See
* https://docs.oracle.com/javase/specs/jvms/se16/html/jvms-4.html#jvms-4.1
*
* @return the JVM version such as <code>8</code> for Java 8 and <code>11</code> for Java 11.
* @return the JVM version such as <code>8</code> for Java 8 and <code>11</code>
* for Java 11.
*/
public static Optional<Integer> classfileJvmVersion(Path file) {
try {
Expand Down Expand Up @@ -92,7 +105,8 @@ private static int classfileMajorVersion(InputStream classfileBytes) throws IOEx
DataInputStream in = new DataInputStream(classfileBytes);
// See https://docs.oracle.com/javase/specs/jvms/se16/html/jvms-4.html#jvms-4.1
int magic = in.readInt(); // u4 magic
if (magic != 0xCAFEBABE) return -1;
if (magic != 0xCAFEBABE)
return -1;
in.readUnsignedShort(); // u2 minor_version
return in.readUnsignedShort(); // u2 major_version
}
Expand Down
Loading
Loading