Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build for Java 21 #168

Merged
merged 1 commit into from
Nov 3, 2023
Merged
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
10 changes: 7 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 8, 11, 17, 20 ]
java-version: [ 8, 11, 17, 21 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
- run: ./gradlew assemble check --info
java-version: |
${{ matrix.java-version }}
21
- run: ./gradlew assemble check --info
env:
JAVA_TOOLCHAIN: ${{ matrix.java-version }}
30 changes: 15 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ plugins {
id 'scala'
id 'signing'
id 'maven-publish'
// pinned version due to Java 8 compatibility
id "com.diffplug.spotless" version "6.11.0"
// pinned version due to https://github.com/spotbugs/spotbugs/issues/2041
id "com.github.spotbugs" version "5.0.13"
id "com.diffplug.spotless" version "6.22.0"
id "com.github.spotbugs" version "5.2.1"
}

var javaToolchain = System.getenv('JAVA_TOOLCHAIN')

java {
if (javaToolchain != null) {
toolchain {
languageVersion = JavaLanguageVersion.of(javaToolchain)
}
}
}

compileJava {
Expand Down Expand Up @@ -39,20 +47,14 @@ dependencies {

spotless {
java {
palantirJavaFormat()
// remove when spotless moved to this Palantir version
palantirJavaFormat("2.38.0")
}
scala {
scalafmt('3.7.1').configFile('.scalafmt.conf')
}
}

// There are some compatibility issues with spotless older Java versions,
// but we don't need to cross-do style checks anyway
if (JavaVersion.current().ordinal() < JavaVersion.VERSION_17.ordinal()) {
tasks.findByName("spotlessScala").enabled(false)
tasks.findByName("spotlessJava").enabled(false)
}

spotbugs {
ignoreFailures = false
showProgress = true
Expand Down Expand Up @@ -113,9 +115,7 @@ task allocationTest(type: JavaExec) {
jvmArgs = ['-XX:+UnlockExperimentalVMOptions', '-XX:+UseEpsilonGC']
}

if (JavaVersion.current().ordinal() >= JavaVersion.VERSION_11.ordinal()) {
check.dependsOn allocationTest
}
check.dependsOn allocationTest

publishing {
publications {
Expand Down
14 changes: 14 additions & 0 deletions src/test/scala/tlschannel/TestLogger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package tlschannel;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;

@TestInstance(Lifecycle.PER_CLASS)
public class TestLogger {

@Test
public void logJdk() {
System.out.println("java.version: " + System.getProperty("java.version"));
}
}