Skip to content

Commit 4f77ecd

Browse files
committed
[ETCM-736] Enable compiler optimizations in Prod
See https://www.lightbend.com/blog/scala-inliner-optimizer To display optimizations logs : add `"-Yopt-log-inline", "_"`
1 parent 25c3966 commit 4f77ecd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

build.sbt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ val nixBuild = sys.props.isDefinedAt("nix")
1212
// Enable dev mode: disable certain flags, etc.
1313
val mantisDev = sys.props.get("mantisDev").contains("true") || sys.env.get("MANTIS_DEV").contains("true")
1414

15+
lazy val compilerOptimizationsForProd = Seq(
16+
"-opt:l:method", // method-local optimizations
17+
"-opt:l:inline", // inlining optimizations
18+
"-opt-inline-from:**" // inlining allowed to all classes
19+
)
20+
1521
// Releasing. https://github.com/olafurpg/sbt-ci-release
1622
inThisBuild(List(
1723
organization := "io.iohk",
@@ -47,6 +53,7 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
4753
"-encoding",
4854
"utf-8"
4955
),
56+
scalacOptions ++= (if (mantisDev) Seq.empty else compilerOptimizationsForProd),
5057
scalacOptions in (Compile, console) ~= (_.filterNot(
5158
Set(
5259
"-Ywarn-unused-import",

0 commit comments

Comments
 (0)