diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 90e4db8..265790a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -84,6 +84,9 @@ jobs: # Don't test Windows with Bazel 5 to minimize Windows minutes (billed at 2X) - bazelversion: 5.3.2 os: windows-latest + # Don't run the root workspace with Bazel 5, it uses bazel-lib 2.0 which doesn't work. + - bazelversion: 5.3.2 + folder: '.' # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh index ca5859e..b772d10 100755 --- a/.github/workflows/release_prep.sh +++ b/.github/workflows/release_prep.sh @@ -37,3 +37,11 @@ http_archive( EOF awk 'f;/--SNIP--/{f=1}' e2e/smoke/WORKSPACE.bazel echo "\`\`\`" + +cat << EOF +To use rules_esbuild with bazel-lib 2.0, you must additionally register the coreutils toolchain. +\`\`\`starlark +load("@aspect_bazel_lib//lib:repositories.bzl", "register_coreutils_toolchains") +register_coreutils_toolchains() +\`\`\` +EOF \ No newline at end of file diff --git a/MODULE.bazel b/MODULE.bazel index 6cc146a..aa790bb 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -10,7 +10,7 @@ bazel_dep(name = "bazel_skylib", version = "1.4.1") bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True) bazel_dep(name = "gazelle", version = "0.29.0", dev_dependency = True, repo_name = "bazel_gazelle") bazel_dep(name = "buildifier_prebuilt", version = "6.0.0.1", dev_dependency = True) -bazel_dep(name = "aspect_bazel_lib", version = "1.29.2") +bazel_dep(name = "aspect_bazel_lib", version = "1.38.1") bazel_dep(name = "aspect_rules_js", version = "1.29.2") bazel_dep(name = "rules_nodejs", version = "5.8.2") bazel_dep(name = "platforms", version = "0.0.5") diff --git a/WORKSPACE b/WORKSPACE index 18414a2..86a4184 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -18,9 +18,11 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") rules_js_dependencies() -load("@aspect_bazel_lib//lib:repositories.bzl", "DEFAULT_YQ_VERSION", "aspect_bazel_lib_dependencies", "register_yq_toolchains") +load("@aspect_bazel_lib//lib:repositories.bzl", "DEFAULT_YQ_VERSION", "aspect_bazel_lib_dependencies", "register_coreutils_toolchains", "register_yq_toolchains") -aspect_bazel_lib_dependencies(override_local_config_platform = True) +aspect_bazel_lib_dependencies() + +register_coreutils_toolchains() register_yq_toolchains( version = DEFAULT_YQ_VERSION, diff --git a/e2e/bundle/WORKSPACE b/e2e/bundle/WORKSPACE index 63cf2c7..cb2984b 100644 --- a/e2e/bundle/WORKSPACE +++ b/e2e/bundle/WORKSPACE @@ -17,6 +17,14 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc rules_esbuild_dependencies() +load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") + +rules_js_dependencies() + +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + # If you didn't already register a toolchain providing nodejs, do that: load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains") diff --git a/e2e/npm-links/WORKSPACE b/e2e/npm-links/WORKSPACE index f6d1db0..1da8816 100644 --- a/e2e/npm-links/WORKSPACE +++ b/e2e/npm-links/WORKSPACE @@ -9,6 +9,14 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc rules_esbuild_dependencies() +load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") + +rules_js_dependencies() + +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains") nodejs_register_toolchains( diff --git a/e2e/smoke/WORKSPACE.bazel b/e2e/smoke/WORKSPACE.bazel index a3fecfe..66d4967 100644 --- a/e2e/smoke/WORKSPACE.bazel +++ b/e2e/smoke/WORKSPACE.bazel @@ -19,6 +19,14 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc rules_esbuild_dependencies() +load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") + +rules_js_dependencies() + +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + # If you didn't already register a toolchain providing nodejs, do that: load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains") diff --git a/e2e/sourcemaps/WORKSPACE b/e2e/sourcemaps/WORKSPACE index a3fecfe..c4074bf 100644 --- a/e2e/sourcemaps/WORKSPACE +++ b/e2e/sourcemaps/WORKSPACE @@ -19,6 +19,16 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc rules_esbuild_dependencies() +load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") + +rules_js_dependencies() + +# For convenience, npm_translate_lock does this call automatically. +# You can omit this if you have any npm_translate_lock calls. +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + # If you didn't already register a toolchain providing nodejs, do that: load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains") diff --git a/e2e/tsconfig/WORKSPACE b/e2e/tsconfig/WORKSPACE index 1ca80c2..f3f0d48 100644 --- a/e2e/tsconfig/WORKSPACE +++ b/e2e/tsconfig/WORKSPACE @@ -7,6 +7,14 @@ load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependenc rules_esbuild_dependencies() +load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") + +rules_js_dependencies() + +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains") nodejs_register_toolchains( diff --git a/esbuild/dependencies.bzl b/esbuild/dependencies.bzl index 9160224..9413f54 100644 --- a/esbuild/dependencies.bzl +++ b/esbuild/dependencies.bzl @@ -14,16 +14,16 @@ def rules_esbuild_dependencies(): http_archive( name = "aspect_bazel_lib", - sha256 = "ee95bbc80f9ca219b93a8cc49fa19a2d4aa8649ddc9024f46abcdd33935753ca", - strip_prefix = "bazel-lib-1.29.2", - url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.29.2/bazel-lib-v1.29.2.tar.gz", + sha256 = "262e3d6693cdc16dd43880785cdae13c64e6a3f63f75b1993c716295093d117f", + strip_prefix = "bazel-lib-1.38.1", + url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.38.1/bazel-lib-v1.38.1.tar.gz", ) http_archive( name = "aspect_rules_js", - sha256 = "7cb2d84b7d5220194627c9a0267ae599e357350e75ea4f28f337a25ca6219b83", - strip_prefix = "rules_js-1.29.2", - url = "https://github.com/aspect-build/rules_js/releases/download/v1.29.2/rules_js-v1.29.2.tar.gz", + sha256 = "d9ceb89e97bb5ad53b278148e01a77a3e9100db272ce4ebdcd59889d26b9076e", + strip_prefix = "rules_js-1.34.0", + url = "https://github.com/aspect-build/rules_js/releases/download/v1.34.0/rules_js-v1.34.0.tar.gz", ) http_archive( diff --git a/esbuild/private/esbuild.bzl b/esbuild/private/esbuild.bzl index fec42e0..ee5f35d 100644 --- a/esbuild/private/esbuild.bzl +++ b/esbuild/private/esbuild.bzl @@ -1,7 +1,7 @@ "# esbuild rule" load("@aspect_bazel_lib//lib:expand_make_vars.bzl", "expand_variables") -load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_file_to_bin_action", "copy_files_to_bin_actions") +load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "COPY_FILE_TO_BIN_TOOLCHAINS", "copy_file_to_bin_action", "copy_files_to_bin_actions") load("@aspect_rules_js//js:libs.bzl", "js_lib_helpers") load("@aspect_rules_js//js:providers.bzl", "JsInfo", "js_info") load(":helpers.bzl", "desugar_entry_point_names", "write_args_file") @@ -422,7 +422,7 @@ lib = struct( toolchains = [ "@rules_nodejs//nodejs:toolchain_type", "@aspect_rules_esbuild//esbuild:toolchain_type", - ], + ] + COPY_FILE_TO_BIN_TOOLCHAINS, ) esbuild_bundle = rule( diff --git a/internal_deps.bzl b/internal_deps.bzl index 2cac83d..c70a076 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -9,6 +9,15 @@ load("//esbuild/private:maybe.bzl", http_archive = "maybe_http_archive") def rules_esbuild_internal_deps(): "Fetch deps needed for local development" + + # opt-in to 2.0 without forcing users to do so + http_archive( + name = "aspect_bazel_lib", + sha256 = "4b32cf6feab38b887941db022020eea5a49b848e11e3d6d4d18433594951717a", + strip_prefix = "bazel-lib-2.0.1", + url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.0.1/bazel-lib-v2.0.1.tar.gz", + ) + http_archive( name = "io_bazel_rules_go", sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",