polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [02/35] zest-java git commit: build: move all tasks/plugins to the same package in buildSrc
Date Sat, 19 Nov 2016 22:50:03 GMT
build: move all tasks/plugins to the same package in buildSrc


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/65b70ca9
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/65b70ca9
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/65b70ca9

Branch: refs/heads/develop
Commit: 65b70ca98b123dc2067e53381785f18f0f4333a6
Parents: 19777d0
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Fri Nov 11 17:12:58 2016 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Fri Nov 11 17:12:58 2016 +0100

----------------------------------------------------------------------
 build.gradle                                    |  12 +-
 .../src/main/groovy/AsciidocBuildInfo.groovy    |  63 -----
 buildSrc/src/main/groovy/VersionClass.groovy    | 106 --------
 buildSrc/src/main/groovy/Xslt.groovy            | 104 --------
 .../gradle/doc/AsciidocBuildInfoPlugin.groovy   |  56 ++++
 .../zest/gradle/doc/DocumentationTask.groovy    | 263 ++++++++++++++++++
 .../org/apache/zest/gradle/doc/XsltTask.groovy  | 105 ++++++++
 .../zest/gradle/plugin/Documentation.groovy     | 265 -------------------
 .../plugin/ModuleReleaseSpecification.groovy    |  46 ----
 .../gradle/release/ModuleReleaseSpec.groovy     |  44 +++
 .../gradle/version/VersionClassPlugin.groovy    | 100 +++++++
 manual/build.gradle                             |  14 +-
 12 files changed, 583 insertions(+), 595 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 7615651..5760720 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,8 +17,10 @@
  *
  *
  */
-
 import org.apache.tools.ant.filters.ReplaceTokens
