Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add javaOutputVersion to ScalacOptions for scala >= 3.1.2 #122

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ object ScalaVersion {
val V2_13_9 = ScalaVersion(2, 13, 9)
val V3_0_0 = ScalaVersion(3, 0, 0)
val V3_1_0 = ScalaVersion(3, 1, 0)
val V3_1_2 = ScalaVersion(3, 1, 2)
val V3_3_0 = ScalaVersion(3, 3, 0)
val V3_3_1 = ScalaVersion(3, 3, 1)
val V3_3_3 = ScalaVersion(3, 3, 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ private[scalacoptions] trait ScalacOptions {
val feature =
ScalacOption("-feature", _ => true)

/** Compile for a specific version of the Java platform. Supported targets: 8, 9, ..., 17, 18.
*
* The java-output-version flag is supported only on JDK 9 and above, since it relies on the
* functionality provided in
* [[http://openjdk.java.net/jeps/247 JEP-247: Compile for Older Platform Versions]].
*/
def javaOutputVersion(version: String) =
ScalacOption(
"-java-output-version",
List(version),
version => JavaMajorVersion.javaMajorVersion >= 9 && version >= V3_1_2
)

/** Compile for a specific version of the Java platform. Supported targets: 8, 9, ..., 17, 18.
*
* The release flag is supported only on JDK 9 and above, since it relies on the functionality
Expand All @@ -69,7 +82,7 @@ private[scalacoptions] trait ScalacOptions {
ScalacOption(
"-release",
List(version),
version => JavaMajorVersion.javaMajorVersion >= 9 && version >= V2_12_5
version => JavaMajorVersion.javaMajorVersion >= 9 && version.isBetween(V2_12_5, V3_1_2)
)

/** Enable features that will be available in a future version of Scala, for purposes of early
Expand Down