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

Updates scalac flags to be optimal #28

Merged
merged 1 commit into from
Feb 17, 2022
Merged
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
42 changes: 41 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,47 @@ ThisBuild / organization := "com.markatta"

ThisBuild / crossScalaVersions := Seq("2.12.15", "2.11.12", "2.13.8")
ThisBuild / scalaVersion := crossScalaVersions.value.last
ThisBuild / scalacOptions ++= Seq("-feature", "-deprecation", "-Xfatal-warnings", "-Xlint")

val flagsFor11 = Seq(
"-Xlint:_",
"-feature",
"-deprecation",
"-Yconst-opt",
"-Ywarn-infer-any",
"-Yclosure-elim",
"-Ydead-code"
)

val flagsFor12 = Seq(
"-Xlint:_",
"-feature",
"-deprecation",
"-Ywarn-infer-any",
"-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-opt-inline-from:<sources>",
"-opt:l:method"
)

val flagsFor13 = Seq(
"-Xlint:_",
"-feature",
"-deprecation",
"-opt-inline-from:<sources>",
"-opt:l:method"
)

ThisBuild / scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n == 13 =>
flagsFor13
case Some((2, n)) if n == 12 =>
flagsFor12
case Some((2, n)) if n == 11 =>
flagsFor11
}
}

libraryDependencies ++= Seq("org.scalatest" %% "scalatest" % "3.0.8" % "test")

Expand Down