Skip to content

feat: streamline invocation of binaries from npm and update examples#2846

Merged
acozzette merged 15 commits into
aspect-build:mainfrom
acozzette:rspack-example
May 20, 2026
Merged

feat: streamline invocation of binaries from npm and update examples#2846
acozzette merged 15 commits into
aspect-build:mainfrom
acozzette:rspack-example

Conversation

@acozzette
Copy link
Copy Markdown
Contributor

@acozzette acozzette commented May 15, 2026

The new example in examples/rspack started out as a test case by @jbedard and @nickschaap showing how js_run_binary can sometimes fail to work correctly when the execution and target platforms are different.

I was able to get it working, primarily by setting use_execroot_entry_point = False. The problem with the default behavior (use_execroot_entry_point = True) is that it runs target-platform sources during the build action, which can go haywire if the target platform is meaningfully different from the execution platform.

Getting all the sources in the right place and built for the right platform is not entirely straightforward, so I thought it would be good to have some simple examples showing this.

A small new feature the examples rely on is the ability to pass data and fixed_args to the macro that wraps js_run_binary() in the generated package_json.bzl file. The args are forwarded to the underlying js_binary.


Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

The bin.<binary name>() macro generated in package_json.bzl now supports passing data and fixed_args through to the js_binary it creates.

Test plan

  • Covered by existing test cases
  • New test cases added

@aspect-workflows
Copy link
Copy Markdown

aspect-workflows Bot commented May 15, 2026

Bazel 7 (Test)

257 test targets passed

