Skip to content

strict deps labels are incorrect when using non java_* rules #4584

@ittaiz

Description

@ittaiz

Description of the problem / feature request:

Strict deps labels are incorrect when using scala_import
I suspect the problem is in the java rules and not scala_import since java_rules seems to perform their own heuristics which breaks if a different "actor" is in play and scala_import here is accidental. I might be incorrect in my analysis but a few months ago when I debugged it this is what I saw (don't have links to bazel code now, sorry :( )

Feature requests: what underlying problem are you trying to solve with this feature?

Trying to use java_library or java_common.compile with strict deps warnings

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

clone https://github.com/ittaiz/bazel-strict-deps-labels-issue
run bazel build --strict_java_deps=error //...
see:

TransitiveUser.java:1: error: [strict] Using type com.google.common.cache.Cache from an indirect dependency (TOOL_INFO: "@com_google_guava_guava//jar:guava-19.0.jar"). See command below **
import com.google.common.cache.Cache;
                              ^
 ** Please add the following dependencies:
  @com_google_guava_guava//jar:guava-19.0.jar  to //:transitive_user
 ** You can use the following buildozer command:
buildozer 'add deps @com_google_guava_guava//jar:guava-19.0.jar ' //:transitive_user

INFO: Elapsed time: 0.279s, Critical Path: 0.14s
FAILED: Build did NOT complete successfully

expected at the very least @com_google_guava_guava//jar and actually I'd like it to be //:import since the rule effectively exports that file

What operating system are you running Bazel on?

os x

What's the output of bazel info release?

release 0.8.1-homebrew

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4This is either out of scope or we don't have bandwidth to review a PR. (No assignee)staleIssues or PRs that are stale (no activity for 30 days)team-Rules-JavaIssues for Java rulestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions