bazelbuild / rules_closure

Closure rules for Bazel
https://developers.google.com/closure
Apache License 2.0
152 stars 114 forks source link

Error: 'workspace_root' is not allowed on invalid Label with Bazel@HEAD in CI #593

Closed sgowroji closed 10 months ago

sgowroji commented 10 months ago

https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/3391#018b3b61-b0c9-44a4-9e42-89dfe7e885a1

Platform : Ubuntu, MacOS

Logs:

ERROR: /Users/buildkite/builds/bk-imacpro-6/bazel-downstream-projects/rules_closure/closure/private/BUILD:29:24: in closure_base_js_library rule //closure/private:base_lib:
Traceback (most recent call last):
    File "/Users/buildkite/builds/bk-imacpro-6/bazel-downstream-projects/rules_closure/closure/compiler/closure_base_js_library.bzl", line 24, column 37, in _closure_base_js_library
        return create_closure_js_library(ctx, ctx.files.srcs)
    File "/Users/buildkite/builds/bk-imacpro-6/bazel-downstream-projects/rules_closure/closure/compiler/closure_js_library.bzl", line 79, column 36, in create_closure_js_library
        return _closure_js_library_impl(
    File "/Users/buildkite/builds/bk-imacpro-6/bazel-downstream-projects/rules_closure/closure/compiler/closure_js_library.bzl", line 239, column 29, in _closure_js_library_impl
        find_js_module_roots(srcs, workspace_name, label, includes),
    File "/Users/buildkite/builds/bk-imacpro-6/bazel-downstream-projects/rules_closure/closure/private/defs.bzl", line 189, column 43, in find_js_module_roots
        new_bazel_version = Label("@foo//bar").workspace_root.startswith("../")
Error: 'workspace_root' is not allowed on invalid Label @[unknown repo 'foo' requested from @]//bar:bar

Steps:

git clone https://github.com/bazelbuild/rules_closure.git
git reset 7a2c91f9519c301f5adc072e5e18c4bae5273404 --hard
export USE_BAZEL_VERSION=2ddacab80af1dca3c04e74809827c47ec4bc8498
bazel build ...

CC Greenteam @fweikert

gkdn commented 10 months ago

Tried to repro but Bazelisk fails to download 2ddacab80af1dca3c04e74809827c47ec4bc8498

gkdn commented 10 months ago

BTW, I'm expecting this to be fixed by removing the related temporary code:https://github.com/bazelbuild/rules_closure/blob/7a2c91f9519c301f5adc072e5e18c4bae5273404/closure/private/defs.bzl#L189

sgowroji commented 10 months ago

Hi @gkdn, Would you mind sending a fix with a PR. Thanks a lot for your support.