Targets
//:node_modules_build_test [k8-fastbuild]                                                             62ms
//:npm_link_targets_node_modules_build_test [k8-fastbuild]                                            36ms
//:npm_link_targets_test [k8-fastbuild]                                                               80ms
//js/private/test/coverage:pass [k8-fastbuild]                                                        212ms
//js/private/test/create_launcher:test [k8-fastbuild]                                                 241ms
//js/private/test/data:extract-js_library-srcs-data [k8-fastbuild]                                    119ms
//js/private/test/data:extract-write-js_library-data [k8-fastbuild]                                   99ms
//js/private/test/data:from-js_library-data [k8-fastbuild]                                            190ms
//js/private/test/data:from-js_run_binary-genrule [k8-fastbuild]                                      145ms
//js/private/test/data:from-js_run_binary-genrule-copied [k8-fastbuild]                               145ms
//js/private/test/data:from-js_run_binary-srcs [k8-fastbuild]                                         176ms
//js/private/test/data:source-data-execpath [k8-fastbuild]                                            211ms
//js/private/test/fixed_args:fixed_args_test [k8-fastbuild]                                           234ms
//js/private/test/fixed_args:locations_test [k8-fastbuild]                                            145ms
//js/private/test/fixed_args:locations_test_no_expand [k8-fastbuild]                                  172ms
//js/private/test/image/non_ascii:assert_custom_layer_groups_test_node_modules_test [k8-fastbuild]    38ms
//js/private/test/image/non_ascii:assert_custom_layer_groups_test_node_test [k8-fastbuild]            37ms
//js/private/test/image:assert_custom_owner_test_node_modules_test [k8-fastbuild]                     54ms
//js/private/test/image:assert_custom_owner_test_package_store_3p_test [k8-fastbuild]                 51ms
//js/private/test/image:assert_default_test_app_test [k8-fastbuild]                                   37ms
//js/private/test/image:assert_regex_edge_cases_test_app_test [k8-fastbuild]                          48ms
//js/private/test/image:checksum_test_test_test [k8-fastbuild]                                        39ms
//js/private/test/js_binary_sh:BAZEL_PACKAGE_test [k8-fastbuild]                                      188ms
//js/private/test/js_binary_sh:BAZEL_TARGET_test [k8-fastbuild]                                       145ms
//js/private/test/js_binary_sh:JS_BINARY__BINDIR_test [k8-fastbuild]                                  74ms
//js/private/test/js_binary_sh:JS_BINARY__TARGET_test [k8-fastbuild]                                  138ms
//js/private/test/js_binary_sh:JS_BINARY__WORKSPACE_test [k8-fastbuild]                               109ms
//js/private/test/js_binary_sh:env_json_obj_value [k8-fastbuild]                                      139ms
//js/private/test/js_binary_sh:env_json_str_launcher_escaped [k8-fastbuild]                           174ms
//js/private/test/js_binary_sh:regexy-args [k8-fastbuild]                                             102ms
//js/private/test/js_binary_sh:regexy-args-1 [k8-fastbuild]                                           87ms
//js/private/test/js_run_devserver:node_modules_symlink_to_execroot_test [k8-fastbuild]               296ms
//js/private/test/node-patches:escape_node24_test [k8-fastbuild]                                      133ms
//js/private/test/node-patches:escape_nodejs_test [k8-fastbuild]                                      88ms
//js/private/test/node-patches:lstat_node22_cjs_test [k8-fastbuild]                                   127ms
//js/private/test/node-patches:lstat_node22_test [k8-fastbuild]                                       138ms
//js/private/test/node-patches:lstat_nodejs_test [k8-fastbuild]                                       195ms
//js/private/test/node-patches:opendir_node20_cjs_test [k8-fastbuild]                                 152ms
//js/private/test/node-patches:opendir_node22_cjs_test [k8-fastbuild]                                 110ms
//js/private/test/node-patches:opendir_node24_cjs_test [k8-fastbuild]                                 171ms
//js/private/test/node-patches:opendir_nodejs_test [k8-fastbuild]                                     134ms
//js/private/test/node-patches:readdir_node20_test [k8-fastbuild]                                     162ms
//js/private/test/node-patches:readdir_node22_test [k8-fastbuild]                                     184ms
//js/private/test/node-patches:readdir_node24_cjs_test [k8-fastbuild]                                 129ms
//js/private/test/node-patches:readdir_node24_test [k8-fastbuild]                                     177ms
//js/private/test/node-patches:readdir_nodejs_cjs_test [k8-fastbuild]                                 228ms
//js/private/test/node-patches:readlink_node24_cjs_test [k8-fastbuild]                                182ms
//js/private/test/node-patches:readlink_nodejs_cjs_test [k8-fastbuild]                                125ms
//js/private/test/node-patches:readlink_nodejs_test [k8-fastbuild]                                    231ms
//js/private/test/node-patches:realpath_node20_test [k8-fastbuild]                                    175ms
//js/private/test/node-patches:realpath_node24_cjs_test [k8-fastbuild]                                180ms
//js/private/test/node-patches:realpath_node24_test [k8-fastbuild]                                    224ms
//js/private/test/node-patches:realpath_nodejs_cjs_test [k8-fastbuild]                                167ms
//js/private/test/proto:proto_args_test [k8-fastbuild]                                                52ms
//js/private/test/proto:proto_rewrite_imports_test [k8-fastbuild]                                     41ms
//js/private/test:main_default_toolchain [k8-fastbuild]                                               224ms
//js/private/test:main_toolchain_20 [k8-fastbuild]                                                    111ms
//js/private/test:write_launcher_test [k8-fastbuild]                                                  86ms
//js/private/worker:worker_checked_test [k8-fastbuild]                                                35ms
//npm/private/test/npm_package:test_pkg [k8-fastbuild]                                                36ms
//npm/private/test/npm_package:test_pkg_6 [k8-fastbuild]                                              45ms
//npm/private/test/npm_package_publish:test [k8-fastbuild]                                            2s
//npm/private/test/subs:require_non-importers_test [k8-fastbuild]                                     112ms
//npm/private/test/subs:subs_test [k8-fastbuild]                                                      44ms
//npm/private/test:__rollup-test [k8-fastbuild]                                                       208ms
//npm/private/test:npm_auth_tests_test_0 [k8-fastbuild]                                               75ms
//npm/private/test:npm_auth_tests_test_3 [k8-fastbuild]                                               39ms
//npm/private/test:npm_auth_tests_test_4 [k8-fastbuild]                                               38ms
//npm/private/test:pkg_versions_test [k8-fastbuild]                                                   59ms
//npm/private/test:test_generated_pkg_json___rollup-target__js_binary_tagged_manual [k8-fastbuild]    46ms
//npm/private/test:test_generated_pkg_json___rollup-target_js_info_files_tagged_manual [k8-fastbuild] 45ms
//npm/private/test:test_generated_pkg_json___rollup-target_runfiles_lib_tagged_manual [k8-fastbuild]  38ms
//npm/private/test:test_generated_pkg_json_only_expected_properties [k8-fastbuild]                    43ms
//npm/private/test:test_npm_package_visibility_test_10 [k8-fastbuild]                                 95ms
//npm/private/test:test_npm_package_visibility_test_12 [k8-fastbuild]                                 81ms
//npm/private/test:test_npm_package_visibility_test_13 [k8-fastbuild]                                 43ms
//npm/private/test:test_npm_package_visibility_test_4 [k8-fastbuild]                                  31ms
//npm/private/test:test_npm_package_visibility_test_5 [k8-fastbuild]                                  69ms
//npm/private/test:test_npm_package_visibility_test_6 [k8-fastbuild]                                  50ms
//npm/private/test:test_npm_package_visibility_test_7 [k8-fastbuild]                                  52ms
//npm/private/test:test_npm_package_visibility_test_8 [k8-fastbuild]                                  51ms
//npm/private/test:test_npm_package_visibility_test_9 [k8-fastbuild]                                  94ms
//npm/private/test:test_npmrc_test_1 [k8-fastbuild]                                                   35ms
//npm/private/test:test_npmrc_test_2 [k8-fastbuild]                                                   102ms
//npm/private/test:test_pnpm_test_3 [k8-fastbuild]                                                    50ms
//npm/private/test:test_pnpm_test_4 [k8-fastbuild]                                                    36ms
//npm/private/test:test_pnpm_test_5 [k8-fastbuild]                                                    40ms
//npm/private/test:test_pnpm_test_9 [k8-fastbuild]                                                    36ms
//npm/private/test:test_transitive_closure_test_1 [k8-fastbuild]                                      29ms
//npm/private/test:test_utils_test_3 [k8-fastbuild]                                                   103ms
//npm/private/test:test_utils_test_4 [k8-fastbuild]                                                   95ms
//npm/private/test:test_utils_test_5 [k8-fastbuild]                                                   114ms
//npm/private/test:write_npm_translate_lock_0_test [k8-fastbuild]                                     246ms
//npm/private/test:write_npm_translate_lock_1_test [k8-fastbuild]                                     206ms
//npm/private/test:write_npm_translate_lock_3_test [k8-fastbuild]                                     196ms
//npm/private/test:write_npm_translate_lock_4_test [k8-fastbuild]                                     198ms
//npm/private/test:write_npm_translate_lock_6_test [k8-fastbuild]                                     202ms
//npm/private/test:write_npm_translate_lock_7_test [k8-fastbuild]                                     200ms
//npm/private/test:write_npm_translate_lock_9_test [k8-fastbuild]                                     187ms
//tools:preset.update_test [k8-fastbuild]                                                             214ms
+ 157 other targets

