-
Notifications
You must be signed in to change notification settings - Fork 127
Description
If scala options change from one run to the other one, Zinc recompiles the whole project conservatively.
With the advent of compilers like Dotty, Hydra and rsc, the current behaviour is too restrictive because some downstream users may want to filter out scalac options that are dependent to the way compilation should occur (like number of cores). This is safe to do because downstream users know which scala flags affect the compilation and which do not.
You can add this hook in ExternalHooks https://github.com/sbt/zinc/blob/1.x/internal/compiler-interface/src/main/java/xsbti/compile/ExternalHooks.java and https://github.com/sbt/zinc/blob/1.x/internal/compiler-interface/src/main/java/xsbti/compile/DefaultExternalHooks.java. The method compile in IncrementalCompilerImpl already takes an instance of IncOptions, which inside has an instance of ExternalHooks, so the last thing to do is to use the external hook we've just provided in the body of makeConfig, inside MixedAnalyzingCompiler: https://github.com/sbt/zinc/blob/1.x/zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala#L183-L214
/cc @dragos