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

Mill special syntaxes to import plugins and contrib modules dont't work anymore #2474

Closed
lolgab opened this issue Apr 27, 2023 · 1 comment · Fixed by #2476
Closed

Mill special syntaxes to import plugins and contrib modules dont't work anymore #2474

lolgab opened this issue Apr 27, 2023 · 1 comment · Fixed by #2476
Assignees
Milestone

Comments

@lolgab
Copy link
Member

lolgab commented Apr 27, 2023

import $ivy.`com.github.lolgab::mill-crossplatform::0.2.1`

should desugar to:

import $ivy.`com.github.lolgab::mill-crossplatform_mill0.11.0-M8:0.2.1`

but, instead, desugars to:

import $ivy.`com.github.lolgab::mill-crossplatform:0.2.1`

Moreover:

import $ivy.`com.lihaoyi::mill-contrib-bloop:`

doesn't desugar anymore to:

import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
@lefou
Copy link
Member

lefou commented Apr 27, 2023

Partial duplicate of #2457,but this once covers also the platform, hence I'll close the other one as duplicate.

lihaoyi added a commit that referenced this issue Apr 29, 2023
…h management to allow testing (#2476)

Fixes #2474

These were overlooked in #2377
and deleted, and were not covered by any tests. But it's straightforward
to put them back.

# Major Changes

1. Put back `MillIvy.scala` and call it in `MillBuildRootModule.scala`

# Testing 

1. I added an example test `example/misc/6-contrib-import` to both
exercise the code as well as serve as an example we can include in our
docs

2. In order to allow usage of contrib module in `.local` integration and
example tests, I moved the handling of Mill test classpath overrides
from `Util.millProjectModule` to `CoursierSupport#resolveDependencies`.
This lets us be more override contrib modules dependency resolution,
even though they don't have a neat single location for us to call our
`millProjectModule` helper.

3. I refactored `millProjectModule` to not need a `key`, so we just
compute the key based on the dependency name, keeping them consistent
and removing an unnecessary degree of freedom

4. The local-testing-classpath-overrides were moved from using JVM
system properties to instead use classpath resources: we look for
overrides in `mill/local-test-overrides/*`. This should remove any
security worries:
1. Before you only needed to modify the JVM props or `JAVA_OPTS`
environment variable, and could replace the code of a Mill module to any
local filesystem path
2. Now, you need access to modify the Mill classpath to trigger the test
overrides, and at that point you already have access to modifying the
Mill classfiles being executed anyway

While it probably was not strictly necessary to clean up the test
classpath overrides logic as part of this PR, the status quo in master
was a pile of hacks, and I didn't feel like adding another hack to get
`.local` testability of contrib libraries working. With these changes,
contrib libraries work the same as the existing Mill test classpath
overrides, and things are cleaned up so much that the net lines of code
for this PR is negative

There's still more cleanup to do in `build.sc`, but those can come in
follow up PRs
@lefou lefou added this to the 0.11.0-M9 milestone Apr 29, 2023
@lolgab lolgab changed the title Mill special syntaxes to import plugins and contrib modules doesn't work anymore Mill special syntaxes to import plugins and contrib modules dont't work anymore May 19, 2023
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