Bazel 8 (Test)

All tests were cache hits

245 tests (100.0%) were fully cached saving 29s.


Bazel 9 (Test)

All tests were cache hits

245 tests (100.0%) were fully cached saving 31s.


Bazel 7 (Test)

e2e/bzlmod

7 test targets passed

Targets
//:check_styles [k8-fastbuild]                                                                        194ms
//:jasmine_test [k8-fastbuild]                                                                        226ms
//:node_modules_test [k8-fastbuild]                                                                   56ms
//:other_module_binary_test [k8-fastbuild]                                                            82ms
//:other_module_linked_packages [k8-fastbuild]                                                        61ms
//:other_module_run_binary_test [k8-fastbuild]                                                        36ms
//:test [k8-fastbuild]                                                                                99ms

Bazel 8 (Test)

e2e/bzlmod

All tests were cache hits

7 tests (100.0%) were fully cached saving 642ms.


Bazel 9 (Test)

e2e/bzlmod

All tests were cache hits

7 tests (100.0%) were fully cached saving 596ms.


Bazel 7 (Test)

e2e/git_dep_metadata

1 test target passed

Targets
//:no_git_metadata_test                                                                               27ms

Bazel 8 (Test)

e2e/git_dep_metadata

All tests were cache hits

1 test (100.0%) was fully cached saving 26ms.


Bazel 9 (Test)

e2e/git_dep_metadata

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Bazel 7 (Test)

e2e/gyp_no_install_script

2 test targets passed

Targets
//:test [k8-fastbuild]                                                                                55ms
//:write_npm_translate_lock_bzlmod_test [k8-fastbuild]                                                134ms

Bazel 8 (Test)

e2e/gyp_no_install_script

All tests were cache hits

1 test (100.0%) was fully cached saving 50ms.


Bazel 9 (Test)

e2e/gyp_no_install_script

All tests were cache hits

1 test (100.0%) was fully cached saving 46ms.


Bazel 7 (Test)

e2e/js_binary_workspace

4 test targets passed

Targets
//:js_run_binary_chdir_test [k8-fastbuild]                                                            68ms
//:test [k8-fastbuild]                                                                                52ms
@@workspace~//:js_binary_chdir_test [k8-fastbuild]                                                    88ms
@@workspace~//:js_test_chdir_test [k8-fastbuild]                                                      116ms

Bazel 8 (Test)

e2e/js_binary_workspace

All tests were cache hits

4 tests (100.0%) were fully cached saving 226ms.


Bazel 9 (Test)

e2e/js_binary_workspace

All tests were cache hits

4 tests (100.0%) were fully cached saving 238ms.


Bazel 8 (Test)

e2e/js_image_oci

All tests were cache hits

1 test (100.0%) was fully cached saving 4s.


Bazel 9 (Test)

e2e/js_image_oci

All tests were cache hits

1 test (100.0%) was fully cached saving 4s.


Bazel 7 (Test)

e2e/nextjs

3 test targets passed

Targets
//v15/cjs:test [k8-fastbuild]                                                                         47ms
//v15/esm:test [k8-fastbuild]                                                                         21ms
//v15/mjs:test [k8-fastbuild]                                                                         63ms

Bazel 8 (Test)

e2e/nextjs

All tests were cache hits

3 tests (100.0%) were fully cached saving 94ms.


Bazel 9 (Test)

e2e/nextjs

All tests were cache hits

3 tests (100.0%) were fully cached saving 112ms.


Bazel 7 (Test)

e2e/npm_link_package

4 test targets passed

Targets
//cjs/src:test [k8-fastbuild]                                                                         219ms
//cjs:package_store_targets_test [k8-fastbuild]                                                       80ms
//esm/src:test [k8-fastbuild]                                                                         211ms
//esm:package_store_targets_test [k8-fastbuild]                                                       70ms

Bazel 8 (Test)

e2e/npm_link_package

All tests were cache hits

4 tests (100.0%) were fully cached saving 363ms.


Bazel 9 (Test)

e2e/npm_link_package

All tests were cache hits

4 tests (100.0%) were fully cached saving 415ms.


Bazel 7 (Test)

e2e/npm_link_package-rerooted

2 test targets passed

Targets
//root/src:test [k8-fastbuild]                                                                        154ms
//root:package_store_targets_test [k8-fastbuild]                                                      55ms

Bazel 8 (Test)

e2e/npm_link_package-rerooted

All tests were cache hits

2 tests (100.0%) were fully cached saving 139ms.


Bazel 9 (Test)

e2e/npm_link_package-rerooted

All tests were cache hits

2 tests (100.0%) were fully cached saving 186ms.


Bazel 7 (Test)

e2e/npm_translate_lock

3 test targets passed

Targets
//:test                                                                                               56ms
//:test_dev_filtering                                                                                 216ms
//:test_prod_filtering                                                                                210ms

Bazel 8 (Test)

e2e/npm_translate_lock

All tests were cache hits

3 tests (100.0%) were fully cached saving 287ms.


Bazel 9 (Test)

e2e/npm_translate_lock

All tests were cache hits

3 tests (100.0%) were fully cached saving 289ms.


Bazel 7 (Test)

e2e/npm_translate_lock_disable_hooks

3 test targets passed

Targets
//:test [k8-fastbuild]                                                                                24ms
//:write_npm_translate_lock_defs_0_test [k8-fastbuild]                                                95ms
//:write_npm_translate_lock_defs_1_test [k8-fastbuild]                                                84ms

Bazel 8 (Test)

e2e/npm_translate_lock_disable_hooks

All tests were cache hits

1 test (100.0%) was fully cached saving 62ms.


Bazel 9 (Test)

e2e/npm_translate_lock_disable_hooks

All tests were cache hits

1 test (100.0%) was fully cached saving 32ms.


Bazel 7 (Test)

e2e/npm_translate_lock_empty

2 test targets passed

Targets
//:test [k8-fastbuild]                                                                                18ms
//:write_npm_translate_lock_bzlmod_test [k8-fastbuild]                                                101ms

Bazel 8 (Test)

e2e/npm_translate_lock_empty

All tests were cache hits

2 tests (100.0%) were fully cached saving 114ms.


Bazel 9 (Test)

e2e/npm_translate_lock_empty

All tests were cache hits

2 tests (100.0%) were fully cached saving 105ms.


Bazel 7 (Test)

e2e/npm_translate_lock_exclude_package_contents

1 test target passed

Targets
//:test_sh                                                                                            35ms

Bazel 8 (Test)

e2e/npm_translate_lock_exclude_package_contents

All tests were cache hits

1 test (100.0%) was fully cached saving 21ms.


Bazel 9 (Test)

e2e/npm_translate_lock_exclude_package_contents

All tests were cache hits

1 test (100.0%) was fully cached saving 86ms.


Bazel 7 (Test)

e2e/npm_translate_lock_multi

2 test targets passed

Targets
//app1:test                                                                                           47ms
//app2:test                                                                                           45ms

Bazel 8 (Test)

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 54ms.


Bazel 9 (Test)

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 113ms.


Bazel 7 (Test)

e2e/npm_translate_lock_partial_clone

1 test target passed

Targets
//root:test                                                                                           28ms

Bazel 8 (Test)

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Bazel 9 (Test)

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 38ms.


Bazel 7 (Test)

e2e/npm_translate_lock_replace_packages

4 test targets passed

Targets
//:node_modules_test [k8-fastbuild]                                                                   29ms
//:test [k8-fastbuild]                                                                                83ms
//:utils_test [k8-fastbuild]                                                                          100ms
//:write_npm_translate_lock_bzlmod_test [k8-fastbuild]                                                132ms

Bazel 8 (Test)

e2e/npm_translate_lock_replace_packages

All tests were cache hits

4 tests (100.0%) were fully cached saving 249ms.


Bazel 9 (Test)

e2e/npm_translate_lock_replace_packages

All tests were cache hits

4 tests (100.0%) were fully cached saving 320ms.


Bazel 7 (Test)

e2e/npm_translate_lock_subdir_patch

1 test target passed

Targets
//subdir:test                                                                                         61ms

Bazel 8 (Test)

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 67ms.


Bazel 9 (Test)

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 50ms.


Bazel 7 (Test)

e2e/npm_translate_package_lock

1 test target passed

Targets
//:test                                                                                               18ms

Bazel 8 (Test)

e2e/npm_translate_package_lock

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 32ms.


Bazel 7 (Test)

e2e/npm_translate_yarn_lock

1 test target passed

Targets
//:test                                                                                               21ms

Bazel 8 (Test)

e2e/npm_translate_yarn_lock

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 32ms.


Bazel 7 (Test)

e2e/output_paths

Buildkite build #12743 is running...


Bazel 8 (Test)

e2e/output_paths

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/output_paths

All tests were cache hits

2 tests (100.0%) were fully cached saving 171ms.


Bazel 7 (Test)

e2e/patch_from_repo

1 test target passed

Targets
//:test                                                                                               19ms

Bazel 7 (Test)

e2e/pnpm_lockfiles

Buildkite build #12743 is running...


Bazel 8 (Test)

e2e/pnpm_lockfiles

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/pnpm_lockfiles

Buildkite build #12743 is running...


Bazel 7 (Test)

e2e/pnpm_repo_install

Buildkite build #12743 is running...


Bazel 8 (Test)

e2e/pnpm_repo_install

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/pnpm_repo_install

Buildkite build #12743 is running...


Bazel 7 (Test)

e2e/pnpm_workspace

15 test targets passed

Targets
//:node_test [k8-fastbuild]                                                                           285ms
//:repos_test [k8-fastbuild]                                                                          70ms
//:vendored [k8-fastbuild]                                                                            39ms
//app/a:aspect_test_a_bin_test [k8-fastbuild]                                                         125ms
//app/a:npm_link_targets_node_modules_build_test [k8-fastbuild]                                       77ms
//app/a:npm_link_targets_test [k8-fastbuild]                                                          74ms
//app/a:test [k8-fastbuild]                                                                           181ms
//app/b:aliases [k8-fastbuild]                                                                        71ms
//app/b:test [k8-fastbuild]                                                                           112ms
//app/c:aspect_test_a_bin_test [k8-fastbuild]                                                         130ms
//app/c:test [k8-fastbuild]                                                                           162ms
//app/d:test [k8-fastbuild]                                                                           195ms
//lib/a:vendored [k8-fastbuild]                                                                       63ms
//lib/b:aliases [k8-fastbuild]                                                                        71ms
//lib/d:aliases [k8-fastbuild]                                                                        70ms

