OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 import hashlib | 3 import hashlib |
4 import operator | 4 import operator |
5 import os | 5 import os |
6 import shutil | 6 import shutil |
7 import stat | 7 import stat |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 if proc.returncode: | 86 if proc.returncode: |
87 print >> sys.stderr, error_template % proc.returncode | 87 print >> sys.stderr, error_template % proc.returncode |
88 sys.exit(proc.returncode) | 88 sys.exit(proc.returncode) |
89 | 89 |
90 | 90 |
91 def build_artifacts(): | 91 def build_artifacts(): |
92 print 'Compiling...' | 92 print 'Compiling...' |
93 java_files = [] | 93 java_files = [] |
94 for root, dirs, files in sorted(os.walk(src_path)): | 94 for root, dirs, files in sorted(os.walk(src_path)): |
95 for file_name in files: | 95 for file_name in files: |
96 java_files.append(os.path.join(root, file_name)) | 96 if file_name.endswith('.java'): |
| 97 java_files.append(os.path.join(root, file_name)) |
97 | 98 |
98 bin_path = tempfile.mkdtemp() | 99 bin_path = tempfile.mkdtemp() |
99 manifest_file = tempfile.NamedTemporaryFile(mode='wt', delete=False) | 100 manifest_file = tempfile.NamedTemporaryFile(mode='wt', delete=False) |
100 try: | 101 try: |
101 manifest_file.write('Class-Path: %s\n' % closure_jar_relpath) | 102 manifest_file.write('Class-Path: %s\n' % closure_jar_relpath) |
102 manifest_file.close() | 103 manifest_file.close() |
103 javac_path = os.path.join(java_bin_path, 'javac') | 104 javac_path = os.path.join(java_bin_path, 'javac') |
104 javac_command = '%s -d %s -cp %s %s' % (javac_path, bin_path, rel_to_abs
(closure_jar_relpath), ' '.join(java_files)) | 105 javac_command = '%s -d %s -cp %s %s' % (javac_path, bin_path, rel_to_abs
(closure_jar_relpath), ' '.join(java_files)) |
105 run_and_communicate(javac_command, 'Error: javac returned %d') | 106 run_and_communicate(javac_command, 'Error: javac returned %d') |
106 | 107 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 print 'No modifications found, rebuild not required.' | 156 print 'No modifications found, rebuild not required.' |
156 return | 157 return |
157 if not no_rebuild: | 158 if not no_rebuild: |
158 build_artifacts() | 159 build_artifacts() |
159 | 160 |
160 update_hashes() | 161 update_hashes() |
161 print 'Done.' | 162 print 'Done.' |
162 | 163 |
163 if __name__ == '__main__': | 164 if __name__ == '__main__': |
164 main() | 165 main() |
OLD | NEW |