How to get WORKSPACE directory in bazel rule

后端 未结 3 836
渐次进展
渐次进展 2021-01-15 04:12

I order to use clang tools like clang-format, clang-tidy or generate a compilation database like this, I need to know the WORKSPACE directory withi

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-15 04:38

    If you're like me and writing a repository_rule instead of a regular one, resolving the following label can help you: "@//:WORKSPACE"

    Then use ctx.path to extract the required data: https://docs.bazel.build/versions/master/skylark/lib/repository_ctx.html#path

提交回复
热议问题