expression is not a declared prerequisite of this rule
It seems like
globfunction has a bug when usingallow_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
filegroupasfilegroup( 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
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 yeah feel free to delete my original question, thanks for creating a separate issue for my question 🙏
I will try printing the glob result
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.