OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 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 |
| 4 # BSD-style license that can be found in the LICENSE file. |
| 5 # |
| 6 # Script to compile the analyzer. |
| 7 # |
| 8 # Usage: compile_analyzer.py OPTIONS files |
| 9 # |
| 10 |
| 11 import optparse |
| 12 import subprocess |
| 13 import sys |
| 14 |
| 15 |
| 16 def GetOptions(): |
| 17 options = optparse.OptionParser(usage='usage: %prog [options] <output>') |
| 18 options.add_option("--class_path", |
| 19 help='Classpath to link against when compiling') |
| 20 options.add_option("--output_dir", |
| 21 help='Where to output files') |
| 22 options.add_option("--class_path_file", |
| 23 help='File describing the classpath in manifest style') |
| 24 options.add_option("--jar_file", |
| 25 help='Location of the jar file') |
| 26 options.add_option("--jar_entry_directory", |
| 27 help='Which directory within output to pack into the jar files') |
| 28 options.add_option("--entry_point", |
| 29 help='The entry point for running the program.') |
| 30 return options.parse_args() |
| 31 |
| 32 def CompileAnalyzer(options, args): |
| 33 cmd = ['javac', |
| 34 '-sourcepath', 'foobar', |
| 35 '-source', '6', |
| 36 '-target', '6', |
| 37 '-implicit:none', |
| 38 '-d', options.output_dir, |
| 39 '-cp', options.class_path, |
| 40 ] |
| 41 cmd.extend(args) |
| 42 subprocess.call(cmd) |
| 43 |
| 44 def CreateJarFile(options): |
| 45 cmd = ['jar', 'cfem', options.jar_file, options.entry_point, |
| 46 options.class_path_file, |
| 47 '-C', options.output_dir, options.jar_entry_directory]; |
| 48 subprocess.call(cmd) |
| 49 |
| 50 def main(): |
| 51 (options, args) = GetOptions() |
| 52 # Add all the source files. |
| 53 CompileAnalyzer(options, args) |
| 54 CreateJarFile(options) |
| 55 |
| 56 if __name__=='__main__': |
| 57 main() |
OLD | NEW |