Skip to content

Fix overcompilation with scalac -release by dummy mapping ct.sym entries #982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2021

Conversation

retronym
Copy link
Member

@retronym retronym commented Jun 2, 2021

Manually tested with https://github.com/retronym/zinc-bug-release-flag. I can't figure out how to make the test framework a) simulate multiple SBT sessions (ie reload state from disk) or b) conditionally run the new test only on JDK 9+.

Before:

> sbt clean compile && echo "==== ROUND 2 ====" && sbt compile 'last compileIncremental'
[info] welcome to sbt 1.5.3 (AdoptOpenJDK Java 11.0.11)
[info] loading project definition from /Users/jz/code/zinc-bug-release-flag/project
[info] loading settings for project zinc-bug-release-flag from build.sbt ...
[info] set current project to zinc-bug-release-flag (in build file:/Users/jz/code/zinc-bug-release-flag/)
[info] Executing in batch mode. For better performance use sbt's shell
[success] Total time: 0 s, completed 2 Jun. 2021, 11:22:39 am
[info] compiling 1 Scala source to /Users/jz/code/zinc-bug-release-flag/target/scala-2.12/classes ...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.14. Compiling...
[info]   Compilation completed in 5.956s.
[success] Total time: 7 s, completed 2 Jun. 2021, 11:22:46 am
==== ROUND 2 ====
[info] welcome to sbt 1.5.3 (AdoptOpenJDK Java 11.0.11)
[info] loading project definition from /Users/jz/code/zinc-bug-release-flag/project
[info] loading settings for project zinc-bug-release-flag from build.sbt ...
[info] set current project to zinc-bug-release-flag (in build file:/Users/jz/code/zinc-bug-release-flag/)
[info] Executing in batch mode. For better performance use sbt's shell
[info] compiling 1 Scala source to /Users/jz/code/zinc-bug-release-flag/target/scala-2.12/classes ...
[success] Total time: 3 s, completed 2 Jun. 2021, 11:22:53 am
[debug] [zinc] IncrementalCompile -----------

After:

> rm -rf /Users/jz/.sbt/boot/scala-2.12.14/org.scala-sbt/sbt/1.5.4-SNAPSHOT && sbt --sbt-version 1.5.4-SNAPSHOT clean compile && echo "==== ROUND 2 ====" && sbt  --sbt-version 1.5.4-SNAPSHOT compile 'last compileIncremental'
[info] [launcher] getting org.scala-sbt sbt 1.5.4-SNAPSHOT  (this may take some time)...
[info] welcome to sbt 1.5.4-SNAPSHOT (N/A Java 15.0.2)
[info] loading project definition from /Users/jz/code/zinc-bug-release-flag/project
[info] loading settings for project zinc-bug-release-flag from build.sbt ...
[info] set current project to zinc-bug-release-flag (in build file:/Users/jz/code/zinc-bug-release-flag/)
[info] Executing in batch mode. For better performance use sbt's shell
[success] Total time: 0 s, completed 2 Jun 2021, 1:40:47 pm
[info] compiling 1 Scala source to /Users/jz/code/zinc-bug-release-flag/target/scala-2.12/classes ...
[success] Total time: 2 s, completed 2 Jun 2021, 1:40:50 pm
==== ROUND 2 ====
[info] welcome to sbt 1.5.4-SNAPSHOT (N/A Java 15.0.2)
[info] loading project definition from /Users/jz/code/zinc-bug-release-flag/project
[info] loading settings for project zinc-bug-release-flag from build.sbt ...
[info] set current project to zinc-bug-release-flag (in build file:/Users/jz/code/zinc-bug-release-flag/)
[info] Executing in batch mode. For better performance use sbt's shell
[success] Total time: 0 s, completed 2 Jun 2021, 1:40:53 pm
[debug] [zinc] IncrementalCompile -----------
[debug] IncrementalCompile.incrementalCompile
[debug] previous = Stamps for: 1 products, 1 sources, 1 libraries
[debug] current source = Set(${BASE}/src/main/scala/test.scala)
[debug] > initialChanges = InitialChanges(Changes(added = Set(), removed = Set(), changed = Set(), unmodified = ...),Set(),Set(),API Changes: Set())
[debug] No changes

Fixes #981

retronym added 2 commits June 2, 2021 13:42

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@retronym retronym requested review from dwijnand and eed3si9n June 2, 2021 03:48
Copy link
Member

@jvican jvican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@retronym retronym added the area/over_compilation Zinc picks up more compilation than needed label Jun 2, 2021
Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @retronym!

@eed3si9n eed3si9n merged commit d56686b into sbt:develop Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/over_compilation Zinc picks up more compilation than needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overcompilation (always recompiled) when scalac -release flag
4 participants