OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 # | 5 # |
6 # Script to compile the analyzer. | 6 # Script to compile the analyzer. |
7 # | 7 # |
8 # Usage: compile_analyzer.py OPTIONS files | 8 # Usage: compile_analyzer.py OPTIONS files |
9 # | 9 # |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 class_path_file_name = options.output_dir + options.class_path_file | 62 class_path_file_name = options.output_dir + options.class_path_file |
63 with open(class_path_file_name, 'w') as output: | 63 with open(class_path_file_name, 'w') as output: |
64 print >> output, 'Class-Path:', '.', | 64 print >> output, 'Class-Path:', '.', |
65 for r,d,f in os.walk(options.output_dir): | 65 for r,d,f in os.walk(options.output_dir): |
66 for file in f: | 66 for file in f: |
67 if file.endswith('.jar'): | 67 if file.endswith('.jar'): |
68 print >> output, file, | 68 print >> output, file, |
69 # Add new line | 69 # Add new line |
70 print >> output | 70 print >> output |
71 | 71 |
72 def FindRoot(): | |
73 full_path = os.path.realpath(__file__) | |
74 dart_root = os.path.dirname(os.path.dirname(os.path.dirname(full_path))) | |
75 return dart_root | |
76 | |
77 def CopyBinaries(options): | |
ahe
2013/03/12 14:13:11
Why do you need to copy the "binaries"?
ricow1
2013/03/12 15:28:55
That is a good point - I originally did not want t
| |
78 dart_root = FindRoot() | |
79 sdk_bin = os.path.join(dart_root, 'sdk', 'bin') | |
80 bin_directory = os.path.join(options.output_dir, 'bin') | |
81 os.makedirs(bin_directory) | |
82 unix_bin = os.path.join(sdk_bin, 'analyzer') | |
83 windows_bin = os.path.join(sdk_bin, 'analyzer.bat') | |
84 shutil.copy(unix_bin, bin_directory) | |
85 shutil.copy(windows_bin, bin_directory) | |
86 | |
72 def main(): | 87 def main(): |
73 (options, args) = GetOptions() | 88 (options, args) = GetOptions() |
74 # Clean out everything whenever we do a build, guarantees that we don't have | 89 # Clean out everything whenever we do a build, guarantees that we don't have |
75 # any leftover jar files. | 90 # any leftover jar files. |
76 shutil.rmtree(options.output_dir, ignore_errors=True) | 91 shutil.rmtree(options.output_dir, ignore_errors=True) |
77 os.makedirs(options.output_dir) | 92 os.makedirs(options.output_dir) |
78 | 93 |
79 CopyFiles(options) | 94 CopyFiles(options) |
80 CreateClassPathFile(options) | 95 CreateClassPathFile(options) |
81 CompileAnalyzer(options, args) | 96 CompileAnalyzer(options, args) |
82 CreateJarFile(options) | 97 CreateJarFile(options) |
83 | 98 CopyBinaries(options) |
84 | 99 |
85 if __name__=='__main__': | 100 if __name__=='__main__': |
86 main() | 101 main() |
OLD | NEW |