1 4 5 9 10 package org.openlaszlo.cm; 11 import org.openlaszlo.compiler.CompilationError; 12 import org.apache.log4j.*; 13 import java.io.*; 14 import java.util.Properties ; 15 16 public class Main { 17 29 public static void main(String args[]) 30 throws IOException 31 { 32 Logger logger = Logger.getRootLogger(); 34 logger.setLevel(Level.ERROR); 35 BasicConfigurator.configure(); 36 File srcDir = new File("."); 37 File cacheDir = new File("."); 38 Properties props = new Properties (); 39 40 for (int i = 0; i < args.length; i++) { 41 String arg = args[i].intern(); 42 if (arg == "-src") { 43 srcDir = new File(args[++i]); 44 continue; 45 } 46 if (arg == "-cache") { 47 cacheDir = new File(args[++i]); 48 continue; 49 } 50 if (arg.startsWith("-D")) { 51 String key = arg.substring(2); 52 String value = "true"; 53 int offset = key.indexOf('='); 54 if (offset >= 0) { 55 value = key.substring(offset + 1).intern(); 56 key = key.substring(0, offset); 57 } 58 props.setProperty(key, value); 59 continue; 60 } 61 if (arg.startsWith("-")) { 62 System.err.println("usage error"); 63 return; 64 } 65 String fileName = arg; 66 try { 67 CompilationManager cm; 68 69 cm = new CompilationManager(srcDir, cacheDir, props); 70 cm.getItem(fileName, null); 71 } catch (CompilationError e) { 72 System.err.print(e.toHTML()); 78 } 79 } 80 } 81 } 82 | Popular Tags |