Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / scripts / build_applications.py
1 #!/usr/bin/env python
2 #
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
5 # found in the LICENSE file.
6
7 """
8 Invokes concatenate_application_code for applications specified on the command line.
9 """
10
11 from os import path
12 import concatenate_application_code
13 import modular_build
14 import sys
15
16 try:
17     import simplejson as json
18 except ImportError:
19     import json
20
21
22 def main(argv):
23     try:
24         input_path_flag_index = argv.index('--input_path')
25         input_path = argv[input_path_flag_index + 1]
26         output_path_flag_index = argv.index('--output_path')
27         output_path = argv[output_path_flag_index + 1]
28         application_names = argv[1:input_path_flag_index]
29         debug_flag_index = argv.index('--debug')
30         minify = argv[debug_flag_index + 1] == '0'
31     except:
32         print('Usage: %s app_1 app_2 ... app_N --input_path <input_path> --output_path <output_path> --debug <0_or_1>' % argv[0])
33         raise
34
35     loader = modular_build.DescriptorLoader(input_path)
36     for app in application_names:
37         concatenate_application_code.build_application(app, loader, input_path, output_path, minify)
38
39 if __name__ == '__main__':
40     sys.exit(main(sys.argv))