A library for configuring scalac options

scalac-options

scalac-options is a library containing logic for configuring Scala compiler options according to the current Scala compiler version.

This logic was originally developed in the sbt-tpolecat sbt plugin, and this library is intended to enable the reuse of that logic in other build tool plugins, for example sbt-typelevel and mill-tpolecat.

Usage

This library is published for Scala 2.12.x, 2.13.x and 3.1.x:

// sbt
"org.typelevel" %% "scalac-options" % "0.1.1"

// mill
ivy"org.typelevel::scalac-options:0.1.1"

// Scala CLI
//> using lib "org.typelevel::scalac-options:0.1.1"

This library offers functions for filtering proposed Scala compiler options according to Scala version:

scalacOptions := ScalacOptions.tokensForVersion(
  ScalaVersion.V3_1_0, // the Scala compiler major, minor, patch version
  ScalacOptions.default // a curated default option set
) // returns a Seq[String] of Scala compiler options

ScalacOptions.optionsForVersion(
  ScalaVersion.V3_1_0,
  ScalacOptions.default
) // returns a Set[ScalacOption]

A shorthand for using the default option set is also provided:

scalacOptions := ScalacOptions.defaultTokensForVersion(
  ScalaVersion.V3_1_0
) // returns a Seq[String] of Scala compiler options based on the default option set

ScalacOptions.defaultOptionsForVersion(
  ScalaVersion.V3_1_0
) // returns a Set[ScalacOption] based on the default option set

Conduct

Participants are expected to follow the Scala Code of Conduct while discussing the project on GitHub and any other venues associated with the project. See the organizational Code of Conduct for more details.

License

All code in this repository is licensed under the Apache License, Version 2.0. See LICENSE.