Commit ffcb7f1e authored by scottmg's avatar scottmg Committed by Commit bot

Make gyp_flag_compare.py regenerate and take a target name to make it more usable

Used to take two text files in obscure ninja format, now
expects the targets to compare. e.g.

tools/gn/bin/gyp_flag_compare.py base

or

tools/gn/bin/gyp_flag_compare.py breakpad_processor_support processor_support

TBR=brettw@chromium.org
BUG=335824

Review URL: https://codereview.chromium.org/559853002

Cr-Commit-Position: refs/heads/master@{#294111}
parent 96986bf6
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
build, report on differences between the command lines.""" build, report on differences between the command lines."""
import os
import subprocess
import sys import sys
...@@ -101,16 +103,29 @@ def CompareLists(gyp, gn, name, dont_care=None): ...@@ -101,16 +103,29 @@ def CompareLists(gyp, gn, name, dont_care=None):
return output 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(): def main():
if len(sys.argv) != 3: if len(sys.argv) != 2 and len(sys.argv) != 3:
print 'usage: %s gyp_commands.txt gn_commands.txt' % __file__ print 'usage: %s gyp_target gn_target' % __file__
print ' or: %s target' % __file__
return 1 return 1
with open(sys.argv[1], 'rb') as f:
gyp = f.readlines() if len(sys.argv) == 2:
with open(sys.argv[2], 'rb') as f: sys.argv.append(sys.argv[1])
gn = f.readlines()
all_gyp_flags = GetFlags(gyp) print >>sys.stderr, 'Regenerating...'
all_gn_flags = GetFlags(gn) # 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()) gyp_files = set(all_gyp_flags.keys())
gn_files = set(all_gn_flags.keys()) gn_files = set(all_gn_flags.keys())
different_source_list = gyp_files != gn_files different_source_list = gyp_files != gn_files
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment