1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package util; 18 19 import java.io.FileInputStream; 20 import java.util.Iterator; 21 import java.util.Properties; 22 23 import jasmin.Main; 24 25 public class CompileAllJasmin { 26 27 /** 28 * @param args args[0] the (absolute or relative to the working dir) 29 * path to the (properties) file containing line by line 30 * all jasmin files which need to be compiled. 31 * args[1] is the target directory where to put the compiled .class files to 32 */ 33 public static void main(String[] args) throws Exception { 34 System.out.println("reading from "+args[0]+" and writing to "+args[1]); 35 Properties p = new Properties(); 36 p.load(new FileInputStream(args[0])); 37 38 //System.out.println("p:::"+p.toString()); 39 int i=0; 40 for (Iterator<Object> it_keys = p.keySet().iterator(); it_keys.hasNext();) { 41 String file = (String) it_keys.next(); 42 Main m = new jasmin.Main(); 43 //java -jar $project_lib/jasmin.jar -d $javac_out $ajasminfile 44 if (i ==0) { 45 m.main(new String[] {"-d" ,args[1], file }); 46 } else { 47 // leave away -d option since saved into static field 48 m.main(new String[] {file }); 49 } 50 i++; 51 } 52 } 53 54 } 55