Commit ebb7e44
authored
Fix running terser from external repository. (#125)
I've got a repo which terses some typescript. It works when built inside
the repo, but when the exact same target is built outside the repo, it
fails to build.
load("@aspect_rules_terser//terser:defs.bzl", terser_minified =
"terser")
terser_minified(
name = name + "__min",
srcs = [":" + name],
node_modules = "//:node_modules",
sourcemap = False,
)
(cd
/dev/shm/bazel-sandbox.a3f391e631c5ea6c72bb0d2c0b90317c117ec497a3759d6de83cbe1ad7ada353/linux-sandbox/6993/execroot/spacecookies
&& \
exec env - \
BAZEL_BINDIR=bazel-out/k8-opt/bin \
COMPILATION_MODE=opt \
TMPDIR=/tmp \
/home/austin/.cache/bazel/_bazel_austin/install/5309d864f9edb3a2e8380ffc84e6b95c/linux-sandbox
-t 15 -w /dev/shm -w
/dev/shm/bazel-sandbox.a3f391e631c5ea6c72bb0d2c0b90317c117ec497a3759d6de83cbe1ad7ada353/linux-sandbox/6993/execroot/spacecookies
-w /tmp -e /tmp -S
/dev/shm/bazel-sandbox.a3f391e631c5ea6c72bb0d2c0b90317c117ec497a3759d6de83cbe1ad7ada353/linux-sandbox/6993/stats.out
-H -N -U -D
/dev/shm/bazel-sandbox.a3f391e631c5ea6c72bb0d2c0b90317c117ec497a3759d6de83cbe1ad7ada353/linux-sandbox/6993/debug.out
--
bazel-out/k8-opt-exec-ST-31ad040affd4/bin/external/aos/aos/network/www/_reflection_test_bundle__min_terser_binary_/_reflection_test_bundle__min_terser_binary
../aos/aos/network/www/reflection_test_bundle.js --output
../aos/aos/network/www/reflection_test_bundle__min.js --config-file
bazel-out/k8-opt/bin/external/aos/aos/network/www/_reflection_test_bundle__min.minify_options.json)
node:internal/fs/utils:356
throw err;
^
Error: ENOENT: no such file or directory, lstat
'/dev/shm/bazel-sandbox.a3f391e631c5ea6c72bb0d2c0b90317c117ec497a3759d6de83cbe1ad7ada353/linux-sandbox/6993/execroot/spacecookies/bazel-out/k8-opt/aos/aos/network/www/reflection_test_bundle.js'
at Object.lstatSync (node:fs:1666:3)
at Object.lstatSync
(/home/austin/.cache/bazel/_bazel_austin/0654a46dce625c9bc6e0b54d6df8dcff/external/aspect_rules_js/js/private/node-patches/fs.cjs:125:23)
at isDirectory
(/dev/shm/bazel-sandbox.a3f391e631c5ea6c72bb0d2c0b90317c117ec497a3759d6de83cbe1ad7ada353/linux-sandbox/6993/execroot/spacecookies/bazel-out/k8-opt-exec-ST-31ad040affd4/bin/external/aos/aos/network/www/_reflection_test_bundle__min_terser_binary_/_reflection_test_bundle__min_terser_binary.runfiles/aos/aos/network/www/_reflection_test_bundle__min_terser_runner.cjs:25:13)
at Array.find (<anonymous>)
at main
(/dev/shm/bazel-sandbox.a3f391e631c5ea6c72bb0d2c0b90317c117ec497a3759d6de83cbe1ad7ada353/linux-sandbox/6993/execroot/spacecookies/bazel-out/k8-opt-exec-ST-31ad040affd4/bin/external/aos/aos/network/www/_reflection_test_bundle__min_terser_binary_/_reflection_test_bundle__min_terser_binary.runfiles/aos/aos/network/www/_reflection_test_bundle__min_terser_runner.cjs:251:15)
at Object.<anonymous>
(/dev/shm/bazel-sandbox.a3f391e631c5ea6c72bb0d2c0b90317c117ec497a3759d6de83cbe1ad7ada353/linux-sandbox/6993/execroot/spacecookies/bazel-out/k8-opt-exec-ST-31ad040affd4/bin/external/aos/aos/network/www/_reflection_test_bundle__min_terser_binary_/_reflection_test_bundle__min_terser_binary.runfiles/aos/aos/network/www/_reflection_test_bundle__min_terser_runner.cjs:269:3)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12) {
errno: -2,
syscall: 'lstat',
code: 'ENOENT',
path:
'/dev/shm/bazel-sandbox.a3f391e631c5ea6c72bb0d2c0b90317c117ec497a3759d6de83cbe1ad7ada353/linux-sandbox/6993/execroot/spacecookies/bazel-out/k8-opt/aos/aos/network/www/reflection_test_bundle.js'
}
Node.js v18.20.3
When built locally, instead of
`../aos/aos/network/www/reflection_test_bundle.js`, it references
`aos/network/www/reflection_test_bundle.js` which works. Manually
adjusting it to `external/aos/aos/network/www/reflection_test_bundle.js`
makes it build. Really, this is an abuse of short_path, so abuse it a
bit more.
<!-- Delete this comment!
Include a summary of your changes, links to related issue(s), relevant
motivation and context for why you made the change, how you arrived at
this design, or alternatives considered.
For repositories that use a squash merge strategy, the pull request
description may also be used as the landed commit description ensuring
that useful information ends up in the git log.
-->
---
### Changes are visible to end-users: yes/no
<!-- If no, please delete this section. -->
- Searched for relevant documentation and updated as needed: yes/no
- Breaking change (forces users to change their own code or config):
yes/no
- Suggested release notes appear below: yes/no
### Test plan
<!-- Delete any which do not apply -->
- Covered by existing test cases
- New test cases added
- Manual testing; please provide instructions so we can reproduce:
---------
Signed-off-by: Austin Schuh <[email protected]>1 parent 4a0dba9 commit ebb7e44
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
| |||
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
52 | | - | |
53 | | - | |
| 57 | + | |
| 58 | + | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
| |||
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
93 | | - | |
| 98 | + | |
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
| |||
0 commit comments