-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: js_run_binary defaults to opt runfiles for all compilation modes. #606
Comments
Thanks for the bug report @paullewis. I don't think we'll have any time to look at it until the end of the week or early next week as its BazelCon in NYC this week and that is keeping us busier than usual this week. @alexeagle is doing a short talk about our upcoming products on Wednesday that may interest you: https://opensourcelive.withgoogle.com/events/bazelcon2022?talk=day1-talk6 |
I think I've run into the same issue, where every target in my repo is building twice if they are used by a This is resulting in very long build times for our repo, since we actually pull a lot of packages into
Update on the above: never mind, that doesn't work. Check @gregmagolan's reply below |
Bazel is transitioning the js_binary Under the hood rules_js/js/private/js_run_binary.bzl Line 336 in 8dc6d52
and the tool in You could work around this by patching bazel-lib run_binary to use An example of that approach is in js_run_devserver,
|
Thanks for this @gregmagolan, this is some very helpful insight. I guess the part that I'm confused about then is that I still get the second build "[for tool]" even though the execution platform is the same as the target platform. (Or at least, I'm not setting any In this case, the |
If you I'd have to look more closely at your build graph & profile to see if the transitions are related to the long build times you are experiencing. We do paid offer consulting and Bazel support if you're interesting in more hands on help, https://www.aspect.dev/hello. |
Thanks for this @gregmagolan, and good to know you guys offer support! I ended up patching bazel-lib's I didn't quite understand the workaround with using |
What happened?
It looks like the runfiles defaults to
opt
forjs_run_binary
, irrespective of the Bazel compilation mode, and I'm not sure I understand why. In my particular case I'm using esbuild to generate files and togglingsplitting
andminifying
based on the compilation mode (on foropt
and off forfastbuild
), which in turn means that the hashes in the file names differ based on compilation mode.I have a script that goes looking in the runfiles for the generated JS, and under
fastbuild
it goes looking for those that would've been generated underopt
.Version
Development (host) and target OS/architectures: Mac
Output of
bazel --version
: bazel 5.3.2Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file: 1.6.9Language(s) and/or frameworks involved: JavaScript & Node
How to reproduce
Given a
js_binary
like this:Running
bazel run //:test
and loggingprocess.env.RUNFILES
I see afastbuild
path:RUNFILES: '/path/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/test.sh.runfiles'
However, if I now run that same
js_binary
as the tool for ajs_run_binary
like this:The
process.env.RUNFILES
is now set to anopt
path:The text was updated successfully, but these errors were encountered: