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

runClasspath should not include compileModuleDeps classes #3819

Closed
lolgab opened this issue Oct 23, 2024 · 3 comments · Fixed by #3774
Closed

runClasspath should not include compileModuleDeps classes #3819

lolgab opened this issue Oct 23, 2024 · 3 comments · Fixed by #3774
Labels
bug The issue represents an bug
Milestone

Comments

@lolgab
Copy link
Member

lolgab commented Oct 23, 2024

Motivation

I expect compileModuleDeps to be used only at compile time and not at runtime. So at runtime, the other module shouldn't exist in the classpath.

Reproduction

// build.sc
import mill._, scalalib._

object m1 extends JavaModule {
  def compileModuleDeps = Seq(m2)
}
object m2 extends JavaModule
$ mill show m1.runClasspath

[
  "ref:v0:c984eca8:/Users/lorenzo/scala/repro-mill/consumer/m2/compile-resources",
  "ref:v0:c984eca8:/Users/lorenzo/scala/repro-mill/consumer/m2/resources",
  "ref:v0:c984eca8:/Users/lorenzo/scala/repro-mill/consumer/out/m2/compile.dest/classes",
  "ref:v0:c984eca8:/Users/lorenzo/scala/repro-mill/consumer/m1/compile-resources",
  "ref:v0:c984eca8:/Users/lorenzo/scala/repro-mill/consumer/m1/resources",
  "ref:v0:c984eca8:/Users/lorenzo/scala/repro-mill/consumer/out/m1/compile.dest/classes"
]

As you can see there are many m2 entries in runClasspath

Mill version

Both 0.11.12 and 0.12.0-RC3

@lefou
Copy link
Member

lefou commented Oct 23, 2024

This is with Mill 0.11.12, right?

@lihaoyi
Copy link
Member

lihaoyi commented Oct 23, 2024

This appears to be fixed in main, and I bisected the fix down to #3774. Indeed we can see the updates to scalalib/test/src/mill/scalalib/ScalaMultiModuleClasspathsTests.scala reflect the changed semantics with compileModuleDeps no longer being included in the runClasspath

@lihaoyi lihaoyi closed this as completed Oct 23, 2024
@lefou
Copy link
Member

lefou commented Oct 23, 2024

Indeed, I can't reproduce with Mill built from current main branch.

> cat > build.sc << EOF
// build.sc
import mill._, scalalib._

object m1 extends JavaModule {
  def compileModuleDeps = Seq(m2)
}
object m2 extends JavaModule
EOF

> dev-mill show m1.runClasspath
[build.mill-57/61] compile
[build.mill-57] [info] compiling 1 Scala source to /tmp/mill1/out/mill-build/compile.dest/classes ...
[build.mill-57] [info] done compiling
[1/1] show
[
  "ref:v0:c984eca8:/tmp/mill1/m1/compile-resources",
  "ref:v0:c984eca8:/tmp/mill1/m1/resources",
  "ref:v0:c984eca8:/tmp/mill1/out/m1/compile.dest/classes"
]
[57/57] === show m1.runClasspath === 1s

@lefou lefou added this to the 0.12.0 milestone Oct 23, 2024
@lolgab lolgab added the bug The issue represents an bug label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue represents an bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants