You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -25,22 +25,22 @@ Find out more about build scans for Gradle and Maven at https://scans.gradle.com
25
25
# Functionality
26
26
27
27
The following functionality is provided by the rocker plugin:
28
-
28
+
29
29
* Generate Java sources from a given set of Rocker templates
30
30
* Add the generated Java sources to the name-matching source set, if existing
31
-
* Wire task dependencies such that the Java sources are generated before the Java compile task of the name-matching source set compiles them, if existing
31
+
* Wire task dependencies such that the Java sources are generated before the Java compile task of the name-matching source set compiles them, if existing
32
32
33
33
The following Gradle configuration changes are contributed by the rocker plugin:
34
-
35
-
* Add the `com.fizzed:rocker-compiler` dependency needed to execute the Rocker template engine to the new `rockerCompiler` configuration
34
+
35
+
* Add the `com.fizzed:rocker-compiler` dependency needed to execute the Rocker template engine to the new `rockerCompiler` configuration
36
36
* Add the `com.fizzed:rocker-runtime` dependency to the name-matching `implementation` configuration to successfully compile the Java sources generated from the Rocker templates
37
37
* Use the customizable Rocker version across all `com.fizzed:rocker-*` dependencies
38
38
39
39
The following Gradle features are supported by the rocker plugin:
40
-
41
-
*`RockerCompile` task instances are themselves incremental
42
-
*`RockerCompile` task instances participate in incremental builds
43
-
*`RockerCompile` task instances participate in task output caching (if the rocker hot reload feature is disabled)
40
+
41
+
*`RockerCompile` task instances are themselves incremental
42
+
*`RockerCompile` task instances participate in incremental builds
43
+
*`RockerCompile` task instances participate in task output caching (if the rocker hot reload feature is disabled)
Please refer to the [Gradle DSL PluginDependenciesSpec](http://www.gradle.org/docs/current/dsl/org.gradle.plugin.use.PluginDependenciesSpec.html) to
74
+
Please refer to the [Gradle DSL PluginDependenciesSpec](http://www.gradle.org/docs/current/dsl/org.gradle.plugin.use.PluginDependenciesSpec.html) to
75
75
understand the behavior and limitations when using the new syntax to declare plugin dependencies.
76
76
77
77
## Define rocker configurations
78
78
79
79
This is a sample configuration:
80
-
80
+
81
81
```groovy
82
82
plugins {
83
-
id 'nu.studer.rocker' version '0.4'
83
+
id 'nu.studer.rocker' version '1.0'
84
84
id 'java'
85
85
}
86
86
@@ -99,23 +99,23 @@ rocker {
99
99
rockerVersion = '1.2.2' // optional
100
100
```
101
101
102
-
The rocker _main_ configuration declares that the Rocker templates are in _src/rocker_ and the generated Java sources need to end up in _src/generated/rocker_. It further
103
-
declares via the _optimize_ property that the generated Java sources should be optimized to not contain any code that allows for hot reload via Rocker. Since the name
102
+
The rocker _main_ configuration declares that the Rocker templates are in _src/rocker_ and the generated Java sources need to end up in _src/generated/rocker_. It further
103
+
declares via the _optimize_ property that the generated Java sources should be optimized to not contain any code that allows for hot reload via Rocker. Since the name
104
104
of the configuration is `main`, the generated sources are added to the `main` source set contributed by the applied `java` plugin.
105
105
106
106
Given the configuration above, you can invoke the Rocker template engine by issuing `./gradlew compileRocker`. You can also directly call `./gradlew compileJava` which first
107
-
generates the Java sources from the Rocker templates, and then compiles these Java sources as part of compiling all sources in the _main_ source set.
107
+
generates the Java sources from the Rocker templates, and then compiles these Java sources as part of compiling all sources in the _main_ source set.
108
108
109
-
Since we declared to use version _1.2.2_ of the Rocker template engine, all Rocker dependencies of all Gradle configurations will be of that given version.
109
+
Since we declared to use version _1.2.2_ of the Rocker template engine, all Rocker dependencies of all Gradle configurations will be of that given version.
110
110
111
111
> I suggest you use the [Continuous build](https://docs.gradle.org/current/userguide/continuous_build.html) feature of Gradle instead of using the Rocker hot reload feature.
112
-
> Declare `optimize = true` in the rocker configuration of your Gradle build, and then run your build with the `-t` command line option. In addition, deactivating the hot
112
+
> Declare `optimize = true` in the rocker configuration of your Gradle build, and then run your build with the `-t` command line option. In addition, deactivating the hot
113
113
> reload feature of Rocker will enable the rocker tasks for task output caching by the [Gradle build cache](https://docs.gradle.org/current/userguide/build_cache.html).
114
114
115
115
## Complete rocker configuration options
116
116
117
117
For each named configuration, the following options can be configured:
118
-
118
+
119
119
*`optimize` (boolean): if _true_, hot reload support is removed from the generated templates, task output becomes cacheable
120
120
*`extendsClass` (String): the class that all template implementations should extend
121
121
*`extendsModelClass` (String): the class that all template models should extend
@@ -125,8 +125,8 @@ For each named configuration, the following options can be configured:
125
125
*`outputDir` (Path): the directory where rocker will generate the Java sources into
126
126
*`classDir` (Path): the directory where the hot reload feature will compile classes to at runtime
127
127
128
-
> Warning: do not configure any of `templateDir`, `outputDir`, and `classDir` to point to the same directory or to a directory that also contains other content.
129
-
128
+
> Warning: do not configure any of `templateDir`, `outputDir`, and `classDir` to point to the same directory or to a directory that also contains other content.
129
+
130
130
# Invocation
131
131
132
132
## Invoke rocker task
@@ -140,6 +140,7 @@ You can find a self-contained example build script [here](example).
140
140
141
141
# Changelog
142
142
143
+
+ 1.0 - Made Gradle 5.0 the minimum compatible version and replaced usage of deprecated APIs.
143
144
+ 0.4 - Removed wiring between `clean` task and deleting generated Rocker sources, uses Rocker 1.2.0 by default.
144
145
+ 0.3.1 - Fixed incremental template compilation.
145
146
+ 0.3 - Incremental template compilation, i.e. only the modified templates are compiled.
0 commit comments