Search in sources :

Example 1 with SimpleHttpFileServerFactory

use of org.gradle.plugins.javascript.envjs.http.simple.SimpleHttpFileServerFactory in project gradle by gradle.

the class BrowserEvaluate method doEvaluate.

@TaskAction
void doEvaluate() {
    HttpFileServer fileServer = new SimpleHttpFileServerFactory().start(getContent(), 0);
    try {
        Writer resultWriter = new FileWriter(getResult());
        getEvaluator().evaluate(fileServer.getResourceUrl(getResource()), resultWriter);
        resultWriter.close();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    } finally {
        fileServer.stop();
    }
    setDidWork(true);
}
Also used : SimpleHttpFileServerFactory(org.gradle.plugins.javascript.envjs.http.simple.SimpleHttpFileServerFactory) FileWriter(java.io.FileWriter) HttpFileServer(org.gradle.plugins.javascript.envjs.http.HttpFileServer) UncheckedIOException(org.gradle.api.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(org.gradle.api.UncheckedIOException) FileWriter(java.io.FileWriter) Writer(java.io.Writer)

Aggregations

FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 Writer (java.io.Writer)1 UncheckedIOException (org.gradle.api.UncheckedIOException)1 HttpFileServer (org.gradle.plugins.javascript.envjs.http.HttpFileServer)1 SimpleHttpFileServerFactory (org.gradle.plugins.javascript.envjs.http.simple.SimpleHttpFileServerFactory)1