From 7181610b0c84e2cd87852a7f7d30c4e7e4ca32cd Mon Sep 17 00:00:00 2001 From: dpranke Date: Sun, 24 Apr 2016 16:14:52 -0700 Subject: [PATCH] Add MB configs for ClangToTLinux* bots on FYI The tip-of-tree Clang bots rely on an environment variable called LLVM_FORCE_HEAD_REVISION to be set in order to know to fetch the tip-of-tree Clang and use its version in the compile time defines, rather than the checked-in version. We don't want GN to use or depend on environment variables, so this patch modifies the clang update script to also look at a new command line arg, and adds a GN arg called 'llvm_force_head_revision' to cause the same effect. However, we need to keep the env var around for `gclient runhooks` and to keep the existing bots (and devs) working while on GYP, and, perhaps more importantly, adding a new GYP_DEFINE that does what we need to build/common.gypi is proving intractable, so we hack MB to rewrite what the GYP_DEFINE would be if life made sense back into the env var. BUG=481692, 582737 R=thakis@chromium.org, brettw@chromium.org Review URL: https://codereview.chromium.org/1908293002 Cr-Original-Commit-Position: refs/heads/master@{#389408} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 909bad6afa7124f67c4890f3c1bc244179141978 --- config/compiler/BUILD.gn | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn index 07408d69c..fd8f46eab 100644 --- a/config/compiler/BUILD.gn +++ b/config/compiler/BUILD.gn @@ -90,6 +90,23 @@ declare_args() { # Gold icf level, values are "none", "safe", "all". If value isn't overridden, # default initialization is below. gold_icf_level = "" + + # If this is set to true, or if LLVM_FORCE_HEAD_REVISION is set to 1 + # in the environment, we use the revision in the llvm repo to determine + # the CLANG_REVISION to use, instead of the version hard-coded into + # //tools/clang/scripts/update.py. This should only be used in + # conjunction with setting LLVM_FORCE_HEAD_REVISION in the + # environment when `gclient runhooks` is run as well. + llvm_force_head_revision = false +} + +if (is_clang && !is_nacl) { + update_args = [ "--print-revision" ] + if (llvm_force_head_revision) { + update_args += [ "--llvm-force-head-revision" ] + } + clang_revision = + exec_script("//tools/clang/scripts/update.py", update_args, "trim string") } # Apply the default logic for these values if they were not set explicitly. @@ -226,10 +243,7 @@ config("compiler") { # when turning clang on or off. (defines are passed via the command line, # and build system rebuild things when their commandline changes). Nothing # should ever read this define. - defines += - [ "CR_CLANG_REVISION=" + exec_script("//tools/clang/scripts/update.py", - [ "--print-revision" ], - "trim string") ] + defines += [ "CR_CLANG_REVISION=$clang_revision" ] } # Non-Mac Posix compiler flags setup. @@ -974,9 +988,7 @@ config("default_warnings") { "-Wno-shift-negative-value", ] - if (exec_script("//tools/clang/scripts/update.py", - [ "--print-revision" ], - "trim string") != "266460-1") { + if (llvm_force_head_revision) { cflags += [ # TODO(thakis): https://crbug.com/604888 "-Wno-undefined-var-template",