Skip to content
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

Classpath regression in Bloop export #1918

Closed
ckipp01 opened this issue Jul 5, 2022 · 2 comments · Fixed by #3211
Closed

Classpath regression in Bloop export #1918

ckipp01 opened this issue Jul 5, 2022 · 2 comments · Fixed by #3211
Labels
contrib Issues related to contrib modules, which are probably maintained by someone outside mill core team
Milestone

Comments

@ckipp01
Copy link
Collaborator

ckipp01 commented Jul 5, 2022

There seems to be a regression caused by #1843 where now when you do a Bloop export for the Mill codebase itself, bloop is unable to build the contrib modules. This was reported before in #990 and fixed in the past.

How to reproduce

  1. Clone the mill code base
  2. ./mill --import ivy:com.lihaoyi::mill-contrib-bloop: mill.contrib.bloop.Bloop/install on the mill codebase
  3. bloop compile contrib.bloop
  4. Notice a bunch of compilation errors

You can then switch Mill back to 0.10.3, repeat the above and see that everything works fine.

Difference in Bloop files

Between 0.10.3 and 0.10.4 you can see that the bloop export is different. Here are the missing classpath entries that the contrib.bloop target expects, but they aren't there:

<$PWD>/.bloop/out/scalalib/classes
<$PWD>/.bloop/out/scalajslib/classes
<$PWD>/.bloop/out/scalanativelib/classes
<$PWD>/.bloop/out/main/classes
<$PWD>/.bloop/out/scalalib.api/classes
<$PWD>/.bloop/out/testrunner/classes
<$PWD>/.bloop/out/main.core/classes
<$PWD>/.bloop/out/main.client/classes
<$PWD>/.bloop/out/main.moduledefs/classes
<$PWD>/.bloop/out/main.api/classes
<$PWD>/.bloop/out/main.util/classes
<$PWD>/.bloop/out/scalajslib.worker-api/classes
<$PWD>/.bloop/out/scalanativelib.api/classes

Potential fix

Taken from #990 (comment)

I think a proper implementation for the classpath and runtimeClasspath to be used in Bloop should not hand-roll the same logic found in JavaModule and ScalaModule but instead it should re-use the bspCompileClasspath target, which is already exactly doing this (and is meant to be an maintained abstraction to be used by BSP). It returns an UnresolvedPath, which is either a local path (which can be re-used in Bloop, e.g. a resolved depenency) or a path relative to another target. E.g. the compiler output of a dependencies is some classes/ sub path inside the dest dir of that compile target. When generating the Bloop config, we need to map these unresolved paths to the real compile output paths Bloop used for these modules. All information should be already present in the BloopImpl to implement this mapping. But it's not a trivial change, so I won't do it right now.

@lefou
Copy link
Member

lefou commented Jul 5, 2022

@ckipp01 Thanks for reporting!

To all, as this targets a contrib module, there is no high priority in fixing this by the core developers. So, any help or PR is much appreciated! Don't hesitate to ask, if you want to tackle this but struggle with details.

@lefou
Copy link
Member

lefou commented Jul 16, 2022

For more details, read the chat starting with this post: https://gitter.im/lihaoyi/mill?at=62d17f11ab6b634f73283112

@lefou lefou added the contrib Issues related to contrib modules, which are probably maintained by someone outside mill core team label Sep 7, 2022
@lolgab lolgab closed this as completed in eafa453 Jun 16, 2024
@lefou lefou added this to the 0.11.8 milestone Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contrib Issues related to contrib modules, which are probably maintained by someone outside mill core team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants