sbt / zinc

Scala incremental compiler library, used by sbt and other build tools
Apache License 2.0
333 stars 118 forks source link

[2.x] Fix mixed compilation to JAR #1376

Closed adpi2 closed 1 month ago

adpi2 commented 1 month ago

For the second compilation step of a mixed compilation (Scala then Java, or vice versa), Zinc copies the current output Jar to a temporary jar. All dependencies on this temporary jar must be declared as internal class dependencies. To do so we we cannot use the declared class file (the temporary jar), instead we use the binary class name, which is stored in a binaryNameToClassName map.

eed3si9n commented 1 month ago

If possible, could you add a scripted test for this please?

adpi2 commented 1 month ago

@eed3si9n the scripted tests are disabled in this wip/sbt-2.x branch. But I have 2 scripted tests in https://github.com/sbt/sbt/pull/7592 that would fail without this.

I should backport this PR to 1.x and add a scripted test there, but I am not yet sure if it is possible to configure compilation to JAR.