I am trying to get a value of the full current directory path from within .bzl rule. I have tried following:
ctx.host_configuration.default_shell_env.PATHreturns"/Users/[user_name]/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:...ctx.bin_dir.pathreturnsbazel-out/local-fastbuild/binpwd = ctx.expand_make_variables("cmd", "$$PWD", {})returns string$PWD- I don't think this rule is helpful for me, but may be just using it wrong.
What I need is the directory under which the cmd that runs Bazel .bzl rule is running. For example: /Users/[user_name]/git/workspace/path/to/bazel/rule.bzl or at least first part of the path prior to the WORKSPACE directory.
I can't use pwd because I need this value before I call ctx.actions.run_shell()
Are there no attributes in Bazel configurations that hold this value?