Bazel 8 (Test)

e2e/pnpm_workspace

All tests were cache hits

14 tests (100.0%) were fully cached saving 2s.


Bazel 9 (Test)

e2e/pnpm_workspace

Buildkite build #12743 is running...


Bazel 7 (Test)

e2e/pnpm_workspace_deps

3 test targets passed

Targets
//tests:direct [k8-fastbuild]                                                                         94ms
//tests:dupes [k8-fastbuild]                                                                          91ms
//tests:pkg [k8-fastbuild]                                                                            87ms

Bazel 8 (Test)

e2e/pnpm_workspace_deps

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/pnpm_workspace_deps

All tests were cache hits

3 tests (100.0%) were fully cached saving 237ms.


Bazel 7 (Test)

e2e/pnpm_workspace_rerooted

Buildkite build #12743 is running...


Bazel 8 (Test)

e2e/pnpm_workspace_rerooted

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/pnpm_workspace_rerooted

Buildkite build #12743 is running...


Bazel 7 (Test)

e2e/protobuf-es

Buildkite build #12743 is running...


Bazel 8 (Test)

e2e/protobuf-es

All tests were cache hits

3 tests (100.0%) were fully cached saving 664ms.


Bazel 9 (Test)

e2e/protobuf-es

All tests were cache hits

3 tests (100.0%) were fully cached saving 752ms.


Bazel 7 (Test)

e2e/protobuf-google

Buildkite build #12743 is running...


Bazel 8 (Test)

e2e/protobuf-google

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/protobuf-google

All tests were cache hits

2 tests (100.0%) were fully cached saving 245ms.


Bazel 7 (Test)

e2e/repo_mapping

3 test targets passed

Targets
//:node_modules_test [k8-fastbuild]                                                                   41ms
//:package_store_targets_test [k8-fastbuild]                                                          46ms
//:test [k8-fastbuild]                                                                                58ms

Bazel 8 (Test)

e2e/repo_mapping

All tests were cache hits

3 tests (100.0%) were fully cached saving 154ms.


Bazel 9 (Test)

e2e/repo_mapping

All tests were cache hits

3 tests (100.0%) were fully cached saving 308ms.


Bazel 7 (Test)

e2e/vendored_node

Buildkite build #12743 is running...


Bazel 8 (Test)

e2e/vendored_node

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/vendored_node

Buildkite build #12743 is running...


Bazel 7 (Test)

e2e/vendored_tarfile

1 test target passed

Targets
//:test                                                                                               18ms

Bazel 8 (Test)

e2e/vendored_tarfile

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/vendored_tarfile

All tests were cache hits

1 test (100.0%) was fully cached saving 32ms.


Bazel 7 (Test)

e2e/verify_patches

Buildkite build #12743 is running...


Bazel 8 (Test)

e2e/verify_patches

Buildkite build #12743 is running...


Bazel 9 (Test)

e2e/verify_patches

Waiting for runner...


Bazel 7 (Test)

examples

84 test targets passed

