-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Resolve Mill build source dependencies #946
Conversation
046b921
to
a52d9c4
Compare
a52d9c4
to
d75b3d6
Compare
@@ -132,24 +132,28 @@ class MillBuildServer(evaluator: Evaluator, bspVersion: String, serverVersion: S | |||
val millBuildTargetId = getMillBuildTargetId(evaluator) | |||
|
|||
val items = dependencySourcesParams.getTargets.asScala | |||
.filter(_ != millBuildTargetId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to not resolve source dependencies for the Mill build dependencies. Which made code navigation hard since all we could see were the signature only.
Try(getClass.getClassLoader.asInstanceOf[SpecialClassLoader]).fold( | ||
_ => Seq.empty, | ||
_.allJars.filter(url => isSourceJar(url) && exists(Path(url.getFile))).map(_.toURI.toString) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we get the source files for the build dependencies filtering with isSourceJar
.
.fold(_ => Seq.empty, _.allJars.filter(url => exists(Path(url.getFile))).map(_.toURI.toString)) | ||
val classpath = Try(getClass.getClassLoader.asInstanceOf[SpecialClassLoader]).fold( | ||
_ => Seq.empty, | ||
_.allJars.filter(url => !isSourceJar(url) && exists(Path(url.getFile))).map(_.toURI.toString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are filtering out the source jars here since they are loaded in buildTargetDependencySources
.
Can you please describe what the issue is and how this PR solves it. |
Sure. In my
But with the current state of BSP it looks like this:
Because I don't have the sources loaded in my IDE, so the IDE decompiled the class files. With this change, it loads the source jars of mill build dependencies accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Thanks @lefou |
No description provided.