google / jsinterop-generator

Generates Java annotated with JsInterop from JavaScript extern sources
Apache License 2.0
75 stars 24 forks source link

Local JDK dependency warnings when building with elemental2 #38

Open sgammon opened 5 years ago

sgammon commented 5 years ago

Hello esteemed Googlers,

I get these warnings when building with elemental2, and I was wondering if there is anything I can do to fix it? I would be happy to contribute a PR, but I'm having trouble tracking down where the dependency is. I've looked in elemental2 and jsinterop-generator but with no luck yet.

WARNING: /private/.../external/bazel_tools/tools/jdk/BUILD:116:1: in alias rule @bazel_tools//tools/jdk:jar: target '@bazel_tools//tools/jdk:jar' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594)

WARNING: /private/.../external/com_google_jsinterop_generator/third_party/BUILD:62:1: in alias rule @com_google_jsinterop_generator//third_party:jar: target '@com_google_jsinterop_generator//third_party:jar' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594)

WARNING: /private/.../external/com_google_elemental2/java/elemental2/core/BUILD:38:1: in _jsinterop_generator rule @com_google_elemental2//java/elemental2/core:core__internal_src_generated: target '@com_google_elemental2//java/elemental2/core:core__internal_src_generated' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594)

WARNING: /.../external/com_google_elemental2/java/elemental2/dom/BUILD:95:1: in _jsinterop_generator rule @com_google_elemental2//java/elemental2/dom:dom__internal_src_generated: target '@com_google_elemental2//java/elemental2/dom:dom__internal_src_generated' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594)

I'm not quite sure this is the right place to file this issue, because the warnings mention a number of repositories. Local Bazel version:

Build label: 0.24.1
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Apr 2 16:32:47 2019 (1554222767)
Build timestamp: 1554222767
Build timestamp as int: 1554222767
jDramaix commented 5 years ago

Those warnings are not directly related to elemental2. They come from the jsinterop generator.

The jsinterop generator is referencing @bazel_tools//tools/jdk:jar that depends on deprecated target @local_jdk//:jar

We need to fix that by using @bazel_tools//tools/jdk:current_java_runtime instead referencing directly the jar tool and change the skylark rules using this target. Example: https://github.com/drigz/rules_openapi/commit/5e454dc57eea08661b72d31e6080d33e27a351cb