Skip to content

Commit 0e6e7cd

Browse files
Merge pull request #122 from channingwalton/main
Add javaOutputVersion to ScalacOptions for scala >= 3.1.2
2 parents 3405e12 + 19a58a4 commit 0e6e7cd

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/src/main/scala/org/typelevel/scalacoptions/ScalaVersion.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ object ScalaVersion {
4545
val V2_13_9 = ScalaVersion(2, 13, 9)
4646
val V3_0_0 = ScalaVersion(3, 0, 0)
4747
val V3_1_0 = ScalaVersion(3, 1, 0)
48+
val V3_1_2 = ScalaVersion(3, 1, 2)
4849
val V3_3_0 = ScalaVersion(3, 3, 0)
4950
val V3_3_1 = ScalaVersion(3, 3, 1)
5051
val V3_3_3 = ScalaVersion(3, 3, 3)

lib/src/main/scala/org/typelevel/scalacoptions/ScalacOptions.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ private[scalacoptions] trait ScalacOptions {
6060
val feature =
6161
ScalacOption("-feature", _ => true)
6262

63+
/** Compile for a specific version of the Java platform. Supported targets: 8, 9, ..., 17, 18.
64+
*
65+
* The java-output-version flag is supported only on JDK 9 and above, since it relies on the
66+
* functionality provided in
67+
* [[http://openjdk.java.net/jeps/247 JEP-247: Compile for Older Platform Versions]].
68+
*/
69+
def javaOutputVersion(version: String) =
70+
ScalacOption(
71+
"-java-output-version",
72+
List(version),
73+
version => JavaMajorVersion.javaMajorVersion >= 9 && version >= V3_1_2
74+
)
75+
6376
/** Compile for a specific version of the Java platform. Supported targets: 8, 9, ..., 17, 18.
6477
*
6578
* The release flag is supported only on JDK 9 and above, since it relies on the functionality

0 commit comments

Comments
 (0)