rules_scala icon indicating copy to clipboard operation
rules_scala copied to clipboard

[IDE integration] code not resolving under "transitive" mode

Open wisechengyi opened this issue 3 years ago • 1 comments
trafficstars

I have created a minimal repro at https://github.com/bazelbuild/rules_scala/pull/1358/files

3 targets: a -> b -> c. Temporarily setting the following for scala toolchain to show the point.

--- a/scala/BUILD
+++ b/scala/BUILD
@@ -23,7 +23,8 @@ toolchain(
 
 scala_toolchain(
     name = "unused_dependency_checker_error_toolchain_impl",
-    unused_dependency_checker_mode = "error",
+    unused_dependency_checker_mode = "off",
+    dependency_mode = "transitive",
     visibility = ["//visibility:public"],
 )

When importingtmp/src/scala/a into intellij with the bazel plugin:

directories:
  tmp/src/scala/a

# Automatically includes all relevant targets under the 'directories' above
derive_targets_from_directories: true

targets:
  # If source code isn't resolving, add additional targets that compile it here

additional_languages:
  scala

Screen Shot 2022-02-18 at 5 03 26 PM

You can see that B can resolve correct, but C fails to resolve.

So was wondering if it's a rules_scala issue that it fails to let bazel plugin's aspect know about C, or a bazel plugin issue for asking for too little?

References

  • Importing tmp/src/scala would have C resolved.
  • building aworks just fine:
% bazel build tmp/src/scala/a
DEBUG: /private/var/tmp/_bazel_yic/2ceecb63e72239e50b9654ebbc6f2a73/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14: 
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /private/var/tmp/_bazel_yic/2ceecb63e72239e50b9654ebbc6f2a73/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:125:14: buildkite_config not using checked in configs; Bazel version 4.1.0 was picked/selected but no checked in config was found in map {"0.20.0": ["8.0.0"], "0.21.0": ["8.0.0"], "0.22.0": ["8.0.0", "9.0.0"], "0.23.0": ["8.0.0", "9.0.0"], "0.23.1": ["8.0.0", "9.0.0"], "0.23.2": ["9.0.0"], "0.24.0": ["9.0.0"], "0.24.1": ["9.0.0"], "0.25.0": ["9.0.0"], "0.25.1": ["9.0.0"], "0.25.2": ["9.0.0"], "0.26.0": ["9.0.0"], "0.26.1": ["9.0.0"], "0.27.0": ["9.0.0"], "0.27.1": ["9.0.0"], "0.28.0": ["9.0.0"], "0.28.1": ["9.0.0"], "0.29.0": ["9.0.0"], "0.29.1": ["9.0.0", "10.0.0"], "1.0.0": ["9.0.0", "10.0.0"], "1.0.1": ["10.0.0"], "1.1.0": ["10.0.0"], "1.2.0": ["10.0.0"], "1.2.1": ["10.0.0"], "2.0.0": ["10.0.0"], "2.1.0": ["10.0.0"], "2.1.1": ["10.0.0", "11.0.0"], "2.2.0": ["11.0.0"], "3.0.0": ["11.0.0"], "3.1.0": ["11.0.0"], "3.2.0": ["11.0.0"], "3.3.0": ["11.0.0"], "3.3.1": ["11.0.0"], "3.4.1": ["11.0.0"], "3.5.0": ["11.0.0"], "3.5.1": ["11.0.0"], "3.6.0": ["11.0.0"], "3.7.0": ["11.0.0"], "3.7.1": ["11.0.0"], "3.7.2": ["11.0.0"], "4.0.0": ["11.0.0"]}
INFO: Analyzed target //tmp/src/scala/a:a (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //tmp/src/scala/a:a up-to-date:
  bazel-bin/tmp/src/scala/a/a.jar
INFO: Elapsed time: 0.240s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action

wisechengyi avatar Feb 19 '22 01:02 wisechengyi

Seems known at https://github.com/bazelbuild/intellij/issues/1825#issuecomment-629224211

wisechengyi avatar Feb 22 '22 18:02 wisechengyi