sbt-twirl-remote-cache is an SBT plugin that brings support of the remote caching introduced in SBT 1.4.0.
The plugin creates an archive of the generated Twirl templates and pushes it to the directory/remote repository.
Works out of the box with Play Framework.
Note: caching of the generated files can lead to various problems, e.g. non-reproducible builds.
On the other hand, such an approach is suitable for a project with multiple subprojects, where the templates do not change often.
Therefore use with caution.
To use sbt-twirl-remote-cache in an existing SBT project (1.4.0+), add the following dependency to your plugins.sbt
:
addSbtPlugin("io.github.irevive" % "sbt-twirl-remote-cache" % "0.1.0")
The project configuration:
lazy val root = project
.in(file("."))
.enablePlugins(PlayScala)
.settings(
// setup remote cache
pushRemoteCacheTo := Some(MavenCache("local-cache", (ThisBuild / baseDirectory).value / "remote-cache"))
)
The commands:
twirlPushRemoteCache
- compile Twirl templates and push an archive to the remote cache repositorytwirlPullRemoteCache
- pull an archive from the remote cache repository and extract Twirl templates
CI usage example:
sbt pullRemoteCache \
twirlPullRemoteCache \
compile \
test \
pushRemoteCache \
twirlPushRemoteCache