Add import_depth to allow controlling transative dependency depth
The work here it to add a import_depth option to the bazel project view. This configuration allows the classpath of the project to be reduced, where 1 is only the dependencies required for the targets imported to compile. Setting it less then 0 disables the filtering and the existing functionality to be used.
This allows functionality similar to the IJ bazel plugin, which excludes transitives and provides a partial classpath. I would also like this concept be brought into IJ, but starting here
Test Results
38 files ±0 38 suites ±0 21s :stopwatch: -1s 55 tests ±0 54 :white_check_mark: ±0 1 :zzz: ±0 0 :x: ±0 110 runs ±0 100 :white_check_mark: ±0 10 :zzz: ±0 0 :x: ±0
Results for commit 0e36caa6. ± Comparison against base commit 6de81359.
:recycle: This comment has been updated with latest results.
Cool feature. Doesn't Eclipse complain though if it can't find necessary classes when it launches tests?
Yes, good call out. I need to think though this one, I know IJ invokes bazel to remove the classpath in the IDE from causing issues, may have to do something similar, or figure out a way to store the actual runtime classpath outside Eclipse's project model.
@brian-mcnamara I think it would be good to capture the motivation for this change. Perhaps we should open an issue and add a few screenshots or some date showing before and/or after timings/memory consumption?
I renamed import_depth to runtime_import_depth due to JetBrains BSP plugin using import_depth flag as a helper to specify the depth of source projects to pull into the project view during sync.
hmm ... should we use classpath_depth?
hmm ... should we use
classpath_depth?
Not opposed to that, the only thing that may be confusing is setting the value to 0, which in the current implementation means exclude all runtime dependencies, but with classpath_depth, 0 to me would indicate even compile time classpath are excluded. I could just subtract 1 from the input to get around this and make it more intuitive.