This is an automated email from the ASF dual-hosted git repository.

mdedetrich pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-pekko-sbt-paradox.git


The following commit(s) were added to refs/heads/main by this push:
     new 68bf26d  Add inliner settings
68bf26d is described below

commit 68bf26d9214c0a31c51bf7d16739dd168a7ea01c
Author: Matthew de Detrich <[email protected]>
AuthorDate: Thu Feb 22 08:17:21 2024 +0100

    Add inliner settings
---
 build.sbt | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/build.sbt b/build.sbt
index 87e2bee..ad2c204 100644
--- a/build.sbt
+++ b/build.sbt
@@ -111,3 +111,30 @@ ThisBuild / scalacOptions ++= List(
   "-language:_",
   "-encoding",
   "UTF-8")
+
+// We don't want to depend on sbt-pekko-build since this project
+// is not a pekko module, i.e. its just a common theme for document
+// generation so the settings should match
+// 
https://github.com/pjfanning/sbt-pekko-build/blob/main/src/main/scala/com/github/pjfanning/pekkobuild/PekkoInlinePlugin.scala#L27-L30
+
+lazy val pekkoInlineEnabled: SettingKey[Boolean] = settingKey(
+  "Whether to enable the Scala 2 inliner Defaults to pekko.no.inline property")
+
+pekkoInlineEnabled := {
+  val prop = "pekko.no.inline"
+  val enabled = !sys.props.contains(prop)
+  val log = sLog.value
+  if (enabled)
+    log.info(s"Scala 2 optimizer/inliner enabled, to disable set the $prop 
system property")
+  else
+    log.info(s"Scala 2 optimizer/inliner disabled, to enable remove the $prop 
system property")
+  enabled
+}
+
+ThisBuild / scalacOptions ++= {
+  if (pekkoInlineEnabled.value) {
+    List(
+      "-opt-inline-from:<sources>",
+      "-opt:l:inline")
+  } else List.empty
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to