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

Unified Diff: tools/create_snapshot_file.py

Issue 8439061: Support command line parameters to specify a url to file name mapping. This is used during snapsh... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 1 month 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
« bin/gen_snapshot.cc ('K') | « include/dart_api.h ('k') | vm/dart.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/create_snapshot_file.py
===================================================================
--- tools/create_snapshot_file.py (revision 1106)
+++ tools/create_snapshot_file.py (working copy)
@@ -22,19 +22,23 @@
result = optparse.OptionParser()
result.add_option("--executable",
action="store", type="string",
- help="path to executable")
+ help="path to snapshot generator executable")
result.add_option("--output_bin",
action="store", type="string",
- help="binary snapshot output file name")
+ help="output file name into which snapshot in binary form is generated")
result.add_option("--input_cc",
action="store", type="string",
- help="input template file name")
+ help="input file name which contains the C buffer template")
result.add_option("--output",
action="store", type="string",
- help="generated snapshot output file name")
- result.add_option("--scripts",
+ help="output file name into which snapshot in C buffer form is generated")
+ result.add_option("--script",
action="store", type="string",
- help="list of scripts to include in snapshot")
+ help="Dart script for which snapshot is to be generated")
+ result.add_option("--url_mapping",
+ default=[],
+ action="append",
+ help="mapping from url to file name, used when generating snapshots")
result.add_option("-v", "--verbose",
help='Verbose output.',
default=False, action="store_true")
@@ -80,25 +84,41 @@
def Main():
- # Parse the options.
+ # Parse options.
parser = BuildOptions()
(options, args) = parser.parse_args()
if not ProcessOptions(options):
parser.print_help()
return 1
- # Construct the path to the dart binary.
- snapshot_argument = ''.join([ "--snapshot=", options.output_bin ])
- if not options.scripts:
- command = [ options.executable, snapshot_argument ]
- else:
- scripts = string.split(options.scripts)
- command = [ options.executable, snapshot_argument ] + scripts
+ # If there are additional arguments, report error and exit.
+ if args:
+ parser.print_help()
+ return 1
+
+ # Setup arguments to the snapshot generator binary.
+ script_args = [ ]
+
+ # First setup the snapshot output filename.
+ script_args.append(''.join([ "--snapshot=", options.output_bin ]))
+
+ # Next setup all url mapping options specified.
+ for url_arg in options.url_mapping:
+ url_mapping_argument = ''.join(["--url_mapping=", url_arg ])
+ script_args.append(url_mapping_argument)
+
+ # Finally append the script name if one is specified.
+ if options.script:
+ script_args.append(options.script)
+
+ # Construct command line to execute the snapshot generator binary and invoke.
+ command = [ options.executable ] + script_args
if options.verbose:
print ' '.join(command)
subprocess.call(command)
if not makeFile(options.output, options.input_cc, options.output_bin):
+ print "Unable to generate snapshot in C buffer form"
return -1
return 0
« bin/gen_snapshot.cc ('K') | « include/dart_api.h ('k') | vm/dart.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698