OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (C) 2014 Google Inc. All rights reserved. | 2 # Copyright (C) 2014 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 idl_file_list = sorted([line.rstrip('\n') | 107 idl_file_list = sorted([line.rstrip('\n') |
108 for line in input_file]) | 108 for line in input_file]) |
109 expanded_global_entries.append((directory, idl_file_list)) | 109 expanded_global_entries.append((directory, idl_file_list)) |
110 global_header_filename = os.path.join(self.output_directory, 'DartGlobal
.h') | 110 global_header_filename = os.path.join(self.output_directory, 'DartGlobal
.h') |
111 global_cpp_filename = os.path.join(self.output_directory, 'DartGlobal.cp
p') | 111 global_cpp_filename = os.path.join(self.output_directory, 'DartGlobal.cp
p') |
112 self.generate_global_and_write(expanded_global_entries, | 112 self.generate_global_and_write(expanded_global_entries, |
113 (global_header_filename, global_cpp_filen
ame)) | 113 (global_header_filename, global_cpp_filen
ame)) |
114 | 114 |
115 def generate_dart_blink(self, global_entries): | 115 def generate_dart_blink(self, global_entries): |
116 global_dart_blink_filename = os.path.join(self.output_directory, | 116 global_dart_blink_filename = os.path.join(self.output_directory, |
117 'sky_core.dart') | 117 'dart_sky.dart') |
118 expanded_global_entries = [] | 118 expanded_global_entries = [] |
119 for (directory, file_list_file) in global_entries: | 119 for (directory, file_list_file) in global_entries: |
120 with open(file_list_file) as input_file: | 120 with open(file_list_file) as input_file: |
121 idl_file_list = sorted([line.rstrip('\n') | 121 idl_file_list = sorted([line.rstrip('\n') |
122 for line in input_file]) | 122 for line in input_file]) |
123 expanded_global_entries.append((directory, idl_file_list)) | 123 expanded_global_entries.append((directory, idl_file_list)) |
124 self.generate_dart_blink_and_write(expanded_global_entries, | 124 self.generate_dart_blink_and_write(expanded_global_entries, |
125 global_dart_blink_filename) | 125 global_dart_blink_filename) |
126 | 126 |
127 | 127 |
128 def main(): | 128 def main(): |
129 options, filename = parse_options() | 129 options, filename = parse_options() |
130 idl_compiler = IdlCompilerDart(options.output_directory, | 130 idl_compiler = IdlCompilerDart(options.output_directory, |
131 interfaces_info_filename=options.interfaces_i
nfo_file, | 131 interfaces_info_filename=options.interfaces_i
nfo_file, |
132 only_if_changed=options.write_file_only_if_ch
anged) | 132 only_if_changed=options.write_file_only_if_ch
anged) |
133 if bool(options.global_entries): | 133 if bool(options.global_entries): |
134 idl_compiler.generate_global(options.global_entries) | 134 idl_compiler.generate_global(options.global_entries) |
135 elif bool(options.blink_global_entries): | 135 elif bool(options.blink_global_entries): |
136 idl_compiler.generate_dart_blink(options.blink_global_entries) | 136 idl_compiler.generate_dart_blink(options.blink_global_entries) |
137 else: | 137 else: |
138 idl_compiler.compile_file(filename) | 138 idl_compiler.compile_file(filename) |
139 | 139 |
140 | 140 |
141 if __name__ == '__main__': | 141 if __name__ == '__main__': |
142 sys.exit(main()) | 142 sys.exit(main()) |
OLD | NEW |