Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 28 options.add_option("--jar_entry_directory", | 28 options.add_option("--jar_entry_directory", |
| 29 help='Which directory within output to pack into the jar files') | 29 help='Which directory within output to pack into the jar files') |
| 30 options.add_option("--entry_point", | 30 options.add_option("--entry_point", |
| 31 help='The entry point for running the program.') | 31 help='The entry point for running the program.') |
| 32 options.add_option("--dependent_jar_files", | 32 options.add_option("--dependent_jar_files", |
| 33 help='The jar files that we link against, space separated.') | 33 help='The jar files that we link against, space separated.') |
| 34 return options.parse_args() | 34 return options.parse_args() |
| 35 | 35 |
| 36 def CompileAnalyzer(options, args): | 36 def CompileAnalyzer(options, args): |
| 37 # We rely on all jar files being copied to the output dir. | 37 # We rely on all jar files being copied to the output dir. |
| 38 class_path = options.output_dir + '*' | 38 if sys.platform == 'win32': |
| 39 class_path = options.output_dir + '*;' | |
| 40 else: | |
| 41 class_path = options.output_dir + '*' | |
| 39 cmd = [GetJavacPath(), | 42 cmd = [GetJavacPath(), |
| 40 '-sourcepath', 'foobar', | 43 '-sourcepath', 'foobar', |
| 41 '-source', '6', | 44 '-source', '6', |
| 42 '-target', '6', | 45 '-target', '6', |
| 43 '-implicit:none', | 46 '-implicit:none', |
| 44 '-d', options.output_dir, | 47 '-d', options.output_dir, |
| 45 '-cp', class_path, | 48 '-cp', class_path, |
| 46 ] | 49 ] |
| 47 cmd.extend(args) | 50 cmd.extend(args) |
| 48 subprocess.call(cmd) | 51 subprocess.check_call(cmd) |
|
ahe
2013/04/12 15:06:49
Unfortunately, we cannot use check_call as it isn'
kustermann
2013/04/12 15:18:08
Done.
| |
| 49 | 52 |
| 50 def CreateJarFile(options): | 53 def CreateJarFile(options): |
| 51 class_path_file_name = options.output_dir + options.class_path_file | 54 class_path_file_name = options.output_dir + options.class_path_file |
| 52 jar_file_name = options.output_dir + options.jar_file_name | 55 jar_file_name = options.output_dir + options.jar_file_name |
| 53 cmd = [GetJarToolPath(), 'cfem', jar_file_name, options.entry_point, | 56 cmd = [GetJarToolPath(), 'cfem', jar_file_name, options.entry_point, |
| 54 class_path_file_name, | 57 class_path_file_name, |
| 55 '-C', options.output_dir, options.jar_entry_directory] | 58 '-C', options.output_dir, options.jar_entry_directory] |
| 56 subprocess.call(cmd) | 59 subprocess.check_call(cmd) |
| 57 | 60 |
| 58 def CopyFiles(options): | 61 def CopyFiles(options): |
| 59 # Strip " from the string | 62 # Strip " from the string |
| 60 files = options.dependent_jar_files.replace('"', '') | 63 files = options.dependent_jar_files.replace('"', '') |
| 61 for f in files.split(" "): | 64 for f in files.split(" "): |
| 62 shutil.copy(f, options.output_dir) | 65 shutil.copy(f, options.output_dir) |
| 63 | 66 |
| 64 def CreateClassPathFile(options): | 67 def CreateClassPathFile(options): |
| 65 class_path_file_name = options.output_dir + options.class_path_file | 68 class_path_file_name = options.output_dir + options.class_path_file |
| 66 with open(class_path_file_name, 'w') as output: | 69 with open(class_path_file_name, 'w') as output: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 os.makedirs(options.output_dir) | 102 os.makedirs(options.output_dir) |
| 100 | 103 |
| 101 CopyFiles(options) | 104 CopyFiles(options) |
| 102 CreateClassPathFile(options) | 105 CreateClassPathFile(options) |
| 103 CompileAnalyzer(options, args) | 106 CompileAnalyzer(options, args) |
| 104 CreateJarFile(options) | 107 CreateJarFile(options) |
| 105 | 108 |
| 106 | 109 |
| 107 if __name__=='__main__': | 110 if __name__=='__main__': |
| 108 main() | 111 main() |
| OLD | NEW |