google / google/jsinterop-annotations

Visibility error when added as dep per readme

Open
#3 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
25
Forks
9
PR merge metrics
No merged PRs in 30d

Description

I'm new to j2cl and Bazel FWIW.

I was missing the annotations dep and got this error:
```
error: [strict] Using type jsinterop.annotations.JsType from an indirect dependency (TOOL_INFO: "@com_google_jsinterop_annotations-j2cl//java/jsinterop/annotations"). See command below **
import jsinterop.annotations.JsType;
^
** Please add the following dependencies:
@com_google_jsinterop_annotations-j2cl//java/jsinterop/annotations to //...
** You can use the following buildozer command:
buildozer 'add deps @com_google_jsinterop_annotations-j2cl//java/jsinterop/annotations' //...
```

Adding `@com_google_jsinterop_annotations-j2cl//java/jsinterop/annotations` didn't work:
```
in deps attribute of j2cl_library rule //...: '@com_google_jsinterop_annotations-j2cl//java/jsinterop/annotations:annotations' does not have mandatory providers: 'closure_js_library'. Since this rule was created by the macro 'j2cl_library', the error might have been caused by the macro implementation
```

Searching brought me here -- I _think_ this is the same library. The readme says to add `@com_google_jsinterop_annotations//:jsinterop-annotations-j2cl` to deps, but this produces the error:
```
in j2cl_library rule //com/zarbosoft/merman:editor: alias '@com_google_jsinterop_annotations//:jsinterop-annotations-j2cl' referring to target '@com_google_jsinterop_annotations//java/jsinterop/annotations:annotations-j2cl' is not visible from target '//...'. Check the visibility declaration of the former target if you think the dependency is legitimate
```

Eventually I found an example of the annotations in the guava j2cl sample, which uses `@com_google_j2cl//:jsinterop-annotations-j2cl` and this worked.

I'm not sure if this is the recommended usage though.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.