Example usage for com.google.gwt.dev Compiler main

List of usage examples for com.google.gwt.dev Compiler main

Introduction

In this page you can find the example usage for com.google.gwt.dev Compiler main.

Prototype

public static void main(String[] args) 

Source Link

Usage

From source file:org.cruxframework.crux.tools.compile.AbstractCruxCompiler.java

License:Apache License

/**
 * @param url//  w  w  w. j  a  v  a2 s  .c om
 * @param moduleName
 */
protected void doCompileFile(URL url, String moduleName) {
    logger.info("Compiling:" + url.toString());

    // Because of an AWT BUG, GWT needs to execute a System.exit command to 
    // finish its compilation. This class calls the Compiler from an ant command,
    // so, this bug is not a problem here. We need to compile all the modules on the same 
    // JVM. Call prerocessCruxPages on a separated JVM would cost a lot to our performance. 
    setSecurityManagerToAvoidSystemExit();

    try {
        Compiler.main(getGwtArgs(moduleName));
    } catch (DoNotExitException e) {
        //Do nothing...continue compile looping
    } finally {
        restoreSecurityManager();
    }
}

From source file:stroom.gwt.GwtCompilerWrapper.java

License:Apache License

/**
 * Simple wrapper script to run the GWT compiler in the background while outputting something to standard out
 * every 20s. This is intended for use to prevent travis-ci from timing out during the compilation step
 * of the build/*from  www . j  a va2 s .  c  o  m*/
 */
public static void main(String[] args) {
    System.out.println("Starting GWT Compiler in the background...");
    if (args != null) {
        System.out.println("GWT Compiler args: " + Arrays.stream(args).collect(Collectors.joining(" ")));
    }

    CompletableFuture<Void> future = CompletableFuture.runAsync(() -> Compiler.main(args));

    future.exceptionally(throwable -> {
        System.out.println("Error during GWT Compile: " + throwable.getMessage());
        throwable.printStackTrace();
        return null;
    });

    Instant startTime = Instant.now();
    while (!future.isDone()) {
        doSleep(TIME_BETWEEN_CONSOLE_OUTPUT_MS);
        Duration duration = Duration.between(startTime, Instant.now());
        System.out.println(String.format("GWT Compile still running... (Duration: %s)", duration));
    }

    if (future.isCompletedExceptionally()) {
        System.exit(1);
    }
    System.exit(0);

}