-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prevent recompilation after cold scalafix invocations on sbt 1.4+
On all sbt versions, the Zinc analysis is now saved on compilations triggered by scalafix invocations. On sbt 1.4+, this allows subsequent scalafix invocations not to re-trigger compilations, and subsequent regular compilations to be either incremental (in case the build contains `-Xfatal-warnings` or alike) or a full cache hit otherwise. On sbt 1.3.x, this does not help for any subsequent compilations. That's because before sbt/sbt@e81d459, compile*FileInputs had to be explicitly triggeredBy any task that stores a Zinc analysis for the cache key to be effective. Even though it would have been possible to register `scalafix / compile` to trigger them and thus get the same benefits as on sbt 1.4+, the complexity is just not worth it.
- Loading branch information
Showing
8 changed files
with
52 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/sbt-test/sbt-1.4/relax-scalacOptions/project/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.4.9 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# when the build does not contain any flag relaxed on scalafix invocation | ||
# check that regular compilation benefits froma prior direct scalafix invocation ... | ||
-> scalafix --check RemoveUnused | ||
-> checkLastCompilationCached | ||
> compile | ||
> checkLastCompilationCached | ||
|
||
# ... and indirect scalafix invocation | ||
> clean | ||
> test:scalafix --check RemoveUnused | ||
-> checkLastCompilationCached | ||
> compile | ||
> checkLastCompilationCached | ||
|
||
# we now have 2 fatal warnings preventing compilation | ||
> set scalacOptions ++= Seq("-Xfatal-warnings") | ||
-> compile | ||
|
||
# ensure that a semantic rule can be ran despite warnings, to fix one of the warning | ||
> scalafix RemoveUnused | ||
|
||
# confirm that the rule was applied and that triggered compilation is cached once the updated file recompiled | ||
> scalafix --check RemoveUnused | ||
-> checkLastCompilationCached | ||
> scalafix --check RemoveUnused | ||
> checkLastCompilationCached | ||
|
||
# and that -Xfatal-warnings remains honored for regular compilation | ||
-> compile | ||
|
||
# confirm that regular compilation succeeds after fixing the last warning | ||
> scalafix ProcedureSyntax | ||
> compile | ||
|
||
# check that regular compilation is cached as usual | ||
> compile | ||
> checkLastCompilationCached | ||
|
||
# check that there is no recompilation when running a semantic rule after a regular compilation ... | ||
> scalafix RemoveUnused | ||
> checkLastCompilationCached | ||
|
||
# nor when compiling after running a semantic rule | ||
> compile | ||
> checkLastCompilationCached |
This file was deleted.
Oops, something went wrong.