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

Side by Side Diff: client/tools/update.py

Issue 9567032: Bring htmlconverter back up to date: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/tools/htmlconverter_test.py ('k') | samples/third_party/dromaeo/generate_frog_tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 # This script builds and then uploads the Dart client sample app to AppEngine, 6 # This script builds and then uploads the Dart client sample app to AppEngine,
7 # where it is accessible by visiting http://dart.googleplex.com. 7 # where it is accessible by visiting http://dart.googleplex.com.
8 import os 8 import os
9 import subprocess 9 import subprocess
10 import sys 10 import sys
11 11
12 from os.path import abspath, basename, dirname, exists, join, split, relpath 12 from os.path import abspath, basename, dirname, exists, join, split, relpath
13 import base64, re, os, shutil, subprocess, sys, tempfile, optparse 13 import base64, re, os, shutil, subprocess, sys, tempfile, optparse
14 14
15 APP_PATH = os.getcwd() 15 APP_PATH = os.getcwd()
16 CLIENT_TOOLS_PATH = dirname(abspath(__file__)) 16 CLIENT_TOOLS_PATH = dirname(abspath(__file__))
17 CLIENT_PATH = dirname(CLIENT_TOOLS_PATH) 17 CLIENT_PATH = dirname(CLIENT_TOOLS_PATH)
18 18
19 # Add the client tools directory so we can find htmlconverter.py. 19 # Add the client tools directory so we can find htmlconverter.py.
20 sys.path.append(CLIENT_TOOLS_PATH) 20 sys.path.append(CLIENT_TOOLS_PATH)
21 import htmlconverter 21 import htmlconverter
22 22
23 def convertOne(infile, options): 23 def convertOne(infile, options):
24 outDirBase = 'outcode' 24 outDirBase = 'outcode'
25 outfile = join(outDirBase, infile) 25 outfile = join(outDirBase, infile)
26 print 'converting %s to %s' % (infile, outfile) 26 print 'converting %s to %s' % (infile, outfile)
27 27
28 # TODO(jmesserly): this is a workaround for an OOM error in DartC
29 # See bug 5393264
30 if options.optimize:
31 os.putenv('DART_JVMARGS', '-Xmx512m')
32
33 if 'dart' in options.target: 28 if 'dart' in options.target:
34 htmlconverter.convertForDartium( 29 htmlconverter.convertForDartium(
35 infile, 30 infile,
36 outDirBase, 31 outDirBase,
37 outfile.replace('.html', '-dart.html'), 32 outfile.replace('.html', '-dart.html'),
38 options.verbose) 33 options.verbose)
39 if 'js' in options.target: 34 if 'js' in options.target:
40 htmlconverter.convertForChromium( 35 htmlconverter.convertForChromium(
41 infile, options.optimize, options.frog, options.dartc_extra_flags, 36 infile, options.dartc_extra_flags,
42 outfile.replace('.html', '-js.html'), 37 outfile.replace('.html', '-js.html'),
43 options.verbose) 38 options.verbose)
44 39
45 40
46 def Flags(): 41 def Flags():
47 """ Consturcts a parser for extracting flags from the command line. """ 42 """ Consturcts a parser for extracting flags from the command line. """
48 result = optparse.OptionParser() 43 result = optparse.OptionParser()
49 result.add_option("-t", "--target", 44 result.add_option("-t", "--target",
50 help="The target html to generate", 45 help="The target html to generate",
51 metavar="[js,dart]", 46 metavar="[js,dart]",
52 default='js,dart') 47 default='js,dart')
53 result.add_option("--frog",
54 help="Use frog compiler (default dartc)",
55 default=False,
56 action="store_true")
57 result.add_option("--optimize",
58 help="Use optimizer in dartc",
59 default=False,
60 action="store_true")
61 result.add_option("--verbose", 48 result.add_option("--verbose",
62 help="Print verbose output", 49 help="Print verbose output",
63 default=False, 50 default=False,
64 action="store_true") 51 action="store_true")
65 result.add_option("--dartc_extra_flags", 52 result.add_option("--dartc_extra_flags",
66 help="Additional flag text to pass to dartc", 53 help="Additional flag text to pass to dartc",
67 default="", 54 default="",
68 action="store") 55 action="store")
69 #result.set_usage("update.py input.html -o OUTDIR -t chromium,dartium") 56 #result.set_usage("update.py input.html -o OUTDIR -t chromium,dartium")
70 return result 57 return result
(...skipping 16 matching lines...) Expand all
87 # parser.print_help() 74 # parser.print_help()
88 # return 1 75 # return 1
89 76
90 REL_APP_PATH = relpath(APP_PATH) 77 REL_APP_PATH = relpath(APP_PATH)
91 for file in getAllHtmlFiles(): 78 for file in getAllHtmlFiles():
92 infile = join(REL_APP_PATH, file) 79 infile = join(REL_APP_PATH, file)
93 convertOne(infile, options) 80 convertOne(infile, options)
94 81
95 if __name__ == '__main__': 82 if __name__ == '__main__':
96 main() 83 main()
OLDNEW
« no previous file with comments | « client/tools/htmlconverter_test.py ('k') | samples/third_party/dromaeo/generate_frog_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698