jsinterop-annotations
jsinterop-annotations copied to clipboard
Visibility error when added as dep per readme
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.