Skip to content

[ETCM-736] Enable compiler optimizations in Prod #963

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

Merged
merged 3 commits into from
Apr 14, 2021
Merged
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
7 changes: 7 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ val nixBuild = sys.props.isDefinedAt("nix")
// Enable dev mode: disable certain flags, etc.
val mantisDev = sys.props.get("mantisDev").contains("true") || sys.env.get("MANTIS_DEV").contains("true")

lazy val compilerOptimizationsForProd = Seq(
"-opt:l:method", // method-local optimizations
"-opt:l:inline", // inlining optimizations
"-opt-inline-from:io.iohk.**" // inlining the project only
)

// Releasing. https://github.com/olafurpg/sbt-ci-release
inThisBuild(List(
organization := "io.iohk",
Expand Down Expand Up @@ -47,6 +53,7 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
"-encoding",
"utf-8"
),
scalacOptions ++= (if (mantisDev) Seq.empty else compilerOptimizationsForProd),
scalacOptions in (Compile, console) ~= (_.filterNot(
Set(
"-Ywarn-unused-import",
Expand Down
16 changes: 8 additions & 8 deletions nix/protoc.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/build.sbt b/build.sbt
index 6bf2b25cb..155de447d 100644
index 4ac21ff40..ccd34412e 100644
--- a/build.sbt
+++ b/build.sbt
@@ -25,6 +25,7 @@ def commonSettings(projectName: String) = Seq(
"-encoding",
"UTF-8"
),
@@ -43,6 +43,7 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
scalaVersion := `scala-2.13`,
// Scalanet snapshots are published to Sonatype after each build.
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
+ PB.runProtoc in Compile := (args => Process("@protobuf@/bin/protoc", args)!),
scalacOptions in (Compile, console) ~= (_.filterNot(
Set(
"-Ywarn-unused-import",
testOptions in Test += Tests
.Argument(TestFrameworks.ScalaTest, "-l", "EthashMinerSpec"), // miner tests disabled by default,
scalacOptions := Seq(