irevive / sbt-twirl-remote-cache   0.1.0

MIT License GitHub

Remote cache support for generated Twirl templates

Scala versions: 2.12
sbt plugins: 1.0


Build Status Maven Version

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.

Quick Start

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")

Usage Guide

The project configuration:

lazy val root = project
    // 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 repository
  • twirlPullRemoteCache - pull an archive from the remote cache repository and extract Twirl templates

CI usage example:

sbt pullRemoteCache \ 
    twirlPullRemoteCache \ 
    compile \
    test \
    pushRemoteCache \