Index: tools/isolate_driver.py |
diff --git a/tools/isolate_driver.py b/tools/isolate_driver.py |
index 192de2cb837d9530d655a03303a73d1ccf9e8286..73ad0d6547742c0fce1b729a5212a842aa42c568 100755 |
--- a/tools/isolate_driver.py |
+++ b/tools/isolate_driver.py |
@@ -19,11 +19,12 @@ WARNING: The target to use for build.ninja analysis is the base name of the |
'foo_test_run' analysed. |
""" |
-import StringIO |
import glob |
+import json |
import logging |
import os |
import posixpath |
+import StringIO |
import subprocess |
import sys |
import time |
@@ -248,9 +249,23 @@ def create_wrapper(args, isolate_index, isolated_index): |
args[isolate_index] = temp_isolate |
+def prepare_isolate_call(args, output): |
+ """Gathers all information required to run isolate.py later. |
+ |
+ Dumps it as JSON to |output| file. |
+ """ |
+ with open(output, 'wb') as f: |
+ json.dump({ |
+ 'args': args, |
+ 'dir': os.getcwd(), |
+ 'version': 1, |
+ }, f, indent=2, sort_keys=True) |
+ |
+ |
def main(): |
logging.basicConfig(level=logging.ERROR, format='%(levelname)7s %(message)s') |
args = sys.argv[1:] |
+ mode = args[0] if args else None |
isolate = None |
isolated = None |
is_component = False |
@@ -261,13 +276,19 @@ def main(): |
isolated = i + 1 |
if arg == 'component=shared_library': |
is_component = True |
- if isolate is None or isolated is None: |
+ if isolate is None or isolated is None or not mode: |
print >> sys.stderr, 'Internal failure' |
return 1 |
if is_component: |
create_wrapper(args, isolate, isolated) |
+ # In 'prepare' mode just collect all required information for postponed |
+ # isolated.py invocation later, store it in *.isolated.gen.json file. |
+ if mode == 'prepare': |
+ prepare_isolate_call(args[1:], args[isolated] + '.gen.json') |
+ return 0 |
+ |
swarming_client = os.path.join(SRC_DIR, 'tools', 'swarming_client') |
sys.stdout.flush() |
result = subprocess.call( |