Skip to content

Commit

Permalink
Require JDK17+ for development (#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenbaker authored Dec 16, 2024
1 parent d75650d commit 888bf20
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Java ${{ matrix.java }} ${{ matrix.os }}
strategy:
matrix:
java: [8, 11, 17, 21]
java: [17, 21]
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Please read through this document before submitting any issues or pull requests
information to effectively respond to your bug report or contribution.


## Building the Project

Building this project **requires having a JDK17+ installation**. However, for the time being, most modules will still
produce artifacts targeting JDK8, unless explicitly noted otherwise.

## Reporting Bugs/Feature Requests

We welcome you to use the GitHub issue tracker to report bugs or suggest features.
Expand Down
13 changes: 8 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ plugins {
val libraryVersion = project.file("VERSION").readText().trim()
println("Smithy version: '$libraryVersion'")

// Verify Java version is 17+
// Since most plugins are not toolchain-aware, we can't rely on gradle toolchains, which means we'll have to enforce
// that the global java version (i.e. whatever JAVA_HOME is set to and what Gradle uses) is set to 17+
val javaVersion = JavaVersion.current()
check(javaVersion.isCompatibleWith(JavaVersion.VERSION_17)) {
"Building this project requires Java 17 or later. You are currently running Java ${javaVersion.majorVersion}."
}

allprojects {
group = "software.amazon.smithy"
version = libraryVersion
Expand All @@ -40,11 +48,6 @@ afterEvaluate {
classpath = files(subprojects.map { project(it.path).sourceSets.main.get().compileClasspath })
(options as StandardJavadocDocletOptions).apply {
addStringOption("Xdoclint:-html", "-quiet")
// Fixed in JDK 12: https://bugs.openjdk.java.net/browse/JDK-8215291
// --no-module-directories does not exist in JDK 8 and is removed in 13
if (JavaVersion.current().run { isJava9 || isJava10 || isJava11 }) {
addBooleanOption("-no-module-directories", true)
}
}
}
}
Expand Down

0 comments on commit 888bf20

Please sign in to comment.