Last active
May 11, 2022 08:05
-
-
Save channingwalton/abaf385d7564ba179cfbc4f2c2c44aee to your computer and use it in GitHub Desktop.
Scala 2.13 compiler flags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val scalacOptions ++= Seq( | |
"-encoding", | |
"utf-8", // Specify character encoding used by source files. | |
"-deprecation", // Emit warning and location for usages of deprecated APIs. | |
"-explaintypes", // Explain type errors in more detail. | |
"-feature", // Emit warning and location for usages of features that should be imported explicitly. | |
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred | |
"-language:experimental.macros", // Allow macro definition (besides implementation and application) | |
"-language:higherKinds", // Allow higher-kinded types | |
"-language:implicitConversions", // Allow definition of implicit functions called views | |
"-language:postfixOps", // Allow post fix ops | |
"-unchecked", // Enable additional warnings where generated code depends on assumptions. | |
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access. | |
"-Xfatal-warnings", // Fail the compilation if there are any warnings. | |
"-Xlint:-serial", // Enable all except for serial. see scalac -Xlint:help for more | |
"-Ybackend-parallelism", java.lang.Runtime.getRuntime.availableProcessors().toString, // Scala 2.12.5 compiler flag to run some compilation tasks in parallel | |
"-Ywarn-dead-code", // Warn when dead code is identified. | |
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined. | |
"-Ywarn-numeric-widen", // Warn when numerics are widened. | |
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused. | |
// Stats and scalac-profiling - see https://www.scala-lang.org/blog/2018/06/04/scalac-profiling.html | |
// uncomment the bloop plugin in project/plugins.sbt | |
// ,"-Ystatistics:typer", "-Ybackend-parallelism", "1" // stats | |
// ,"-Ycache-plugin-class-loader:last-modified" | |
// ,"-Ycache-plugin-class-loader:last-modified" | |
// ,"-Xplugin:/Users/USER/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/epfl/scala/scalac-profiling_2.12/1.0.0/scalac-profiling_2.12-1.0.0.jar" | |
// ,"-P:scalac-profiling:no-profiledb" | |
// ,"-P:scalac-profiling:show-profiles" | |
// ,"-P:scalac-profiling:sourceroot:PATH_TO_PROJECT_ROOT | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, comparing to many other online article that suggests using a hardcoded number like 4 or 8.