diff -r 245d9215a97e -r d48a0da4549c vm/src/main/java/org/apidesign/vm4brwsr/Main.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vm/src/main/java/org/apidesign/vm4brwsr/Main.java Thu Nov 08 18:32:32 2012 +0100 @@ -0,0 +1,46 @@ +/** + * Back 2 Browser Bytecode Translator + * Copyright (C) 2012 Jaroslav Tulach + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. Look for COPYING file in the top folder. + * If not, see http://opensource.org/licenses/GPL-2.0. + */ +package org.apidesign.vm4brwsr; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.util.Arrays; +import java.util.List; + +/** Generator of JavaScript from bytecode of classes on classpath of the VM + * with a Main method. + * + * @author Jaroslav Tulach + */ +final class Main { + private Main() {} + + public static void main(String... args) throws IOException { + if (args.length < 2) { + System.err.println("Usage: java -cp ... -jar ... java/lang/Class org/your/App ..."); + return; + } + + Writer w = new BufferedWriter(new FileWriter(args[0])); + List classes = Arrays.asList(args).subList(1, args.length); + GenJS.compile(w, classes); + w.close(); + } +}