[PATCH] D152491: Fix bazel build --incompatible_no_implicit_file_export

Benoit Jacob via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 19:39:30 PDT 2023


Benoit created this revision.
Herald added a subscriber: hanchung.
Herald added a project: All.
Benoit requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The Bazel build relies, 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152491

Files:
  utils/bazel/llvm-project-overlay/llvm/BUILD.bazel


Index: utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -17,7 +17,11 @@
 
 licenses(["notice"])
 
-exports_files(["LICENSE.TXT"])
+exports_files([
+    "LICENSE.TXT",
+    "cmake/modules/llvm-driver-template.cpp.in",
+    "include/llvm/Option/OptParser.td"
+])
 
 # 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152491.529806.patch
Type: text/x-patch
Size: 597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230609/66916184/attachment.bin>


More information about the llvm-commits mailing list