google / jsinterop-annotations

JsInterop java annotations for J2CL and GWT
Apache License 2.0
18 stars 8 forks source link

No such target '@com_google_jsinterop_annotations//:com_google_jsinterop_annotations' #4

Closed rendaw closed 3 years ago

rendaw commented 3 years ago

Sorry, again I might be confused or be looking at the wrong project here.

bazel run ..._dev_server in a j2cl project fails with the error:

ERROR: /home/.../5d3af3ef2f570227985f1da47f50df97/external/com_google_common_html_types/BUILD:7:12: no such target '@com_google_jsinterop_annotations//:com_google_jsinterop_annotations': target 'com_google_jsinterop_annotations' not declared in package '' defined by /home/.../5d3af3ef2f570227985f1da47f50df97/external/com_google_jsinterop_annotations/BUILD and referenced by '@com_google_common_html_types//:com_google_common_html_types'

It looks like by convention the com_google_jsinterop_annotations target should exist but in the BUILD here there's only jsinterop-annotations.

AFAICT safe-html-types depends on jsinterop-annotations here https://github.com/google/safe-html-types/blob/8507735457ea41a37dfa027fb176d49d5783c4ba/types/pom.xml#L38 . The BUILD files seem to be generated automatically from rules_jvm_external however I'm not sure how it comes up with the name com_google_jsinterop_annotations - is this taken from the workspace name?

gkdn commented 3 years ago

I think you followed the instruction in this repo and added

http_archive(
    name = "com_google_jsinterop_annotations",
    strip_prefix = "jsinterop-annotations-%s" % _JSINTEROP_ANNOTATIONS_VERSION,
    url = "https://github.com/google/jsinterop-annotations/archive/%s.zip" % _JSINTEROP_ANNOTATIONS_VERSION,
)

This is correct however rules_closure actually defines com_google_jsinterop_annotations here which probably interferes with your definition:

If you using J2CL, you don't need to define com_google_jsinterop_annotations. And you need to depend it from a target you can just use it from @com_google_j2cl//:jsinterop-annotations-j2cl dependency.

rendaw commented 3 years ago

You're absolutely correct. Thank you again!

I think I hit issues missing elemental2 deps and then when I had issues with missing annotation dependencies I went to the readme and pulled in the archive too rather than just the dep string.