Skip to content

Commit 333f2c3

Browse files
authored
[gn] Use exec_script_allowlist in //llvm/utils/gn/.gn (#134172)
This requires gn_version >= 2207. Run llvm/utils/gn/get.py to update your GN binary if you hit the assert added in this commit.
1 parent cf7d34a commit 333f2c3

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

llvm/utils/gn/.gn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
buildconfig = "//llvm/utils/gn/build/BUILDCONFIG.gn"
66

77
# Disallow all calls to exec_script. We should be very conservative about
8-
# whitelisting things here.
9-
exec_script_whitelist = []
8+
# allowing things here.
9+
exec_script_allowlist = []
1010

1111
# Execute action() targets using Python 3.
1212
script_executable = "python3"

llvm/utils/gn/build/toolchain/BUILD.gn

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,6 @@ template("unix_toolchain") {
7171
default_output_dir = "{{root_out_dir}}/lib"
7272
}
7373

74-
if (current_os == "ios" || current_os == "mac") {
75-
# gn < 1693 (e214b5d35898) doesn't support |frameworks|, requiring
76-
# frameworks to be listed in |libs|, but gn >= 1808 (3028c6a426a4) forbids
77-
# frameworks from appearing in |libs|. This assertion provides a helpful
78-
# cue to upgrade, and is much more user-friendly than the failure that
79-
# occurs when an older gn encounters |frameworks|.
80-
#
81-
# gn_version doesn’t actually exist in gn < 1709 (52cb644a3fb4), and
82-
# defined(gn_version) doesn't actually work as expected
83-
# (https://crbug.com/gn/183), so 1709 is the true minimum enforced by
84-
# this construct, and if gn_version is not available, this line will still
85-
# be blamed, making the resolution somewhat discoverable.
86-
assert(gn_version >= 1693,
87-
"Your GN is too old! " +
88-
"Update it, perhaps by running llvm/utils/gn/get.py")
89-
}
90-
9174
# Make these apply to all tools below.
9275
lib_switch = "-l"
9376
lib_dir_switch = "-L"

llvm/utils/gn/secondary/BUILD.gn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
22
import("//llvm/utils/gn/build/toolchain/compiler.gni")
33

4+
# `exec_script_allowlist` was added in GN version 2207, so that's the minimum
5+
# version of GN we require.
6+
assert(gn_version >= 2207,
7+
"Your GN is too old! Update it, perhaps by running llvm/utils/gn/get.py")
8+
49
group("default") {
510
deps = [
611
"//clang-tools-extra/clangd/test",

0 commit comments

Comments
 (0)