From 1c532b5e44fa1fbff84c494c659fe722b7df4b10 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 9 Jun 2023 02:33:51 +0000 Subject: [PATCH] bazel build --incompatible_no_implicit_file_export The Bazel build was relying, for the two files enumerated in this diff, on the legacy implicit-export semantics described here: https://bazel.build/reference/be/functions#exports_files This documentation page encourages migrating away from this legacy behavior, and indeed we have a user who reported a Bazel build error and it appears that they were already using the new, stricter behavior: https://github.com/openxla/iree/pull/13982 and while examining fixes on our side and trying to get a clean Bazel build, I ran into this similar issue in the LLVM overlay. It would arguably be cleaner (in the sense of more structured) to rely on `filegroup` to export this, but I am insufficiently familiar with the Clang build (the dependent targets seem to be below Clang) to do this myself. The present `exports_files` solution has the merit of being localized in these few lines here. Differential Revision: https://reviews.llvm.org/D152491 --- utils/bazel/.bazelrc | 5 +++++ utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/utils/bazel/.bazelrc b/utils/bazel/.bazelrc index b0f137f..c06e9b3 100644 --- a/utils/bazel/.bazelrc +++ b/utils/bazel/.bazelrc @@ -25,6 +25,11 @@ build --strip=never # Add layering check to all projects. build --features=layering_check +# Opt out of legacy lax behavior implicitly exporting files that are rule inputs +# with default visibility. +# See: https://bazel.build/reference/be/functions#exports_files +build --incompatible_no_implicit_file_export + ############################################################################### # Options to select different strategies for linking potential dependent # libraries. The default leaves it disabled. diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel index 0cc28fd..c43ab72 100644 --- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel @@ -17,7 +17,18 @@ package( licenses(["notice"]) -exports_files(["LICENSE.TXT"]) +exports_files([ + "LICENSE.TXT", + "cmake/modules/llvm-driver-template.cpp.in", + "include/llvm/CodeGen/SDNodeProperties.td", + "include/llvm/CodeGen/ValueTypes.td", + "include/llvm/Frontend/Directive/DirectiveBase.td", + "include/llvm/Frontend/OpenACC/ACC.td", + "include/llvm/Frontend/OpenMP/OMP.td", + "include/llvm/IR/Intrinsics.td", + "include/llvm/Option/OptParser.td", + "utils/lit/lit.py", +]) # It may be tempting to add compiler flags here, but that should be avoided. # The necessary warnings and other compile flags should be provided by the -- 2.7.4