-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #464 from sourcegraph/olafurpg/java17
Include missing `--add-exports` flags for Java 9+ Gradle builds
- Loading branch information
Showing
9 changed files
with
178 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
scip-java/src/main/scala/com/sourcegraph/scip_java/buildtools/SystemJavaVersion.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.sourcegraph.scip_java.buildtools | ||
|
||
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) | ||
try { | ||
os.proc( | ||
"java", | ||
"-cp", | ||
jar.toString(), | ||
"com.sourcegraph.semanticdb_javac.PrintJavaVersion" | ||
) | ||
.call() | ||
.out | ||
.text() | ||
.trim() | ||
} finally { | ||
Files.deleteIfExists(jar) | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/PrintJavaVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.sourcegraph.semanticdb_javac; | ||
|
||
public class PrintJavaVersion { | ||
public static void main(String[] args) { | ||
System.out.print(System.getProperty("java.version")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters