| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # -*- coding: UTF-8 -*- | 2 # -*- coding: UTF-8 -*- |
| 3 # | 3 # |
| 4 # Copyright 2016 The Chromium Authors. All rights reserved. | 4 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
| 6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
| 7 | 7 |
| 8 """ | 8 """ |
| 9 Builds applications in release mode: | 9 Builds applications in release mode: |
| 10 - Concatenates autostart modules, application modules' module.json descriptors, | 10 - Concatenates autostart modules, application modules' module.json descriptors, |
| 11 and the application loader into a single script. | 11 and the application loader into a single script. |
| 12 - Builds app.html referencing the application script. | 12 - Builds app.html referencing the application script. |
| 13 """ | 13 """ |
| 14 | 14 |
| 15 from cStringIO import StringIO | 15 from cStringIO import StringIO |
| 16 from os import path | 16 from os import path |
| 17 from os.path import join | 17 from os.path import join |
| 18 from modular_build import read_file, write_file, bail_error | |
| 19 import copy | 18 import copy |
| 20 import modular_build | |
| 21 import os | 19 import os |
| 22 import re | 20 import re |
| 23 import shutil | 21 import shutil |
| 24 import sys | 22 import sys |
| 25 | 23 |
| 24 from modular_build import read_file, write_file, bail_error |
| 25 import modular_build |
| 26 import rjsmin |
| 27 |
| 26 try: | 28 try: |
| 27 import simplejson as json | 29 import simplejson as json |
| 28 except ImportError: | 30 except ImportError: |
| 29 import json | 31 import json |
| 30 | 32 |
| 31 import rjsmin | |
| 32 | |
| 33 | 33 |
| 34 def main(argv): | 34 def main(argv): |
| 35 try: | 35 try: |
| 36 input_path_flag_index = argv.index('--input_path') | 36 input_path_flag_index = argv.index('--input_path') |
| 37 input_path = argv[input_path_flag_index + 1] | 37 input_path = argv[input_path_flag_index + 1] |
| 38 output_path_flag_index = argv.index('--output_path') | 38 output_path_flag_index = argv.index('--output_path') |
| 39 output_path = argv[output_path_flag_index + 1] | 39 output_path = argv[output_path_flag_index + 1] |
| 40 application_names = argv[1:input_path_flag_index] | 40 application_names = argv[1:input_path_flag_index] |
| 41 except: | 41 except: |
| 42 print('Usage: %s app_1 app_2 ... app_N --input_path <input_path> --outpu
t_path <output_path>' % argv[0]) | 42 print('Usage: %s app_1 app_2 ... app_N --input_path <input_path> --outpu
t_path <output_path>' % argv[0]) |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 modular_build.concatenate_scripts(scripts, module_dir, self.output_d
ir, output) | 219 modular_build.concatenate_scripts(scripts, module_dir, self.output_d
ir, output) |
| 220 if resources: | 220 if resources: |
| 221 self._write_module_resources(resources, output) | 221 self._write_module_resources(resources, output) |
| 222 output_file_path = concatenated_module_filename(module_name, self.output
_dir) | 222 output_file_path = concatenated_module_filename(module_name, self.output
_dir) |
| 223 write_file(output_file_path, minify_js(output.getvalue())) | 223 write_file(output_file_path, minify_js(output.getvalue())) |
| 224 output.close() | 224 output.close() |
| 225 | 225 |
| 226 | 226 |
| 227 if __name__ == '__main__': | 227 if __name__ == '__main__': |
| 228 sys.exit(main(sys.argv)) | 228 sys.exit(main(sys.argv)) |
| OLD | NEW |