Skip to content

test: add an example of how to invoke Rspack#2846

Open
acozzette wants to merge 2 commits into
aspect-build:mainfrom
acozzette:rspack-example
Open

test: add an example of how to invoke Rspack#2846
acozzette wants to merge 2 commits into
aspect-build:mainfrom
acozzette:rspack-example

Conversation

@acozzette
Copy link
Copy Markdown
Contributor

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.


Changes are visible to end-users: no

Test plan

  • 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
//js/private/coverage:coverage_checked_test [k8-fastbuild]                                               52ms
//js/private/devserver:watch_checked_test [k8-fastbuild]                                                 57ms
//js/private/node-patches:checked_in_compile_test [k8-fastbuild]                                         34ms
//js/private/test/data:extract-js_library-srcs2 [k8-fastbuild]                                           55ms
//js/private/test/data:extract-write-generated [k8-fastbuild]                                            58ms
//js/private/test/data:extract-write-js_library-srcs [k8-fastbuild]                                      55ms
//js/private/test/data:from-data [k8-fastbuild]                                                          101ms
//js/private/test/data:from-js_library-data [k8-fastbuild]                                               77ms
//js/private/test/data:from-js_library-srcs [k8-fastbuild]                                               96ms
//js/private/test/data:from-js_run_binary-genrule-copied [k8-fastbuild]                                  160ms
//js/private/test/data:from-js_run_binary-js_library-data [k8-fastbuild]                                 85ms
//js/private/test/data:from-js_run_binary-js_library-srcs [k8-fastbuild]                                 137ms
//js/private/test/data:from-parent-genrule [k8-fastbuild]                                                70ms
//js/private/test/data:source-data-execpath [k8-fastbuild]                                               123ms
//js/private/test/fixed_args:fixed_args_test [k8-fastbuild]                                              104ms
//js/private/test/fixed_args:locations_test [k8-fastbuild]                                               129ms
//js/private/test/fixed_args:locations_test_no_expand [k8-fastbuild]                                     115ms
//js/private/test/image/non_ascii:assert_custom_layer_groups_test_just_the_fs_patch_test [k8-fastbuild]  55ms
//js/private/test/image/non_ascii:assert_custom_layer_groups_test_node_modules_test [k8-fastbuild]       35ms
//js/private/test/image/non_ascii:assert_custom_layer_groups_test_package_store_1p_test [k8-fastbuild]   62ms
//js/private/test/image/non_ascii:assert_custom_layer_groups_test_package_store_3p_test [k8-fastbuild]   76ms
//js/private/test/image:assert_custom_layers_nomatch_test_app_test [k8-fastbuild]                        54ms
//js/private/test/image:assert_custom_owner_test_node_modules_test [k8-fastbuild]                        66ms
//js/private/test/image:assert_custom_owner_test_package_store_3p_test [k8-fastbuild]                    36ms
//js/private/test/image:assert_default_test_app_test [k8-fastbuild]                                      71ms
//js/private/test/image:assert_default_test_node_modules_test [k8-fastbuild]                             40ms
//js/private/test/image:assert_default_test_node_test [k8-fastbuild]                                     43ms
//js/private/test/image:assert_default_test_package_store_1p_test [k8-fastbuild]                         44ms
//js/private/test/image:assert_regex_edge_cases_test_app_test [k8-fastbuild]                             36ms
//js/private/test/image:assert_regex_edge_cases_test_odd_characters_test [k8-fastbuild]                  31ms
//js/private/test/image:assert_regex_edge_cases_test_package_store_3p_test [k8-fastbuild]                64ms
//js/private/test/js_binary_sh:BAZEL_BUILD_FILE_PATH_test [k8-fastbuild]                                 176ms
//js/private/test/js_binary_sh:BAZEL_TARGET_NAME_test [k8-fastbuild]                                     94ms
//js/private/test/js_binary_sh:JS_BINARY__WORKSPACE_test [k8-fastbuild]                                  174ms
//js/private/test/js_binary_sh:env_json_launcher_escaped [k8-fastbuild]                                  71ms
//js/private/test/js_binary_sh:env_json_str_launcher_escaped [k8-fastbuild]                              76ms
//js/private/test/no_copy_to_bin:no_copy_to_bin_test [k8-fastbuild]                                      104ms
//js/private/test/node-patches:escape_nodejs_test [k8-fastbuild]                                         108ms
//js/private/test/node-patches:lstat_node24_test [k8-fastbuild]                                          150ms
//js/private/test/node-patches:opendir_node20_test [k8-fastbuild]                                        279ms
//js/private/test/node-patches:opendir_node24_test [k8-fastbuild]                                        233ms
//js/private/test/node-patches:opendir_nodejs_cjs_test [k8-fastbuild]                                    145ms
//js/private/test/node-patches:opendir_nodejs_test [k8-fastbuild]                                        189ms
//js/private/test/node-patches:readdir_node20_test [k8-fastbuild]                                        232ms
//js/private/test/node-patches:readdir_node22_cjs_test [k8-fastbuild]                                    162ms
//js/private/test/node-patches:readlink_node20_cjs_test [k8-fastbuild]                                   144ms
//js/private/test/node-patches:readlink_node22_test [k8-fastbuild]                                       217ms
//js/private/test/node-patches:readlink_nodejs_test [k8-fastbuild]                                       167ms
//js/private/test/node-patches:realpath_node20_cjs_test [k8-fastbuild]                                   158ms
//js/private/test/node-patches:realpath_node24_cjs_test [k8-fastbuild]                                   248ms
//js/private/test/node-patches:spawn_test_node20 [k8-fastbuild]                                          932ms
//js/private/test/node-patches:spawn_test_node24 [k8-fastbuild]                                          723ms
//js/private/test/node-patches:spawn_test_nodejs [k8-fastbuild]                                          643ms
//js/private/test/proto:cross_package_dep_fail_test [k8-fastbuild]                                       27ms
//js/private/test/proto:proto_args_test [k8-fastbuild]                                                   29ms
//js/private/test/proto:proto_rewrite_imports_test [k8-fastbuild]                                        28ms
//js/private/test:data_in_runfiles_test [k8-fastbuild]                                                   40ms
//js/private/test:explicit_types_test [k8-fastbuild]                                                     72ms
//js/private/test:main_toolchain_20 [k8-fastbuild]                                                       133ms
//js/private/test:run_environment_info_tests_binary_env_test [k8-fastbuild]                              87ms
//js/private/test:run_environment_info_tests_test_inherit_only_subject [k8-fastbuild]                    145ms
//js/private/test:run_environment_info_tests_test_inherit_only_test [k8-fastbuild]                       60ms
//js/private/test:transitive_type_deps_empty_srcs_test [k8-fastbuild]                                    35ms
//js/private/test:transitive_type_deps_test [k8-fastbuild]                                               68ms
//js/private/test:write_launcher_test [k8-fastbuild]                                                     116ms
//js/private/watch:watch_checked_1_test [k8-fastbuild]                                                   82ms
//js/private/worker:worker_checked_test [k8-fastbuild]                                                   43ms
//npm/private/test/npm_package:test_pkg_5 [k8-fastbuild]                                                 50ms
//npm/private/test/npm_package:test_pkg_with_node_modules [k8-fastbuild]                                 103ms
//npm/private/test/subs:require_non-importers_test [k8-fastbuild]                                        103ms
//npm/private/test:__rollup-test [k8-fastbuild]                                                          185ms
//npm/private/test:node_modules_test [k8-fastbuild]                                                      21ms
//npm/private/test:npm_auth_tests_test_1 [k8-fastbuild]                                                  66ms
//npm/private/test:npm_auth_tests_test_4 [k8-fastbuild]                                                  93ms
//npm/private/test:pkg_versions_test [k8-fastbuild]                                                      53ms
//npm/private/test:test_generated_pkg_json___rollup-target_copy_srcs_to_bin_tagged_manual [k8-fastbuild] 109ms
//npm/private/test:test_generated_pkg_json___rollup-target_js_info_files_tagged_manual [k8-fastbuild]    80ms
//npm/private/test:test_generated_pkg_json_only_expected_properties [k8-fastbuild]                       77ms
//npm/private/test:test_npm_package_visibility_test_10 [k8-fastbuild]                                    75ms
//npm/private/test:test_npm_package_visibility_test_12 [k8-fastbuild]                                    62ms
//npm/private/test:test_npm_package_visibility_test_4 [k8-fastbuild]                                     60ms
//npm/private/test:test_npm_package_visibility_test_5 [k8-fastbuild]                                     41ms
//npm/private/test:test_npmrc_test_1 [k8-fastbuild]                                                      71ms
//npm/private/test:test_npmrc_test_4 [k8-fastbuild]                                                      77ms
//npm/private/test:test_npmrc_test_6 [k8-fastbuild]                                                      109ms
//npm/private/test:test_pnpm_test_0 [k8-fastbuild]                                                       75ms
//npm/private/test:test_pnpm_test_11 [k8-fastbuild]                                                      84ms
//npm/private/test:test_pnpm_test_8 [k8-fastbuild]                                                       77ms
//npm/private/test:test_pnpm_test_9 [k8-fastbuild]                                                       57ms
//npm/private/test:test_transitive_closure_test_0 [k8-fastbuild]                                         68ms
//npm/private/test:test_transitive_closure_test_1 [k8-fastbuild]                                         84ms
//npm/private/test:test_translate_lock_test_0 [k8-fastbuild]                                             61ms
//npm/private/test:test_translate_lock_test_2 [k8-fastbuild]                                             57ms
//npm/private/test:test_translate_lock_test_3 [k8-fastbuild]                                             65ms
//npm/private/test:test_translate_lock_test_4 [k8-fastbuild]                                             39ms
//npm/private/test:test_utils_test_3 [k8-fastbuild]                                                      84ms
//npm/private/test:test_utils_test_5 [k8-fastbuild]                                                      63ms
//npm/private/test:write_npm_translate_lock_6_test [k8-fastbuild]                                        201ms
//npm/private/test:write_npm_translate_lock_7_test [k8-fastbuild]                                        170ms
//npm/private/test:write_npm_translate_lock_9_test [k8-fastbuild]                                        152ms
+ 157 other targets

Bazel 8 (Test)

All tests were cache hits

217 tests (100.0%) were fully cached saving 27s.


Bazel 9 (Test)

All tests were cache hits

217 tests (100.0%) were fully cached saving 30s.


Bazel 7 (Test)

e2e/bzlmod

7 test targets passed

Targets
//:check_styles [k8-fastbuild]                                                                           124ms
//:jasmine_test [k8-fastbuild]                                                                           187ms
//:node_modules_test [k8-fastbuild]                                                                      58ms
//:other_module_binary_test [k8-fastbuild]                                                               63ms
//:other_module_linked_packages [k8-fastbuild]                                                           29ms
//:other_module_run_binary_test [k8-fastbuild]                                                           60ms
//:test [k8-fastbuild]                                                                                   92ms

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                                                                                  19ms

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]                                                                                   63ms
//:write_npm_translate_lock_bzlmod_test [k8-fastbuild]                                                   81ms

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]                                                               70ms
//:test [k8-fastbuild]                                                                                   37ms
@@workspace~//:js_binary_chdir_test [k8-fastbuild]                                                       76ms
@@workspace~//:js_test_chdir_test [k8-fastbuild]                                                         120ms

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]                                                                            25ms
//v15/esm:test [k8-fastbuild]                                                                            24ms
//v15/mjs:test [k8-fastbuild]                                                                            57ms

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]                                                                            194ms
//cjs:package_store_targets_test [k8-fastbuild]                                                          78ms
//esm/src:test [k8-fastbuild]                                                                            144ms
//esm:package_store_targets_test [k8-fastbuild]                                                          85ms

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]                                                                           125ms
//root:package_store_targets_test [k8-fastbuild]                                                         27ms

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                                                                                                  42ms
//:test_dev_filtering                                                                                    225ms
//:test_prod_filtering                                                                                   221ms

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]                                                                                   30ms
//:write_npm_translate_lock_defs_0_test [k8-fastbuild]                                                   112ms
//:write_npm_translate_lock_defs_1_test [k8-fastbuild]                                                   149ms

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]                                                                                   26ms
//:write_npm_translate_lock_bzlmod_test [k8-fastbuild]                                                   109ms

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                                                                                               25ms

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                                                                                              43ms
//app2:test                                                                                              34ms

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                                                                                              24ms

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]                                                                      61ms
//:test [k8-fastbuild]                                                                                   101ms
//:utils_test [k8-fastbuild]                                                                             81ms
//:write_npm_translate_lock_bzlmod_test [k8-fastbuild]                                                   56ms

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                                                                                            89ms

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                                                                                                  17ms

