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

Unified Diff: tools/isolate_driver.py

Issue 2039873002: [gn] Fix isolate_driver for gn (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review Created 4 years, 6 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 | « gni/isolate.gni ('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
index d1b39b095828dc634d2d49b1d40b32ec9d1638d6..154235302e50eb3bf7496c9d69431194dedfcfc7 100644
--- a/tools/isolate_driver.py
+++ b/tools/isolate_driver.py
@@ -30,6 +30,16 @@ def prepare_isolate_call(args, output):
'version': 1,
}, f, indent=2, sort_keys=True)
+def rebase_directories(args, abs_base):
+ """Rebases all paths to be relative to abs_base."""
+ def replace(index):
+ args[index] = os.path.relpath(os.path.abspath(args[index]), abs_base)
+ for i, arg in enumerate(args):
+ if arg in ['--isolate', '--isolated']:
+ replace(i + 1)
+ if arg == '--path-variable':
+ # Path variables have a triple form: --path-variable NAME <path>.
+ replace(i + 2)
def main():
logging.basicConfig(level=logging.ERROR, format='%(levelname)7s %(message)s')
@@ -49,6 +59,14 @@ def main():
print >> sys.stderr, 'Internal failure'
return 1
+ # Make sure all paths are relative to the isolate file. This is an
+ # expectation of the go binaries. In gn, this script is not called
+ # relative to the isolate file, but relative to the product dir.
+ new_base = os.path.abspath(os.path.dirname(args[isolate]))
+ rebase_directories(args, new_base)
+ assert args[isolate] == os.path.basename(args[isolate])
+ os.chdir(new_base)
+
# In 'prepare' mode just collect all required information for postponed
# isolated.py invocation later, store it in *.isolated.gen.json file.
if mode == 'prepare':
« no previous file with comments | « gni/isolate.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698