From 908b1ce448a5f0d84e7a53ba7ce9c29ceb6c1b9d Mon Sep 17 00:00:00 2001 From: Rahul Butani Date: Fri, 12 Feb 2021 04:58:32 -0600 Subject: [PATCH] llvm_toolchain: don't break when used with dev builds of bazel --- toolchain/cc_toolchain_config.bzl.tpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/toolchain/cc_toolchain_config.bzl.tpl b/toolchain/cc_toolchain_config.bzl.tpl index 8ab5df75..6b15f4b1 100644 --- a/toolchain/cc_toolchain_config.bzl.tpl +++ b/toolchain/cc_toolchain_config.bzl.tpl @@ -244,10 +244,14 @@ def cc_toolchain_config(name, cpu): # This was only added in bazel v4.0.0. # + # `native.bazel_version` might give us back an empty string if a local dev build + # of bazel is being used; in this case we'll assume the version is at least + # 4.0.0. + # # See: https://github.com/bazelbuild/bazel/commit/da345f1f249ebf28bec88c6e0d63260dfaef14e9 **( {"builtin_sysroot": builtin_sysroot} - if int("%{bazel_version}".split(".")[0]) >= 4 + if int(("%{bazel_version}" or "4.0.0").split(".")[0]) >= 4 else {} ) )