+import org.apache.zest.gradle.doc.AsciidocBuildInfoPlugin
+import org.apache.zest.gradle.release.ModuleReleaseSpec
+import org.apache.zest.gradle.version.VersionClassPlugin
 
 project.ext {
   title = "Apache Zestâ„¢ (Java Edition) SDK"
@@ -51,7 +53,7 @@ sourceCompatibility = "1.8"
 
 // Collect the modules that fulfills the Release Criteria.
 project.ext {
-  releaseSpec = new org.apache.zest.gradle.plugin.ModuleReleaseSpecification()
+  releaseSpec = new ModuleReleaseSpec()
   releaseApprovedProjects = allprojects.findAll( { p -> rootProject.releaseSpec.satisfiedBy( p ) } )
 }
 
@@ -281,8 +283,8 @@ allprojects {
       apply plugin: 'jacoco'
     }
     apply plugin: 'osgi'
-    apply plugin: VersionClass
-    apply plugin: AsciidocBuildInfo
+    apply plugin: VersionClassPlugin
+    apply plugin: AsciidocBuildInfoPlugin
 
 //    if( name == "org.apache.zest.core.runtime" )
 //    {
@@ -364,7 +366,7 @@ allprojects {
     }
 
 //    // Create checkstyle report
-//    task checkstyleReport( type: Xslt, dependsOn: check ) {
+//    task checkstyleReport( type: XsltTask, dependsOn: check ) {
 //      source project.checkstyle.reportsDir
 //      include '*.xml'
 //      destDir = file( "build/reports/checkstyle/" )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/AsciidocBuildInfo.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/AsciidocBuildInfo.groovy b/buildSrc/src/main/groovy/AsciidocBuildInfo.groovy
deleted file mode 100644
index 6a9a77c..0000000
--- a/buildSrc/src/main/groovy/AsciidocBuildInfo.groovy
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-import groovy.transform.CompileStatic
-import org.gradle.api.Project
-import org.gradle.api.Plugin
-
-@CompileStatic
-class AsciidocBuildInfo implements Plugin<Project>
-{
-
-    final static String TASK_NAME = 'makeAsciidocBuildInfo'
-
-    AsciidocBuildInfo()
-    {
-    }
-
-    def void apply( Project project )
-    {
-        def buildInfoDir = new File( project.buildDir, "docs/buildinfo" );
-
-        def makeAsciidocBuildInfoTask = project.task( TASK_NAME ) << {
-            buildInfoDir.mkdirs()
-
-            // GroupID, ArtifactID, Version table in artifact.txt
-            def artifactTableFile = new File( buildInfoDir, "artifact.txt" )
-            def artifactTable = """
-                |.Artifact
-                |[role="artifact", options="header,autowidth"]
-                ||===================================================
-                ||Group ID|Artifact ID|Version
-                ||${project.group}|${project.name}|${project.version}
-                ||===================================================
-                """.stripMargin()
-            artifactTableFile.withWriter { out -> out.println( artifactTable ) }
-        }
-
-        // Declare inputs/outputs
-        if( project.getBuildFile() != null && project.getBuildFile().exists() )
-        {
-            makeAsciidocBuildInfoTask.getInputs().file(project.getBuildFile())
-        }
-        makeAsciidocBuildInfoTask.getOutputs().file( buildInfoDir )
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/VersionClass.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/VersionClass.groovy b/buildSrc/src/main/groovy/VersionClass.groovy
deleted file mode 100644
index b8c8a92..0000000
--- a/buildSrc/src/main/groovy/VersionClass.groovy
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-import groovy.transform.CompileStatic
-import org.gradle.api.Project
-import org.gradle.api.Plugin
-import org.gradle.api.Task
-import org.gradle.api.file.SourceDirectorySet
-import org.gradle.api.plugins.JavaPlugin
-import org.gradle.api.plugins.JavaPluginConvention
-import org.gradle.api.tasks.SourceSet
-import org.gradle.api.tasks.bundling.Jar
-
-// TODO:perf Build only one for the whole project
-// TODO:perf Remove the build date, maybe not for release versions
-// TODO:release Put git data in with placeholders for dev versions
-@CompileStatic
-class VersionClass implements Plugin<Project>
-{
-
-  VersionClass()
-  {
-  }
-
-  def void apply(Project project)
-  {
-    project.getPlugins().apply(JavaPlugin.class)
-    def genSrc = 'generated-src/version'
-    def generatedSrcDir = new File(project.buildDir, genSrc)
-
-    Task makeVersionClassTask = project.task('makeVersionClass') << {
-      def now = new Date()
-      def tmpGroup = project.name
-      if( tmpGroup.startsWith("org.apache.zest.core"))
-      {
-        tmpGroup = tmpGroup - ".core"
-      }
-      tmpGroup = tmpGroup.replace('-','_')
-      def outFilename = "java/" + tmpGroup.replace('.', '/') + "/BuildVersion.java"
-      def outFile = new File(generatedSrcDir, outFilename)
-      outFile.getParentFile().mkdirs()
-      def f = new FileWriter(outFile)
-      f.write('package ' + tmpGroup + ';\n')
-      f.write("""
-/**
- * Simple class for storing the version derived from the build system.
- *
- */
-public interface BuildVersion
-{
-    /** The version of the project from the gradle build.gradle file. */
-    String VERSION = \"""" + project.version + """\";
-
-    /** The name of the project from the gradle build.gradle file. */
-    String NAME = \"""" + project.name + """\";
-
-    /** The group of the project from the gradle build.gradle file. */
-    String GROUP = \"""" + project.group + """\";
-
-    /** The date this file was generated, usually the last date that the project was modified. */
-    String DATE = \"""" + now + """\";
-
-    /** The full details of the version, including the build date. */
-    String DETAILED_VERSION = GROUP + ":" + NAME + ":" + VERSION + " " + DATE;
-}\n
-""")
-      f.close()
-    }
-    def sourceSets = project.convention.getPlugin(JavaPluginConvention).sourceSets
-    sourceSets.create("version") { SourceSet sourceSet ->
-        sourceSet.java { SourceDirectorySet dirSet ->
-            dirSet.srcDir project.buildDir.name + '/' + genSrc + '/java'
-        }
-    }
-    makeVersionClassTask.getInputs().files(sourceSets.getByName('main').allSource)
-    makeVersionClassTask.getOutputs().file(generatedSrcDir)
-    if( project.getBuildFile() != null && project.getBuildFile().exists() )
-    {
-      makeVersionClassTask.getInputs().files(project.getBuildFile())
-    }
-    project.getTasks().getByName('compileJava').dependsOn('compileVersionJava')
-    project.getTasks().getByName('compileVersionJava').dependsOn('makeVersionClass')
-    project.getTasks().getByName('jar') { Jar task ->
-      task.from sourceSets.getByName('version').output
-    }
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/Xslt.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/Xslt.groovy b/buildSrc/src/main/groovy/Xslt.groovy
deleted file mode 100644
index 3414350..0000000
--- a/buildSrc/src/main/groovy/Xslt.groovy
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-/**
- *  Gradle plug-in for running a set of one or more
- *  files through an XSLT transform.  A styleSheet
- *  file must be specified.  The source file(s) are
- *  configured just like any other source task:
- *     source <file>
- *       ...or...
- *     source <directory>
- *       ...and then optionally...
- *     include '*.xml'
- *     exclude, etc.
- *
- *  One of destDir or destFile must be specified, though if
- *  there are multiple source files then destFile will just
- *  keep getting rewritten.
- *
- *  The extension is stripped from the source files and the
- *  specified extension is appended (whether it is set or not)
- *  it defaults to no extension.
- *
- *  Example task formatting a check style report:
- *
- *  task checkstyleReport(type: Xslt, dependsOn: check) {*      source project.checkstyleResultsDir
- *      include '*.xml'
- *
- *      destDir = project.checkstyleResultsDir
- *      extension = 'html'
- *
- *      stylesheetFile = file( 'config/checkstyle/checkstyle-noframes.xsl' )
- *}*
- *  The above definition requires that the specified XSL file be
- *  copied in with the other checkstyle configuration files.  (The
- *  file in the example is part of the checkstyle distribution.)
- *
- */
-
-import groovy.transform.CompileStatic
-import org.gradle.api.file.EmptyFileVisitor
-import org.gradle.api.tasks.SourceTask
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.Optional
-import org.gradle.api.tasks.InputFile
-import org.gradle.api.tasks.TaskAction
-import org.gradle.api.file.FileVisitDetails
-
-import javax.xml.transform.TransformerFactory
-import javax.xml.transform.stream.StreamResult
-import javax.xml.transform.stream.StreamSource
-
-@CompileStatic
-class Xslt extends SourceTask
-{
-
-  @OutputDirectory @Optional
-  File destDir
-
-  @Optional
-  String extension
-
-  @InputFile
-  File stylesheetFile
-
-  @TaskAction
-  def transform()
-  {
-    def factory = TransformerFactory.newInstance()
-    def transformer = factory.newTransformer(new StreamSource(stylesheetFile));
-
-    getSource().visit( new EmptyFileVisitor() {
-      @Override
-      void visitFile(FileVisitDetails fvd) {
-        // Remove the extension from the file name
-        def name = fvd.file.name.replaceAll('[.][^\\.]*$', '')
-        if( extension == null )
-        {
-          extension = 'html'
-        }
-        name += '.' + extension
-        def destFile = new File(destDir, name)
-        transformer.transform(new StreamSource(fvd.file), new StreamResult(destFile))
-      }
-    } )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/AsciidocBuildInfoPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/AsciidocBuildInfoPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/AsciidocBuildInfoPlugin.groovy
new file mode 100644
index 0000000..efb9654
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/AsciidocBuildInfoPlugin.groovy
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.zest.gradle.doc
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Project
+import org.gradle.api.Plugin
+
+@CompileStatic
+class AsciidocBuildInfoPlugin implements Plugin<Project>
+{
+  final static String TASK_NAME = 'makeAsciidocBuildInfo'
+
+  def void apply( Project project )
+  {
+    def buildInfoDir = new File( project.buildDir, "docs/buildinfo" );
+
+    def makeAsciidocBuildInfoTask = project.task( TASK_NAME ) << {
+      buildInfoDir.mkdirs()
+
+      // GroupID, ArtifactID, Version table in artifact.txt
+      def artifactTableFile = new File( buildInfoDir, "artifact.txt" )
+      def artifactTable = """
+        |.Artifact
+        |[role="artifact", options="header,autowidth"]
+        ||===================================================
+        ||Group ID|Artifact ID|Version
+        ||${ project.group }|${ project.name }|${ project.version }
+        ||===================================================
+        """.stripMargin()
+      artifactTableFile.withWriter { out -> out.println( artifactTable ) }
+    }
+
+    // Declare inputs/outputs
+    if( project.getBuildFile() != null && project.getBuildFile().exists() )
+    {
+      makeAsciidocBuildInfoTask.getInputs().file( project.getBuildFile() )
+    }
+    makeAsciidocBuildInfoTask.getOutputs().file( buildInfoDir )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/DocumentationTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/DocumentationTask.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/DocumentationTask.groovy
new file mode 100644
index 0000000..af1efa5
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/DocumentationTask.groovy
@@ -0,0 +1,263 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.zest.gradle.doc
+
+import groovy.io.FileType
+import groovy.transform.CompileStatic
+import groovy.transform.TypeCheckingMode;
+import org.gradle.api.DefaultTask
+import org.gradle.api.Project
+import org.gradle.api.file.CopySpec
+import org.gradle.api.tasks.TaskAction
+import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.InputDirectory
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.OutputDirectory
+import org.gradle.process.ExecSpec
+
+// TODO: try to use dependencies for FOP and execute within the same JVM.
+// TODO: move the bulk of resources into this plugin, instead of sitting in the project.
+@CompileStatic
+class DocumentationTask extends DefaultTask
+{
+  @Input def String docName
+  @Input def String docType
+  void setDocName( String docName ) { this.docName = docName }
+  void setDocType( String docType ) { this.docType = docType }
+
+  @InputDirectory def File getCommonResourcesDir() { project.file( 'src/resources' ) }
+  @InputDirectory def File getConfigDir() { project.file( 'src/conf' ) }
+  @InputDirectory def File getDocsDir() { project.file( 'src/docs') }
+  @InputDirectory def File getSrcMainDir() { project.file( 'src/main') }
+  @InputDirectory def File getXslDir() { project.file( 'src/xsl') }
+  @InputDirectory def File getBuildSrcDir() { project.rootProject.file( 'buildSrc/src' ) }
+
+  @InputFiles def getSubProjectsDocsDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/docs' ) } }
+  @InputFiles def getSubProjectsTestDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/test' ) } }
+
+  @OutputDirectory def File getOutputDir() { project.file( "${project.buildDir}/docs/${docName}/" ) }
+
+  def File getTempAsciidocDir() { project.file( "${project.buildDir}/tmp-asciidoc" ) }
+  def File getTempDir() { project.file( "${project.buildDir}/tmp/docs/${docName}") }
+
+  @TaskAction
+  def void generate()
+  {
+    installAsciidocFilters()
+
+    [ outputDir, tempAsciidocDir, tempDir ].each { it.deleteDir() }
+    [ outputDir, tempAsciidocDir, tempDir ].each { it.mkdirs() }
+
+    copySubProjectsDocsResources()
+    generateAsciidocAccordingToReleaseSpecification()
+    generateXDoc()
+    generateChunkedHtml()
+    // generateSingleHtml()
+    // generatePdf()
+  }
+
+  def void installAsciidocFilters()
+  {
+    def digester = java.security.MessageDigest.getInstance( 'SHA' )
+    def filtersDir = project.rootProject.file( 'buildSrc/src/asciidoc/filters' )
+    def userHome = new File( System.getProperty( 'user.home' ) )
+    def dotAsciidocFiltersDir = new File( userHome, '.asciidoc/filters' )
+    def installSnippets = false
+    filtersDir.eachFileRecurse( groovy.io.FileType.FILES ) { originalFile ->
+      def targetFile = new File( dotAsciidocFiltersDir, (originalFile.toURI() as String) - (filtersDir.toURI() as String) )
+      if( !targetFile.exists() )
+      {
+        installSnippets = true
+      }
+      else
+      {
+        def originalDigest = digester.digest( originalFile.bytes )
+        def targetDigest = digester.digest( targetFile.bytes )
+        if( originalDigest != targetDigest )
+        {
+          installSnippets = true
+        }
+      }
+    }
+    if( installSnippets )
+    {
+      dotAsciidocFiltersDir.mkdirs()
+      project.rootProject.copy { CopySpec spec ->
+        spec.from filtersDir
+        spec.into dotAsciidocFiltersDir
+      }
+      dotAsciidocFiltersDir.eachFileRecurse( FileType.FILES ) { file ->
+        if( file.name.endsWith( '.py' ) ) {
+          chmod(file, '755')
+        }
+      }
+      println "Zest Asciidoc Filters Installed!"
+    }
+  }
+
+  @CompileStatic(TypeCheckingMode.SKIP)
+  def void chmod(File file, String permissions) {
+    ant.chmod( file: file.absolutePath, perm: permissions )
+  }
+
+  def void copySubProjectsDocsResources()
+  {
+    project.rootProject.subprojects.each { p ->
+      p.copy { CopySpec spec ->
+        spec.from p.file( 'src/docs/resources' )
+        spec.into outputDir
+        spec.include '**'
+      }
+    }
+  }
+
+  def void generateAsciidocAccordingToReleaseSpecification()
+  {
+    project.copy { CopySpec spec ->
+      spec.from docsDir
+      spec.into tempAsciidocDir
+      spec.include '**'
+    }
+    if( project.version != '0' && !project.version.toString().contains( 'SNAPSHOT' ) ) {
+      def licenseFile = new File( tempAsciidocDir, 'userguide/libraries.txt' )
+      def extensionsFile = new File( tempAsciidocDir, 'userguide/extensions.txt' )
+      def toolsFile = new File( tempAsciidocDir, 'userguide/tools.txt' )
+      [ licenseFile, extensionsFile, toolsFile ].each { asciidocFile ->
+        def filteredFileContent = ''
+        asciidocFile.readLines().each { line ->
+          if( line.startsWith( 'include::' ) ) {
+            def approved = false
+            Set<Project> releaseApprovedProjects = project.rootProject.extensions.extraProperties.get('releaseApprovedProjects') as Set<Project>
+            releaseApprovedProjects.collect{it.projectDir}.each { approvedProjectDir ->
+              if( line.contains( "${approvedProjectDir.parentFile.name}/${approvedProjectDir.name}" ) ) {
+                approved = true
+              }
+            }
+            if( approved ) {
+              filteredFileContent += "$line\n"
+            }
+          } else {
+            filteredFileContent += "$line\n"
+          }
+        }
+        asciidocFile.text = filteredFileContent
+      }
+    }
+  }
+
+  def void generateXDoc()
+  {
+    project.exec { ExecSpec spec ->
+      spec.executable = 'asciidoc'
+      spec.workingDir = '..'
+      def commonResourcesPath = relativePath( project.rootDir, commonResourcesDir )
+      def asciidocConfigPath = relativePath( project.rootDir, new File( configDir, 'asciidoc.conf' ) )
+      def docbookConfigPath = relativePath( project.rootDir, new File( configDir, 'docbook45.conf' ) )
+      def linkimagesConfigPath = relativePath( project.rootDir, new File( configDir, 'linkedimages.conf' ) )
+      def xdocOutputPath =  relativePath( project.rootDir, new File( tempDir, 'xdoc-temp.xml' ) )
+      def asciidocIndexPath = relativePath( project.rootDir, new File( tempAsciidocDir, "$docName/index.txt" ) )
+      spec.args = [
+              '--attribute', 'revnumber=' + project.version,
+              '--attribute', 'level1=' + (docType.equals('article') ? 1 : 0),
+              '--attribute', 'level2=' + (docType.equals('article') ? 2 : 1),
+              '--attribute', 'level3=' + (docType.equals('article') ? 3 : 2),
+              '--attribute', 'level4=' + (docType.equals('article') ? 4 : 3),
+              '--attribute', 'importdir=' + commonResourcesPath,
+              '--backend', 'docbook',
+              '--attribute', 'docinfo1',
+              '--doctype', docType,
+              '--conf-file=' + asciidocConfigPath,
+              '--conf-file=' + docbookConfigPath,
+              '--conf-file=' + linkimagesConfigPath,
+              '--out-file', xdocOutputPath,
+              asciidocIndexPath
+      ]
+    }
+  }
+
+  def void generateChunkedHtml()
+  {
+    project.copy { CopySpec spec ->
+      spec.from commonResourcesDir
+      spec.into outputDir
+      spec.include '**'
+    }
+    project.copy { CopySpec spec ->
+      spec.from "$docsDir/$docName/resources"
+      spec.into outputDir
+      spec.include '**'
+    }
+
+    project.exec { ExecSpec spec ->
+      def xsltFile = "$docsDir/$docName/xsl/chunked.xsl"
+      def outputPath = relativePath( project.projectDir, outputDir ) + '/'
+      spec.executable = 'xsltproc'
+      spec.args = [
+              '--nonet',
+              '--noout',
+              '--output', outputPath,
+              xsltFile,
+              "$tempDir/xdoc-temp.xml"
+      ]
+    }
+  }
+
+  def void generateSingleHtml()
+  {
+    project.exec { ExecSpec spec ->
+      // XML_CATALOG_FILES=
+      String xsltFile = "$xslDir/xhtml.xsl"
+      spec.executable = 'xsltproc'
+      spec.args = [
+              '--nonet',
+              '--noout',
+              '--output', "$outputDir/${docName}.html",
+              xsltFile,
+              "$tempDir/xdoc-temp.xml"
+      ]
+    }
+  }
+
+  def void generatePdf()
+  {
+    // $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
+    // $ fop article.fo article.pdf
+    project.exec { ExecSpec spec ->
+      String xsltFile = "$xslDir/fo.xsl"
+      spec.executable = 'xsltproc'
+      spec.args = [
+        '--nonet',
+        '--output', "$tempDir/${docName}.fo",
+        xsltFile,
+        "$tempDir/xdoc-temp.xml"
+      ]
+    }
+    project.exec { ExecSpec spec ->
+      spec.executable = 'fop'
+      spec.args = [
+        "$tempDir/${docName}.fo",
+        "$outputDir/${docName}.pdf"
+      ]
+    }
+  }
+
+  def String relativePath( File root, File target )
+  {
+    new File( root.toURI().relativize( target.toURI() ).toString() ).path
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
new file mode 100644
index 0000000..d992e9f
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
@@ -0,0 +1,105 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.zest.gradle.doc
+
+import groovy.transform.CompileStatic
+import org.gradle.api.file.EmptyFileVisitor
+import org.gradle.api.tasks.SourceTask
+import org.gradle.api.tasks.OutputDirectory
+import org.gradle.api.tasks.Optional
+import org.gradle.api.tasks.InputFile
+import org.gradle.api.tasks.TaskAction
+import org.gradle.api.file.FileVisitDetails
+import javax.xml.transform.TransformerFactory
+import javax.xml.transform.stream.StreamResult
+import javax.xml.transform.stream.StreamSource
+
+/**
+ *  Gradle task for running a set of one or more
+ *  files through an XSLT transform.  A styleSheet
+ *  file must be specified.  The source file(s) are
+ *  configured just like any other source task:
+ *     source <file>
+ *       ...or...
+ *     source <directory>
+ *       ...and then optionally...
+ *     include '*.xml'
+ *     exclude, etc.
+ *
+ *  One of destDir or destFile must be specified, though if
+ *  there are multiple source files then destFile will just
+ *  keep getting rewritten.
+ *
+ *  The extension is stripped from the source files and the
+ *  specified extension is appended (whether it is set or not)
+ *  it defaults to no extension.
+ *
+ *  Example task formatting a check style report:
+ *
+ *  task checkstyleReport(type: XsltTask, dependsOn: check) {
+ *      source project.checkstyleResultsDir
+ *      include '*.xml'
+ *
+ *      destDir = project.checkstyleResultsDir
+ *      extension = 'html'
+ *
+ *      stylesheetFile = file( 'config/checkstyle/checkstyle-noframes.xsl' )
+ * }
+ *
+ *  The above definition requires that the specified XSL file be
+ *  copied in with the other checkstyle configuration files.  (The
+ *  file in the example is part of the checkstyle distribution.)
+ *
+ */
+@CompileStatic
+class XsltTask extends SourceTask
+{
+
+  @OutputDirectory
+  @Optional
+  File destDir
+
+  @Optional
+  String extension
+
+  @InputFile
+  File stylesheetFile
+
+  @TaskAction
+  def transform()
+  {
+    def factory = TransformerFactory.newInstance()
+    def transformer = factory.newTransformer( new StreamSource( stylesheetFile ) );
+
+    getSource().visit( new EmptyFileVisitor() {
+      @Override
+      void visitFile( FileVisitDetails fvd )
+      {
+        // Remove the extension from the file name
+        def name = fvd.file.name.replaceAll( '[.][^\\.]*$', '' )
+        if( extension == null )
+        {
+          extension = 'html'
+        }
+        name += '.' + extension
+        def destFile = new File( destDir, name )
+        transformer.transform( new StreamSource( fvd.file ), new StreamResult( destFile ) )
+      }
+    } )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/org/apache/zest/gradle/plugin/Documentation.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/plugin/Documentation.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/plugin/Documentation.groovy
deleted file mode 100644
index 0d2a931..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/plugin/Documentation.groovy
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.gradle.plugin
-
-import groovy.io.FileType
-import groovy.transform.CompileStatic
-import groovy.transform.TypeCheckingMode;
-import org.gradle.api.DefaultTask
-import org.gradle.api.Project
-import org.gradle.api.file.CopySpec
-import org.gradle.api.tasks.TaskAction
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputDirectory
-import org.gradle.api.tasks.InputFiles
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.process.ExecSpec
-
-// TODO: try to use dependencies for FOP and execute within the same JVM.
-// TODO: move the bulk of resources into this plugin, instead of sitting in the project.
-@CompileStatic
-class Documentation extends DefaultTask
-{
-  @Input def String docName
-  @Input def String docType
-  void setDocName( String docName ) { this.docName = docName }
-  void setDocType( String docType ) { this.docType = docType }
-
-  @InputDirectory def File getCommonResourcesDir() { project.file( 'src/resources' ) }
-  @InputDirectory def File getConfigDir() { project.file( 'src/conf' ) }
-  @InputDirectory def File getDocsDir() { project.file( 'src/docs') }
-  @InputDirectory def File getSrcMainDir() { project.file( 'src/main') }
-  @InputDirectory def File getXslDir() { project.file( 'src/xsl') }
-  @InputDirectory def File getBuildSrcDir() { project.rootProject.file( 'buildSrc/src' ) }
-
-  @InputFiles def getSubProjectsDocsDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/docs' ) } }
-  @InputFiles def getSubProjectsTestDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/test' ) } }
-
-  @OutputDirectory def File getOutputDir() { project.file( "${project.buildDir}/docs/${docName}/" ) }
-
-  def File getTempAsciidocDir() { project.file( "${project.buildDir}/tmp-asciidoc" ) }
-  def File getTempDir() { project.file( "${project.buildDir}/tmp/docs/${docName}") }
-
-  @TaskAction
-  def void generate()
-  {
-    installAsciidocFilters()
-
-    [ outputDir, tempAsciidocDir, tempDir ].each { it.deleteDir() }
-    [ outputDir, tempAsciidocDir, tempDir ].each { it.mkdirs() }
-
-    copySubProjectsDocsResources()
-    generateAsciidocAccordingToReleaseSpecification()
-    generateXDoc()
-    generateChunkedHtml()
-    // generateSingleHtml()
-    // generatePdf()
-  }
-
-  def void installAsciidocFilters()
-  {
-    def digester = java.security.MessageDigest.getInstance( 'SHA' )
-    def filtersDir = project.rootProject.file( 'buildSrc/src/asciidoc/filters' )
-    def userHome = new File( System.getProperty( 'user.home' ) )
-    def dotAsciidocFiltersDir = new File( userHome, '.asciidoc/filters' )
-    def installSnippets = false
-    filtersDir.eachFileRecurse( groovy.io.FileType.FILES ) { originalFile ->
-      def targetFile = new File( dotAsciidocFiltersDir, (originalFile.toURI() as String) - (filtersDir.toURI() as String) )
-      if( !targetFile.exists() )
-      {
-        installSnippets = true
-      }
-      else
-      {
-        def originalDigest = digester.digest( originalFile.bytes )
-        def targetDigest = digester.digest( targetFile.bytes )
-        if( originalDigest != targetDigest )
-        {
-          installSnippets = true
-        }
-      }
-    }
-    if( installSnippets )
-    {
-      dotAsciidocFiltersDir.mkdirs()
-      project.rootProject.copy { CopySpec spec ->
-        spec.from filtersDir
-        spec.into dotAsciidocFiltersDir
-      }
-      dotAsciidocFiltersDir.eachFileRecurse( FileType.FILES ) { file ->
-        if( file.name.endsWith( '.py' ) ) {
-          chmod(file, '755')
-        }
-      }
-      println "Zest Asciidoc Filters Installed!"
-    }
-  }
-
-  @CompileStatic(TypeCheckingMode.SKIP)
-  def void chmod(File file, String permissions) {
-    ant.chmod( file: file.absolutePath, perm: permissions )
-  }
-
-  def void copySubProjectsDocsResources()
-  {
-    project.rootProject.subprojects.each { p ->
-      p.copy { CopySpec spec ->
-        spec.from p.file( 'src/docs/resources' )
-        spec.into outputDir
-        spec.include '**'
-      }
-    }
-  }
-
-  def void generateAsciidocAccordingToReleaseSpecification()
-  {
-    project.copy { CopySpec spec ->
-      spec.from docsDir
-      spec.into tempAsciidocDir
-      spec.include '**'
-    }
-    if( project.version != '0' && !project.version.toString().contains( 'SNAPSHOT' ) ) {
-      def licenseFile = new File( tempAsciidocDir, 'userguide/libraries.txt' )
-      def extensionsFile = new File( tempAsciidocDir, 'userguide/extensions.txt' )
-      def toolsFile = new File( tempAsciidocDir, 'userguide/tools.txt' )
-      [ licenseFile, extensionsFile, toolsFile ].each { asciidocFile ->
-        def filteredFileContent = ''
-        asciidocFile.readLines().each { line ->
-          if( line.startsWith( 'include::' ) ) {
-            def approved = false
-            Set<Project> releaseApprovedProjects = project.rootProject.extensions.extraProperties.get('releaseApprovedProjects') as Set<Project>
-            releaseApprovedProjects.collect{it.projectDir}.each { approvedProjectDir ->
-              if( line.contains( "${approvedProjectDir.parentFile.name}/${approvedProjectDir.name}" ) ) {
-                approved = true
-              }
-            }
-            if( approved ) {
-              filteredFileContent += "$line\n"
-            }
-          } else {
-            filteredFileContent += "$line\n"
-          }
-        }
-        asciidocFile.text = filteredFileContent
-      }
-    }
-  }
-
-  def void generateXDoc()
-  {
-    project.exec { ExecSpec spec ->
-      spec.executable = 'asciidoc'
-      spec.workingDir = '..'
-      def commonResourcesPath = relativePath( project.rootDir, commonResourcesDir )
-      def asciidocConfigPath = relativePath( project.rootDir, new File( configDir, 'asciidoc.conf' ) )
-      def docbookConfigPath = relativePath( project.rootDir, new File( configDir, 'docbook45.conf' ) )
-      def linkimagesConfigPath = relativePath( project.rootDir, new File( configDir, 'linkedimages.conf' ) )
-      def xdocOutputPath =  relativePath( project.rootDir, new File( tempDir, 'xdoc-temp.xml' ) )
-      def asciidocIndexPath = relativePath( project.rootDir, new File( tempAsciidocDir, "$docName/index.txt" ) )
-      spec.args = [
-              '--attribute', 'revnumber=' + project.version,
-              '--attribute', 'level1=' + (docType.equals('article') ? 1 : 0),
-              '--attribute', 'level2=' + (docType.equals('article') ? 2 : 1),
-              '--attribute', 'level3=' + (docType.equals('article') ? 3 : 2),
-              '--attribute', 'level4=' + (docType.equals('article') ? 4 : 3),
-              '--attribute', 'importdir=' + commonResourcesPath,
-              '--backend', 'docbook',
-              '--attribute', 'docinfo1',
-              '--doctype', docType,
-              '--conf-file=' + asciidocConfigPath,
-              '--conf-file=' + docbookConfigPath,
-              '--conf-file=' + linkimagesConfigPath,
-              '--out-file', xdocOutputPath,
-              asciidocIndexPath
-      ]
-    }
-  }
-
-  def void generateChunkedHtml()
-  {
-    project.copy { CopySpec spec ->
-      spec.from commonResourcesDir
-      spec.into outputDir
-      spec.include '**'
-    }
-    project.copy { CopySpec spec ->
-      spec.from "$docsDir/$docName/resources"
-      spec.into outputDir
-      spec.include '**'
-    }
-
-    project.exec { ExecSpec spec ->
-      def xsltFile = "$docsDir/$docName/xsl/chunked.xsl"
-      def outputPath = relativePath( project.projectDir, outputDir ) + '/'
-      spec.executable = 'xsltproc'
-      spec.args = [
-              '--nonet',
-              '--noout',
-              '--output', outputPath,
-              xsltFile,
-              "$tempDir/xdoc-temp.xml"
-      ]
-    }
-  }
-
-  def void generateSingleHtml()
-  {
-    project.exec { ExecSpec spec ->
-      // XML_CATALOG_FILES=
-      String xsltFile = "$xslDir/xhtml.xsl"
-      spec.executable = 'xsltproc'
-      spec.args = [
-              '--nonet',
-              '--noout',
-              '--output', "$outputDir/${docName}.html",
-              xsltFile,
-              "$tempDir/xdoc-temp.xml"
-      ]
-    }
-  }
-
-  def void generatePdf()
-  {
-    // $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
-    // $ fop article.fo article.pdf
-    project.exec { ExecSpec spec ->
-      String xsltFile = "$xslDir/fo.xsl"
-      spec.executable = 'xsltproc'
-      spec.args = [
-        '--nonet',
-        '--output', "$tempDir/${docName}.fo",
-        xsltFile,
-        "$tempDir/xdoc-temp.xml"
-      ]
-    }
-    project.exec { ExecSpec spec ->
-      spec.executable = 'fop'
-      spec.args = [
-        "$tempDir/${docName}.fo",
-        "$outputDir/${docName}.pdf"
-      ]
-    }
-  }
-
-  def String relativePath( File root, File target )
-  {
-    new File( root.toURI().relativize( target.toURI() ).toString() ).path
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/org/apache/zest/gradle/plugin/ModuleReleaseSpecification.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/plugin/ModuleReleaseSpecification.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/plugin/ModuleReleaseSpecification.groovy
deleted file mode 100644
index d9a33f8..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/plugin/ModuleReleaseSpecification.groovy
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.zest.gradle.plugin;
-
-import org.gradle.api.Project
-
-class ModuleReleaseSpecification
-{
-  def boolean satisfiedBy( Project project )
-  {
-    def devStatusFile = new File( project.projectDir, "dev-status.xml" )
-    if( !devStatusFile.exists() )
-    {
-      return false
-    }
-    def module = new XmlSlurper().parse( devStatusFile )
-    def codebase = module.status.codebase.text()
-    def docs = module.status.documentation.text()
-    def tests = module.status.unittests.text()
-    def satisfied = ( codebase == 'none' && docs == 'complete' && tests != 'complete' )
-    satisfied |= ( codebase == 'early' && ( docs == 'complete' || docs == 'good') && (tests == 'complete' || tests == 'good' ) )
-    satisfied |= ( codebase == 'beta' && (docs == 'complete' || docs == 'good' || docs == 'brief') && (tests == 'complete' || tests == 'good' || tests == 'some') )
-    satisfied |= ( codebase == 'stable' )
-    satisfied |= ( codebase == 'mature' )
-    // TODO Add a task to report this easily
-    // println "$project.name($satisfied) -> $codebase, $docs, $tests"
-    return satisfied
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
new file mode 100644
index 0000000..0d81bac
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.zest.gradle.release;
+
+import org.gradle.api.Project
+
+class ModuleReleaseSpec
+{
+  def boolean satisfiedBy( Project project )
+  {
+    def devStatusFile = new File( project.projectDir, "dev-status.xml" )
+    if( !devStatusFile.exists() )
+    {
+      return false
+    }
+    def module = new XmlSlurper().parse( devStatusFile )
+    def codebase = module.status.codebase.text()
+    def docs = module.status.documentation.text()
+    def tests = module.status.unittests.text()
+    def satisfied = ( codebase == 'none' && docs == 'complete' && tests != 'complete' )
+    satisfied |= ( codebase == 'early' && ( docs == 'complete' || docs == 'good') && (tests == 'complete' || tests == 'good' ) )
+    satisfied |= ( codebase == 'beta' && (docs == 'complete' || docs == 'good' || docs == 'brief') && (tests == 'complete' || tests == 'good' || tests == 'some') )
+    satisfied |= ( codebase == 'stable' )
+    satisfied |= ( codebase == 'mature' )
+    // TODO Add a task to report this easily
+    // println "$project.name($satisfied) -> $codebase, $docs, $tests"
+    return satisfied
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/buildSrc/src/main/groovy/org/apache/zest/gradle/version/VersionClassPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/version/VersionClassPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/version/VersionClassPlugin.groovy
new file mode 100644
index 0000000..b32e843
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/version/VersionClassPlugin.groovy
@@ -0,0 +1,100 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.zest.gradle.version
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Project
+import org.gradle.api.Plugin
+import org.gradle.api.Task
+import org.gradle.api.file.SourceDirectorySet
+import org.gradle.api.plugins.JavaPlugin
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.tasks.SourceSet
+import org.gradle.api.tasks.bundling.Jar
+
+// TODO:perf Build only one for the whole project
+// TODO:perf Remove the build date, maybe not for release versions
+// TODO:release Put git data in with placeholders for dev versions
+@CompileStatic
+class VersionClassPlugin implements Plugin<Project>
+{
+  def void apply( Project project )
+  {
+    project.getPlugins().apply( JavaPlugin.class )
+    def genSrc = 'generated-src/version'
+    def generatedSrcDir = new File( project.buildDir, genSrc )
+
+    Task makeVersionClassTask = project.task( 'makeVersionClass' ) << {
+      def now = new Date()
+      def tmpGroup = project.name
+      if( tmpGroup.startsWith( "org.apache.zest.core" ) )
+      {
+        tmpGroup = tmpGroup - ".core"
+      }
+      tmpGroup = tmpGroup.replace( '-', '_' )
+      def outFilename = "java/" + tmpGroup.replace( '.', '/' ) + "/BuildVersion.java"
+      def outFile = new File( generatedSrcDir, outFilename )
+      outFile.getParentFile().mkdirs()
+      def f = new FileWriter( outFile )
+      f.write( 'package ' + tmpGroup + ';\n' )
+      f.write( """
+/**
+ * Simple class for storing the version derived from the build system.
+ *
+ */
+public interface BuildVersion
+{
+    /** The version of the project from the gradle build.gradle file. */
+    String VERSION = \"""" + project.version + """\";
+
+    /** The name of the project from the gradle build.gradle file. */
+    String NAME = \"""" + project.name + """\";
+
+    /** The group of the project from the gradle build.gradle file. */
+    String GROUP = \"""" + project.group + """\";
+
+    /** The date this file was generated, usually the last date that the project was modified. */
+    String DATE = \"""" + now + """\";
+
+    /** The full details of the version, including the build date. */
+    String DETAILED_VERSION = GROUP + ":" + NAME + ":" + VERSION + " " + DATE;
+}\n
+""" )
+      f.close()
+    }
+    def sourceSets = project.convention.getPlugin( JavaPluginConvention ).sourceSets
+    sourceSets.create( "version" ) { SourceSet sourceSet ->
+      sourceSet.java { SourceDirectorySet dirSet ->
+        dirSet.srcDir project.buildDir.name + '/' + genSrc + '/java'
+      }
+    }
+    makeVersionClassTask.getInputs().files( sourceSets.getByName( 'main' ).allSource )
+    makeVersionClassTask.getOutputs().file( generatedSrcDir )
+    if( project.getBuildFile() != null && project.getBuildFile().exists() )
+    {
+      makeVersionClassTask.getInputs().files( project.getBuildFile() )
+    }
+    project.getTasks().getByName( 'compileJava' ).dependsOn( 'compileVersionJava' )
+    project.getTasks().getByName( 'compileVersionJava' ).dependsOn( 'makeVersionClass' )
+    project.getTasks().getByName( 'jar' ) { Jar task ->
+      task.from sourceSets.getByName( 'version' ).output
+    }
+  }
+}
+
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/65b70ca9/manual/build.gradle
----------------------------------------------------------------------
diff --git a/manual/build.gradle b/manual/build.gradle
index b36997a..173b2b3 100644
--- a/manual/build.gradle
+++ b/manual/build.gradle
@@ -17,6 +17,8 @@
  *
  *
  */
+import org.apache.zest.gradle.doc.AsciidocBuildInfoPlugin
+import org.apache.zest.gradle.doc.DocumentationTask
 
 description = "Apache Zestâ„¢ Manuals and Website."
 
@@ -28,25 +30,25 @@ dependencies {
   runtime( libraries.slf4j_simple )
 }
 
-
-//task userguide( type: org.apache.zest.gradle.plugin.documentation.Documentation ) {
+//task userguide( type: DocumentationTask ) {
 //  docName = 'userguide'
 //  docType = 'book'
 //}
 //
-//task recipes( type: org.apache.zest.gradle.plugin.documentation.Documentation ) {
+//task recipes( type: DocumentationTask ) {
 //  docName = 'recipes'
 //  docType = 'article'
 //}
 //
-//task referenceManual( type: org.apache.zest.gradle.plugin.documentation.Documentation ) {
+//task referenceManual( type: DocumentationTask ) {
 //  docName = 'reference'
 //  docType = 'book'
 //}
 
 
-task website( type: org.apache.zest.gradle.plugin.Documentation,
-              dependsOn: rootProject.allprojects.tasks.flatten().findAll { it.name == AsciidocBuildInfo.TASK_NAME } ) {
+task website( type: DocumentationTask,
+              dependsOn: rootProject.allprojects.tasks.flatten().
+                findAll { it.name == AsciidocBuildInfoPlugin.TASK_NAME } ) {
   docName 'website'
   docType 'article'
 }


Mime
View raw message