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

Unified Diff: tools/gn/bin/gyp_flag_compare.py

Issue 559853002: Make gyp_flag_compare.py regenerate and take a target name to make it more usable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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: tools/gn/bin/gyp_flag_compare.py
diff --git a/tools/gn/bin/gyp_flag_compare.py b/tools/gn/bin/gyp_flag_compare.py
index f53240fa05dfbd878773b53d9735d8d6190dcb7f..ead046bcfe0186eb35194c285c9d58fd0b32dfa2 100755
--- a/tools/gn/bin/gyp_flag_compare.py
+++ b/tools/gn/bin/gyp_flag_compare.py
@@ -8,6 +8,8 @@
build, report on differences between the command lines."""
+import os
+import subprocess
import sys
@@ -101,16 +103,29 @@ def CompareLists(gyp, gn, name, dont_care=None):
return output
+def Run(command_line):
+ """Run |command_line| as a subprocess and return stdout. Raises on error."""
+ return subprocess.check_output(command_line, shell=True)
+
+
def main():
- if len(sys.argv) != 3:
- print 'usage: %s gyp_commands.txt gn_commands.txt' % __file__
+ if len(sys.argv) != 2 and len(sys.argv) != 3:
+ print 'usage: %s gyp_target gn_target' % __file__
+ print ' or: %s target' % __file__
return 1
- with open(sys.argv[1], 'rb') as f:
- gyp = f.readlines()
- with open(sys.argv[2], 'rb') as f:
- gn = f.readlines()
- all_gyp_flags = GetFlags(gyp)
- all_gn_flags = GetFlags(gn)
+
+ if len(sys.argv) == 2:
+ sys.argv.append(sys.argv[1])
+
+ print >>sys.stderr, 'Regenerating...'
+ # Currently only Release, non-component.
+ Run('gn gen out/gn_flags --args="is_debug=false is_component_build=false"')
+ del os.environ['GYP_DEFINES']
+ Run('python build/gyp_chromium -Goutput_dir=out_gyp_flags -Gconfig=Release')
+ gn = Run('ninja -C out/gn_flags -t commands %s' % sys.argv[2])
+ gyp = Run('ninja -C out_gyp_flags/Release -t commands %s' % sys.argv[1])
+ all_gyp_flags = GetFlags(gyp.splitlines())
+ all_gn_flags = GetFlags(gn.splitlines())
gyp_files = set(all_gyp_flags.keys())
gn_files = set(all_gn_flags.keys())
different_source_list = gyp_files != gn_files
« 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