bazel icon indicating copy to clipboard operation
bazel copied to clipboard

expression is not a declared prerequisite of this rule

Open laurentlb opened this issue 6 years ago • 3 comments

It seems like glob function has a bug when using allow_empty = True, the documentation for bazel v 2.2.0 has this api for the function:

glob(include, exclude=[], exclude_directories=1, allow_empty=True)

when I try to apply it in the filegroup as

filegroup(
    name = "icons_svg",
    srcs = glob(
        [
            "src/icons/*.svg",
        ],
        allow_empty = True,
    ),
)

and then use this filegroup in another bazel rule

ts_node(
    name = "icons_gen",
    args = [
        "src/scripts/myScript.ts",
        # more ts-node cli arguments ...
        "$(rootpaths :icons_svg)",
    ],
    data = [
        ":icons_svg",
    ],
)

I am getting an error

in args attribute of nodejs_binary rule //:icons_gen: label '//:src/icons' in $(location) expression is not a declared prerequisite of this rule. Since this rule was created by the macro 'ts_node', the error might have been caused by the macro implementation

Originally posted by @Iulia-Soimaru in https://github.com/bazelbuild/bazel/issues/8195#issuecomment-671657597

laurentlb avatar Aug 11 '20 07:08 laurentlb

This doesn't seem related to glob or incompatible_disallow_empty_glob. If you agree, I'll delete your comment from the other issue.

In your build file, write print(glob(["src/icons/*.svg"], allow_empty = True)) to see what the glob function returns.

This might be a problem with the ts_node macro or the nodejs_binary rule.

laurentlb avatar Aug 11 '20 07:08 laurentlb

@laurentlb yeah feel free to delete my original question, thanks for creating a separate issue for my question 🙏

I will try printing the glob result

Iulia-Soimaru avatar Aug 11 '20 21:08 Iulia-Soimaru

Please file an issue with the owners of ts_node or nodejs_binary, if it turns out to be an issue with Bazel or the native rules, feel free to re-open.

oquenchil avatar Aug 28 '20 09:08 oquenchil