use of org.gradle.scala.internal.reflect.ScalaMethod in project gradle by gradle.
the class PlayRunAdapterV26X method runDevHttpServer.
@Override
public InetSocketAddress runDevHttpServer(ClassLoader classLoader, ClassLoader docsClassLoader, Object buildLink, Object buildDocHandler, int httpPort) throws ClassNotFoundException {
ScalaMethod runMethod = ScalaReflectionUtil.scalaMethod(classLoader, "play.core.server.DevServerStart", "mainDevHttpMode", getBuildLinkClass(classLoader), int.class, String.class);
Object reloadableServer = runMethod.invoke(buildLink, httpPort, "0.0.0.0");
return JavaReflectionUtil.method(reloadableServer, InetSocketAddress.class, "mainAddress").invoke(reloadableServer);
}
use of org.gradle.scala.internal.reflect.ScalaMethod in project gradle by gradle.
the class TwirlCompiler method execute.
@Override
public WorkResult execute(TwirlCompileSpec spec) {
List<File> outputFiles = Lists.newArrayList();
ClassLoader cl = getClass().getClassLoader();
ScalaMethod compile = getCompileMethod(cl);
Iterable<RelativeFile> sources = spec.getSources();
for (RelativeFile sourceFile : sources) {
TwirlTemplateFormat format = findTemplateFormat(spec, sourceFile.getFile());
try {
Object result = compile.invoke(buildCompileArguments(spec, cl, sourceFile, format));
ScalaOptionInvocationWrapper<File> maybeFile = new ScalaOptionInvocationWrapper<File>(result);
if (maybeFile.isDefined()) {
File outputFile = maybeFile.get();
outputFiles.add(outputFile);
}
} catch (Exception e) {
throw new RuntimeException("Error invoking Play Twirl template compiler.", e);
}
}
return WorkResults.didWork(!outputFiles.isEmpty());
}
Aggregations