| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 output.write(self.descriptors.application_json()) | 207 output.write(self.descriptors.application_json()) |
| 208 output.write(';\n/* Core resources */\n') | 208 output.write(';\n/* Core resources */\n') |
| 209 self._write_module_resources(self.core_resource_names(), output) | 209 self._write_module_resources(self.core_resource_names(), output) |
| 210 output.write('\n/* Application loader */\n') | 210 output.write('\n/* Application loader */\n') |
| 211 output.write(read_file(join(self.application_dir, self.app_file('js')))) | 211 output.write(read_file(join(self.application_dir, self.app_file('js')))) |
| 212 | 212 |
| 213 def _concatenate_dynamic_module(self, module_name): | 213 def _concatenate_dynamic_module(self, module_name): |
| 214 module = self.descriptors.modules[module_name] | 214 module = self.descriptors.modules[module_name] |
| 215 scripts = module.get('scripts') | 215 scripts = module.get('scripts') |
| 216 resources = self.descriptors.module_resources(module_name) | 216 resources = self.descriptors.module_resources(module_name) |
| 217 if not scripts and not resources: | |
| 218 return | |
| 219 module_dir = join(self.application_dir, module_name) | 217 module_dir = join(self.application_dir, module_name) |
| 220 output = StringIO() | 218 output = StringIO() |
| 221 if scripts: | 219 if scripts: |
| 222 modular_build.concatenate_scripts(scripts, module_dir, self.output_d
ir, output) | 220 modular_build.concatenate_scripts(scripts, module_dir, self.output_d
ir, output) |
| 223 if resources: | 221 if resources: |
| 224 self._write_module_resources(resources, output) | 222 self._write_module_resources(resources, output) |
| 225 output_file_path = concatenated_module_filename(module_name, self.output
_dir) | 223 output_file_path = concatenated_module_filename(module_name, self.output
_dir) |
| 226 write_file(output_file_path, minify_js(output.getvalue())) | 224 write_file(output_file_path, minify_js(output.getvalue())) |
| 227 output.close() | 225 output.close() |
| 228 | 226 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 symlink_or_copy_file(join(os.getcwd(), self.application_dir, html_name),
join(self.output_dir, html_name), True) | 270 symlink_or_copy_file(join(os.getcwd(), self.application_dir, html_name),
join(self.output_dir, html_name), True) |
| 273 | 271 |
| 274 | 272 |
| 275 def build_application(application_name, loader, application_dir, output_dir, rel
ease_mode): | 273 def build_application(application_name, loader, application_dir, output_dir, rel
ease_mode): |
| 276 descriptors = loader.load_application(application_name + '.json') | 274 descriptors = loader.load_application(application_name + '.json') |
| 277 if release_mode: | 275 if release_mode: |
| 278 builder = ReleaseBuilder(application_name, descriptors, application_dir,
output_dir) | 276 builder = ReleaseBuilder(application_name, descriptors, application_dir,
output_dir) |
| 279 else: | 277 else: |
| 280 builder = DebugBuilder(application_name, descriptors, application_dir, o
utput_dir) | 278 builder = DebugBuilder(application_name, descriptors, application_dir, o
utput_dir) |
| 281 builder.build_app() | 279 builder.build_app() |
| OLD | NEW |