sbt-native-packager icon indicating copy to clipboard operation
sbt-native-packager copied to clipboard

Evaluate templating system alternatives

Open muuki88 opened this issue 7 years ago • 2 comments

Status Quo

Native-packager has currently a homemade templating system, which has scaled well so far. It provides the following features

  • one-time resolving of placeholders
  • bash and bat friendly surroundings ( ${{placeholder}} and @@placeholder@@ )
  • different charsets and eol styles
  • placeholder definition as Seq[(String,String)], allowing duplicate additions

These features limited the usage in many ways, which lead to the following hard to use/debug issues

  • Template nesting is done with placeholders, which means the value's in the replacements: Seq[(String,String)] become incredible large strings, making debugging hard and nested resolving a manual work.
  • Different placeholder styles need additional configuration
  • No typing for template and global namespaces (linuxScriptReplacements, bashScriptReplacements) lead to a lot of clutter and hard to understand mechanisms
  • Untested internal library

Requirements

The experience lead to the following requirements

  • Typed templates as much as possible
  • Separate namespaces for templates
  • Testable: unit tests and shellcheck tests
  • Nesting of templates
  • Recursive resolving
  • Support optional values
  • Scala 2.10 or Java

Acceptance Criteria

  • [ ] All templates use the new templating system
  • [ ] All bash scripts are tested with shellcheck

muuki88 avatar May 28 '17 13:05 muuki88

First candidate is scalate with mustache templates.

muuki88 avatar May 28 '17 14:05 muuki88

sbt-pack uses twirl.

muuki88 avatar Nov 03 '17 14:11 muuki88