com.google.gwt.dev.GwtCompiler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xapi-dev Show documentation
Show all versions of xapi-dev Show documentation
Everything needed to run a comprehensive dev environment.
Just type X_ and pick a service from autocomplete;
new dev modules will be added as they are built.
The only dev service not included in the uber jar is xapi-dev-maven,
as it includes all runtime dependencies of maven, adding ~4 seconds to build time,
and 6 megabytes to the final output jar size (without xapi-dev-maven, it's ~1MB).
The newest version!
package com.google.gwt.dev;
import java.util.concurrent.FutureTask;
import xapi.time.X_Time;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.dev.CompileTaskRunner;
import com.google.gwt.dev.Compiler;
import com.google.gwt.dev.CompilerOptions;
import com.google.gwt.dev.CompileTaskRunner.CompileTask;
import com.google.gwt.dev.Compiler.ArgProcessor;
import com.google.gwt.dev.shell.CheckForUpdates;
import com.google.gwt.dev.shell.CheckForUpdates.UpdateResult;
import com.google.gwt.dev.util.Memory;
import com.google.gwt.dev.util.log.speedtracer.SpeedTracerLogger;
public class GwtCompiler {
public static void main(String[] args) {
Memory.initialize();
if (System.getProperty("gwt.jjs.dumpAst") != null) {
System.out.println("Will dump AST to: "
+ System.getProperty("gwt.jjs.dumpAst"));
}
SpeedTracerLogger.init();
new Thread(){
{
setDaemon(true);
}
public void run() {
while (true) {
System.out.print("");
System.out.flush();
System.err.print("");
System.err.flush();
X_Time.trySleep(500, 0);
}
};
}.start();
/*
* NOTE: main always exits with a call to System.exit to terminate any
* non-daemon threads that were started in Generators. Typically, this is to
* shutdown AWT related threads, since the contract for their termination is
* still implementation-dependent.
*/
final CompilerOptions options = new CompilerOptionsImpl();
if (new ArgProcessor(options).processArgs(args)) {
CompileTask task = new CompileTask() {
@Override
public boolean run(TreeLogger logger) throws UnableToCompleteException {
FutureTask updater = null;
if (!options.isUpdateCheckDisabled()) {
updater = CheckForUpdates.checkForUpdatesInBackgroundThread(logger,
CheckForUpdates.ONE_DAY);
}
boolean success = new Compiler(options).run(logger);
if (success) {
CheckForUpdates.logUpdateAvailable(logger, updater);
}
return success;
}
};
if (CompileTaskRunner.runWithAppropriateLogger(options, task)) {
// Exit w/ success code.
System.out.flush();
System.exit(0);
}
}
// Exit w/ non-success code.
System.out.println("Gwt compile failure");
System.out.flush();
System.exit(1);
}
}