Bazel 8 (Test)

e2e/npm_translate_package_lock

All tests were cache hits

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


Bazel 9 (Test)

e2e/npm_translate_package_lock

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/npm_translate_yarn_lock

Buildkite build #12712 is running...


Bazel 8 (Test)

e2e/npm_translate_yarn_lock

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/npm_translate_yarn_lock

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/output_paths

Buildkite build #12712 is running...


Bazel 8 (Test)

e2e/output_paths

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/output_paths

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/patch_from_repo

1 test target passed

Targets
//:test                                                                                                  20ms

Bazel 7 (Test)

e2e/pnpm_lockfiles

59 test targets passed

Targets
//cases/docusaurus-direct-peer-v9:docusaurus_direct_with_peers [k8-fastbuild]                            49ms
//cases/isaacs-cliui-v90:isaacs_cliui [k8-fastbuild]                                                     57ms
//cases/multi-document-v11:multi_document_v11 [k8-fastbuild]                                             73ms
//cases/nested-peer-v9:nested_peers_targets [k8-fastbuild]                                               68ms
//cases/override-with-alias-url-v9:override-with-alias-url-v9 [k8-fastbuild]                             93ms
//cases/versionless-patch-v9:versionless_patch_targets [k8-fastbuild]                                    30ms
//cases/versionless-patch-v9:versionless_patch_test [k8-fastbuild]                                       162ms
//cases/workspace-peer-v9:optional_peers_targets [k8-fastbuild]                                          79ms
//v101:aliases-test [k8-fastbuild]                                                                       205ms
//v101:patch-test [k8-fastbuild]                                                                         119ms
//v101:repos_0_test [k8-fastbuild]                                                                       90ms
//v101:repos_10_test [k8-fastbuild]                                                                      91ms
//v101:repos_11_test [k8-fastbuild]                                                                      93ms
//v101:repos_12_test [k8-fastbuild]                                                                      82ms
//v101:repos_13_test [k8-fastbuild]                                                                      88ms
//v101:repos_1_test [k8-fastbuild]                                                                       96ms
//v101:repos_2_test [k8-fastbuild]                                                                       133ms
//v101:repos_3_test [k8-fastbuild]                                                                       143ms
//v101:repos_4_test [k8-fastbuild]                                                                       94ms
//v101:repos_5_test [k8-fastbuild]                                                                       109ms
//v101:repos_6_test [k8-fastbuild]                                                                       82ms
//v101:repos_7_test [k8-fastbuild]                                                                       92ms
//v101:repos_8_test [k8-fastbuild]                                                                       136ms
//v101:repos_9_test [k8-fastbuild]                                                                       121ms
//v101:targets [k8-fastbuild]                                                                            25ms
//v110:aliases-test [k8-fastbuild]                                                                       183ms
//v110:patch-test [k8-fastbuild]                                                                         119ms
//v110:repos_0_test [k8-fastbuild]                                                                       105ms
//v110:repos_10_test [k8-fastbuild]                                                                      88ms
//v110:repos_11_test [k8-fastbuild]                                                                      118ms
//v110:repos_12_test [k8-fastbuild]                                                                      102ms
//v110:repos_13_test [k8-fastbuild]                                                                      99ms
//v110:repos_1_test [k8-fastbuild]                                                                       81ms
//v110:repos_2_test [k8-fastbuild]                                                                       80ms
//v110:repos_3_test [k8-fastbuild]                                                                       96ms
//v110:repos_4_test [k8-fastbuild]                                                                       83ms
//v110:repos_5_test [k8-fastbuild]                                                                       102ms
//v110:repos_6_test [k8-fastbuild]                                                                       126ms
//v110:repos_7_test [k8-fastbuild]                                                                       61ms
//v110:repos_8_test [k8-fastbuild]                                                                       132ms
//v110:repos_9_test [k8-fastbuild]                                                                       99ms
//v110:targets [k8-fastbuild]                                                                            42ms
//v90:aliases-test [k8-fastbuild]                                                                        221ms
//v90:patch-test [k8-fastbuild]                                                                          123ms
//v90:repos_0_test [k8-fastbuild]                                                                        69ms
//v90:repos_10_test [k8-fastbuild]                                                                       78ms
//v90:repos_11_test [k8-fastbuild]                                                                       110ms
//v90:repos_12_test [k8-fastbuild]                                                                       84ms
//v90:repos_13_test [k8-fastbuild]                                                                       110ms
//v90:repos_1_test [k8-fastbuild]                                                                        130ms
//v90:repos_2_test [k8-fastbuild]                                                                        119ms
//v90:repos_3_test [k8-fastbuild]                                                                        83ms
//v90:repos_4_test [k8-fastbuild]                                                                        74ms
//v90:repos_5_test [k8-fastbuild]                                                                        85ms
//v90:repos_6_test [k8-fastbuild]                                                                        93ms
//v90:repos_7_test [k8-fastbuild]                                                                        82ms
//v90:repos_8_test [k8-fastbuild]                                                                        101ms
//v90:repos_9_test [k8-fastbuild]                                                                        76ms
//v90:targets [k8-fastbuild]                                                                             30ms

