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

Make runtime deps transitive #3774

Merged
merged 5 commits into from
Oct 21, 2024
Merged

Conversation

lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented Oct 20, 2024

Fixes #3761
Fixes #3819

  • Introduce runModuleDeps, the runtime version of moduleDeps and compileModuleDeps

  • We introduce transitiveRunIvyDeps, the runtime version of transitiveIvyDeps, and use it in most places as a replacement for runIvyDeps

  • I also flipped the ordering of transitiveModuleDeps/transitiveRunModuleDeps to put this on the right/last, to follow the rest of the module resolution logic where "upstream" things come on the left/first in the classpath ordering

There are some behavioral changes, e.g. the A module's direct compileModuleDeps no longer end up on your runClasspath, as shown by the change in the test case mill.scalalib.ScalaMultiModuleClasspathsTests.modCompile. I think the new behavior is more correct than the old one?

One (benign?) consequence of this change is that the contents of the various *run* tasks now have considerable overlap with the non-run tasks, e.g. transitiveRunIvyDeps overlaps with transitiveIvyDeps.

The way transitive runtime dependencies are now managed, both "run{Module,Ivy}Dep of {module,ivy}Dep" and "{module,ivy}Dep of run{Module,Ivy}Dep" are both aggregated into the run classpath. I'm not sure if this matches what Maven does (it does according to chatgpt!) but it seems reasonable to me

Added some additional unit tests to cover the new transitive behavior. The whole dependency-wiring stuff is pretty gnarly but hopefully the existing test suite will stop us from breaking too much (especially mill.scalalib.ScalaMultiModuleClasspathsTests which is pretty rigorous and we add to).

This is a binary-compatible but semantically incompatible change, would be good to get it into 0.12.0

Best reviewed with Hide Whitespace enabled

@lihaoyi lihaoyi requested review from lefou and lolgab October 20, 2024 01:44
@lihaoyi lihaoyi merged commit 210916e into com-lihaoyi:main Oct 21, 2024
24 checks passed
@lefou lefou added this to the 0.12.0 milestone Oct 21, 2024
/** Should only be called from [[moduleDepsChecked]] */
private lazy val recRunModuleDeps: Seq[JavaModule] =
ModuleUtils.recursive[JavaModule](
(millModuleSegments ++ Seq(Segment.Label("moduleDeps"))).render,
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be: moduleDeps -> runModuleDeps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants