Skip to content
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

The "Unused Deps" tool does not work for dependencies declared in native_java_libraries #268

Open
lolski opened this issue Mar 4, 2021 · 0 comments

Comments

@lolski
Copy link
Member

lolski commented Mar 4, 2021

Description

Unused deps fail to detect unused dependencies in our native_java_libraries macro. This is true for dependencies declared in the deps as well as native_libraries_deps field.

How to reproduce

  1. Add a dependency that is sure to be unused. For example, add "@maven//:info_picocli_picocli" to //rocks:rocks:

https://github.com/graknlabs/grakn/blob/7ef3ac2843774173c72d1e69d658c0c2f21006f0/rocks/BUILD#L29-L70

native_java_libraries(
    name = "rocks",
    srcs = glob(["*.java"]),
    deps = [
        # Internal dependencies
        "//common:common",
        "//concurrent:concurrent",
        "//graph:graph",
        "@maven//:info_picocli_picocli", 
    ...
)
  1. bazel run @graknlabs_dependencies//tool/unuseddeps:unused-deps -- remove

Expected output

The "@maven//:info_picocli_picocli" dep should be removed

Actual output

The "@maven//:info_picocli_picocli" dep is not removed

lolski pushed a commit to lolski/dependencies that referenced this issue Oct 7, 2022
## What is the goal of this PR?

Fix parsing of maven dependencies that do not conform to the `groupId:artifactId:version` standard, e.g., https://github.com/grpc/grpc-java/blob/bf191cb5ea56fe96e0ffa4c8936d3096c738fb07/repositories.bzl#L18

## What are the changes implemented in this PR?

Adds more forgiving parsing of maven coordinates by using the first two values as the group & artifact IDs and the last value as the version, ignoring any other values inbetween.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant