| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 Release: | 8 Release: |
| 9 - Concatenates autostart modules, application modules' module.json descriptors
, | 9 - Concatenates autostart modules, application modules' module.json descriptors
, |
| 10 and the application loader into a single script. | 10 and the application loader into a single script. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 def _concatenate_application_script(self, output): | 188 def _concatenate_application_script(self, output): |
| 189 runtime_contents = read_file(join(self.application_dir, 'Runtime.js')) | 189 runtime_contents = read_file(join(self.application_dir, 'Runtime.js')) |
| 190 runtime_contents = re.sub('var allDescriptors = \[\];', 'var allDescript
ors = %s;' % self._release_module_descriptors().replace('\\', '\\\\'), runtime_c
ontents, 1) | 190 runtime_contents = re.sub('var allDescriptors = \[\];', 'var allDescript
ors = %s;' % self._release_module_descriptors().replace('\\', '\\\\'), runtime_c
ontents, 1) |
| 191 output.write('/* Runtime.js */\n') | 191 output.write('/* Runtime.js */\n') |
| 192 output.write(runtime_contents) | 192 output.write(runtime_contents) |
| 193 output.write('\n/* Autostart modules */\n') | 193 output.write('\n/* Autostart modules */\n') |
| 194 self._concatenate_autostart_modules(output) | 194 self._concatenate_autostart_modules(output) |
| 195 output.write('/* Application descriptor %s */\n' % self.app_file('json')
) | 195 output.write('/* Application descriptor %s */\n' % self.app_file('json')
) |
| 196 output.write('applicationDescriptor = ') | 196 output.write('applicationDescriptor = ') |
| 197 output.write(self.descriptors.application_json) | 197 output.write(self.descriptors.application_json()) |
| 198 output.write(';\n/* Core CSS */\n') | 198 output.write(';\n/* Core CSS */\n') |
| 199 self._write_module_css_styles(self.core_css_names(), output) | 199 self._write_module_css_styles(self.core_css_names(), output) |
| 200 output.write('\n/* Application loader */\n') | 200 output.write('\n/* Application loader */\n') |
| 201 output.write(read_file(join(self.application_dir, self.app_file('js')))) | 201 output.write(read_file(join(self.application_dir, self.app_file('js')))) |
| 202 | 202 |
| 203 def _concatenate_dynamic_module(self, module_name): | 203 def _concatenate_dynamic_module(self, module_name): |
| 204 module = self.descriptors.modules[module_name] | 204 module = self.descriptors.modules[module_name] |
| 205 scripts = module.get('scripts') | 205 scripts = module.get('scripts') |
| 206 stylesheets = self.descriptors.module_stylesheets(module_name) | 206 stylesheets = self.descriptors.module_stylesheets(module_name) |
| 207 if not scripts and not stylesheets: | 207 if not scripts and not stylesheets: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 hardlink_or_copy_file(join(self.application_dir, html_name), join(self.o
utput_dir, html_name), True) | 261 hardlink_or_copy_file(join(self.application_dir, html_name), join(self.o
utput_dir, html_name), True) |
| 262 | 262 |
| 263 | 263 |
| 264 def build_application(application_name, loader, application_dir, output_dir, rel
ease_mode): | 264 def build_application(application_name, loader, application_dir, output_dir, rel
ease_mode): |
| 265 descriptors = loader.load_application(application_name + '.json') | 265 descriptors = loader.load_application(application_name + '.json') |
| 266 if release_mode: | 266 if release_mode: |
| 267 builder = ReleaseBuilder(application_name, descriptors, application_dir,
output_dir) | 267 builder = ReleaseBuilder(application_name, descriptors, application_dir,
output_dir) |
| 268 else: | 268 else: |
| 269 builder = DebugBuilder(application_name, descriptors, application_dir, o
utput_dir) | 269 builder = DebugBuilder(application_name, descriptors, application_dir, o
utput_dir) |
| 270 builder.build_app() | 270 builder.build_app() |
| OLD | NEW |