summaryrefslogtreecommitdiffstats
path: root/chrome/build_nacl_irt.py
diff options
context:
space:
mode:
authorbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-16 22:01:17 +0000
committerbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-16 22:01:17 +0000
commit80fcc8fc2390d4085943e34ae1861aff3cf7e45c (patch)
tree7d1ac6875cd6f6acd8febcaf480441e0e32bd390 /chrome/build_nacl_irt.py
parent7362671659bc1e18a168320a24b6aa469e99af11 (diff)
downloadchromium_src-80fcc8fc2390d4085943e34ae1861aff3cf7e45c.zip
chromium_src-80fcc8fc2390d4085943e34ae1861aff3cf7e45c.tar.gz
chromium_src-80fcc8fc2390d4085943e34ae1861aff3cf7e45c.tar.bz2
Use a cheap overapproximation of the input set to the nacl IRT build.
Hopefully this will reduce the global pain while we get the gyp pattern for building the IRT sorted out. Reduces the gyp generation time on mac by ~13 seconds. Basically makes the gyp generation for this step sub-second, but will cause some spurious rebuild. BUG=http://code.google.com/p/chromium/issues/detail?id=82230 TEST=None R=thakis@chromium.org Review URL: http://codereview.chromium.org/7919017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/build_nacl_irt.py')
-rwxr-xr-xchrome/build_nacl_irt.py100
1 files changed, 83 insertions, 17 deletions
diff --git a/chrome/build_nacl_irt.py b/chrome/build_nacl_irt.py
index cee7655..f0fb0c5 100755
--- a/chrome/build_nacl_irt.py
+++ b/chrome/build_nacl_irt.py
@@ -45,6 +45,80 @@ def RelativePath(path, base):
return os.sep.join(rel_parts)
+def CrawlDirectorySources(path, dst_set):
+ """Find all source files under a directory
+
+ Ignores all directories starting with a dot.
+ Args:
+ path: path to walk
+ dst_set: a set to add the files found to.
+ """
+ for root, dirs, files in os.walk(path, topdown=True):
+ for d in dirs:
+ if d.startswith('.'):
+ dirs.remove(d)
+ for f in files:
+ if os.path.splitext(f)[1] in ['.cc', '.c', '.S', '.h', '.x']:
+ dst_set.add(os.path.join(root, f))
+
+
+def PrintRelativePaths(inputs):
+ """Print a set of file paths in sorted order relative to SRC_DIR.
+
+ Args:
+ inputs: a set of absolute paths.
+ """
+ # Check that everything exists and make it script relative.
+ # Exclude things above SRC_DIR.
+ rel_inputs = set()
+ for f in inputs:
+ nf = os.path.join(NACL_DIR, f)
+ if not os.path.exists(nf):
+ raise Exception('missing input file "%s"' % nf)
+ # If the relative path from SRC_DIR to the file starts with ../ ignore it.
+ # (i.e. the file is outside the client).
+ if RelativePath(nf, SRC_DIR).startswith('..' + os.sep):
+ continue
+ rel_inputs.add(RelativePath(nf, SCRIPT_DIR).replace(os.sep, '/'))
+ # Print it sorted.
+ rel_inputs = sorted(list(rel_inputs))
+ for f in rel_inputs:
+ print f
+
+
+def CheapPrintInputs():
+ """Approximate the inputs to the nacl irt build step cheaply."""
+ inputs = set()
+ for base in [
+ 'base',
+ 'build',
+ 'gpu/GLES2',
+ 'gpu/KHR',
+ 'gpu/command_buffer',
+ 'native_client/src/include',
+ 'native_client/src/shared/gio',
+ 'native_client/src/shared/imc',
+ 'native_client/src/shared/platform',
+ 'native_client/src/shared/srpc',
+ 'native_client/src/third_party/dlmalloc',
+ 'native_client/src/third_party/valgrind',
+ 'native_client/src/trusted/desc',
+ 'native_client/src/trusted/nacl_base',
+ 'native_client/src/trusted/service_runtime',
+ 'native_client/src/untrusted/irt',
+ 'native_client/src/untrusted/nacl',
+ 'native_client/src/untrusted/pthread',
+ 'native_client/src/untrusted/stubs',
+ 'ppapi/c',
+ 'ppapi/cpp',
+ 'ppapi/native_client/src/shared/ppapi_proxy',
+ 'ui/gfx/gl',
+ ]:
+ CrawlDirectorySources(os.path.join(SRC_DIR, base), inputs)
+ inputs.add(os.path.join(SRC_DIR, 'DEPS'))
+ PrintRelativePaths(inputs)
+
+
def PrintInputs(platforms):
"""Print all the transitive inputs required to build the IRT.
@@ -102,22 +176,8 @@ def PrintInputs(platforms):
os.path.exists(os.path.join(PPAPI_NACL_DIR, filename))):
filename = '../ppapi/native_client/' + filename
inputs.add(filename)
- # Check that everything exists and make it script relative.
- # Exclude things above SRC_DIR.
- rel_inputs = set()
- for f in inputs:
- nf = os.path.join(NACL_DIR, f)
- if not os.path.exists(nf):
- raise Exception('missing input file "%s"' % nf)
- # If the relative path from SRC_DIR to the file starts with ../ ignore it.
- # (i.e. the file is outside the client).
- if RelativePath(nf, SRC_DIR).startswith('..' + os.sep):
- continue
- rel_inputs.add(RelativePath(nf, SCRIPT_DIR).replace(os.sep, '/'))
- # Print it sorted.
- rel_inputs = sorted(list(rel_inputs))
- for f in rel_inputs:
- print f
+ # Print it.
+ PrintRelativePaths(inputs)
def BuildIRT(platforms, out_dir):
@@ -189,6 +249,9 @@ def Main(argv):
parser.add_option('--inputs', dest='inputs', default=False,
action='store_true',
help='only emit the transitive inputs to the irt build')
+ parser.add_option('--cheap', dest='cheap', default=False,
+ action='store_true',
+ help='use an approximation of the IRT\'s inputs')
parser.add_option('--platform', dest='platforms', action='append',
default=[],
help='add a platform to build for (x86-32|x86-64)')
@@ -201,7 +264,10 @@ def Main(argv):
sys.exit(1)
if options.inputs:
- PrintInputs(options.platforms)
+ if options.cheap:
+ CheapPrintInputs()
+ else:
+ PrintInputs(options.platforms)
else:
BuildIRT(options.platforms, options.outdir)