Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(981)

Unified Diff: scripts/common/chromium_utils.py

Issue 2276363002: Make the IsClangWinBuild function GN friendly (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Remove the re.VERBOSE Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/common/chromium_utils.py
diff --git a/scripts/common/chromium_utils.py b/scripts/common/chromium_utils.py
index 8dd27ef8adf9ea913501b72ad6583b6c2da2d10b..c522c20b63cb8ea0f4789e30a6ebcd817bcdc6dd 100644
--- a/scripts/common/chromium_utils.py
+++ b/scripts/common/chromium_utils.py
@@ -2005,24 +2005,18 @@ def GetSlaveNamesForBuilder(builders, builder_name):
return slaves
def IsClangWinBuild(build_dir, target):
- """Check if a ninja build has been build with Clang on Windows.
-
- This checks the build.ninja file from the build directory to see which
- compiler has been used for a build.
- """
- # TODO(sebmarchand): Make this works for gn builds, currently only the gyp one
- # is supported.
+ """Check if a ninja build has been build with Clang on Windows."""
if not IsWindows():
return False
- build_file = os.path.join(build_dir, target, 'build.ninja')
- if not os.path.isfile(build_file):
+
+ gn_file = os.path.join(build_dir, target, 'args.gn')
+ if not os.path.isfile(gn_file):
+ print 'WARNING: Unable to find the args.gn file.'
return False
- # Matches e.g. "cl_x86 = path/to/clang-cl.exe"
- clang_cl_re = re.compile(
- r'^cl_x\d\d\s+\=\s+(?P<compiler_path>[^ ]+)\s.*$',
- re.VERBOSE)
- for line in open(build_file):
- m = clang_cl_re.match(line)
- if m:
- return 'clang' in m.group('compiler_path')
+ # Matches e.g. "gn_arg = value"
+ gn_arg_re = re.compile(r'^(?P<flag>[^= ]+)\s*=\s*(?P<value>[^ \n]+)$')
+ for line in open(gn_file):
+ m = gn_arg_re.match(line)
+ if m and m.group('flag') == 'is_clang':
+ return m.group('value') == 'true'
return False
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698