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

Side by Side Diff: chrome/build_nacl_irt.py

Issue 7701017: Switching NaCl IRT to be built inside the chrome build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/download_nacl_irt.py ('k') | chrome/nacl.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import optparse 6 import optparse
7 import os 7 import os
8 import re 8 import re
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 # Invoke scons to get dependency tree. 53 # Invoke scons to get dependency tree.
54 cmd = [ 54 cmd = [
55 sys.executable, 'scons.py', '-n', '--tree=all', 55 sys.executable, 'scons.py', '-n', '--tree=all',
56 '--mode=nacl', 'platform=' + platform, 56 '--mode=nacl', 'platform=' + platform,
57 'scons-out/nacl_irt-' + platform + '/staging/irt.nexe', 57 'scons-out/nacl_irt-' + platform + '/staging/irt.nexe',
58 ] 58 ]
59 p = subprocess.Popen(cmd, cwd=NACL_DIR, 59 p = subprocess.Popen(cmd, cwd=NACL_DIR,
60 stdout=subprocess.PIPE, 60 stdout=subprocess.PIPE,
61 stderr=subprocess.PIPE) 61 stderr=subprocess.PIPE)
62 (p_stdout, p_stderr) = p.communicate() 62 (p_stdout, p_stderr) = p.communicate()
63 # If things fail on windows, try running --help, if that fails,
64 # emit this script as an input (to satiate gyp), and assume we're being
65 # run on a test only bot.
66 # TODO(bradnelson): add plumbing to the buildbots to allow this script
67 # to know its on a test only bot + make scons return a _particular_
68 # return code so we can detect this kind of fail in one step.
69 if p.returncode != 0 and sys.platform == 'win32':
70 cmd = [sys.executable, 'scons.py', '--help']
71 p = subprocess.Popen(cmd, cwd=NACL_DIR,
72 stdout=subprocess.PIPE,
73 stderr=subprocess.PIPE)
74 (p_stdout, p_stderr) = p.communicate()
75 if p.returncode !=0:
76 # If scons can't even run, emit just this script as an input.
77 # See comment above this one.
78 print RelativePath(__file__, SCRIPT_DIR).replace(os.sep, '/')
79 return
63 if p.returncode != 0: 80 if p.returncode != 0:
64 sys.exit(2) 81 sys.exit(2)
65 # Extract unique inputs. 82 # Extract unique inputs.
66 for line in p_stdout.splitlines(): 83 for line in p_stdout.splitlines():
67 m = re.match('^[ -+|]*\+\-(.+)', line) 84 m = re.match('^[ -+|]*\+\-(.+)', line)
68 if not m: 85 if not m:
69 continue 86 continue
70 filename = m.group(1) 87 filename = m.group(1)
71 if '[' in filename: 88 if '[' in filename:
72 continue 89 continue
73 if filename.startswith('scons-out'): 90 if filename.startswith('scons-out'):
74 continue 91 continue
75 if filename.endswith('.nexe'): 92 if filename.endswith('.nexe'):
76 continue 93 continue
77 # Apply the underlay of gpu/command_buffer (to match scons). 94 # Apply the underlay of gpu/command_buffer (to match scons).
78 if filename.startswith(NACL_CMD_BUFFER_DIR + os.sep): 95 if filename.startswith(NACL_CMD_BUFFER_DIR + os.sep):
79 filename = GPU_CMD_BUFFER_DIR + filename[len(NACL_CMD_BUFFER_DIR):] 96 filename = GPU_CMD_BUFFER_DIR + filename[len(NACL_CMD_BUFFER_DIR):]
80 inputs.add(filename) 97 inputs.add(filename)
81 # Check that everything exists and make it script relative. 98 # Check that everything exists and make it script relative.
82 # Exclude things above SRC_DIR. 99 # Exclude things above SRC_DIR.
83 rel_inputs = set() 100 rel_inputs = set()
84 for f in inputs: 101 for f in inputs:
85 nf = os.path.join(NACL_DIR, f) 102 nf = os.path.join(NACL_DIR, f)
86 if not os.path.exists(nf): 103 if not os.path.exists(nf):
87 raise Exception('missing input file "%s"' % nf) 104 raise Exception('missing input file "%s"' % nf)
88 # If the relative path from SRC_DIR to the file starts with ../ ignore it. 105 # If the relative path from SRC_DIR to the file starts with ../ ignore it.
89 # (i.e. the file is outside the client). 106 # (i.e. the file is outside the client).
90 if RelativePath(nf, SRC_DIR).startswith('..' + os.sep): 107 if RelativePath(nf, SRC_DIR).startswith('..' + os.sep):
91 continue 108 continue
92 rel_inputs.add(RelativePath(nf, SCRIPT_DIR)) 109 rel_inputs.add(RelativePath(nf, SCRIPT_DIR).replace(os.sep, '/'))
93 # Print it sorted. 110 # Print it sorted.
94 rel_inputs = sorted(list(rel_inputs)) 111 rel_inputs = sorted(list(rel_inputs))
95 for f in rel_inputs: 112 for f in rel_inputs:
96 print f 113 print f
97 114
98 115
99 def BuildIRT(platforms, out_dir): 116 def BuildIRT(platforms, out_dir):
100 """Build the IRT for several platforms. 117 """Build the IRT for several platforms.
101 118
102 Arguments: 119 Arguments:
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 sys.exit(1) 194 sys.exit(1)
178 195
179 if options.inputs: 196 if options.inputs:
180 PrintInputs(options.platforms) 197 PrintInputs(options.platforms)
181 else: 198 else:
182 BuildIRT(options.platforms, options.outdir) 199 BuildIRT(options.platforms, options.outdir)
183 200
184 201
185 if __name__ == '__main__': 202 if __name__ == '__main__':
186 Main(sys.argv) 203 Main(sys.argv)
OLDNEW
« no previous file with comments | « build/download_nacl_irt.py ('k') | chrome/nacl.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698