diff --git a/.bazelrc.common b/.bazelrc.common index dfa97f05c8..c950f2042f 100644 --- a/.bazelrc.common +++ b/.bazelrc.common @@ -70,3 +70,7 @@ build --incompatible_strict_action_env # Enable with --config=release build:release --stamp --workspace_status_command=$(pwd)/workspace_status.sh + +# Config to enable building and testing with bzlmod +common:bzlmod --enable_bzlmod +common:bzlmod --//:flag_bzlmod diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8d0084dfbe..71a1baf99b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -174,8 +174,6 @@ jobs: - bazelversion: 5.1.1 bzlmodEnabled: true # TODO: un-exclude the following bzlmod tests once they work - - folder: . - bzlmodEnabled: true - folder: e2e/js_image_docker bzlmodEnabled: true - folder: e2e/js_image_oci @@ -236,17 +234,24 @@ jobs: ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }} ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }} - - name: Set bzlmod flag + - name: Set bzlmod flag (for integration tests) # Store the --enable_bzlmod flag that we add to the test command below # only when we're running bzlmod in our test matrix. id: set_bzlmod_flag - if: matrix.bzlmodEnabled + if: ${{ matrix.bzlmodEnabled && matrix.folder != '.'}} run: echo "bzlmod_flag=--enable_bzlmod" >> $GITHUB_OUTPUT + - name: Set bzlmod configuration (for test //...) + # Store the --enable_bzlmod flag that we add to the test command below + # only when we're running bzlmod in our test matrix. + id: set_bzlmod_config + if: ${{ matrix.bzlmodEnabled && matrix.folder == '.'}} + run: echo "bzlmod_config=--config=bzlmod" >> $GITHUB_OUTPUT + - name: bazel test //... working-directory: ${{ matrix.folder }} run: | - bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc test --config=${{ matrix.config }} ${{ steps.set_bzlmod_flag.outputs.bzlmod_flag }} //... + bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc test --config=${{ matrix.config }} ${{ steps.set_bzlmod_flag.outputs.bzlmod_flag }} ${{ steps.set_bzlmod_config.outputs.bzlmod_config }} //... ls $(bazel info output_base)/external | grep -v __links | grep -vz unused env: # Bazelisk will download bazel to here @@ -274,7 +279,7 @@ jobs: if: matrix.config == 'local' working-directory: ${{ matrix.folder }} run: | - bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc coverage --config=${{ matrix.config }} --instrument_test_targets //... + bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc coverage --config=${{ matrix.config }} ${{ steps.set_bzlmod_config.outputs.bzlmod_config }} --instrument_test_targets //... env: # Bazelisk will download bazel to here XDG_CACHE_HOME: ~/.cache/bazel-repo diff --git a/BUILD.bazel b/BUILD.bazel index 168cfa8fc1..2131585097 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,6 +4,7 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@buildifier_prebuilt//:rules.bzl", "buildifier") load("@npm//:defs.bzl", "npm_link_all_packages") load("@pnpm__links//:defs.bzl", npm_link_pnpm = "npm_link_imported_package") +load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") load("//npm:defs.bzl", "npm_link_package") # Link all packages from the /WORKSPACE npm_translate_lock(name = "npm") and also packages from @@ -61,3 +62,15 @@ buildifier( lint_mode = "warn", mode = "diff", ) + +bool_flag( + name = "flag_bzlmod", + build_setting_default = False, +) + +config_setting( + name = "bzlmod", + flag_values = { + ":flag_bzlmod": "true", + }, +) diff --git a/MODULE.bazel b/MODULE.bazel index aa6c91a07e..c0a4eb0db8 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -10,11 +10,21 @@ bazel_dep(name = "aspect_bazel_lib", version = "1.27.0") bazel_dep(name = "bazel_skylib", version = "1.4.1") bazel_dep(name = "rules_nodejs", version = "5.8.0") bazel_dep(name = "platforms", version = "0.0.4") +bazel_dep(name = "gazelle", version = "0.28.0", repo_name = "bazel_gazelle") +bazel_dep(name = "buildifier_prebuilt", version = "6.0.0.1", dev_dependency = True) +bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True) + +ext = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "ext") + +ext.host() + +use_repo(ext, "aspect_bazel_lib_host") node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node") node.toolchain( name = "nodejs", + node_version = "16.9.0", ) use_repo(node, "nodejs_toolchains") @@ -38,4 +48,125 @@ pnpm.pnpm( ) use_repo(pnpm, "pnpm") +use_repo(pnpm, "pnpm__links") + +############################################ +# Example npm dependencies + +npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True) + +npm.npm_translate_lock( + name = "npm", + bins = { + # derived from "bin" attribute in node_modules/typescript/package.json + "typescript": [ + "tsc=./bin/tsc", + "tsserver=./bin/tsserver", + ] + }, + custom_postinstalls = { + "@aspect-test/c": "echo moo > cow.txt", + "@aspect-test/c@2.0.2": "echo mooo >> cow.txt", + }, + data = [ + "//:examples/npm_deps/patches/meaning-of-life@1.0.0-pnpm.patch", + "//:package.json", + "//:pnpm-workspace.yaml", + "//examples/js_binary:package.json", + "//examples/macro:package.json", + "//examples/npm_deps:package.json", + "//examples/npm_package/libs/lib_a:package.json", + "//examples/npm_package/packages/pkg_a:package.json", + "//examples/npm_package/packages/pkg_b:package.json", + "//examples/webpack_cli:package.json", + "//js/private/coverage/bundle:package.json", + "//js/private/worker/src:package.json", + "//npm/private/test:package.json", + "//npm/private/test:vendored/lodash-4.17.21.tgz", + "//npm/private/test/npm_package:package.json", + "//npm/private/test/vendored/is-odd:package.json", + "//npm/private/test/vendored/semver-max:package.json", + ], + generate_bzl_library_targets = True, + lifecycle_hooks = { + # we fetch @kubernetes/client-node from source and it has a `prepare` lifecycle hook that needs to be run + "@kubernetes/client-node": ["prepare"], + # 'install' hook fails as it assumes the following path to `node-pre-gyp`: ./node_modules/.bin/node-pre-gyp + # https://github.com/stultuss/protoc-gen-grpc-ts/blob/53d52a9d0e1fe3cbe930dec5581eca89b3dde807/package.json#L28 + "protoc-gen-grpc@2.0.3": [], + }, + lifecycle_hooks_execution_requirements = { + "*": [ + "no-sandbox", + ], + # If @kubernetes/client-node is not sandboxed, will fail with + # ``` + # src/azure_auth.ts(97,43): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments. + # src/azure_auth.ts(98,34): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments. + # src/gcp_auth.ts(93,43): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments. + # src/gcp_auth.ts(94,34): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments. + # ``` + # since a `jsonpath-plus@7.2.0` that is newer then the transitive dep `jsonpath-plus@0.19.0` is found outside of the sandbox that + # includes typings that don't match the 0.19.0 "any" usage. + "@kubernetes/client-node": [], + "@figma/nodegit": [ + "no-sandbox", + # Workaround Engflow not honoring requires-network on build actions + "no-remote-exec", + "requires-network", + ], + "esbuild": [ + "no-sandbox", + # Workaround Engflow not honoring requires-network on build actions + "no-remote-exec", + "requires-network", + ], + "segfault-handler": [ + "no-sandbox", + # Workaround Engflow not honoring requires-network on build actions + "no-remote-exec", + "requires-network", + ], + }, + npmrc = "//:.npmrc", + patch_args = { + "*": ["-p1"], + "@gregmagolan/test-a": ["-p4"], + }, + patches = { + "@gregmagolan/test-a": ["//examples/npm_deps:patches/test-a.patch"], + "@gregmagolan/test-a@0.0.1": ["//examples/npm_deps:patches/test-a@0.0.1.patch"], + "@gregmagolan/test-b": ["//examples/npm_deps:patches/test-b.patch"], + "meaning-of-life@1.0.0": ["//examples/npm_deps:patches/meaning-of-life@1.0.0-after_pnpm.patch"], + }, + pnpm_lock = "//:pnpm-lock.yaml", + pnpm_version = "7.25.0", + public_hoist_packages = { + # Instructs the linker to hoist the ms@2.1.3 npm package to `node_modules/ms` in the `examples/npm_deps` package. + # Similar to adding `public-hoist-pattern[]=ms` in .npmrc but with control over which version to hoist and where + # to hoist it. This hoisted package can be referenced by the label `//examples/npm_deps:node_modules/ms` same as + # other direct dependencies in the `examples/npm_deps/package.json`. + "ms@2.1.3": ["examples/npm_deps"], + }, + update_pnpm_lock = True, + verify_node_modules_ignored = "//:.bazelignore", + verify_patches = "//examples/npm_deps/patches:patches", +) + +use_repo(npm, "npm", "npm__rollup__2.70.2", "npm__webpack-bundle-analyzer__4.5.0__bufferutil_4.0.7") + +# As an example, manually import a package using explicit coordinates. +# Just a demonstration of the syntax de-sugaring. +npm.npm_import( + name = "acorn__8.4.0", + bins = {"acorn": "./bin/acorn"}, + integrity = "sha512-ULr0LDaEqQrMFGyQ3bhJkLsbtrQ8QibAseGZeaSUiT/6zb9IvIkomWHJIvgvwad+hinRAgsI51JcWk2yvwyL+w==", + package = "acorn", + # Root package where to link the virtual store + root_package = "", + version = "8.4.0", +) + +use_repo(npm, "acorn__8.4.0") +use_repo(npm, "acorn__8.4.0__links") diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 3d6194f05c..f430e77f30 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -3,46 +3,97 @@ load("@aspect_bazel_lib//lib:docs.bzl", "stardoc_with_diff_test", "update_docs") stardoc_with_diff_test( name = "js_binary", bzl_library_target = "//js/private:js_binary", + # https://github.com/bazelbuild/stardoc/pull/141 + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) stardoc_with_diff_test( name = "js_library", bzl_library_target = "//js/private:js_library", + # https://github.com/bazelbuild/stardoc/pull/141 + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) stardoc_with_diff_test( name = "js_run_binary", bzl_library_target = "//js/private:js_run_binary", + # https://github.com/bazelbuild/stardoc/pull/141 + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) stardoc_with_diff_test( name = "js_run_devserver", bzl_library_target = "//js/private:js_run_devserver", + # https://github.com/bazelbuild/stardoc/pull/141 + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) stardoc_with_diff_test( name = "js_filegroup", bzl_library_target = "//js/private:js_filegroup", + # https://github.com/bazelbuild/stardoc/pull/141 + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) stardoc_with_diff_test( name = "js_image_layer", bzl_library_target = "//js/private:js_image_layer", + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) stardoc_with_diff_test( name = "npm_package", bzl_library_target = "//npm/private:npm_package", + # https://github.com/bazelbuild/stardoc/pull/141 + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) stardoc_with_diff_test( name = "npm_link_package", bzl_library_target = "//npm/private:npm_link_package", + # https://github.com/bazelbuild/stardoc/pull/141 + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) stardoc_with_diff_test( name = "npm_import", bzl_library_target = "//npm:npm_import", + # https://github.com/bazelbuild/stardoc/pull/141 + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) -update_docs(name = "update") +update_docs( + name = "update", + # https://github.com/bazelbuild/stardoc/pull/141 + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), +) diff --git a/e2e/pnpm_workspace/MODULE.bazel b/e2e/pnpm_workspace/MODULE.bazel index d5813748b6..752d120cbe 100644 --- a/e2e/pnpm_workspace/MODULE.bazel +++ b/e2e/pnpm_workspace/MODULE.bazel @@ -16,6 +16,7 @@ node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node") node.toolchain( name = "nodejs", + node_version = "16.9.0", ) use_repo(node, "nodejs_toolchains") diff --git a/e2e/pnpm_workspace_deps/MODULE.bazel b/e2e/pnpm_workspace_deps/MODULE.bazel index f42ce50a19..4a07f9cf49 100644 --- a/e2e/pnpm_workspace_deps/MODULE.bazel +++ b/e2e/pnpm_workspace_deps/MODULE.bazel @@ -16,6 +16,7 @@ node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node") node.toolchain( name = "nodejs", + node_version = "16.9.0", ) use_repo(node, "nodejs_toolchains") diff --git a/e2e/pnpm_workspace_rerooted/MODULE.bazel b/e2e/pnpm_workspace_rerooted/MODULE.bazel index d48bee62dd..a094c95399 100644 --- a/e2e/pnpm_workspace_rerooted/MODULE.bazel +++ b/e2e/pnpm_workspace_rerooted/MODULE.bazel @@ -16,6 +16,7 @@ node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node") node.toolchain( name = "nodejs", + node_version = "16.9.0", ) use_repo(node, "nodejs_toolchains") diff --git a/examples/js_library/two/BUILD.bazel b/examples/js_library/two/BUILD.bazel index 3adb0d9347..cc3e60102d 100644 --- a/examples/js_library/two/BUILD.bazel +++ b/examples/js_library/two/BUILD.bazel @@ -35,6 +35,16 @@ bzl_library( stardoc_with_diff_test( name = "tsc-docs", bzl_library_target = ":tsc", + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) -update_docs(name = "docs") +update_docs( + name = "docs", + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), +) diff --git a/examples/macro/BUILD.bazel b/examples/macro/BUILD.bazel index 54ce3a311c..0473fcf794 100644 --- a/examples/macro/BUILD.bazel +++ b/examples/macro/BUILD.bazel @@ -25,6 +25,16 @@ bzl_library( stardoc_with_diff_test( name = "mocha-docs", bzl_library_target = ":mocha", + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) -update_docs(name = "docs") +update_docs( + name = "docs", + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), +) diff --git a/js/dev_repositories.bzl b/js/dev_repositories.bzl index 69d83b08b5..b5bec23225 100644 --- a/js/dev_repositories.bzl +++ b/js/dev_repositories.bzl @@ -24,17 +24,13 @@ def rules_js_dev_dependencies(): http_archive( name = "bazel_skylib", sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", - urls = [ - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", - ], + urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz"], ) http_archive( name = "bazel_skylib_gazelle_plugin", sha256 = "0a466b61f331585f06ecdbbf2480b9edf70e067a53f261e0596acd573a7d2dc3", - urls = [ - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-gazelle-plugin-1.4.1.tar.gz", - ], + urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-gazelle-plugin-1.4.1.tar.gz"], ) http_archive( diff --git a/js/private/test/BUILD.bazel b/js/private/test/BUILD.bazel index 7816e14052..630b7882fe 100644 --- a/js/private/test/BUILD.bazel +++ b/js/private/test/BUILD.bazel @@ -33,6 +33,10 @@ write_source_files( files = { "shellcheck_launcher.sh": ":shell_launcher_sed", }, + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) js_library_test_suite(name = "js_library_test") diff --git a/js/private/test/expand_template/BUILD.bazel b/js/private/test/expand_template/BUILD.bazel index 1b38730e28..45c7ac3cbd 100644 --- a/js/private/test/expand_template/BUILD.bazel +++ b/js/private/test/expand_template/BUILD.bazel @@ -21,7 +21,10 @@ expand_template( diff_test( name = "a_stamp_test", file1 = ":a_stamp", - file2 = "a_stamp_expected", + file2 = select({ + "//:bzlmod": "a_stamp_expected_bzlmod", + "//conditions:default": "a_stamp_expected", + }), ) expand_template( @@ -43,7 +46,10 @@ expand_template( diff_test( name = "a_test", file1 = ":a", - file2 = "a_expected", + file2 = select({ + "//:bzlmod": "a_expected_bzlmod", + "//conditions:default": "a_expected", + }), ) # This test requires that DefaultInfo be returned with the proper outputs. diff --git a/js/private/test/expand_template/a_expected_bzlmod b/js/private/test/expand_template/a_expected_bzlmod new file mode 100644 index 0000000000..103336c6bc --- /dev/null +++ b/js/private/test/expand_template/a_expected_bzlmod @@ -0,0 +1,6 @@ +WORKSPACE: _main +VERSION: v0.0.0 +TMPL_PATH: js/private/test/expand_template/a.tmpl +WORKSPACE: _main +VERSION: v0.0.0 +TMPL_PATH: js/private/test/expand_template/a.tmpl diff --git a/js/private/test/expand_template/a_stamp_expected_bzlmod b/js/private/test/expand_template/a_stamp_expected_bzlmod new file mode 100644 index 0000000000..e099fa5414 --- /dev/null +++ b/js/private/test/expand_template/a_stamp_expected_bzlmod @@ -0,0 +1,6 @@ +WORKSPACE: _main +VERSION: v1.2.3 +TMPL_PATH: js/private/test/expand_template/a.tmpl +WORKSPACE: _main +VERSION: v1.2.3 +TMPL_PATH: js/private/test/expand_template/a.tmpl diff --git a/js/private/test/image/structure/BUILD.bazel b/js/private/test/image/structure/BUILD.bazel index e658879335..1e5d3639a9 100644 --- a/js/private/test/image/structure/BUILD.bazel +++ b/js/private/test/image/structure/BUILD.bazel @@ -74,4 +74,8 @@ write_source_files( # mode bit on files aren't stable between RBE and Local since RBE isn't aware of git which tracks permissions for files. # we don't care about unstable inputs because it's not our responsibility to keep them stable which would expand api surface for js_image_layer tags = ["no-remote-exec"], + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) diff --git a/js/private/test/image/symlink_tree.test.mjs b/js/private/test/image/symlink_tree.test.mjs index fd06aa3c6e..7f1a069545 100644 --- a/js/private/test/image/symlink_tree.test.mjs +++ b/js/private/test/image/symlink_tree.test.mjs @@ -17,7 +17,7 @@ createReadStream(process.argv[3]).pipe(createGunzip()).pipe(extract) await new Promise((resolve) => extract.on('finish', resolve)) const symlink = node_modules_entries.get( - 'app/js/private/test/image/bin.runfiles/aspect_rules_js/js/private/test/image/node_modules/acorn' + `app/js/private/test/image/bin.runfiles/${process.env.TEST_WORKSPACE}/js/private/test/image/node_modules/acorn` ) assert.ok(!!symlink) @@ -25,5 +25,5 @@ assert.equal(symlink.type, 'symlink') assert.equal(symlink.mtime.getTime(), new Date(0).getTime()) assert.equal( symlink.linkname, - '/app/js/private/test/image/bin.runfiles/aspect_rules_js/node_modules/.aspect_rules_js/acorn@8.8.2/node_modules/acorn' + `/app/js/private/test/image/bin.runfiles/${process.env.TEST_WORKSPACE}/node_modules/.aspect_rules_js/acorn@8.8.2/node_modules/acorn` ) diff --git a/js/private/test/js_binary_sh/BUILD.bazel b/js/private/test/js_binary_sh/BUILD.bazel index 35a7a2f188..d55ab59c9b 100644 --- a/js/private/test/js_binary_sh/BUILD.bazel +++ b/js/private/test/js_binary_sh/BUILD.bazel @@ -61,6 +61,10 @@ assert_contains( name = "BAZEL_WORKSPACE_test", actual = ":stderr", expected = "DEBUG: aspect_rules_js[js_binary]: BAZEL_WORKSPACE aspect_rules_js", + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) assert_contains( @@ -97,4 +101,8 @@ assert_contains( name = "js_binary_BAZEL_WORKSPACE_test", actual = ":stderr", expected = "DEBUG: aspect_rules_js[js_binary]: js_binary WORKSPACE aspect_rules_js", + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) diff --git a/npm/private/npm_translate_lock_generate.bzl b/npm/private/npm_translate_lock_generate.bzl index 21f37c9003..06f2a17aa2 100644 --- a/npm/private/npm_translate_lock_generate.bzl +++ b/npm/private/npm_translate_lock_generate.bzl @@ -926,7 +926,7 @@ load("@aspect_rules_js//npm/private:npm_package_store.bzl", _npm_package_store = name = _import.package, src = ":" + paths.join(_import.package, _PACKAGE_JSON_BZL_FILENAME), dep = "@{repo_name}//{link_package}:{package_name}_bzl_library".format( - repo_name = _import.name, + repo_name = _to_apparent_repo_name(_import.name), link_package = link_package, package_name = link_package.split("/")[-1] or _import.package.split("/")[-1], ), diff --git a/npm/private/test/BUILD.bazel b/npm/private/test/BUILD.bazel index da5219ebb9..25a66fe8f4 100644 --- a/npm/private/test/BUILD.bazel +++ b/npm/private/test/BUILD.bazel @@ -38,6 +38,10 @@ write_source_files( "package_json_checked.bzl": "@npm__rollup__2.70.2//examples/npm_deps:package_json.bzl", "package_json_with_dashes_checked.bzl": "@npm__webpack-bundle-analyzer__4.5.0__bufferutil_4.0.7//npm/private/test:package_json.bzl", }, + target_compatible_with = select({ + "//:bzlmod": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) build_test(