From 2e99fcb021a4d764509ea6c2d64ccfa28df70b3a Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Tue, 21 Jun 2022 14:36:28 -0400 Subject: [PATCH] Reland "[bazel] Update to v5.2.0" This is a reland of commit fb13c18ddf7df9b6d64315fac6bac840f3289fe7 Bazel 5.2.0 was fine, it was the fact that our toolchain was not erroring when clang failed that was an issue. We were always returning error code 0, but Bazel 5.2.0 was correctly identifying that we hadn't produced the promised build artifacts. Original change's description: > [bazel] Update to v5.2.0 > > The primary change we are looking for is > "Add support for .ar archives (and .deb files) > https://github.com/bazelbuild/bazel/pull/15218" > > https://blog.bazel.build/2022/06/08/bazel-5.2.html > > In theory, we should be able to trigger Linux RBE > compilations (e.g. IWYU) from Mac with this change. > > Change-Id: I217406d21fd55507e090c4bb5f79c796230717e6 > Bug: skia:12541 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549659 > Reviewed-by: Joe Gregorio Bug: skia:12541 Change-Id: I160b5802adc232d5cf7f7d05b20d5eabbb3d5102 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/551841 Reviewed-by: Joe Gregorio --- .bazelversion | 2 +- toolchain/download_linux_amd64_toolchain.bzl | 26 ++++--------------- .../clang_trampoline_linux.sh | 2 ++ 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/.bazelversion b/.bazelversion index 28cbf7c0aa..91ff57278e 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -5.0.0 \ No newline at end of file +5.2.0 diff --git a/toolchain/download_linux_amd64_toolchain.bzl b/toolchain/download_linux_amd64_toolchain.bzl index 0b8c924141..6be9a57493 100644 --- a/toolchain/download_linux_amd64_toolchain.bzl +++ b/toolchain/download_linux_amd64_toolchain.bzl @@ -150,21 +150,15 @@ debs_to_install = [ def _download_and_extract_deb(ctx, deb, sha256, prefix, output = ""): """Downloads a debian file and extracts the data into the provided output directory""" - # https://bazel.build/rules/lib/repository_ctx#download - # .deb files are also .ar archives. - ctx.download( + # https://bazel.build/rules/lib/repository_ctx#download_and_extract + # A .deb file has a data.tar.xz and a control.tar.xz, but the important contents + # (i.e. the headers or libs) are in the data.tar.xz + ctx.download_and_extract( url = _mirror([deb, mirror_prefix + sha256 + ".deb"]), - output = "tmp/deb.ar", + output = "tmp", sha256 = sha256, ) - # https://bazel.build/rules/lib/repository_ctx#execute - # This uses the statically built binary from the infra repo - res = ctx.execute(["bin/open_ar", "--input", "tmp/deb.ar", "--output_dir", "tmp"], quiet = False) - if res.return_code != 0: - # Run it again to display the error - fail("Could not open deb.ar from " + deb) - # https://bazel.build/rules/lib/repository_ctx#extract ctx.extract( archive = "tmp/data.tar.xz", @@ -176,16 +170,6 @@ def _download_and_extract_deb(ctx, deb, sha256, prefix, output = ""): ctx.delete("tmp") def _download_linux_amd64_toolchain_impl(ctx): - # Workaround for Bazel not yet supporting .ar files - # See https://skia-review.googlesource.com/c/buildbot/+/524764 - # https://bazel.build/rules/lib/repository_ctx#download - ctx.download( - url = mirror_prefix + "open_ar_v1", - sha256 = "55bb74d9ce5d6fa06e390b2319a410ec595dbb591a3ce650da356efe970f86d3", - executable = True, - output = "bin/open_ar", - ) - # Download the clang toolchain (the extraction can take a while) # https://bazel.build/rules/lib/repository_ctx#download_and_extract ctx.download_and_extract( diff --git a/toolchain/linux_trampolines/clang_trampoline_linux.sh b/toolchain/linux_trampolines/clang_trampoline_linux.sh index a8bb9e9d68..09483aaf1e 100755 --- a/toolchain/linux_trampolines/clang_trampoline_linux.sh +++ b/toolchain/linux_trampolines/clang_trampoline_linux.sh @@ -6,6 +6,8 @@ export LD_LIBRARY_PATH="external/clang_linux_amd64/usr/lib/x86_64-linux-gnu:external/clang_linux_amd64/usr/lib/llvm-13/lib" +set -e + # We only want to run include-what-you-use if DSKIA_ENFORCE_IWYU is in the arguments # passed in (i.e. the "skia_enforce_iwyu" feature is enabled) and we are not linking # (as detected by the presence of -fuse-ld).