Skip to content

Commit af750a7

Browse files
add -java-output-version
1 parent f551479 commit af750a7

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-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
@@ -41,6 +41,7 @@ object ScalaVersion {
4141
val V2_13_9 = ScalaVersion(2, 13, 9)
4242
val V3_0_0 = ScalaVersion(3, 0, 0)
4343
val V3_1_0 = ScalaVersion(3, 1, 0)
44+
val V3_1_2 = ScalaVersion(3, 1, 2)
4445
val V3_3_0 = ScalaVersion(3, 3, 0)
4546
val V3_3_1 = ScalaVersion(3, 3, 1)
4647
val V3_3_3 = ScalaVersion(3, 3, 3)

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,25 @@ 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
6679
* provided in [[http://openjdk.java.net/jeps/247 JEP-247: Compile for Older Platform Versions]].
6780
*/
81+
@deprecated("Use javaOutputVersion instead", "3.1.2")
6882
def release(version: String) =
6983
ScalacOption(
7084
"-release",

0 commit comments

Comments
 (0)