-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(wip) Create a Play! module to compile the router #421
Conversation
Your problem is that the The solution to this is to construct the |
Something like cl.loadClass("scala.collection.mutable.WrappedArray$ofRef")
.getConstructors()(0)
.newInstance(task.additionalImports.toArray) |
Thanks for your help @lihaoyi |
I'd rather we keep twirl and play-routes separate for now. Twirl is used in a lot more places than Play: people using Cask, Scalatra, Unfiltered, Akka-http, etc. all can (and do) make use of Twirl. Perhaps those that want the "full" play experience can just |
Fair enough 👍
I don't think that the Play! router makes sense outside of a Play! project, so maybe we should extract Twirl to a dedicated module but keep the Play! router in the Will it be possible to use the // build.sc
import $ivy.`com.lihaoyi::mill-contrib-twirllib`
import $ivy.`com.lihaoyi::mill-contrib-playlib`
import mill._, scalalib._, twirllib._, playlib._
object foo extends PlayModule {
def scalaVersion = "2.12.4"
def playVersion = "2.6.18"
def twirlVersion = "1.3.15" // could be resolved from playVersion
def ivyDeps = Agg(
"com.typesafe.play" %% "play-ws-standalone" % "1.1.10",
"com.typesafe.play" %% "play-mailer" % "6.0.0"
)
} |
Sure there’s no reason we wouldnt be able to make that work
…On Sat, 1 Sep 2018 at 8:46 PM, Guillaume Grossetie ***@***.***> wrote:
I'd rather we keep twirl and play-routes separate for now. Twirl is used
in a lot more places than Play: people using Cask, Scalatra, Unfiltered,
Akka-http, etc. all can (and do) make use of Twirl.
Fair enough 👍
Perhaps those that want the "full" play experience can just import $ivy
both mill-contrib-twirllib and mill-contrib-playroutes
I don't think that the Play! router makes sense outside of a Play!
project, so maybe we should extract Twirl to a dedicated module but keep
the Play! router in the playlib module ?
Will it be possible to use the TwirlCompiler in the Play! module ? Since
a Play! application has a well defined directory structure it should be
easy to provide a good user experience:
// build.scimport $ivy.`com.lihaoyi::mill-contrib-twirllib`import $ivy.`com.lihaoyi::mill-contrib-playlib`import mill._, scalalib._, twirllib._, playlib._
object foo extends PlayModule {
def scalaVersion = "2.12.4"
def playVersion = "2.6.18"
def twirlVersion = "1.3.15" // could be resolved from playVersion
def ivyDeps = Agg(
"com.typesafe.play" %% "play-ws-standalone" % "1.1.10",
"com.typesafe.play" %% "play-mailer" % "6.0.0"
)
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#421 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ATpwjJnQmG2t7EZZOsMyYsbRvxjDTiPpks5uWoHBgaJpZM4WT9Yp>
.
|
Right(filesJava.asScala) | ||
case "scala.util.Left" => | ||
// TODO: convert the error of type RoutesCompilationError to a CompilationResult | ||
Left(Seq(CompilationResult(Path(""), PathRef(Path(""))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure about the return type... Do we want to return a CompilationResult
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it failed, we can either return a Option
, Either
, or mill.eval.Result.Error
/mill.eval.Result.Exception
. I don't care much either way, except returning an invalid CompilationResult
is probably unacceptable since anyone trying to use it will find garbage inside
b30fad6
to
c49e1b1
Compare
Are anyone still working on this pr? |
@sorenvalentinjp Sorry I don't have time right now to work on it but you can take my work and fix the remaining issues pointed out by @lihaoyi |
closing due to inactivity |
🚧 Work In Progress
I've moved the TwirlCompiler and the RouterCompiler on the newly created
contrib.playlib
module. Currently I'm stuck with a classpath/reflection issue.The following call throws an exception:
The goal of the code is to instantiate the case class
RoutesCompilerTask
: https://github.com/playframework/playframework/blob/73284a8ea6001c80570dafb804a0ec99a7e7a6f2/framework/src/routes-compiler/src/main/scala/play/routes/compiler/RoutesCompiler.scala#L75This issue is pretty hard to debug because the exception is not thrown when I'm using Intellij IDEA to debug 😞
Ref: #324