Bazel 8 (Test)

e2e/pnpm_lockfiles

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/pnpm_lockfiles

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/pnpm_repo_install

Buildkite build #12712 is running...


Bazel 8 (Test)

e2e/pnpm_repo_install

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/pnpm_repo_install

All tests were cache hits

4 tests (100.0%) were fully cached saving 4s.


Bazel 7 (Test)

e2e/pnpm_workspace

Buildkite build #12712 is running...


Bazel 8 (Test)

e2e/pnpm_workspace

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/pnpm_workspace

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/pnpm_workspace_deps

3 test targets passed

Targets
//tests:direct [k8-fastbuild]                                                                            81ms
//tests:dupes [k8-fastbuild]                                                                             68ms
//tests:pkg [k8-fastbuild]                                                                               76ms

Bazel 8 (Test)

e2e/pnpm_workspace_deps

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/pnpm_workspace_deps

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/pnpm_workspace_rerooted

Buildkite build #12712 is running...


Bazel 8 (Test)

e2e/pnpm_workspace_rerooted

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/pnpm_workspace_rerooted

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/protobuf-es

Buildkite build #12712 is running...


Bazel 8 (Test)

e2e/protobuf-es

Buildkite build #12712 is running...


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 #12712 is running...


Bazel 8 (Test)