Targets
//:linked_packages_build_test [k8-fastbuild]                                                          72ms
//coverage:coverage [k8-fastbuild]                                                                    133ms
//genrule:test_acorn [k8-fastbuild]                                                                   56ms
//genrule:test_require_acorn [k8-fastbuild]                                                           46ms
//js_binary:aspect_bin_a_test [k8-fastbuild]                                                          109ms
//js_binary:case7_test [k8-fastbuild]                                                                 192ms
//js_binary:npm_version_test [k8-fastbuild]                                                           254ms
//js_binary:test13-1_cjs [k8-fastbuild]                                                               42ms
//js_binary:test13-1_mjs [k8-fastbuild]                                                               51ms
//js_binary:test13-2_cjs [k8-fastbuild]                                                               46ms
//js_binary:test13-2_mjs [k8-fastbuild]                                                               55ms
//js_binary:test4-b_cjs [k8-fastbuild]                                                                73ms
//js_binary:test4-b_mjs [k8-fastbuild]                                                                61ms
//js_binary:test4-cjs-a [k8-fastbuild]                                                                47ms
//js_binary:test4-mjs-a [k8-fastbuild]                                                                36ms
//js_binary:test5_cjs [k8-fastbuild]                                                                  71ms
//js_binary:test5_mjs [k8-fastbuild]                                                                  72ms
//js_binary:test6 [k8-fastbuild]                                                                      91ms
//js_binary:test6_alt [k8-fastbuild]                                                                  94ms
//js_binary:test8 [k8-fastbuild]                                                                      57ms
//js_binary:test_cjs [k8-fastbuild]                                                                   86ms
//js_binary:test_exitcode [k8-fastbuild]                                                              106ms
//js_binary:test_js_binary_under_custom_rule [k8-fastbuild]                                           42ms
//js_binary:test_js_binary_under_custom_rule_local [k8-fastbuild]                                     58ms
//js_binary:test_js_binary_under_genrule_cjs [k8-fastbuild]                                           62ms
//js_binary:test_js_binary_under_genrule_mjs [k8-fastbuild]                                           32ms
//js_binary:test_js_binary_under_js_run_binary_cjs [k8-fastbuild]                                     67ms
//js_binary:test_js_binary_under_js_run_binary_local_cjs [k8-fastbuild]                               68ms
//js_binary:test_js_binary_under_js_run_binary_local_mjs [k8-fastbuild]                               37ms
//js_binary:test_js_binary_under_js_run_binary_mjs [k8-fastbuild]                                     45ms
//js_binary:test_js_binary_under_js_run_binary_no_copy_data_to_bin [k8-fastbuild]                     49ms
//js_binary:test_mjs [k8-fastbuild]                                                                   164ms
//js_binary:test_stderr [k8-fastbuild]                                                                77ms
//js_binary:test_stdout [k8-fastbuild]                                                                64ms
//js_lib_pkg/b:test_each_target [k8-fastbuild]                                                        133ms
//js_lib_pkg/b:test_parent_target [k8-fastbuild]                                                      221ms
//js_library/two:two_test [k8-fastbuild]                                                              149ms
//linked_consumer:direct [k8-fastbuild]                                                               152ms
//linked_consumer:pkg [k8-fastbuild]                                                                  142ms
//linked_consumer:sources_test [k8-fastbuild]                                                         56ms
//linked_consumer:types_test [k8-fastbuild]                                                           36ms
//linked_empty_node_modules:test [k8-fastbuild]                                                       56ms
//macro:test_all [k8-fastbuild]                                                                       665ms
//macro:test_cjs [k8-fastbuild]                                                                       482ms
//macro:test_esm [k8-fastbuild]                                                                       612ms
//macro:test_js [k8-fastbuild]                                                                        482ms
//nextjs:next_build_test [k8-fastbuild]                                                               36ms
//nextjs:write_next_links_defs_test [k8-fastbuild]                                                    106ms
//npm_deps/patches:patches_update_test [k8-fastbuild]                                                 105ms
//npm_deps:circular_deps_build_test [k8-fastbuild]                                                    37ms
//npm_deps:rollup_version_test [k8-fastbuild]                                                         181ms
//npm_deps:test1 [k8-fastbuild]                                                                       31ms
//npm_deps:test10_cjs [k8-fastbuild]                                                                  163ms
//npm_deps:test10_mjs [k8-fastbuild]                                                                  146ms
//npm_deps:test11_cjs [k8-fastbuild]                                                                  304ms
//npm_deps:test11_mjs [k8-fastbuild]                                                                  179ms
//npm_deps:test3 [k8-fastbuild]                                                                       115ms
//npm_deps:test4 [k8-fastbuild]                                                                       86ms
//npm_deps:test5 [k8-fastbuild]                                                                       52ms
//npm_deps:test5_alt [k8-fastbuild]                                                                   50ms
//npm_deps:test6 [k8-fastbuild]                                                                       126ms
//npm_deps:test7_a [k8-fastbuild]                                                                     124ms
//npm_deps:test7_b_cjs [k8-fastbuild]                                                                 189ms
//npm_deps:test7_b_mjs [k8-fastbuild]                                                                 159ms
//npm_deps:test8 [k8-fastbuild]                                                                       151ms
//npm_deps:test9_cjs [k8-fastbuild]                                                                   252ms
//npm_deps:test9_mjs [k8-fastbuild]                                                                   186ms
//npm_deps:test_peer [k8-fastbuild]                                                                   176ms
//npm_deps:test_uvu_version [k8-fastbuild]                                                            214ms
//package_json_module:test [k8-fastbuild]                                                             591ms
//rspack:build_test [k8-fastbuild]                                                                    60ms
//runfiles:module_name_runfiles [k8-fastbuild]                                                        161ms
//runfiles:outer_runfiles [k8-fastbuild]                                                              196ms
//runfiles:run_outer_binary_asserts__direct_srcs [k8-fastbuild]                                       128ms
//runfiles:run_outer_binary_asserts__transitive_data [k8-fastbuild]                                   103ms
//runfiles:run_test_binary_asserts__direct_srcs [k8-fastbuild]                                        74ms
//runfiles:run_test_binary_asserts__transitive_data [k8-fastbuild]                                    90ms
//runfiles:runfiles [k8-fastbuild]                                                                    125ms
//stack_traces:stack_traces [k8-fastbuild]                                                            130ms
//stamped_package_json:stamp_test [k8-fastbuild]                                                      56ms
//vite3:build_test [k8-fastbuild]                                                                     28ms
//vite6:build_test [k8-fastbuild]                                                                     59ms
//webpack_cli:test [k8-fastbuild]                                                                     319ms
//worker:test_pi [k8-fastbuild]                                                                       135ms

