diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index c40163e542..e692a85a52 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -1,5 +1,5 @@ --- -bazel: 3.6.0 +bazel: 4.0.0 tasks: ubuntu1604: name: ubuntu1604 diff --git a/.bazelversion b/.bazelversion index 40c341bdcd..fcdb2e109f 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -3.6.0 +4.0.0 diff --git a/README.md b/README.md index 9e1eff7b4a..03a0518d83 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ so this repo can be thought of as "JavaScript rules for Bazel" as well. (We woul This repository is maintained by volunteers in the Bazel community. Neither Google, nor the Bazel team, provides support for the code. However, this repository is part of the test suite used to vet new Bazel releases. -We follow semantic versioning. Patch releases have bugfixes, minor releases have new features. Only major releases (1.x, 2.x) have breaking changes. +We follow semantic versioning. Patch releases have bugfixes, minor releases have new features. Only major releases (1.x, 2.x) have breaking changes. We support the last two major releases of Bazel, see `SUPPORTED_BAZEL_VERSIONS` in our `/index.bzl` for the list we test against. + We strive to give you an easy upgrade path when we do introduce a breaking change by documenting a migration path. If you use code from an `/internal` path, or the labs package, these are not subject to our support policy and may have breaking changes or removals with no warning or migration path. diff --git a/e2e/symlinked_node_modules_npm/.bazelversion b/e2e/symlinked_node_modules_npm/.bazelversion deleted file mode 120000 index 96cf94962b..0000000000 --- a/e2e/symlinked_node_modules_npm/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -../../.bazelversion \ No newline at end of file diff --git a/e2e/symlinked_node_modules_yarn/.bazelversion b/e2e/symlinked_node_modules_yarn/.bazelversion deleted file mode 120000 index 96cf94962b..0000000000 --- a/e2e/symlinked_node_modules_yarn/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -../../.bazelversion \ No newline at end of file diff --git a/index.bzl b/index.bzl index 8f210e334b..d5be2aa343 100644 --- a/index.bzl +++ b/index.bzl @@ -81,7 +81,7 @@ def yarn_install(**kwargs): # against. # This version should be updated together with the version of the Bazel # in .bazelversion. This is asserted in //internal:bazel_version_test. -BAZEL_VERSION = "3.6.0" +BAZEL_VERSION = "4.0.0" # Versions of Bazel which users should be able to use. # Ensures we don't break backwards-compatibility, @@ -89,8 +89,9 @@ BAZEL_VERSION = "3.6.0" # These are the versions used when testing nested workspaces with # bazel_integration_test. SUPPORTED_BAZEL_VERSIONS = [ - # TODO: add LTS versions of bazel like 1.0.0, 2.0.0 BAZEL_VERSION, + "3.6.0", + "2.2.0", ] def check_rules_nodejs_version(minimum_version_string): diff --git a/internal/bazel_integration_test/bazel_integration_test.bzl b/internal/bazel_integration_test/bazel_integration_test.bzl index 4da5770340..60d5f2a389 100644 --- a/internal/bazel_integration_test/bazel_integration_test.bzl +++ b/internal/bazel_integration_test/bazel_integration_test.bzl @@ -15,12 +15,10 @@ """Bazel integration testing """ -load("@build_bazel_rules_nodejs//:index.bzl", "SUPPORTED_BAZEL_VERSIONS") +load("@build_bazel_rules_nodejs//:index.bzl", "BAZEL_VERSION", "SUPPORTED_BAZEL_VERSIONS") load("@build_bazel_rules_nodejs//packages:index.bzl", "NPM_PACKAGES") load("//internal/common:windows_utils.bzl", "BATCH_RLOCATION_FUNCTION", "is_windows") -BAZEL_BINARY = "@build_bazel_bazel_%s//:bazel_binary" % SUPPORTED_BAZEL_VERSIONS[0].replace(".", "_") - # Avoid using non-normalized paths (workspace/../other_workspace/path) def _to_manifest_path(ctx, file): if file.short_path.startswith("../"): @@ -29,10 +27,6 @@ def _to_manifest_path(ctx, file): return ctx.workspace_name + "/" + file.short_path def _bazel_integration_test(ctx): - if len(SUPPORTED_BAZEL_VERSIONS) > 1: - fail(""" - bazel_integration_test doesn't support multiple Bazel versions to test against yet. - """) if len(ctx.files.workspace_files) == 0: fail(""" No files were found to run under integration testing. See comment in /.bazelrc. @@ -126,7 +120,7 @@ ${{COMMAND}} BAZEL_INTEGRATION_TEST_ATTRS = { "bazel_binary": attr.label( - default = BAZEL_BINARY, + mandatory = True, doc = """The bazel binary files to test against. It is assumed by the test runner that the bazel binary is found at label_workspace/bazel (wksp/bazel.exe on Windows)""", @@ -275,16 +269,18 @@ def rules_nodejs_integration_test(name, **kwargs): for key in npm_packages: _tar_npm_packages[key + ".tar"] = npm_packages[key] - bazel_integration_test( - name = name, - check_npm_packages = NPM_PACKAGES, - repositories = repositories, - # some bazelrc imports are outside of the nested workspace so - # the test runner will handle these as special cases - bazelrc_imports = { - "//:common.bazelrc": "import %workspace%/../../common.bazelrc", - }, - npm_packages = _tar_npm_packages, - tags = tags, - **kwargs - ) + for bazel_version in SUPPORTED_BAZEL_VERSIONS: + bazel_integration_test( + name = "%s_%s" % (name, "bazel" + bazel_version) if bazel_version != BAZEL_VERSION else name, + check_npm_packages = NPM_PACKAGES, + repositories = repositories, + bazel_binary = "@build_bazel_bazel_%s//:bazel_binary" % bazel_version.replace(".", "_"), + # some bazelrc imports are outside of the nested workspace so + # the test runner will handle these as special cases + bazelrc_imports = { + "//:common.bazelrc": "import %workspace%/../../common.bazelrc", + }, + npm_packages = _tar_npm_packages, + tags = tags, + **kwargs + )