Skip to content

A lot of code compiled on a small change (local variable name change) #1396

@OndrejSpanel

Description

@OndrejSpanel

steps

I am afraid I need help to reproduce the issue in a smaller project. My project is SBT based, Scala 3, several modules, JS + JVM, with about 500 Scala source files.

problem

When I make a small change in my project, like renaming a local variable in a function, a lot of files (>400) is compiled.

expectation

On any change which is internal to a single function and does not affect its interface (parameters or return value) only one file should be compiled.

notes

It is possible something in my sources is contributing to the problem, but given current tools, it is quite hard to learn what exactly is the issue. The complete build log obtained using Level.Debug has over 50 000 lines.

I attach an excerpt obtained using ThisBuild / logLevel := Level.Debug from my sbt build which was triggered after I renamed a local variable from add to toAdd :

[debug] compilation cycle 1
[info] compiling 2 Scala sources to C:\Dev\tempi\jvmCommon\target\scala-3.5.0\classes ...

[debug] compilation cycle 2
[info] compiling 36 Scala sources to C:\Dev\tempi\jvmCommon\target\scala-3.5.0\classes ...

[debug] compilation cycle 3
[info] compiling 50 Scala sources to C:\Dev\tempi\jvmCommon\target\scala-3.5.0\classes ...

[debug] compilation cycle 4
[info] compiling 481 Scala sources and 9 Java sources to C:\Dev\tempi\jvmCommon\target\scala-3.5.0\classes ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/over_compilationZinc picks up more compilation than needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions