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

Unified Diff: tools/isolate_driver.py

Issue 1378133005: [swarming] Add isolate driver. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/isolate.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate_driver.py
diff --git a/tools/isolate_driver.py b/tools/isolate_driver.py
new file mode 100644
index 0000000000000000000000000000000000000000..d1b39b095828dc634d2d49b1d40b32ec9d1638d6
--- /dev/null
+++ b/tools/isolate_driver.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# Copyright 2015 the V8 project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Adaptor script called through build/isolate.gypi.
+
+Slimmed down version of chromium's isolate driver that doesn't process dynamic
+dependencies.
+"""
+
+import json
+import logging
+import os
+import subprocess
+import sys
+
+TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
+
+
+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')
+ if len(sys.argv) < 2:
+ print >> sys.stderr, 'Internal failure; mode required'
+ return 1
+ mode = sys.argv[1]
+ args = sys.argv[1:]
+ isolate = None
+ isolated = None
+ for i, arg in enumerate(args):
+ if arg == '--isolate':
+ isolate = i + 1
+ if arg == '--isolated':
+ isolated = i + 1
+ if not isolate or not isolated:
+ print >> sys.stderr, 'Internal failure'
+ return 1
+
+ # 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(TOOLS_DIR, 'swarming_client')
+ sys.stdout.flush()
+ return subprocess.call(
+ [sys.executable, os.path.join(swarming_client, 'isolate.py')] + args)
+
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « build/isolate.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698