1 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
12 from trace_viewer import trace_viewer_project
13 def _sopen(filename, mode):
15 return open(filename, mode)
16 return os.fdopen(os.dup(sys.stdout.fileno()), 'w')
19 parser = optparse.OptionParser(
20 usage="%prog --js=<filename> --css=<filename>",
22 A script to takes all of the javascript and css files that comprise trace-viewer
23 and merges them together into two giant js and css files, taking into account
24 various ordering restrictions between them.
26 parser.add_option("--js", dest="js_file",
27 help="Where to place generated javascript file")
28 parser.add_option("--css", dest="css_file",
29 help="Where to place generated css file")
30 options, args = parser.parse_args(args)
32 if not options.js_file and not options.css_file:
33 sys.stderr.write("ERROR: Must specify one of --js=<filename> or "
34 "--css=<filename>\n\n")
38 project = trace_viewer_project.TraceViewerProject()
39 load_sequence = project.CalcLoadSequenceForModuleFilenames(
40 ['tracing/standalone_timeline_view.js'])
43 with _sopen(options.js_file, 'w') as f:
44 f.write(tvcm.GenerateJS(load_sequence))
47 with _sopen(options.css_file, 'w') as f:
48 f.write(tvcm.GenerateCSS(load_sequence))