Android: Show class sources in IDE#6856
Draft
souvlakias wants to merge 4 commits intocom-lihaoyi:mainfrom
Draft
Conversation
vaslabs
reviewed
Feb 19, 2026
| import mill.javalib.bsp.BspModule | ||
| import mill.api.JsonFormatters.given | ||
|
|
||
| trait BspAndroidModule extends mill.javalib.bsp.BspJavaModule { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #6634
This is a POC on linking the classes jar with their respective sources.jar using bsp
The problem
Since android deps are aars, we extract them into a Task.dest and pass the found
.jars into the classpath.Bsp sees the
sources.jars that exist in~/.cache/coursierand doesnt pair the two.How it works
BspAndroidModulethat overridesbspBuildTargetDependencySourcesto show to the sources.jars that exist next to the jars that we pass in the classpathTweaks
resolvedMvnJarSourcesinJavaModuleto easily get allsources.jarsandroidResolvedMvnDeps(which is what we pass to compileclasspath), now needs to use a helper task that returnsSeq[UnpackedDep]], in order for the bsp module to find_.sourcesJarfrom that helper task (that exist in the same Task.dest with the ones in classpath)Notes
This may not be the best approach. Another solution could be to use GenIdea, and create xmls that link the two jars for each dep.