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

Side by Side Diff: client/dom/scripts/dartdomgenerator.py

Issue 9537001: Generate dart:html bindings for Dartium as well as Frog. All unittests now pass (or are disabled fo… (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 | « no previous file | client/dom/scripts/dartgenerator.py » ('j') | client/dom/scripts/dartgenerator.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/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 is the entry point to create Dart APIs from the IDL database.""" 6 """This is the entry point to create Dart APIs from the IDL database."""
7 7
8 import dartgenerator 8 import dartgenerator
9 import database 9 import database
10 import logging.config 10 import logging.config
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if 'frog' in systems: 139 if 'frog' in systems:
140 _logger.info('Copy dom_frog to frog/') 140 _logger.info('Copy dom_frog to frog/')
141 subprocess.call(['cd .. ; ../tools/copy_dart.py frog dom_frog.dart'], 141 subprocess.call(['cd .. ; ../tools/copy_dart.py frog dom_frog.dart'],
142 shell=True); 142 shell=True);
143 143
144 if 'htmlfrog' in systems: 144 if 'htmlfrog' in systems:
145 _logger.info('Copy html_frog to ../html/frog/') 145 _logger.info('Copy html_frog to ../html/frog/')
146 subprocess.call(['cd ../../html ; ../tools/copy_dart.py frog html_frog.dart' ], 146 subprocess.call(['cd ../../html ; ../tools/copy_dart.py frog html_frog.dart' ],
147 shell=True); 147 shell=True);
148 148
149 if 'htmldartium' in systems:
150 _logger.info('Copy html_dartium to ../html/dartium/')
151 subprocess.call(['cd ../../html ; ../tools/copy_dart.py dartium html_dartium .dart'],
152 shell=True);
153
149 def main(): 154 def main():
150 parser = optparse.OptionParser() 155 parser = optparse.OptionParser()
151 parser.add_option('--systems', dest='systems', 156 parser.add_option('--systems', dest='systems',
152 action='store', type='string', 157 action='store', type='string',
153 default='frog,dummy,wrapping', 158 default='frog,dummy,wrapping',
154 help='Systems to generate (frog, native, dummy, ' 159 help='Systems to generate (frog, native, dummy, '
155 'htmlfrog, htmldartium)') 160 'htmlfrog, htmldartium)')
156 parser.add_option('--output-dir', dest='output_dir', 161 parser.add_option('--output-dir', dest='output_dir',
157 action='store', type='string', 162 action='store', type='string',
158 default=None, 163 default=None,
159 help='Directory to put the generated files') 164 help='Directory to put the generated files')
160 parser.add_option('--use-database-cache', dest='use_database_cache', 165 parser.add_option('--use-database-cache', dest='use_database_cache',
161 action='store_true', 166 action='store_true',
162 default=False, 167 default=False,
163 help='''Use the cached database from the previous run to 168 help='''Use the cached database from the previous run to
164 improve startup performance''') 169 improve startup performance''')
165 (options, args) = parser.parse_args() 170 (options, args) = parser.parse_args()
166 171
167 current_dir = os.path.dirname(__file__) 172 current_dir = os.path.dirname(__file__)
168 systems = options.systems.split(',') 173 systems = options.systems.split(',')
169 num_html_systems = ('htmlfrog' in systems) + ('htmldartium' in systems) 174 num_html_systems = ('htmlfrog' in systems) + ('htmldartium' in systems)
170 if num_html_systems > 0 and num_html_systems < len(systems): 175 if num_html_systems > 0 and num_html_systems < len(systems):
171 print 'Cannot generate html and dom bindings at the same time' 176 print 'Cannot generate html and dom bindings at the same time'
sra1 2012/02/29 23:11:55 Just a question: could we generate both by partiti
Jacob 2012/03/01 00:40:44 Sounds reasonable but as it is unrelated to this C
172 sys.exit(-1) 177 sys.exit(-1)
173 178
174 use_database_cache = options.use_database_cache 179 use_database_cache = options.use_database_cache
175 generate_html_systems = ('htmlfrog' in systems) or ('htmldartium' in systems) 180 generate_html_systems = ('htmlfrog' in systems) or ('htmldartium' in systems)
176 output_dir = options.output_dir or ( 181 output_dir = options.output_dir or (
177 os.path.join(current_dir, '../../html') if generate_html_systems else 182 os.path.join(current_dir, '../../html') if generate_html_systems else
178 os.path.join(current_dir, '..')) 183 os.path.join(current_dir, '..'))
179 184
180 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) 185 logging.config.fileConfig(os.path.join(current_dir, 'logging.conf'))
181 186
182 GenerateDOM(systems, generate_html_systems, output_dir, use_database_cache) 187 GenerateDOM(systems, generate_html_systems, output_dir, use_database_cache)
183 188
184 # Copy dummy DOM where dartc build expects it. 189 # Copy dummy DOM where dartc build expects it.
185 if 'dummy' in systems: 190 if 'dummy' in systems:
186 # TODO(sra): Make other tools pick this up directly, or do a copy_dart into 191 # TODO(sra): Make other tools pick this up directly, or do a copy_dart into
187 # a specific directory. 192 # a specific directory.
188 source = os.path.join(output_dir, 'dom_dummy.dart') 193 source = os.path.join(output_dir, 'dom_dummy.dart')
189 target = os.path.join(output_dir, 'dom.dart') 194 target = os.path.join(output_dir, 'dom.dart')
190 shutil.copyfile(source, target) 195 shutil.copyfile(source, target)
191 196
192 if __name__ == '__main__': 197 if __name__ == '__main__':
193 sys.exit(main()) 198 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | client/dom/scripts/dartgenerator.py » ('j') | client/dom/scripts/dartgenerator.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698