aboutsummaryrefslogtreecommitdiffstats
path: root/buildSrc/src/main/groovy/VelocityPlugin.groovy
diff options
context:
space:
mode:
authorShevek <[email protected]>2013-12-27 05:49:13 -0800
committerShevek <[email protected]>2013-12-27 05:49:13 -0800
commitbdc6c852f418c3e042aa41469d84544e5f60a526 (patch)
tree7866346f0fa48ad46a6a427d016dd4b83451dbbe /buildSrc/src/main/groovy/VelocityPlugin.groovy
parent39264fd6d2a6646e49f83b5b2b3512c1663a1c9b (diff)
Version bump to 1.4.0-SNAPSHOT.
Rewrite build system to use gradle. Clean up source for the new generation.
Diffstat (limited to 'buildSrc/src/main/groovy/VelocityPlugin.groovy')
-rw-r--r--buildSrc/src/main/groovy/VelocityPlugin.groovy33
1 files changed, 33 insertions, 0 deletions
diff --git a/buildSrc/src/main/groovy/VelocityPlugin.groovy b/buildSrc/src/main/groovy/VelocityPlugin.groovy
new file mode 100644
index 0000000..cc8741a
--- /dev/null
+++ b/buildSrc/src/main/groovy/VelocityPlugin.groovy
@@ -0,0 +1,33 @@
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.apache.velocity.VelocityContext
+import org.apache.velocity.app.VelocityEngine
+import org.apache.velocity.runtime.log.SystemLogChute
+
+class VelocityPluginExtension {
+ String inputDir = "src/main/velocity"
+ String outputDir = "build/generated-sources/velocity"
+ Map<String, Object> contextValues = [:]
+ def context(Closure closure) {
+ contextValues.with closure
+ }
+}
+
+class VelocityPlugin implements Plugin<Project> {
+ void apply(Project project) {
+
+ project.extensions.create("velocity", VelocityPluginExtension)
+
+ project.task('velocityVpp', type: VelocityTask) {
+ description "Preprocesses velocity template files."
+ inputDir = project.file(project.velocity.inputDir)
+ outputDir = project.file(project.velocity.outputDir)
+ contextValues = project.velocity.contextValues
+ }
+
+ project.compileJava.dependsOn(project.velocityVpp)
+ project.sourceSets.main.java.srcDir project.velocity.outputDir
+
+ }
+}
+