Skip to content

Commit 3faa174

Browse files
committed
Bump gradle-api to 8.10 and use typed JavaCompiler
1 parent 28c0442 commit 3faa174

2 files changed

Lines changed: 4 additions & 22 deletions

File tree

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ lazy val V =
1212
val scipBindings = "0.8.0"
1313
val scalaXml = "2.1.0"
1414
val moped = "0.2.0"
15-
val gradle = "7.0"
15+
val gradle = "8.10"
1616
val scala213 = "2.13.13"
1717
val scalameta = "4.9.3"
1818
val kotlinVersion = "2.2.0"

semanticdb-gradle-plugin/src/main/scala/SemanticdbGradlePlugin.scala

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import com.sourcegraph.scip_java.BuildInfo
1111
import org.gradle.api.DefaultTask
1212
import org.gradle.api.Plugin
1313
import org.gradle.api.Project
14-
import org.gradle.api.provider.Property
1514
import org.gradle.api.publish.PublishingExtension
1615
import org.gradle.api.publish.maven.MavenPublication
1716
import org.gradle.api.tasks.SourceSetContainer
@@ -106,28 +105,11 @@ class SemanticdbGradlePlugin extends Plugin[Project] {
106105
.configureEach { task =>
107106
// On JDK 17+ we need --add-exports flags to allow our compiler
108107
// plugin to access javac internals.
109-
type JavaCompiler = {
110-
type Metadata = {
111-
type LangVersion = {
112-
def asInt(): Int
113-
}
114-
def getLanguageVersion(): LangVersion
115-
}
116-
def getMetadata(): Metadata
117-
}
118-
119-
type HasCompilerProperty = {
120-
def getJavaCompiler(): Property[JavaCompiler]
121-
}
122-
123-
val toolchainCompiler = Option(
124-
task
125-
.asInstanceOf[HasCompilerProperty]
126-
.getJavaCompiler()
127-
.getOrNull()
108+
val toolchainJavaVersion = Option(
109+
task.getJavaCompiler().getOrNull()
128110
).map(_.getMetadata().getLanguageVersion().asInt())
129111

130-
val effectiveJavaVersion = toolchainCompiler.getOrElse(
112+
val effectiveJavaVersion = toolchainJavaVersion.getOrElse(
131113
Runtime.version().feature()
132114
)
133115

0 commit comments

Comments
 (0)