Index: tools/gyp_flag_compare.py |
diff --git a/tools/gyp_flag_compare.py b/tools/gyp_flag_compare.py |
index 86fa5c409840188f63fd76d41b5c2afea403c7c7..0b33a459ea874d0d0f6c0f7372abd11e15a27c9f 100755 |
--- a/tools/gyp_flag_compare.py |
+++ b/tools/gyp_flag_compare.py |
@@ -98,6 +98,9 @@ def GetFlags(lines, build_dir): |
assert len(rsp_file) <= 1 |
if rsp_file: |
rsp_file = os.path.join(build_dir, rsp_file[0][1:]) |
+ if not os.path.exists(rsp_file): |
+ print 'Warning: Skipping %s' % rsp_file |
+ continue |
with open(rsp_file, "r") as open_rsp_file: |
command_line = shlex.split(open_rsp_file, posix=False) |
@@ -185,10 +188,10 @@ def CompareLists(gyp, gn, name, dont_care_gyp=None, dont_care_gn=None): |
return output |
-def Run(command_line): |
+def Run(command_line, **kwargs): |
"""Run |command_line| as a subprocess and return stdout. Raises on error.""" |
try: |
- return subprocess.check_output(command_line, shell=True) |
+ return subprocess.check_output(command_line, shell=True,**kwargs) |
except subprocess.CalledProcessError as e: |
# Rescue the output we got until the exception happened. |
print '#### Stdout: ####################################################' |
@@ -197,6 +200,10 @@ def Run(command_line): |
raise |
+def compile(build_type, src_dir): |
+ args = "python -u E:/b/build/scripts/tools/runit.py --show-path python E:/b/build/scripts/slave/compile.py --build-args=-d --build-args=keeprsp --gsutil-py-path E:/b/build/scripts/slave/.recipe_deps/depot_tools/gsutil.py --ninja-path E:/b/build/scripts/slave/.recipe_deps/depot_tools/ninja.exe --target %s --src-dir %s --goma-cache-dir E:/b/build/slave/goma_cache --compiler goma --goma-service-account-json-file C:/creds/service_accounts/service-account-goma-client.json --goma-dir E:/b/build/slave/cache/cipd/goma --goma-fail-fast --goma-disable-local-fallback -- all".replace('/', '\\') |
+ return Run(args % (build_type, src_dir)) |
+ |
def main(): |
if len(sys.argv) < 4: |
print ('usage: %s gn_outdir gyp_outdir gn_target ' |
@@ -206,20 +213,27 @@ def main(): |
if len(sys.argv) == 4: |
sys.argv.append(sys.argv[3]) |
gn_out_dir = sys.argv[1] |
- print >> sys.stderr, 'Expecting gn outdir in %s...' % gn_out_dir |
- gn = Run('ninja -C %s -t commands %s' % (gn_out_dir, sys.argv[3])) |
+ gyp_out_dir = sys.argv[2] |
+ |
+ build_type = os.path.basename(gyp_out_dir) |
+ src_dir = os.path.dirname(os.path.dirname(gyp_out_dir)) |
+ print >> sys.stderr, 'Expecting gyp outdir in %s...' % gyp_out_dir |
if sys.platform == 'win32': |
# On Windows flags are stored in .rsp files which are created during build. |
- print >> sys.stderr, 'Building in %s...' % gn_out_dir |
- Run('ninja -C %s -d keeprsp %s' % (gn_out_dir, sys.argv[3])) |
+ print >> sys.stderr, 'Building in %s...' % gyp_out_dir |
+ # Run('ninja -C %s -d keeprsp %s' % (gyp_out_dir, " ".join(sys.argv[4:]))) |
+ compile(build_type, src_dir) |
- gyp_out_dir = sys.argv[2] |
- print >> sys.stderr, 'Expecting gyp outdir in %s...' % gyp_out_dir |
gyp = Run('ninja -C %s -t commands %s' % (gyp_out_dir, " ".join(sys.argv[4:]))) |
+ |
+ build_type = 'gn' |
+ print >> sys.stderr, 'Expecting gn outdir in %s...' % gn_out_dir |
if sys.platform == 'win32': |
# On Windows flags are stored in .rsp files which are created during build. |
- print >> sys.stderr, 'Building in %s...' % gyp_out_dir |
- Run('ninja -C %s -d keeprsp %s' % (gyp_out_dir, " ".join(sys.argv[4:]))) |
+ print >> sys.stderr, 'Building in %s...' % gn_out_dir |
+ # Run('ninja -C %s -d keeprsp %s' % (gn_out_dir, sys.argv[3])) |
+ compile(build_type, src_dir) |
+ gn = Run('ninja -C %s -t commands %s' % (gn_out_dir, sys.argv[3])) |
all_gyp_flags = GetFlags(gyp.splitlines(), |
os.path.join(os.getcwd(), gyp_out_dir)) |