Skip to content

Fix incOptions in SBT build to avoid spurious recompilations #337

Closed
@retronym

Description

@retronym

My first change to our build to turn off SBT's transitive recompilation based on macros has since been neutered by addition of the antOptions setting in scala/scala@f2d0f1e

I think this will fix it:

diff --git a/build.sbt b/build.sbt
index da823d7df7..9c50bef3f4 100644
--- a/build.sbt
+++ b/build.sbt
@@ -337,8 +337,6 @@ lazy val library = configureAsSubproject(project)
         "-doc-root-content", (sourceDirectory in Compile).value + "/rootdoc.txt"
       )
     },
-    // macros in library+reflect are hard-wired to implementations with `FastTrack`.
-    incOptions := incOptions.value.withRecompileOnMacroDef(false),
     includeFilter in unmanagedResources in Compile := "*.tmpl" | "*.xml" | "*.js" | "*.css" | "rootdoc.txt",
     // Include *.txt files in source JAR:
     mappings in Compile in packageSrc ++= {
@@ -366,8 +364,6 @@ lazy val reflect = configureAsSubproject(project)
   .settings(
     name := "scala-reflect",
     description := "Scala Reflection Library",
-    // macros in library+reflect are hard-wired to implementations with `FastTrack`.
-    incOptions := incOptions.value.withRecompileOnMacroDef(false),
     Osgi.bundleName := "Scala Reflect",
     scalacOptions in Compile in doc ++= Seq(
       "-skip-packages", "scala.reflect.macros.internal:scala.reflect.internal:scala.reflect.io"
@@ -881,7 +877,11 @@ lazy val root: Project = (project in file("."))
       }
     },
     antStyle := false,
-    incOptions := incOptions.value.withNameHashing(!antStyle.value).withAntStyle(antStyle.value)
+    incOptions := {
+      val opts = incOptions.value.withNameHashing(!antStyle.value).withAntStyle(antStyle.value)
+      // macros in library+reflect are hard-wired to implementations with `FastTrack`.
+      opts.withRecompileOnMacroDef(false)
+    }
   )
   .aggregate(library, reflect, compiler, interactive, repl, replJline, replJlineEmbedded,
     scaladoc, scalap, partestExtras, junit, libraryAll, scalaDist).settings(

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions