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

Automatically exclude Mill transitive depedencies from build classpath #3207

Closed
lolgab opened this issue Jun 14, 2024 · 6 comments · Fixed by #3221
Closed

Automatically exclude Mill transitive depedencies from build classpath #3207

lolgab opened this issue Jun 14, 2024 · 6 comments · Fixed by #3221
Labels
bug The issue represents an bug
Milestone

Comments

@lolgab
Copy link
Member

lolgab commented Jun 14, 2024

Plugins should add Mill dependencies as provided, but sometimes they don't and Mill breaks when you update Mill to a newer version which adds new fields to traits.
Mill could solve the problem by automatically add exclusion rules for mill-scalalib and its other artifacts when adding dependencies to the build via import $ivy..

@lolgab
Copy link
Member Author

lolgab commented Jun 14, 2024

This was already fixed in #3189.
I just triggered a new snapshot release for it.

@lolgab lolgab closed this as completed Jun 14, 2024
@lefou lefou modified the milestone: 0.11.8 Jun 14, 2024
@lolgab lolgab reopened this Jun 14, 2024
@lolgab
Copy link
Member Author

lolgab commented Jun 14, 2024

I tried with the latest snapshot but it doesn't seem to be solved.
Reproduction:

// build.sc
import $ivy.`com.disneystreaming.smithy4s::smithy4s-mill-codegen-plugin::0.18.22`

import mill._
import mill.scalalib._

object root extends RootModule with ScalaModule {
  def scalaVersion = "3.4.2"
}

.mill-version

0.11.7-118-56323c

Errors with:

java.lang.AbstractMethodError: Receiver class millbuild.build$root$ does not define or inherit an implementation of the resolved method 'abstract mill.define.ModuleRef mill$scalalib$JavaModule$$super$zincWorker()' of interface mill.scalalib.JavaModule.
    mill.scalalib.JavaModule.zincWorker(JavaModule.scala:38)
    mill.scalalib.JavaModule.zincWorker$(JavaModule.scala:38)
    millbuild.build$root$.zincWorker(build.sc:27)
    mill.scalalib.ScalaModule.$anonfun$compile$1(ScalaModule.scala:287)
    scala.collection.mutable.HashMap.getOrElseUpdate(HashMap.scala:469)
    mill.moduledefs.Cacher.cachedTarget(Cacher.scala:10)
    mill.moduledefs.Cacher.cachedTarget$(Cacher.scala:9)
    mill.define.Module$BaseClass.cachedTarget(Module.scala:58)
    mill.scalalib.ScalaModule.compile(ScalaModule.scala:280)
    mill.scalalib.ScalaModule.compile$(ScalaModule.scala:280)
    millbuild.build$root$.compile(build.sc:27)
    java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.base/java.lang.reflect.Method.invoke(Method.java:566)
    mill.resolve.Resolve$.$anonfun$instantiateTarget$2(Resolve.scala:96)

@lefou
Copy link
Member

lefou commented Jun 18, 2024

I guess to understand this issue better, we should draft an integration test for reproduction. Then we can try to fix this on Mill's side.

@lefou lefou removed this from the 0.11.8 milestone Jun 18, 2024
@lolgab
Copy link
Member Author

lolgab commented Jun 18, 2024

This seems related to #2985

@lefou
Copy link
Member

lefou commented Jun 18, 2024

This seems related to #2985

I don't think so. #2985 is explicitly bumping a dependency, which is supposed to be provided by Mill. This is different from resolving a transitive dependency.

@lefou
Copy link
Member

lefou commented Jun 18, 2024

The issue is, the exclusion filter introduced in #3189 contains less mill modules and transitive dependencies then I thought, hence the filtering in incomplete.

@lefou lefou added the bug The issue represents an bug label Jun 20, 2024
@lefou lefou closed this as completed in 80ab458 Jun 20, 2024
@lefou lefou added this to the 0.11.8 milestone Jun 20, 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.

2 participants