-
-
Notifications
You must be signed in to change notification settings - Fork 147
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
There are many places in the tree where js_run_binary()
is invoked with chdir = package_name()
. It should be noticed that this is not correct in case the repo in which js_run_binary()
is not the main binary. For example, if I create a Bazel project that depends on the Bonanza repo as follows:
git_override(
module_name = "build_bonanza",
commit = "c45401ceea0071815df1d696afa26fb80eaeb0f5",
remote = "https://github.com/buildbarn/bonanza.git",
)
Then building @build_bonanza//cmd/bonanza_browser:generate_stylesheet
fails as follows:
bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/build_bonanza+/cmd/bonanza_browser/generate_stylesheet_/generate_stylesheet: line 449: cd: cmd/bonanza_browser: No such file or directory
If I patch up the Bonanza repo as follows, the target does build:
diff --git a/cmd/bonanza_browser/BUILD.bazel b/cmd/bonanza_browser/BUILD.bazel
index 7c5d9fc..ce3b4bd 100644
--- a/cmd/bonanza_browser/BUILD.bazel
+++ b/cmd/bonanza_browser/BUILD.bazel
@@ -71,7 +71,10 @@ js_run_binary(
name = "stylesheet",
outs = ["stylesheet.css"],
args = ["stylesheet.css"],
- chdir = package_name(),
+ chdir = "external/%s/%s" % (
+ repo_name(),
+ package_name(),
+ ),
tool = ":generate_stylesheet",
)
I think what is needed is proper guidance on how to use the chdir
option properly.
Version
Bazel 8.3.1 running on a Mac, using rules_js v2.3.8
How to reproduce
Any other information?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working