Skip to content

🌼 blossom 2.0.0

Compare
Choose a tag to compare
@zml2008 zml2008 released this 04 Sep 02:16
· 81 commits to main/2.x since this release

NOTE 2.0.1 has been released as a hotfix to this version, resolving an issue with applying headers. See its release notes for details about those changes. We recommend using 2.0.1 instead, but the following release notes still provide helpful migration advice.

Blossom 2.0.0 is a complete redesign of the Blossom plugin to provide a fully featured solution for source and resource templating. It is based on the template engine used to build Sponge's math library. See the README for an introduction to Blossom v2's features.

Migrating from Blossom v1

The key difference in functionality with v2 is that only source files within the specific templates root will be processed as templates -- all other source files will have no other change.

This allows more efficient execution since templates only need to be regenerated when there are actual changes, and means that any compile errors in non-templated files will be linked correctly in IDE logs. Template output will also be exposed correctly to any IDE run configurations, since templates are processed at project import time.

The quickest migration from v1 starts with a buildscript like:

sourceSets {
  main {
    blossom {
      javaSources {
        // template values here
        property("token", value)
      }
    }
  }
}

Then place files that should be processed as templates in src/main/java-templates. These are Pebble templates, so the variable syntax is {{ token }}. See their documentation for more of the language's features.

Substitute java with groovy, kotlin, or scala as desired.