Index: editor/tools/compile_analyzer.py |
=================================================================== |
--- editor/tools/compile_analyzer.py (revision 0) |
+++ editor/tools/compile_analyzer.py (revision 0) |
@@ -0,0 +1,57 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
+# for details. All rights reserved. Use of this source code is governed by a |
+# BSD-style license that can be found in the LICENSE file. |
+# |
+# Script to compile the analyzer. |
+# |
+# Usage: compile_analyzer.py OPTIONS files |
+# |
+ |
+import optparse |
+import subprocess |
+import sys |
+ |
+ |
+def GetOptions(): |
+ options = optparse.OptionParser(usage='usage: %prog [options] <output>') |
+ options.add_option("--class_path", |
+ help='Classpath to link against when compiling') |
+ options.add_option("--output_dir", |
+ help='Where to output files') |
+ options.add_option("--class_path_file", |
+ help='File describing the classpath in manifest style') |
+ options.add_option("--jar_file", |
+ help='Location of the jar file') |
+ options.add_option("--jar_entry_directory", |
+ help='Which directory within output to pack into the jar files') |
+ options.add_option("--entry_point", |
+ help='The entry point for running the program.') |
+ return options.parse_args() |
+ |
+def CompileAnalyzer(options, args): |
+ cmd = ['javac', |
+ '-sourcepath', 'foobar', |
+ '-source', '6', |
+ '-target', '6', |
+ '-implicit:none', |
+ '-d', options.output_dir, |
+ '-cp', options.class_path, |
+ ] |
+ cmd.extend(args) |
+ subprocess.call(cmd) |
+ |
+def CreateJarFile(options): |
+ cmd = ['jar', 'cfem', options.jar_file, options.entry_point, |
+ options.class_path_file, |
+ '-C', options.output_dir, options.jar_entry_directory]; |
+ subprocess.call(cmd) |
+ |
+def main(): |
+ (options, args) = GetOptions() |
+ # Add all the source files. |
+ CompileAnalyzer(options, args) |
+ CreateJarFile(options) |
+ |
+if __name__=='__main__': |
+ main() |