-
Notifications
You must be signed in to change notification settings - Fork 18
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
Implement AutoDeps for BEF #91
Comments
Hi, @plaird |
@beginningineer good question. I am thinking every Eclipse Bazel project will have second Eclipse classpath container "Bazel AutoDeps Classpath Container" that will contain the candidate list of deps. This will allow the Java Editor of JDT to see everything in the candidate list. The trick will be figuring out when a dep should be added to the Bazel Classpath Container (the BUILD file). Bazel Query can tell us that, but there is some real work there to implement. |
Progress has been made on this. While the Global Search Classpath feature #161 is experimental and still needs a lot of refinement, I believe it is the first step towards Autodeps. Details of the Global Search Classpath can be found in #161 and also this doc: https://github.com/salesforce/bazel-eclipse/blob/master/docs/using_the_feature_classpath.md#global-search-classpath |
This feature is getting closer. Just after BEF 1.5.0 was released, I added a hook into JDT's classpath fix extension point. This is the JDT UI scheme for presenting the user with ways to fix the classpath. With #357 we now hook into that UI, and correctly determine which Bazel label (e.g. @maven//:org_slf4j_slf4j-api) needs to be added to the package. What remains is figuring out what target to add the label to, which has two tasks: Figure out what file changed. Figure out what targets in the package use the changed file. |
Once this feature is done, we could take dependency management much further with something like Fasten which does detailed call-graph dependency analysis. I tried to do a quick POC with it, but hit some issues. Because we have resolved the classpath and source file folders already to feed JDT, it should be somewhat easy to hook up Fasten. |
This solution can also be expanded to support jars not already in the workspace. This would require calls up to Maven central. The m2eclipse team is implementing such a feature right now in eclipse-m2e/m2e-core#623 |
We have talked internally about having a feature to automatically track API modules and offer to add the api target to compile_deps, and impl target to runtime_deps. This ticket will track that.
Wix demo'd a similar tool for IJ at BazelCon 2019. If they open source it we can take a look at how they did it. We probably need the user to add a hook into the Bazel workspace to generate a list of class->dep mappings. We need the class to appear even if the package was not imported into BEF.
Here is a discussion that documents some existing work that may help with this:
https://groups.google.com/u/1/g/bazel-discuss/c/W38EuyqEmvM/m/h0Yi3Zm0AAAJ
The text was updated successfully, but these errors were encountered: