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

Side by Side Diff: Source/bindings/scripts/unstable/idl_compiler.py

Issue 124913002: IDL compiler: Pickle interface information (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (C) 2013 Google Inc. All rights reserved. 2 # Copyright (C) 2013 Google Inc. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 def parse_options(): 53 def parse_options():
54 parser = optparse.OptionParser() 54 parser = optparse.OptionParser()
55 parser.add_option('--additional-idl-files') 55 parser.add_option('--additional-idl-files')
56 # FIXME: The --dump-json-and-pickle option is only for debugging and will 56 # FIXME: The --dump-json-and-pickle option is only for debugging and will
57 # be removed once we complete migrating all IDL files from the Perl flow to 57 # be removed once we complete migrating all IDL files from the Perl flow to
58 # the Python flow. 58 # the Python flow.
59 parser.add_option('--dump-json-and-pickle', action='store_true', default=Fal se) 59 parser.add_option('--dump-json-and-pickle', action='store_true', default=Fal se)
60 parser.add_option('--idl-attributes-file') 60 parser.add_option('--idl-attributes-file')
61 parser.add_option('--include', dest='idl_directories', action='append') 61 parser.add_option('--include', dest='idl_directories', action='append')
62 parser.add_option('--output-directory') 62 parser.add_option('--output-directory')
63 parser.add_option('--interface-dependencies-file') 63 parser.add_option('--interfaces-file')
64 parser.add_option('--verbose', action='store_true', default=False) 64 parser.add_option('--verbose', action='store_true', default=False)
65 parser.add_option('--write-file-only-if-changed', type='int') 65 parser.add_option('--write-file-only-if-changed', type='int')
66 # ensure output comes last, so command line easy to parse via regexes 66 # ensure output comes last, so command line easy to parse via regexes
67 parser.disable_interspersed_args() 67 parser.disable_interspersed_args()
68 68
69 options, args = parser.parse_args() 69 options, args = parser.parse_args()
70 if options.output_directory is None: 70 if options.output_directory is None:
71 parser.error('Must specify output directory using --output-directory.') 71 parser.error('Must specify output directory using --output-directory.')
72 if options.additional_idl_files is None: 72 if options.additional_idl_files is None:
73 options.additional_idl_files = [] 73 options.additional_idl_files = []
(...skipping 30 matching lines...) Expand all
104 options = parse_options() 104 options = parse_options()
105 idl_filename = options.idl_filename 105 idl_filename = options.idl_filename
106 basename = os.path.basename(idl_filename) 106 basename = os.path.basename(idl_filename)
107 interface_name, _ = os.path.splitext(basename) 107 interface_name, _ = os.path.splitext(basename)
108 output_directory = options.output_directory 108 output_directory = options.output_directory
109 verbose = options.verbose 109 verbose = options.verbose
110 if verbose: 110 if verbose:
111 print idl_filename 111 print idl_filename
112 relative_dir_posix = get_relative_dir_posix(idl_filename) 112 relative_dir_posix = get_relative_dir_posix(idl_filename)
113 113
114 reader = idl_reader.IdlReader(options.interface_dependencies_file, options.a dditional_idl_files, options.idl_attributes_file, output_directory, verbose) 114 reader = idl_reader.IdlReader(options.interfaces_file, options.additional_id l_files, options.idl_attributes_file, output_directory, verbose)
115 definitions = reader.read_idl_definitions(idl_filename) 115 definitions = reader.read_idl_definitions(idl_filename)
116 code_generator = code_generator_v8.CodeGeneratorV8(definitions, interface_na me, options.output_directory, relative_dir_posix, options.idl_directories, verbo se) 116 code_generator = code_generator_v8.CodeGeneratorV8(definitions, interface_na me, options.output_directory, relative_dir_posix, options.idl_directories, verbo se)
117 if not definitions: 117 if not definitions:
118 # We generate dummy .h and .cpp files just to tell build scripts 118 # We generate dummy .h and .cpp files just to tell build scripts
119 # that outputs have been created. 119 # that outputs have been created.
120 code_generator.write_dummy_header_and_cpp() 120 code_generator.write_dummy_header_and_cpp()
121 return 121 return
122 if options.dump_json_and_pickle: 122 if options.dump_json_and_pickle:
123 write_json_and_pickle(definitions, interface_name, output_directory) 123 write_json_and_pickle(definitions, interface_name, output_directory)
124 return 124 return
125 code_generator.write_header_and_cpp() 125 code_generator.write_header_and_cpp()
126 126
127 127
128 if __name__ == '__main__': 128 if __name__ == '__main__':
129 sys.exit(main()) 129 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698