Upgrade bazel to 4.0.0rc2
A few things of note here:
- I disabled a few incompatible flags in order to minimize the number
of changes we have to deal with.
- I had to upgrade the typescript rules because the old ones didn't
work with new bazel anymore. That brought a typescript compiler
upgrade along. This in turn required me to turn off strict mode.
Otherwise, there are a _ton_ of errors in our typescript files. The
vast majority of them are related to `null` checking.
- The `default_python_version` attribute on Python rules doesn't exist
anymore. It's now replaced by `python_version`.
- I removed the CROSSTOOL in favour of a Starlark-equivalent
configuration function. See `tools/cpp/toolchain_config.bzl` for
more details. This new file is auto-generated using the migration
tools from `rules_cc`. I have made no attempt to beautify this file.
Relatedly, all CROSSTOOL-related files/functionality are gone as well.
- The `config_setting` targets to detect the compiler names had to
change. This is perhaps not surprising. Thanks to Austin for
pointing this out to me.
- The `cc_toolchain` targets all required `ar_files` and `as_files`
attributes where they didn't before. Not really sure what changed,
but the compilations appears to work with these changes.
Change-Id: I2317e5160fa3f8d87f94106b0c3b328918d0c42c
diff --git a/WORKSPACE b/WORKSPACE
index 6c9949d..a8c8a19 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -604,15 +604,11 @@
url = "https://www.frc971.org/Build-Dependencies/webrtc-30376-4c4735b-linux-rio.tar.gz",
)
-# Fetch our Bazel dependencies that aren't distributed on npm
-load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
-
-rules_typescript_dependencies()
-
-# Setup TypeScript toolchain
-load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
-
-ts_setup_workspace()
+http_archive(
+ name = "build_bazel_rules_nodejs",
+ sha256 = "0d9660cf0894f1fe1e9840818553e0080fbce0851169812d77a70bdb9981c946",
+ urls = ["https://www.frc971.org/Build-Dependencies/rules_nodejs-0.37.0.tar.gz"],
+)
# Setup the NodeJS toolchain
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install")
@@ -620,12 +616,26 @@
node_repositories()
# Setup Bazel managed npm dependencies with the `yarn_install` rule.
+#
+# To run yarn by hand, use:
+# bazel run @nodejs_linux_amd64//:bin/yarn -- list
+# I'm sure there is a better path, but that works...
yarn_install(
name = "npm",
package_json = "//:package.json",
+ symlink_node_modules = False,
yarn_lock = "//:yarn.lock",
)
+# Install all Bazel dependencies needed for npm packages that supply Bazel rules
+load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
+
+install_bazel_dependencies()
+
+load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
+
+ts_setup_workspace()
+
# Flatbuffers
local_repository(
name = "com_github_google_flatbuffers",