@CompileStatic class ScaffoldedPagesGenerator extends java.lang.Object implements ModelBuilder
Expands scaffolding templates into the pages the build compiles, run by the Gradle plugin's
generateScaffoldedViews task in a JVM on the application's own classpath.
Running here rather than in the build means a page is modelled by the application's ModelBuilder, expanded by the application's Groovy and named by ScaffoldedPages, exactly as the resolver models, expands and names it when the view is asked for.
ScaffoldedPagesGenerator <plan> <origins> <output directory> <page encoding> <report>
Each line of the plan names a domain class and, tab separated, the templates directories to
expand for it. A templates directory holds a file per template path, such as show.gsp or
admin/show.gsp. Each line of the origins names a templates directory and, after a tab,
where its template came from. The pages are written in the encoding they will be compiled
with. What the build has to decide about is written to the report, a line apiece, tab
separated: each page written - page, its templates directory and its path under the
output directory - and each template that could not be expanded for a domain class -
failed, its templates directory, the domain class and why. What becomes of either depends
on whose template it is, which the build knows and this does not.
| Modifiers | Name | Description |
|---|---|---|
static class |
ScaffoldedPagesGenerator.Failure |
A template that could not be expanded for a domain class, and why. |
static class |
ScaffoldedPagesGenerator.Page |
A page written: the templates directory it was expanded from, and its path under the output directory. |
static class |
ScaffoldedPagesGenerator.Result |
What a generation did. |
| Modifiers | Name | Description |
|---|---|---|
static int |
PROTOCOL |
The version of the exchange with the build this speaks: the command line, and the plan, origins and report files. |
| Constructor and description |
|---|
ScaffoldedPagesGenerator() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
ScaffoldedPagesGenerator.Result |
generate(java.util.Map<java.lang.String, java.util.List<java.io.File>> plan, java.io.File outputDir, java.lang.String encoding, java.util.Map<java.io.File, java.lang.String> origins)Writes, under outputDir where the resolver looks for it, the page for each domain
class and each template in the directories planned for it. |
|
static void |
main(java.lang.String[] args) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
The version of the exchange with the build this speaks: the command line, and the plan, origins and report files. This ships in grails-scaffolding and the build's side in the Gradle plugin, so a build can pair one version with another; the plugin reads this constant from the class file before running it, and expands nothing when it does not speak the same version, so a mismatch leaves the pages to be expanded when rendered instead of failing the build. Raised with every change to either side of the exchange, together with the plugin's.
Writes, under outputDir where the resolver looks for it, the page for each domain
class and each template in the directories planned for it. A template that cannot be
expanded for a domain class is left out, and returned with why.
A page ends with a comment naming the template it was expanded from, which renders as nothing, so that a page the build reports can be traced to the template to fix.
plan - each domain class, with the templates directories to expand for itorigins - where the template in each templates directory came from; the template's own
file for a directory not named