Bazel 8 (Test)

examples

All tests were cache hits

83 tests (100.0%) were fully cached saving 11s.


Bazel 9 (Test)

examples

All tests were cache hits

83 tests (100.0%) were fully cached saving 12s.


Buildifier      Format

@acozzette acozzette marked this pull request as ready for review May 15, 2026 04:45
@acozzette acozzette requested a review from jbedard May 15, 2026 04:46
Comment thread examples/rspack/rspack.config.cjs
@jbedard jbedard requested a review from nickschaap May 17, 2026 02:21
@acozzette
Copy link
Copy Markdown
Contributor Author

I went ahead and updated a bunch of other examples in the repo to use this same pattern. Luckily it was easy to just point Claude at the original example and ask it to imitate that.

@jbedard
Copy link
Copy Markdown
Member

jbedard commented May 19, 2026

I think we need to find a way to still directly invoke vite_bin.vite() and not force vite_bin.vite_binary() + js_run_binary.

Wrapping things like tool config files+deps into js_library is fine though, imo.

@acozzette
Copy link
Copy Markdown
Contributor Author

I tweaked things so that now we are down to just one js_library for the config and one call to vite_bin.bin() (or whatever the particular tool might be).

Comment thread js/private/coverage/bundle/BUILD.bazel
Comment thread examples/rspack/BUILD.bazel
Comment thread examples/rspack/BUILD.bazel
acozzette and others added 15 commits May 19, 2026 20:47
This example started out as a test case by @jbedard and @nickschaap showing how
`js_run_binary` can sometimes fail to work correctly when the execution and
target platforms are different.

I was able to get it working, primarily by setting `use_execroot_entry_point =
False`. The problem with the default behavior (`use_execroot_entry_point =
True`) is that it runs target-platform sources during the build action, which
can go haywire if the target platform is meaningfully different from the
execution platform.

Getting all the sources in the right place and built for the right platform is
not entirely straightforward, so I thought it would be good to have a simple
example showing this. I added a lot of comments trying to explain why
everything is set up the way it is.
…tform separation

For webpack and rollup invocations, configs and their npm plugin/loader
dependencies now live in the tool binary's runfiles rather than being
passed as target-platform action inputs. This ensures all exec-platform
code runs from the same runfiles tree, avoiding resolution failures in
cross-platform builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…orm separation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…orm separation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…/target platform separation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@acozzette acozzette changed the title test: add an example of how to invoke Rspack feat: streamline invocation of binaries from npm and update examples May 20, 2026
Comment thread npm/private/npm_import.bzl
Comment thread npm/private/npm_import.bzl
@acozzette acozzette merged commit ddc5c47 into aspect-build:main May 20, 2026
16 checks passed
@acozzette acozzette deleted the rspack-example branch May 20, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants