Search code examples
bazel

How to load glob function in `bzl` file


I want to use the glob function in bzl file, but it seems like that I can't use it directly. So how can I use it in bzl file? Or how can I use regular expression in bzl file?

Thanks very much for any help!


Solution

  • As we can read on the doc:

    Note that the native module is only available in the loading phase (i.e. for macros, not for rule implementations).

    This basically means you can only use a glob function in a .bzl file if this file is a macro called from a BUILD file.

    Could you detail your use case?

    Regarding regular expressions: They are not available in bzl files.