build: don't use deprecated $(location) pre-declared variable (#36308)

$(location) is not recommended in the bazel docs as depending on context it will either return the value of $(execpath) or $(rootpath). rules_nodejs now supports $(rootpath) and $(execpath) in templated_args of nodejs_binary.

PR Close #36308
This commit is contained in:
Greg Magolan
2020-03-29 13:29:50 -07:00
committed by Alex Rickabaugh
parent 61e5ab4703
commit c58e6ba13a
8 changed files with 16 additions and 14 deletions

View File

@ -20,16 +20,16 @@ def circular_dependency_test(name, deps, entry_point, **kwargs):
templated_args = [
"--circular",
"--no-spinner",
# NOTE: We cannot use `$(location)` to resolve labels. This is because `ts_library`
# NOTE: We cannot use `$(rootpath)` to resolve labels. This is because `ts_library`
# does not pre-declare outputs in the rule. Hence, the outputs cannot be referenced
# through labels (i.e. `//packages/core:index.js`). Read more here:
# https://docs.bazel.build/versions/2.0.0/skylark/rules.html#outputs
# TODO: revisit once https://github.com/bazelbuild/rules_nodejs/issues/1563 is solved.
"$(rlocation %s)" % entry_point,
"$$(rlocation %s)" % entry_point,
# Madge supports custom module resolution, but expects a configuration file
# similar to a Webpack configuration file setting the `resolve` option.
"--webpack-config",
"$(rlocation $(location %s))" % MADGE_CONFIG_LABEL,
"$$(rlocation $(rootpath %s))" % MADGE_CONFIG_LABEL,
],
testonly = 1,
expected_exit_code = 0,