diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c17bda9ab..1825cc6df 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -130,10 +130,11 @@ jobs: major: 6 bzlmod: 1 folder: e2e/npm_translate_lock_replace_packages - # Don't run bzlmod tests with Bazel 6 to reduce the size of the test matrix + # Don't run workspace tests with Bazel 6 to reduce the size of the test matrix + # and remove the need for bazel 6 workspace support for local development. - bazel-version: major: 6 - bzlmod: 1 + bzlmod: 0 # Don't run workspace smoke test under bzlmod - bzlmod: 1 folder: e2e/workspace @@ -150,12 +151,24 @@ jobs: folder: e2e/npm_link_package - bzlmod: 1 folder: e2e/rules_foo - # gyp_no_install_script is broken in an usual way on 6.5.0 + # gyp_no_install_script+patch_from_repo+js_run_devserver are broken in an usual way on 6.5.0 # that is not worth investigating as we're dropping Bazel 6 support soon - bazel-version: major: 6 - bzlmod: 0 folder: e2e/gyp_no_install_script + - bazel-version: + major: 6 + folder: e2e/patch_from_repo + # devservers on bazel6+bzlmod also broken in an odd way + - bazel-version: + major: 6 + folder: e2e/js_run_devserver + - bazel-version: + major: 6 + folder: e2e/webpack_devserver + - bazel-version: + major: 6 + folder: e2e/webpack_devserver_esm # @bazel/runfiles seems broken with non-bzlmod + bazel7 # https://github.com/bazel-contrib/rules_nodejs/issues/3797 - bzlmod: 0 @@ -163,14 +176,14 @@ jobs: include: - bazel-version: major: 7 - version: 7.1.1 + version: 7.3.2 bzlmod: 1 os: windows config: local folder: e2e/bzlmod - bazel-version: major: 7 - version: 7.1.1 + version: 7.3.2 bzlmod: 1 os: macos config: local diff --git a/MODULE.bazel b/MODULE.bazel index ebc37b138..663dfd746 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -51,7 +51,7 @@ bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependenc bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True) bazel_dep(name = "gazelle", version = "0.39.1", dev_dependency = True, repo_name = "bazel_gazelle") bazel_dep(name = "rules_go", version = "0.50.1", dev_dependency = True) -bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True, repo_name = "io_bazel_stardoc") +bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc") host = use_extension( "@aspect_bazel_lib//lib:extensions.bzl", diff --git a/WORKSPACE b/WORKSPACE index d84475cd0..1cbcb09d9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -200,6 +200,10 @@ load("@io_bazel_stardoc//:deps.bzl", "stardoc_external_deps") stardoc_external_deps() +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install") stardoc_pinned_maven_install() diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 17ce79702..f45f037be 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -1,49 +1,85 @@ -load("@aspect_bazel_lib//lib:docs.bzl", "stardoc_with_diff_test", "update_docs") +load(":docs.bzl", "stardoc_with_diff_test", "update_docs") stardoc_with_diff_test( name = "js_binary", bzl_library_target = "//js/private:js_binary", + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( name = "js_library", bzl_library_target = "//js/private:js_library", + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( name = "js_run_binary", bzl_library_target = "//js/private:js_run_binary", + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( name = "js_run_devserver", bzl_library_target = "//js/private:js_run_devserver", symbol_names = ["js_run_devserver"], + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( name = "js_info_files", bzl_library_target = "//js/private:js_info_files", + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( name = "js_image_layer", bzl_library_target = "//js/private:js_image_layer", + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( name = "npm_package", bzl_library_target = "//npm/private:npm_package", + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( name = "npm_link_package", bzl_library_target = "//npm/private:npm_link_package", + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( name = "npm_link_all_packages", bzl_library_target = "//npm/private:npm_translate_lock_generate.docs", + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( @@ -52,6 +88,10 @@ stardoc_with_diff_test( symbol_names = [ "npm_import", ], + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) stardoc_with_diff_test( @@ -61,10 +101,18 @@ stardoc_with_diff_test( "list_patches", "npm_translate_lock", ], + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) update_docs( name = "update", + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) # Demonstration delivery target for Aspect Workflows. @@ -73,7 +121,11 @@ sh_binary( name = "docs_delivery_only_on_change", srcs = ["delivery.sh"], data = glob(["*.md"]), - tags = ["deliverable"], + tags = [ + "deliverable", + "skip-on-bazel6", + "skip-on-rbe", + ], ) # Demonstration delivery target for Aspect Workflows. @@ -82,4 +134,8 @@ sh_binary( name = "docs_delivery", srcs = ["delivery.sh"], data = glob(["*.md"]), + tags = [ + "skip-on-bazel6", + "skip-on-rbe", + ], ) diff --git a/docs/docs.bzl b/docs/docs.bzl new file mode 100644 index 000000000..76fb36dc8 --- /dev/null +++ b/docs/docs.bzl @@ -0,0 +1,18 @@ +""" + Wrapper around stardoc_with_diff_test that only runs the test if Bazel 7 or greater is being used. +""" + +load("@aspect_bazel_lib//lib:docs.bzl", _stardoc_with_diff_test = "stardoc_with_diff_test", _update_docs = "update_docs") +load("@aspect_bazel_lib//lib:utils.bzl", "is_bazel_7_or_greater") + +def stardoc_with_diff_test(name, **kwargs): + """ + Wrapper around stardoc_with_diff_test that only runs the test if Bazel 7 or greater is being used. + """ + if is_bazel_7_or_greater(): + _stardoc_with_diff_test(name, **kwargs) + else: + # buildifier: disable=print + print("WARNING: Skipping stardoc_with_diff_test for %s because it requires Bazel 7 or greater" % name) + +update_docs = _update_docs diff --git a/docs/js_binary.md b/docs/js_binary.md index 6308d4ee0..d9187bf0f 100644 --- a/docs/js_binary.md +++ b/docs/js_binary.md @@ -21,8 +21,6 @@ js_binary( ## js_binary
-load("@aspect_rules_js//js/private:js_binary.bzl", "js_binary")
-
 js_binary(name, data, chdir, copy_data_to_bin, enable_runfiles, entry_point, env, expand_args,
           expand_env, expected_exit_code, fixed_args, include_npm, include_npm_sources,
           include_sources, include_transitive_sources, include_transitive_types, include_types,
@@ -102,8 +100,6 @@ The following environment variables are made available to the Node.js runtime ba
 ## js_test
 
 
-load("@aspect_rules_js//js/private:js_binary.bzl", "js_test")
-
 js_test(name, data, chdir, copy_data_to_bin, enable_runfiles, entry_point, env, expand_args,
         expand_env, expected_exit_code, fixed_args, include_npm, include_npm_sources, include_sources,
         include_transitive_sources, include_transitive_types, include_types, log_level,
@@ -167,8 +163,6 @@ the contract between Bazel and a test runner.
 ## js_binary_lib.create_launcher
 
 
-load("@aspect_rules_js//js/private:js_binary.bzl", "js_binary_lib")
-
 js_binary_lib.create_launcher(ctx, log_prefix_rule_set, log_prefix_rule, fixed_args, fixed_env)
 
@@ -191,8 +185,6 @@ js_binary_lib.create_launcher(ctx -load("@aspect_rules_js//js/private:js_binary.bzl", "js_binary_lib") - js_binary_lib.implementation(ctx)
diff --git a/docs/js_image_layer.md b/docs/js_image_layer.md index 076e1718f..516568bf1 100644 --- a/docs/js_image_layer.md +++ b/docs/js_image_layer.md @@ -19,8 +19,6 @@ js_image_layer( ## js_image_layer
-load("@aspect_rules_js//js/private:js_image_layer.bzl", "js_image_layer")
-
 js_image_layer(name, binary, compression, generate_empty_layers, owner, platform, root)
 
@@ -282,8 +280,6 @@ container_image( ## js_image_layer_lib.implementation
-load("@aspect_rules_js//js/private:js_image_layer.bzl", "js_image_layer_lib")
-
 js_image_layer_lib.implementation(ctx)
 
diff --git a/docs/js_info_files.md b/docs/js_info_files.md index 562bbe874..ad1efce7d 100644 --- a/docs/js_info_files.md +++ b/docs/js_info_files.md @@ -7,8 +7,6 @@ Helper rule to gather files from JsInfo providers of targets and provide them as ## js_info_files
-load("@aspect_rules_js//js/private:js_info_files.bzl", "js_info_files")
-
 js_info_files(name, srcs, include_npm_sources, include_sources, include_transitive_sources,
               include_transitive_types, include_types)
 
diff --git a/docs/js_library.md b/docs/js_library.md index 5e20662ab..031de5297 100644 --- a/docs/js_library.md +++ b/docs/js_library.md @@ -29,8 +29,6 @@ js_library( ## js_library
-load("@aspect_rules_js//js/private:js_library.bzl", "js_library")
-
 js_library(name, deps, srcs, data, copy_data_to_bin, no_copy_to_bin, types)
 
@@ -68,8 +66,6 @@ for more context on why we do this. ## js_library_lib.implementation
-load("@aspect_rules_js//js/private:js_library.bzl", "js_library_lib")
-
 js_library_lib.implementation(ctx)
 
diff --git a/docs/js_run_binary.md b/docs/js_run_binary.md index 6b0f838fb..b2211697c 100644 --- a/docs/js_run_binary.md +++ b/docs/js_run_binary.md @@ -16,8 +16,6 @@ load("@aspect_rules_js//js:defs.bzl", "js_run_binary") ## js_run_binary
-load("@aspect_rules_js//js/private:js_run_binary.bzl", "js_run_binary")
-
 js_run_binary(name, tool, env, srcs, outs, out_dirs, args, chdir, stdout, stderr, exit_code_out,
               silent_on_success, use_execroot_entry_point, copy_srcs_to_bin, include_sources,
               include_types, include_transitive_sources, include_transitive_types,
diff --git a/docs/js_run_devserver.md b/docs/js_run_devserver.md
index 5999d0ccd..f95c9a371 100644
--- a/docs/js_run_devserver.md
+++ b/docs/js_run_devserver.md
@@ -7,8 +7,6 @@ Implementation details for js_run_devserver rule
 ## js_run_devserver
 
 
-load("@aspect_rules_js//js/private:js_run_devserver.bzl", "js_run_devserver")
-
 js_run_devserver(name, tool, command, grant_sandbox_write_permissions, use_execroot_entry_point,
                  allow_execroot_entry_point_with_no_copy_data_to_bin, kwargs)
 
diff --git a/docs/npm_import.md b/docs/npm_import.md index de79cb91a..9e6b77a9b 100644 --- a/docs/npm_import.md +++ b/docs/npm_import.md @@ -22,8 +22,6 @@ for a given lockfile. ## npm_import
-load("@aspect_rules_js//npm/private:npm_import.bzl", "npm_import")
-
 npm_import(name, package, version, deps, extra_build_content, transitive_closure, root_package,
            link_workspace, link_packages, lifecycle_hooks, lifecycle_hooks_execution_requirements,
            lifecycle_hooks_env, lifecycle_hooks_use_default_shell_env, integrity, url, commit,
diff --git a/docs/npm_link_all_packages.md b/docs/npm_link_all_packages.md
index ef87327c9..9d32d60e9 100644
--- a/docs/npm_link_all_packages.md
+++ b/docs/npm_link_all_packages.md
@@ -16,8 +16,6 @@ load("@npm//:defs.bzl", "npm_link_targets", "npm_link_all_packages")
 ## npm_link_all_packages
 
 
-load("@aspect_rules_js//npm/private:npm_translate_lock_generate.docs.bzl", "npm_link_all_packages")
-
 npm_link_all_packages(name, imported_links)
 
@@ -50,8 +48,6 @@ If you use manually-written [`npm_import`](/docs/npm_import.md#npm_import) you c ## npm_link_targets
-load("@aspect_rules_js//npm/private:npm_translate_lock_generate.docs.bzl", "npm_link_targets")
-
 npm_link_targets(name, package)
 
diff --git a/docs/npm_link_package.md b/docs/npm_link_package.md index c69dcf5f7..ee63c2c41 100644 --- a/docs/npm_link_package.md +++ b/docs/npm_link_package.md @@ -7,8 +7,6 @@ npm_link_package rule ## npm_link_package
-load("@aspect_rules_js//npm/private:npm_link_package.bzl", "npm_link_package")
-
 npm_link_package(name, root_package, link, src, deps, fail_if_no_link, auto_manual, visibility,
                  kwargs)
 
diff --git a/docs/npm_package.md b/docs/npm_package.md index bb5588359..a0823eb80 100644 --- a/docs/npm_package.md +++ b/docs/npm_package.md @@ -13,8 +13,6 @@ load("@aspect_rules_js//npm:defs.bzl", "npm_package") ## npm_package
-load("@aspect_rules_js//npm/private:npm_package.bzl", "npm_package")
-
 npm_package(name, srcs, data, args, out, package, version, root_paths,
             include_external_repositories, include_srcs_packages, exclude_srcs_packages,
             include_srcs_patterns, exclude_srcs_patterns, replace_prefixes, allow_overwrites,
@@ -125,8 +123,6 @@ To stamp the current git tag as the "version" in the package.json file, see
 ## npm_package_lib.implementation
 
 
-load("@aspect_rules_js//npm/private:npm_package.bzl", "npm_package_lib")
-
 npm_package_lib.implementation(ctx)
 
@@ -145,8 +141,6 @@ npm_package_lib.implementation(ctx ## stamped_package_json
-load("@aspect_rules_js//npm/private:npm_package.bzl", "stamped_package_json")
-
 stamped_package_json(name, stamp_var, kwargs)
 
diff --git a/docs/npm_translate_lock.md b/docs/npm_translate_lock.md index a5e7f5f2a..8e083ccd9 100644 --- a/docs/npm_translate_lock.md +++ b/docs/npm_translate_lock.md @@ -31,8 +31,6 @@ Advanced users may want to directly fetch a package from npm rather than start f ## list_patches
-load("@aspect_rules_js//npm/private:npm_translate_lock.bzl", "list_patches")
-
 list_patches(name, out, include_patterns, exclude_patterns)
 
@@ -59,8 +57,6 @@ file stays up to date. ## npm_translate_lock
-load("@aspect_rules_js//npm/private:npm_translate_lock.bzl", "npm_translate_lock")
-
 npm_translate_lock(name, pnpm_lock, npm_package_lock, yarn_lock, update_pnpm_lock,
                    node_toolchain_prefix, yq_toolchain_prefix, preupdate, npmrc, use_home_npmrc, data,
                    patches, patch_args, custom_postinstalls, package_visibility, prod,
diff --git a/e2e/pnpm_lockfiles/lockfile-test.bzl b/e2e/pnpm_lockfiles/lockfile-test.bzl
index 45662adf7..89c5e9192 100644
--- a/e2e/pnpm_lockfiles/lockfile-test.bzl
+++ b/e2e/pnpm_lockfiles/lockfile-test.bzl
@@ -209,8 +209,11 @@ def lockfile_test(name = None):
                 for f in BZL_FILES.keys()
             ],
         ),
+        # Target names may be different on workspace vs bzlmod
         target_compatible_with = select({
             "@aspect_bazel_lib//lib:bzlmod": [],
             "//conditions:default": ["@platforms//:incompatible"],
         }),
+        # Target names may be different on bazel versions
+        tags = ["skip-on-bazel6"],
     )
diff --git a/js/private/dev_deps.bzl b/js/private/dev_deps.bzl
index d20d20bc5..aadf4952f 100644
--- a/js/private/dev_deps.bzl
+++ b/js/private/dev_deps.bzl
@@ -35,8 +35,15 @@ def rules_js_dev_dependencies():
 
     http_archive(
         name = "io_bazel_stardoc",
-        sha256 = "fabb280f6c92a3b55eed89a918ca91e39fb733373c81e87a18ae9e33e75023ec",
-        urls = ["https://github.com/bazelbuild/stardoc/releases/download/0.7.1/stardoc-0.7.1.tar.gz"],
+        sha256 = "62bd2e60216b7a6fec3ac79341aa201e0956477e7c8f6ccc286f279ad1d96432",
+        urls = ["https://github.com/bazelbuild/stardoc/releases/download/0.6.2/stardoc-0.6.2.tar.gz"],
+    )
+
+    http_archive(
+        name = "bazel_features",
+        sha256 = "2cd9e57d4c38675d321731d65c15258f3a66438ad531ae09cb8bb14217dc8572",
+        strip_prefix = "bazel_features-1.11.0",
+        url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.11.0/bazel_features-v1.11.0.tar.gz",
     )
 
     http_archive(
diff --git a/js/private/test/BUILD.bazel b/js/private/test/BUILD.bazel
index 4892af7c2..49d31e6a5 100644
--- a/js/private/test/BUILD.bazel
+++ b/js/private/test/BUILD.bazel
@@ -34,6 +34,7 @@ write_source_files(
     files = {
         "snapshots/wksp/launcher.sh": ":shell_launcher_sed",
     },
+    tags = ["skip-on-bazel6"],
     target_compatible_with = select({
         "@aspect_bazel_lib//lib:bzlmod": ["@platforms//:incompatible"],
         "//conditions:default": [],
@@ -45,6 +46,7 @@ write_source_files(
     files = {
         "snapshots/bzlmod/launcher.sh": ":shell_launcher_sed",
     },
+    tags = ["skip-on-bazel6"],
     target_compatible_with = select({
         "@aspect_bazel_lib//lib:bzlmod": [],
         "//conditions:default": ["@platforms//:incompatible"],
diff --git a/js/private/test/image/BUILD.bazel b/js/private/test/image/BUILD.bazel
index 4431441d8..9215b69d6 100644
--- a/js/private/test/image/BUILD.bazel
+++ b/js/private/test/image/BUILD.bazel
@@ -51,6 +51,8 @@ write_source_file(
     testonly = True,
     in_file = ":checksum_gen",
     out_file = "checksum.expected",
+    # Under bazel6 bzlmod name differs
+    tags = ["skip-on-bazel6"],
     # Under bzlmod workspace name is a fixed string `_main` which differs from WORKSPACE
     target_compatible_with = select({
         "@aspect_bazel_lib//lib:bzlmod": [],