e2e/protobuf-google

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/protobuf-google

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/repo_mapping

Buildkite build #12712 is running...


Bazel 8 (Test)

e2e/repo_mapping

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/repo_mapping

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/vendored_node

Buildkite build #12712 is running...


Bazel 8 (Test)

e2e/vendored_node

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/vendored_node

Buildkite build #12712 is running...


Bazel 7 (Test)

e2e/vendored_tarfile

1 test target passed

Targets
//:test                                                                                                  29ms

Bazel 8 (Test)

e2e/vendored_tarfile

Buildkite build #12712 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 #12712 is running...


Bazel 8 (Test)

e2e/verify_patches

Buildkite build #12712 is running...


Bazel 9 (Test)

e2e/verify_patches

All tests were cache hits

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


Bazel 7 (Test)

examples

84 test targets passed

Targets
//:linked_packages_build_test [k8-fastbuild]                                                             73ms
//coverage:coverage [k8-fastbuild]                                                                       81ms
//genrule:test_acorn [k8-fastbuild]                                                                      37ms
//genrule:test_require_acorn [k8-fastbuild]                                                              43ms
//js_binary:aspect_bin_a_test [k8-fastbuild]                                                             129ms
//js_binary:case7_test [k8-fastbuild]                                                                    122ms
//js_binary:npm_version_test [k8-fastbuild]                                                              306ms
//js_binary:test13-1_cjs [k8-fastbuild]                                                                  45ms
//js_binary:test13-1_mjs [k8-fastbuild]                                                                  50ms
//js_binary:test13-2_cjs [k8-fastbuild]                                                                  76ms
//js_binary:test13-2_mjs [k8-fastbuild]                                                                  66ms
//js_binary:test4-b_cjs [k8-fastbuild]                                                                   56ms
//js_binary:test4-b_mjs [k8-fastbuild]                                                                   34ms
//js_binary:test4-cjs-a [k8-fastbuild]                                                                   46ms
//js_binary:test4-mjs-a [k8-fastbuild]                                                                   52ms
//js_binary:test5_cjs [k8-fastbuild]                                                                     40ms
//js_binary:test5_mjs [k8-fastbuild]                                                                     29ms
//js_binary:test6 [k8-fastbuild]                                                                         52ms
//js_binary:test6_alt [k8-fastbuild]                                                                     72ms
//js_binary:test8 [k8-fastbuild]                                                                         44ms
//js_binary:test_cjs [k8-fastbuild]                                                                      205ms
//js_binary:test_exitcode [k8-fastbuild]                                                                 41ms
//js_binary:test_js_binary_under_custom_rule [k8-fastbuild]                                              65ms
//js_binary:test_js_binary_under_custom_rule_local [k8-fastbuild]                                        58ms
//js_binary:test_js_binary_under_genrule_cjs [k8-fastbuild]                                              45ms
//js_binary:test_js_binary_under_genrule_mjs [k8-fastbuild]                                              74ms
//js_binary:test_js_binary_under_js_run_binary_cjs [k8-fastbuild]                                        47ms
//js_binary:test_js_binary_under_js_run_binary_local_cjs [k8-fastbuild]                                  41ms
//js_binary:test_js_binary_under_js_run_binary_local_mjs [k8-fastbuild]                                  48ms
//js_binary:test_js_binary_under_js_run_binary_mjs [k8-fastbuild]                                        29ms
//js_binary:test_js_binary_under_js_run_binary_no_copy_data_to_bin [k8-fastbuild]                        54ms
//js_binary:test_mjs [k8-fastbuild]                                                                      104ms
//js_binary:test_stderr [k8-fastbuild]                                                                   71ms
//js_binary:test_stdout [k8-fastbuild]                                                                   44ms
//js_lib_pkg/b:test_each_target [k8-fastbuild]                                                           108ms
//js_lib_pkg/b:test_parent_target [k8-fastbuild]                                                         77ms
//js_library/two:two_test [k8-fastbuild]                                                                 97ms
//linked_consumer:direct [k8-fastbuild]                                                                  92ms
//linked_consumer:pkg [k8-fastbuild]                                                                     142ms
//linked_consumer:sources_test [k8-fastbuild]                                                            51ms
//linked_consumer:types_test [k8-fastbuild]                                                              55ms
//linked_empty_node_modules:test [k8-fastbuild]                                                          31ms
//macro:test_all [k8-fastbuild]                                                                          607ms
//macro:test_cjs [k8-fastbuild]                                                                          747ms
//macro:test_esm [k8-fastbuild]                                                                          607ms
//macro:test_js [k8-fastbuild]                                                                           435ms
//nextjs:next_build_test [k8-fastbuild]                                                                  41ms
//nextjs:write_next_links_defs_test [k8-fastbuild]                                                       109ms
//npm_deps/patches:patches_update_test [k8-fastbuild]                                                    105ms
//npm_deps:circular_deps_build_test [k8-fastbuild]                                                       25ms
//npm_deps:rollup_version_test [k8-fastbuild]                                                            231ms
//npm_deps:test1 [k8-fastbuild]                                                                          54ms
//npm_deps:test10_cjs [k8-fastbuild]                                                                     156ms
//npm_deps:test10_mjs [k8-fastbuild]                                                                     343ms
//npm_deps:test11_cjs [k8-fastbuild]                                                                     191ms
//npm_deps:test11_mjs [k8-fastbuild]                                                                     141ms
//npm_deps:test3 [k8-fastbuild]                                                                          93ms
//npm_deps:test4 [k8-fastbuild]                                                                          173ms
//npm_deps:test5 [k8-fastbuild]                                                                          52ms
//npm_deps:test5_alt [k8-fastbuild]                                                                      70ms
//npm_deps:test6 [k8-fastbuild]                                                                          113ms
//npm_deps:test7_a [k8-fastbuild]                                                                        146ms
//npm_deps:test7_b_cjs [k8-fastbuild]                                                                    207ms
//npm_deps:test7_b_mjs [k8-fastbuild]                                                                    192ms
//npm_deps:test8 [k8-fastbuild]                                                                          91ms
//npm_deps:test9_cjs [k8-fastbuild]                                                                      103ms
//npm_deps:test9_mjs [k8-fastbuild]                                                                      224ms
//npm_deps:test_peer [k8-fastbuild]                                                                      146ms
//npm_deps:test_uvu_version [k8-fastbuild]                                                               193ms
//package_json_module:test [k8-fastbuild]                                                                396ms
//rspack:build_test [k8-fastbuild]                                                                       60ms
//runfiles:module_name_runfiles [k8-fastbuild]                                                           111ms
//runfiles:outer_runfiles [k8-fastbuild]                                                                 233ms
//runfiles:run_outer_binary_asserts__direct_srcs [k8-fastbuild]                                          89ms
//runfiles:run_outer_binary_asserts__transitive_data [k8-fastbuild]                                      101ms
//runfiles:run_test_binary_asserts__direct_srcs [k8-fastbuild]                                           98ms
//runfiles:run_test_binary_asserts__transitive_data [k8-fastbuild]                                       103ms
//runfiles:runfiles [k8-fastbuild]                                                                       206ms
//stack_traces:stack_traces [k8-fastbuild]                                                               85ms
//stamped_package_json:stamp_test [k8-fastbuild]                                                         117ms
//vite3:build_test [k8-fastbuild]                                                                        35ms
//vite6:build_test [k8-fastbuild]                                                                        39ms
//webpack_cli:test [k8-fastbuild]                                                                        673ms
//worker:test_pi [k8-fastbuild]                                                                          114ms

Bazel 8 (Test)

examples

All tests were cache hits

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


Bazel 9 (Test)

examples

All tests were cache hits

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


Buildifier      Format

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.
@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

module.exports = defineConfig({
entry: {
main: './rspack_entry.js',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is rspack resolving this from the current working directory or relative to the config file since the config file will live in a separate bazel-out tree than than this entrypoint

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's resolving it from the current working directory. js_run_binary's working directory is basically "bazel-out/<target platform>/bin/" + chdir where in this case chdir is "rspack".

For the output path below, I did have to replace __dirname with process.cwd() to reflect that the config file is no longer placed in the target platform bin directory.

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.

2 participants