OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import os | 6 import os |
7 import shutil | 7 import shutil |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
11 | 11 |
12 | 12 |
13 def rel_to_abs(rel_path): | 13 def rel_to_abs(rel_path): |
14 script_path = os.path.dirname(os.path.abspath(__file__)) | 14 script_path = os.path.dirname(os.path.abspath(__file__)) |
15 return os.path.join(script_path, rel_path) | 15 return os.path.join(script_path, rel_path) |
16 | 16 |
17 | 17 |
18 java_bin_path = os.getenv('JAVA_HOME', '') | 18 java_bin_path = os.getenv('JAVA_HOME', '') |
19 if java_bin_path: | 19 if java_bin_path: |
20 java_bin_path = os.path.join(java_bin_path, 'bin') | 20 java_bin_path = os.path.join(java_bin_path, 'bin') |
21 | 21 |
22 main_class = 'org.chromium.closure.compiler.Runner' | 22 main_class = 'org.chromium.closure.compiler.Runner' |
23 jar_name = 'runner.jar' | 23 jar_name = 'runner.jar' |
24 src_dir = 'src' | 24 src_dir = 'src' |
25 closure_jar_relpath = os.path.join('..', 'compiler', 'compiler.jar') | 25 closure_jar_relpath = os.path.join('..', 'compiler', 'compiler.jar') |
26 src_path = rel_to_abs(src_dir) | 26 src_path = rel_to_abs(src_dir) |
27 | 27 |
28 | 28 |
29 def run_and_communicate(command, error_template): | 29 def run_and_communicate(command, error_template): |
| 30 print >> sys.stderr, command |
30 proc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) | 31 proc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) |
31 proc.communicate() | 32 proc.communicate() |
32 if proc.returncode: | 33 if proc.returncode: |
33 print >> sys.stderr, error_template % proc.returncode | 34 print >> sys.stderr, error_template % proc.returncode |
34 sys.exit(proc.returncode) | 35 sys.exit(proc.returncode) |
35 | 36 |
36 | 37 |
37 def build_artifacts(): | 38 def build_artifacts(): |
38 print 'Compiling...' | 39 print 'Compiling...' |
39 java_files = [] | 40 java_files = [] |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 74 |
74 def main(): | 75 def main(): |
75 if len(sys.argv) > 1: | 76 if len(sys.argv) > 1: |
76 show_usage_and_die() | 77 show_usage_and_die() |
77 | 78 |
78 build_artifacts() | 79 build_artifacts() |
79 | 80 |
80 | 81 |
81 if __name__ == '__main__': | 82 if __name__ == '__main__': |
82 main() | 83 main() |
OLD | NEW |