fix: fix a bug where yq failed to build in the root package
This commit is contained in:
parent
f4d38ac959
commit
400ff189b3
|
@ -1,6 +1,7 @@
|
|||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
|
||||
load("//lib:write_source_files.bzl", "write_source_files")
|
||||
load("//lib:yq.bzl", "yq")
|
||||
|
||||
gazelle_binary(
|
||||
name = "gazelle_bin",
|
||||
|
@ -35,3 +36,10 @@ write_source_files(
|
|||
diff_test = False,
|
||||
files = {"test-out/dist/write_source_file_root-test": ":write_source_file_root"},
|
||||
)
|
||||
|
||||
# Test that yq works in the root package
|
||||
yq(
|
||||
name = "yq_root-test",
|
||||
srcs = ["//lib/tests/yq:a.yaml"],
|
||||
expression = ".",
|
||||
)
|
||||
|
|
|
@ -40,7 +40,7 @@ def _yq_impl(ctx):
|
|||
|
||||
# For split operations, yq outputs files in the same directory so we
|
||||
# must cd to the correct output dir before executing it
|
||||
bin_dir = ctx.bin_dir.path + "/" + ctx.label.package
|
||||
bin_dir = "/".join([ctx.bin_dir.path, ctx.label.package]) if ctx.label.package else ctx.bin_dir.path
|
||||
escape_bin_dir = _escape_path(bin_dir)
|
||||
cmd = "cd {bin_dir} && {yq} {args} {eval_cmd} {expression} {sources} {maybe_out}".format(
|
||||
bin_dir = ctx.bin_dir.path + "/" + ctx.label.package,
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
load("//lib/private:diff_test.bzl", "diff_test")
|
||||
load("//lib:yq.bzl", "yq")
|
||||
|
||||
exports_files(
|
||||
[
|
||||
"a.yaml",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Identity (dot) expression produces identical yaml
|
||||
yq(
|
||||
name = "case_dot_expression",
|
||||
|
|
Loading…
Reference in New Issue