Skip to content

Incremental compilation of this repo is broken #23866

@katrinafyi

Description

@katrinafyi

Compiling the compiler leads to a full re-compile every time, even if nothing has changed.

Compiler version

bisected to 9e88707 as the first bad commit, and 0a7f843 is the preceding good commit

  • started bisecting from good commit (i arbitrarily went back 100 commits) 1922c0f
  • still bad at main as of time of writing d84dc5c

if it matters, the sbt and java versions are:

[info] welcome to sbt 1.11.0 (N/A Java 17.0.15)

openjdk version "17.0.15" 2025-04-15
OpenJDK Runtime Environment (build 17.0.15+6-suse-1.1-x8664)
OpenJDK 64-Bit Server VM (build 17.0.15+6-suse-1.1-x8664, mixed mode, sharing)

Minimized code

check out this repo and try to compile twice with no changes in between.

sbt compile compile

Output

second compilation reports sources are being compiled again and still takes large amounts of time

[info] compiling 36 Scala sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 44 Scala sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 46 Scala sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 598 Scala sources and 8 Java sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 4 Java sources to /home/x/progs/scala3/sbt-bridge/src/target/classes ...
[success] Total time: 64 s (0:01:04.0), completed 3 Sept 2025, 12:22:46 pm
[info] compiling 36 Scala sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 44 Scala sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 46 Scala sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 598 Scala sources and 8 Java sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[success] Total time: 38 s, completed 3 Sept 2025, 12:23:25 pm

Expectation

with a successful incremental compilation, the second compile should not mention any compilations and should be much faster.

[info] Executing in batch mode. For better performance use sbt's shell
[info] compiling 181 Scala sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 164 Scala sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 100 Scala sources to /home/x/progs/scala3/compiler/target/scala-3.7.3-RC2/classes ...
[info] compiling 4 Java sources to /home/x/progs/scala3/sbt-bridge/src/target/classes ...
[success] Total time: 55 s, completed 3 Sept 2025, 12:05:37 pm
[success] Total time: 2 s, completed 3 Sept 2025, 12:05:39 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:build-configurationIssues tied to building the compiler itself.area:dxIssues tied to the developer experience when working on the compiler.itype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions