use of org.gradle.scala.internal.reflect.ScalaMethod in project gradle by gradle.
the class RoutesCompiler method compile.
private Boolean compile(File sourceFile, RoutesCompileSpec spec) {
try {
ClassLoader cl = getClass().getClassLoader();
ScalaMethod compile = adapter.getCompileMethod(cl);
Object ret = compile.invoke(adapter.createCompileParameters(cl, sourceFile, spec.getDestinationDir(), spec.isJavaProject(), spec.isNamespaceReverseRouter(), spec.isGenerateReverseRoutes(), spec.isInjectedRoutesGenerator(), spec.getAdditionalImports()));
if (ret != null && ret instanceof Boolean) {
return (Boolean) ret;
} else {
//assume we did some work
return true;
}
} catch (Exception e) {
throw new RuntimeException("Error invoking the Play routes compiler.", e);
}
}
use of org.gradle.scala.internal.reflect.ScalaMethod in project gradle by gradle.
the class PlayRunAdapterV24X method runDevHttpServer.
@Override
public void 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), getBuildDocHandlerClass(docsClassLoader), int.class, String.class);
runMethod.invoke(buildLink, buildDocHandler, httpPort, "0.0.0.0");
}
use of org.gradle.scala.internal.reflect.ScalaMethod in project gradle by gradle.
the class PlayRunAdapterV25X method runDevHttpServer.
@Override
public void 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), getBuildDocHandlerClass(docsClassLoader), int.class, String.class);
runMethod.invoke(buildLink, buildDocHandler, httpPort, "0.0.0.0");
}
use of org.gradle.scala.internal.reflect.ScalaMethod in project gradle by gradle.
the class DefaultVersionedPlayRunAdapter method runDevHttpServer.
@Override
public void runDevHttpServer(ClassLoader classLoader, ClassLoader docsClassLoader, Object buildLink, Object buildDocHandler, int httpPort) throws ClassNotFoundException {
ScalaMethod runMethod = ScalaReflectionUtil.scalaMethod(classLoader, "play.core.server.NettyServer", "mainDevHttpMode", getBuildLinkClass(classLoader), getBuildDocHandlerClass(docsClassLoader), int.class);
runMethod.invoke(buildLink, buildDocHandler, httpPort);
}
use of org.gradle.scala.internal.reflect.ScalaMethod in project gradle by gradle.
the class PlayRunAdapterV23X method createAssetsClassLoader.
@Override
protected ClassLoader createAssetsClassLoader(File assetsJar, Iterable<File> assetsDirs, ClassLoader classLoader) {
Class<?> assetsClassLoaderClass;
assetsClassLoaderClass = loadClass(classLoader, "play.runsupport.AssetsClassLoader");
final Class<?> tuple2Class = loadClass(classLoader, "scala.Tuple2");
List<?> tuples = CollectionUtils.collect(assetsDirs, new Transformer<Object, File>() {
@Override
public Object transform(File file) {
return DirectInstantiator.instantiate(tuple2Class, "public", file);
}
});
ScalaMethod listToScalaSeqMethod = ScalaReflectionUtil.scalaMethod(classLoader, "scala.collection.convert.WrapAsScala", "asScalaBuffer", List.class);
Object scalaTuples = listToScalaSeqMethod.invoke(tuples);
return Cast.uncheckedCast(DirectInstantiator.instantiate(assetsClassLoaderClass, classLoader, scalaTuples));
}
Aggregations