Skip to content

Commit

Permalink
Clean up Java 17 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
olafurpg committed Aug 16, 2022
1 parent fad0baa commit 3078f4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ class GradleBuildTool(index: IndexCommand) extends BuildTool("Gradle", index) {
}

private def initScript(toolchains: GradleJavaToolchains, tmp: Path): Path = {
val executableJavacPath = toolchains.executableJavacPath()
val executable =
executableJavacPath match {
toolchains.executableJavacPath() match {
case Some(path) =>
s"options.forkOptions.executable = '$path'"
case None =>
Expand Down Expand Up @@ -161,7 +160,6 @@ class GradleBuildTool(index: IndexCommand) extends BuildTool("Gradle", index) {
| tasks.withType(JavaCompile) {
| options.fork = true
| options.incremental = false
| System.out.println("JAVA VERSION " + System.getProperty("java.version"))
| $executable
| }
| }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class MavenBuildTool(index: IndexCommand) extends BuildTool("Maven", index) {
index.workingDirectory,
index.finalTargetroot(defaultTargetroot),
tmp,
// TODO: infer Java version from `java -version` because it may not
// match the Java version that's used by the current process.
GradleJavaToolchains.isJavaAtLeast(SystemJavaVersion.detect(), "11")
)
buildCommand ++=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import java.nio.file.Files
import com.sourcegraph.scip_java.Embedded

object SystemJavaVersion {
// Returns the output of `System.getProperty("java.version")` from a fresh JVM
// instance using the system JVM installation. We can't use this process since
// it may be running on a separate JVM process (that's the case when we run
// `sbt test` in this build at least).
def detect(): String = {
val tmp = Files.createTempDirectory("java-version")
val jar = Embedded.semanticdbJar(tmp)
Expand Down

0 comments on commit 3078f4d

Please sign in to comment.