build: detangle buildSrc

Build structure and tasks revamped
See manual/src/docs/tutorials/howto-build-system.txt


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

Branch: refs/heads/develop
Commit: de73010f9523c6104caefffeccc5993248616265
Parents: 42e2b7c
Author: Paul Merlin <[email protected]>
Authored: Sat Dec 24 02:40:31 2016 +0100
Committer: Paul Merlin <[email protected]>
Committed: Sat Dec 24 02:40:31 2016 +0100

----------------------------------------------------------------------
 build.gradle                                    |  11 +-
 buildSrc/build.gradle                           |   6 +-
 .../polygene/gradle/AllProjectsPlugin.groovy    | 214 --------
 .../apache/polygene/gradle/BasePlugin.groovy    |  61 +++
 .../polygene/gradle/CodeProjectsPlugin.groovy   | 172 ------
 .../polygene/gradle/PolygeneExtension.groovy    |  79 ---
 .../polygene/gradle/RootProjectPlugin.groovy    | 273 ----------
 .../apache/polygene/gradle/TaskGroups.groovy    |   5 +-
 .../polygene/gradle/code/CodePlugin.groovy      | 201 +++++++
 .../polygene/gradle/code/MavenMetadata.groovy   | 281 ++++++++++
 .../polygene/gradle/code/PublishNaming.groovy   |  40 ++
 .../gradle/code/PublishedCodePlugin.groovy      | 152 ++++++
 .../gradle/code/PublishingPlugin.groovy         | 211 ++++++++
 .../gradle/code/VersionClassPlugin.groovy       |  94 ++++
 .../DependenciesDeclarationExtension.groovy     |   4 +-
 .../DependenciesDeclarationPlugin.groovy        |   2 +
 .../DependenciesDownloadTask.groovy             |  34 ++
 .../dependencies/DependenciesPlugin.groovy      |  55 +-
 .../dependencies/PolygeneExtension.groovy       |  69 +++
 .../gradle/dist/DistributionPlugin.groovy       | 387 --------------
 .../gradle/dist/GoOfflineHelpersTasks.groovy    | 345 ------------
 .../gradle/doc/AsciidocBuildInfoPlugin.groovy   |  60 ---
 .../gradle/doc/DocumentationTask.groovy         | 292 -----------
 .../polygene/gradle/doc/ManualPlugin.groovy     | 115 ----
 .../apache/polygene/gradle/doc/XsltTask.groovy  | 100 ----
 .../performance/PerformanceTestsPlugin.groovy   |  62 ---
 .../gradle/publish/MavenMetadata.groovy         | 281 ----------
 .../gradle/publish/PublishingPlugin.groovy      | 183 -------
 .../gradle/release/CheckReleaseSpecTask.groovy  |  75 ---
 .../gradle/release/ModuleReleaseSpec.groovy     |  53 --
 .../release/ReleaseApprovedProjectsTask.groovy  |  57 --
 .../gradle/release/ReleaseSpecExtension.groovy  |  40 --
 .../gradle/release/ReleaseSpecPlugin.groovy     |  56 --
 .../polygene/gradle/structure/RootPlugin.groovy |  45 ++
 .../gradle/structure/SettingsPlugin.groovy      |  41 ++
 .../gradle/structure/core/CorePlugin.groovy     |  46 ++
 .../distributions/DistributionsPlugin.groovy    | 523 +++++++++++++++++++
 .../structure/extensions/ExtensionPlugin.groovy |  33 ++
 .../structure/internals/InternalPlugin.groovy   |  33 ++
 .../structure/libraries/LibraryPlugin.groovy    |  31 ++
 .../manual/AsciidocBuildInfoPlugin.groovy       |  60 +++
 .../structure/manual/DocumentationTask.groovy   | 320 ++++++++++++
 .../gradle/structure/manual/ManualPlugin.groovy |  93 ++++
 .../gradle/structure/manual/XsltTask.groovy     | 100 ++++
 .../release/CheckReleaseSpecTask.groovy         |  75 +++
 .../structure/release/ModuleReleaseSpec.groovy  |  51 ++
 .../release/ReleaseApprovedProjectsTask.groovy  |  62 +++
 .../structure/release/ReleasePlugin.groovy      | 277 ++++++++++
 .../release/ReleaseSpecExtension.groovy         |  64 +++
 .../structure/release/ReleaseSpecPlugin.groovy  |  63 +++
 .../release/ReleaseSpecReportTask.groovy        |  45 ++
 .../reports/AggregatedJacocoReportTask.groovy   |  99 ++++
 .../structure/reports/ReportsPlugin.groovy      | 152 ++++++
 .../structure/samples/SamplePlugin.groovy       |  33 ++
 .../tests/PerformanceTestsPlugin.groovy         |  62 +++
 .../gradle/structure/tests/TestPlugin.groovy    |  33 ++
 .../gradle/structure/tools/ToolPlugin.groovy    |  31 ++
 .../structure/tutorials/TutorialPlugin.groovy   |  33 ++
 .../polygene/gradle/tasks/ExecLogged.groovy     |  70 ++-
 .../test/AggregatedJacocoReportTask.groovy      |  91 ----
 .../polygene/gradle/util/Environment.groovy     |  30 ++
 .../polygene/gradle/util/Licensing.groovy       |  49 ++
 .../gradle/version/VersionClassPlugin.groovy    |  98 ----
 .../gradle-plugins/polygene-core.properties     |  18 +
 ...polygene-dependencies-declaration.properties |  18 +
 .../polygene-distributions.properties           |  18 +
 .../polygene-extension.properties               |  18 +
 .../gradle-plugins/polygene-internal.properties |  18 +
 .../gradle-plugins/polygene-library.properties  |  18 +
 .../gradle-plugins/polygene-manual.properties   |  18 +
 .../gradle-plugins/polygene-release.properties  |  18 +
 .../gradle-plugins/polygene-reports.properties  |  18 +
 .../gradle-plugins/polygene-root.properties     |  18 +
 .../gradle-plugins/polygene-sample.properties   |  18 +
 .../gradle-plugins/polygene-settings.properties |  18 +
 .../gradle-plugins/polygene-test.properties     |  18 +
 .../gradle-plugins/polygene-tool.properties     |  18 +
 .../gradle-plugins/polygene-tutorial.properties |  18 +
 .../gradle/release/ModuleReleaseSpecTest.groovy |   1 +
 .../polygene/gradle/tasks/ExecLoggedTest.groovy |  84 +++
 core/api/build.gradle                           |   2 +
 core/bootstrap/build.gradle                     |   2 +
 core/runtime/build.gradle                       |   2 +
 core/spi/build.gradle                           |   2 +
 core/testsupport/build.gradle                   |   4 +-
 distributions/build.gradle                      |   2 +
 distributions/src/bin-dist/NOTICE.txt           |   5 +
 distributions/src/bin-dist/README.txt           |  50 ++
 distributions/src/src-dist/README.txt           |  64 +++
 extensions/cache-ehcache/build.gradle           |   2 +
 extensions/cache-memcache/build.gradle          |   2 +
 extensions/entitystore-file/build.gradle        |   2 +
 extensions/entitystore-geode/build.gradle       |   2 +
 extensions/entitystore-hazelcast/build.gradle   |   2 +
 extensions/entitystore-jclouds/build.gradle     |   2 +
 extensions/entitystore-jdbm/build.gradle        |   2 +
 extensions/entitystore-leveldb/build.gradle     |   2 +
 extensions/entitystore-memory/build.gradle      |   2 +
 extensions/entitystore-mongodb/build.gradle     |   2 +
 extensions/entitystore-preferences/build.gradle |   2 +
 extensions/entitystore-redis/build.gradle       |   2 +
 extensions/entitystore-riak/build.gradle        |   2 +
 extensions/entitystore-sql/build.gradle         |   2 +
 extensions/indexing-elasticsearch/build.gradle  |   2 +
 extensions/indexing-rdf/build.gradle            |   2 +
 extensions/indexing-solr/build.gradle           |   2 +
 extensions/indexing-sql/build.gradle            |   2 +
 extensions/metrics-codahale/build.gradle        |   2 +
 extensions/migration/build.gradle               |   2 +
 extensions/reindexer/build.gradle               |   2 +
 .../valueserialization-jackson/build.gradle     |   2 +
 .../valueserialization-orgjson/build.gradle     |   2 +
 extensions/valueserialization-stax/build.gradle |   2 +
 gradle.properties                               |   4 +-
 libraries/alarm/build.gradle                    |   2 +
 libraries/circuitbreaker/build.gradle           |   2 +
 libraries/constraints/build.gradle              |   2 +
 libraries/fileconfig/build.gradle               |   2 +
 libraries/http/build.gradle                     |   2 +
 libraries/invocation-cache/build.gradle         |   2 +
 libraries/jmx/build.gradle                      |   5 +-
 libraries/lang-groovy/build.gradle              |   2 +
 libraries/lang-javascript/build.gradle          |   2 +
 libraries/locking/build.gradle                  |   2 +
 libraries/logging/build.gradle                  |   2 +
 libraries/metrics/build.gradle                  |   2 +
 libraries/osgi/build.gradle                     |   2 +
 libraries/rdf/build.gradle                      |   2 +
 libraries/rest-client/build.gradle              |   2 +
 libraries/rest-common/build.gradle              |   2 +
 libraries/rest-server/build.gradle              |   2 +
 libraries/rest/build.gradle                     |   2 +
 libraries/restlet/build.gradle                  |   5 +-
 libraries/scripting/build.gradle                |   2 +
 libraries/servlet/build.gradle                  |   2 +
 libraries/shiro-core/build.gradle               |   2 +
 libraries/shiro-web/build.gradle                |   2 +
 libraries/spring/build.gradle                   |   2 +
 libraries/sql-bonecp/build.gradle               |   2 +
 libraries/sql-dbcp/build.gradle                 |   2 +
 libraries/sql-liquibase/build.gradle            |   2 +
 libraries/sql/build.gradle                      |   2 +
 libraries/uid/build.gradle                      |   2 +
 libraries/uowfile/build.gradle                  |   2 +
 manual/build.gradle                             |   5 +-
 .../src/docs/tutorials/howto-build-system.txt   |  88 ++--
 release/build.gradle                            |   2 +
 reports/build.gradle                            |   2 +
 reports/src/javadoc/overview.html               |  26 +
 samples/dci/build.gradle                        |   1 +
 samples/forum/build.gradle                      |   5 +-
 samples/rental/build.gradle                     |   7 +-
 samples/sql-support/build.gradle                |   5 +-
 samples/swing/build.gradle                      |   5 +-
 settings.gradle                                 |  19 +-
 src/bin-dist/NOTICE.txt                         |   5 -
 src/bin-dist/README.txt                         |  50 --
 src/javadoc/overview.html                       |  26 -
 tests/performance/build.gradle                  |   4 +-
 tests/regression/build.gradle                   |   2 +
 .../test/regression/ConcernsOnPropertyTest.java | 115 ++++
 .../polygene/test/regression/Regressions.java   |  30 --
 .../niclas2/ConcernsOnPropertyTest.java         | 115 ----
 tests/unit/README.txt                           |   7 -
 tools/envisage/build.gradle                     |   5 +-
 tools/model-detail/build.gradle                 |   2 +
 tools/qidea/build.gradle                        |   2 +
 tools/shell/build.gradle                        |   4 +
 tools/shell/src/dist/bin/polygene-boot          |   2 +-
 tutorials/cargo/build.gradle                    |   2 +
 tutorials/composites/build.gradle               |   2 +
 tutorials/hello/build.gradle                    |   2 +
 tutorials/introduction/build.gradle             |   2 +
 tutorials/introduction/tenminutes/build.gradle  |   2 +
 .../introduction/thirtyminutes/build.gradle     |   2 +
 tutorials/introduction/twominutes/build.gradle  |   2 +
 tutorials/services/build.gradle                 |   2 +
 177 files changed, 4574 insertions(+), 3395 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 4147856..ff63c21 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,14 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-import org.apache.polygene.gradle.AllProjectsPlugin
-import org.apache.polygene.gradle.RootProjectPlugin
-import org.apache.polygene.gradle.dependencies.DependenciesDeclarationPlugin
 
-apply plugin: DependenciesDeclarationPlugin
+apply plugin: 'polygene-dependencies-declaration'
 apply from: 'dependencies.gradle'
-
-allprojects {
-  apply plugin: AllProjectsPlugin
-}
-apply plugin: RootProjectPlugin
+apply plugin: 'polygene-root'

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/build.gradle
----------------------------------------------------------------------
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 8f292ab..aa94907 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -28,9 +28,11 @@ repositories {
 dependencies {
   compile gradleApi()
   compile localGroovy()
-  compile 'gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.2.2'
-  compile 'gradle.plugin.org.nosphere.honker:honker-gradle:0.2.3'
+  compile 'gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.3.0'
+  compile 'gradle.plugin.org.nosphere.honker:honker-gradle:0.3.0'
   compile 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
+  compile 'org.apache.httpcomponents:httpclient:4.5.2'
+  compile 'org.apache.httpcomponents:httpmime:4.5.2'
 
   testCompile 'junit:junit:4.12'
   testCompile( 'org.spockframework:spock-core:1.0-groovy-2.4' ) { exclude 
module: 'groovy-all' }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/AllProjectsPlugin.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/AllProjectsPlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/AllProjectsPlugin.groovy
deleted file mode 100644
index f890e46..0000000
--- 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/AllProjectsPlugin.groovy
+++ /dev/null
@@ -1,214 +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.polygene.gradle
-
-import groovy.transform.CompileStatic
-import org.apache.polygene.gradle.dependencies.DependenciesPlugin
-import org.apache.polygene.gradle.publish.PublishingPlugin
-import org.gradle.api.JavaVersion
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.plugins.JavaPluginConvention
-import org.gradle.api.tasks.compile.JavaCompile
-import org.gradle.api.tasks.diagnostics.DependencyReportTask
-import org.gradle.api.tasks.javadoc.Javadoc
-import org.gradle.api.tasks.testing.Test
-import org.gradle.api.tasks.testing.logging.TestExceptionFormat
-import org.gradle.external.javadoc.StandardJavadocDocletOptions
-import org.nosphere.honker.gradle.HonkerExtension
-import org.nosphere.honker.gradle.HonkerGenDependenciesTask
-import org.nosphere.honker.gradle.HonkerGenLicenseTask
-import org.nosphere.honker.gradle.HonkerGenNoticeTask
-import org.nosphere.honker.gradle.HonkerLicenseOverrideCandidate
-
-@CompileStatic
-class AllProjectsPlugin implements Plugin<Project>
-{
-  @Override
-  void apply( final Project project )
-  {
-    project.defaultTasks = [ 'classes', 'test' ]
-    project.group = project.rootProject == project ?
-                    'org.apache.polygene' :
-                    "org.apache.polygene.${ project.path.split( ':' ).drop( 1 
).dropRight( 1 ).join( '.' ) }"
-
-    applyDefaultVersion( project )
-    applyPolygeneExtension( project )
-
-    if( project.rootProject == project || CodeProjectsPlugin.isCodeProject( 
project ) )
-    {
-      configureJava( project )
-      project.plugins.apply DependenciesPlugin
-      configureJavadoc( project )
-      configureTest( project )
-    }
-    if( CodeProjectsPlugin.isCodeProject( project ) )
-    {
-      project.plugins.apply CodeProjectsPlugin
-    }
-    if( project.rootProject == project || CodeProjectsPlugin.isCodeProject( 
project ) )
-    {
-      configureDependencyReport( project )
-      configureHonker( project )
-      project.plugins.apply PublishingPlugin
-    }
-  }
-
-  private static void applyDefaultVersion( Project project )
-  {
-    if( project.version == 'unspecified' )
-    {
-      project.version = System.properties.version ?: '0'
-    }
-  }
-
-  private static void applyPolygeneExtension( Project project )
-  {
-    project.extensions.create( "polygene", PolygeneExtension, project )
-  }
-
-  private static void configureJava( Project project )
-  {
-    project.plugins.apply 'java'
-    def javaConvention = project.convention.getPlugin( JavaPluginConvention )
-    javaConvention.targetCompatibility = JavaVersion.VERSION_1_8
-    javaConvention.sourceCompatibility = JavaVersion.VERSION_1_8
-    project.tasks.withType( JavaCompile ) { JavaCompile task ->
-      task.options.encoding = 'UTF-8'
-      // Deprecation warnings for all compilations
-      task.options.compilerArgs << "-Xlint:deprecation"
-      // Unchecked warnings for non-test core compilations
-      if( 'org.apache.polygene.core' == project.group && 
!task.name.toLowerCase( Locale.US ).contains( 'test' ) )
-      {
-        task.options.compilerArgs << "-Xlint:unchecked"
-      }
-    }
-  }
-
-  private static void configureJavadoc( Project project )
-  {
-    project.tasks.withType( Javadoc ) { Javadoc task ->
-      def options = task.options as StandardJavadocDocletOptions
-      options.encoding = 'UTF-8'
-      options.docEncoding = 'UTF-8'
-      options.charSet = 'UTF-8'
-      options.noTimestamp = true
-      options.links = [
-        'http://docs.oracle.com/javase/8/docs/api/',
-        'https://stleary.github.io/JSON-java/',
-        'http://junit.org/junit4/javadoc/latest/'
-      ]
-      // exclude '**/internal/**'
-    }
-  }
-
-  private static void configureTest( Project project )
-  {
-    // Match --max-workers and Test maxParallelForks, use 1 if parallel is 
disabled
-    def parallel = 
project.gradle.startParameter.parallelProjectExecutionEnabled
-    def maxTestWorkers = ( parallel ? 
project.gradle.startParameter.maxWorkerCount : 1 ) as int
-    // The space in the directory name is intentional
-    def allTestsDir = project.file( "$project.buildDir/tmp/test files" )
-    project.tasks.withType( Test ) { Test testTask ->
-      testTask.onlyIf { !project.hasProperty( 'skipTests' ) }
-      testTask.testLogging.info.exceptionFormat = TestExceptionFormat.FULL
-      testTask.maxHeapSize = '1g'
-      testTask.maxParallelForks = maxTestWorkers
-      testTask.systemProperties = [ 'proxySet' : System.properties[ 'proxySet' 
],
-                                    'proxyHost': System.properties[ 
'proxyHost' ],
-                                    'proxyPort': System.properties[ 
'proxyPort' ] ]
-      testTask.reports.html.enabled = true
-      def testDir = new File( allTestsDir, testTask.name )
-      def workDir = new File( testDir, 'work' )
-      def tmpDir = new File( testDir, 'tmp' )
-      def homeDir = new File( testDir, 'home' )
-      testTask.workingDir = workDir
-      testTask.systemProperties << ( [
-        'user.dir'      : workDir.absolutePath,
-        'java.io.tmpdir': tmpDir.absolutePath,
-        'home.dir'      : homeDir.absolutePath
-      ] as Map<String, Object> )
-      testTask.environment << ( [
-        'HOME'       : homeDir.absolutePath,
-        'USERPROFILE': homeDir.absolutePath
-      ] as Map<String, Object> )
-      testTask.doFirst { Test task ->
-        [ workDir, tmpDir, homeDir ]*.mkdirs()
-      }
-      testTask.doLast { Test task ->
-        if( !task.state.failure )
-        {
-          project.delete testDir
-        }
-      }
-    }
-  }
-
-  // Dependency Report generate only the runtime configuration
-  // The report is packaged in the SDK distributions
-  private static void configureDependencyReport( Project project )
-  {
-    project.plugins.apply 'project-report'
-    def dependencyReport = project.tasks.getByName( 'dependencyReport' ) as 
DependencyReportTask
-    dependencyReport.configurations = [ project.configurations.getByName( 
'runtime' ) ] as Set
-  }
-
-  private static void configureHonker( Project project )
-  {
-    project.plugins.apply 'org.nosphere.honker'
-    def honkerGenDependencies = project.tasks.getByName( 
'honkerGenDependencies' ) as HonkerGenDependenciesTask
-    def honkerGenLicense = project.tasks.getByName( 'honkerGenLicense' ) as 
HonkerGenLicenseTask
-    def honkerGenNotice = project.tasks.getByName( 'honkerGenNotice' ) as 
HonkerGenNoticeTask
-    def javaConvention = project.convention.getPlugin( JavaPluginConvention )
-    def mainSourceSet = javaConvention.sourceSets.getByName( 'main' )
-    mainSourceSet.output.dir( [ builtBy: honkerGenDependencies ] as 
Map<String, Object>,
-                              honkerGenDependencies.outputDir )
-    mainSourceSet.output.dir( [ builtBy: honkerGenLicense ] as Map<String, 
Object>,
-                              honkerGenLicense.outputDir )
-    mainSourceSet.output.dir( [ builtBy: honkerGenNotice ] as Map<String, 
Object>,
-                              honkerGenNotice.outputDir )
-    def honker = project.extensions.getByType( HonkerExtension )
-    // Project License, applied to all submodules
-    honker.license 'Apache 2'
-    // Dependencies (transitive or not) with no license information, 
overriding them
-    honker.licenseOverride { HonkerLicenseOverrideCandidate candidate ->
-      if( candidate.group == 'asm' || candidate.module == 'prefuse-core' )
-      {
-        candidate.license = 'BSD 3-Clause'
-      }
-      if( candidate.group == 'javax.websocket'
-        || candidate.group == 'javax.xml.bind' )
-      {
-        candidate.license = 'CDDL'
-      }
-      if( candidate.group == 'org.apache.httpcomponents'
-        || candidate.group == 'net.java.dev.jna'
-        || candidate.group == 'lucene'
-        || candidate.group == 'jdbm'
-        || candidate.group == 'org.osgi'
-        || candidate.group.startsWith( 'org.restlet' ) )
-      {
-        candidate.license = 'Apache 2'
-      }
-    }
-    honkerGenNotice.header = 'Apache Polygene'
-    honkerGenNotice.footer = 'This product includes software developed at\n' +
-                             'The Apache Software Foundation 
(http://www.apache.org/).\n'
-    project.tasks.getByName( 'check' ).dependsOn project.tasks.getByName( 
'honkerCheck' )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/BasePlugin.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/BasePlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/BasePlugin.groovy
new file mode 100644
index 0000000..05f7610
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/BasePlugin.groovy
@@ -0,0 +1,61 @@
+/*
+ *  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.polygene.gradle
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.dependencies.PolygeneExtension
+import org.apache.polygene.gradle.structure.release.ReleaseSpecPlugin
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+
+/**
+ * Plugin applied to all Polygene projects.
+ */
+@CompileStatic
+class BasePlugin implements Plugin<Project>
+{
+  @Override
+  void apply( Project project )
+  {
+    applyGroup project
+    applyVersion project
+    project.plugins.apply ReleaseSpecPlugin
+    applyPolygeneExtension project
+    project.defaultTasks 'classes', 'test'
+  }
+
+  private static void applyGroup( Project project )
+  {
+    project.group = project.path == ':' ?
+                    'org.apache.polygene' :
+                    "org.apache.polygene.${ project.path.split( ':' ).drop( 1 
).dropRight( 1 ).join( '.' ) }"
+  }
+
+  private static void applyVersion( Project project )
+  {
+    if( project.version == 'unspecified' )
+    {
+      project.version = System.properties.version ?: '0'
+    }
+  }
+
+  private static void applyPolygeneExtension( Project project )
+  {
+    project.extensions.create 'polygene', PolygeneExtension, project
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/CodeProjectsPlugin.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/CodeProjectsPlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/CodeProjectsPlugin.groovy
deleted file mode 100644
index 5eeaca0..0000000
--- 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/CodeProjectsPlugin.groovy
+++ /dev/null
@@ -1,172 +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.polygene.gradle
-
-import groovy.transform.CompileStatic
-import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
-import org.apache.polygene.gradle.doc.AsciidocBuildInfoPlugin
-import org.apache.polygene.gradle.version.VersionClassPlugin
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.plugins.JavaPluginConvention
-import org.gradle.api.plugins.osgi.OsgiManifest
-import org.gradle.api.tasks.bundling.AbstractArchiveTask
-import org.gradle.api.tasks.javadoc.Javadoc
-import org.gradle.jvm.tasks.Jar
-import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
-import org.gradle.testing.jacoco.tasks.JacocoReport
-
-@CompileStatic
-class CodeProjectsPlugin implements Plugin<Project>
-{
-  static boolean isCodeProject( Project project )
-  {
-    [ 'src/main/java', 'src/test/java',
-      'src/main/groovy', 'src/test/groovy' ].collect { path ->
-      new File( "$project.projectDir/$path" )
-    }.any { dir -> dir.isDirectory() }
-  }
-
-  @Override
-  void apply( final Project project )
-  {
-    project.plugins.apply VersionClassPlugin
-    project.plugins.apply AsciidocBuildInfoPlugin
-
-    configureJar( project )
-    configureSupplementaryArchives( project )
-    configureArchivesBaseName( project )
-
-    configureJacoco( project )
-    configureCheckstyle( project )
-  }
-
-  private static void configureJar( Project project )
-  {
-    project.plugins.apply 'osgi'
-    def jar = project.tasks.getByName( 'jar' ) as Jar
-    def manifest = jar.manifest as OsgiManifest
-    manifest.attributes( [
-      license    : 'http://www.apache.org/licenses/LICENSE-2.0.txt',
-      docURL     : 'https://polygene.apache.org/',
-      description: project.description ?:
-                   'Apache Polygene™ (Java Edition) is a platform for 
Composite Oriented Programming',
-      vendor     : 'The Apache Software Foundation, https://www.apache.org',
-    ] )
-    manifest.instruction '-debug', 'true'
-  }
-
-  private static void configureSupplementaryArchives( Project project )
-  {
-    def javaConvention = project.convention.getPlugin( JavaPluginConvention )
-    def sourceJar = project.tasks.create( 'sourceJar', Jar ) { Jar task ->
-      task.description = 'Builds -sources.jar'
-      task.classifier = 'sources'
-      task.from javaConvention.sourceSets.getByName( 'main' ).allSource
-    }
-    def testSourceJar = project.tasks.create( 'testSourceJar', Jar ) { Jar 
task ->
-      task.description = 'Builds -testsources.jar'
-      task.classifier = 'testsources'
-      task.from javaConvention.sourceSets.getByName( 'test' ).allSource
-    }
-    def javadoc = project.tasks.getByName( 'javadoc' ) as Javadoc
-    def javadocJar = project.tasks.create( 'javadocJar', Jar ) { Jar task ->
-      task.description = 'Builds -javadoc.jar'
-      task.classifier = 'javadoc'
-      task.from javadoc.destinationDir
-      task.dependsOn javadoc
-    }
-    project.artifacts.add( 'archives', sourceJar )
-    project.artifacts.add( 'archives', testSourceJar )
-    project.artifacts.add( 'archives', javadocJar )
-  }
-
-  private static void configureArchivesBaseName( Project project )
-  {
-    project.tasks.withType( AbstractArchiveTask ) { AbstractArchiveTask task ->
-      def toName = { List<String> path -> path.drop( 1 ).join( '.' ) }
-      def path = project.path.split( ':' ).drop( 1 ) as List<String>
-      if( path[ 0 ] == 'libraries' )
-      {
-        task.baseName = "org.apache.polygene.library.${ toName( path ) }"
-      }
-      else if( path[ 0 ].endsWith( 's' ) )
-      {
-        task.baseName = "org.apache.polygene.${ path[ 0 ].substring( 0, path[ 
0 ].length() - 1 ) }.${ toName( path ) }"
-      }
-      else if( path.size() > 1 )
-      {
-        task.baseName = "org.apache.polygene.${ path[ 0 ] }.${ toName( path ) 
}"
-      }
-      else
-      {
-        task.baseName = "org.apache.polygene.${ path[ 0 ] }"
-      }
-    }
-  }
-
-  private static void configureJacoco( Project project )
-  {
-    def dependencies = project.rootProject.extensions.getByType( 
DependenciesDeclarationExtension )
-    project.plugins.apply 'jacoco'
-    def jacoco = project.extensions.getByType( JacocoPluginExtension )
-    jacoco.toolVersion = dependencies.buildToolsVersions.jacoco
-    project.tasks.withType( JacocoReport ) { JacocoReport task ->
-      task.group = TaskGroups.VERIFICATION
-      task.description = 'Generates test coverage report.'
-    }
-  }
-
-  private static void configureCheckstyle( Project project )
-  {
-    // project.plugins.apply 'checkstyle'
-    //    if( name == "org.apache.polygene.core.runtime" )
-    //    {
-    //      checkstyleMain {
-    //        configFile = new File( 
"$rootProject.projectDir.absolutePath/etc/polygene-runtime-checkstyle.xml" )
-    //        ignoreFailures = true
-    //      }
-    //    }
-    //    else
-    //    {
-    //      checkstyleMain {
-    //        configFile = new File( 
rootProject.projectDir.absolutePath.toString() + 
'/etc/polygene-api-checkstyle.xml' )
-    //        ignoreFailures = true
-    //        reporting.baseDir = "$rootProject.reporting.baseDir/checkstyle"
-    //      }
-    //    }
-    //    checkstyleTest {
-    //      configFile = new File( 
"$rootProject.projectDir.absolutePath/etc/polygene-tests-checkstyle.xml" )
-    //      ignoreFailures = true
-    //    }
-    //
-    //    checkstyleVersion {
-    //      configFile = new File( 
"$rootProject.projectDir.absolutePath/etc/polygene-tests-checkstyle.xml" )
-    //      ignoreFailures = true
-    //    }
-    //    // Create checkstyle report
-    //    task checkstyleReport( type: XsltTask, dependsOn: check ) {
-    //      source project.checkstyle.reportsDir
-    //      include '*.xml'
-    //      destDir = file( "build/reports/checkstyle/" )
-    //      extension = 'html'
-    //      stylesheetFile = file( 
"$rootProject.projectDir/etc/checkstyle-noframes.xsl" )
-    //    }
-    //
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/PolygeneExtension.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/PolygeneExtension.groovy 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/PolygeneExtension.groovy
deleted file mode 100644
index f20a610..0000000
--- 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/PolygeneExtension.groovy
+++ /dev/null
@@ -1,79 +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.polygene.gradle
-
-import groovy.transform.CompileStatic
-import org.gradle.api.Project
-import org.gradle.api.artifacts.Dependency
-
-@CompileStatic
-class PolygeneExtension
-{
-  private final Project project
-  final Core core
-
-  PolygeneExtension( Project project )
-  {
-    this.project = project
-    this.core = new Core()
-  }
-
-  boolean isDevelopmentVersion()
-  {
-    return project.version == '0' || project.version.toString().contains( 
'SNAPSHOT' )
-  }
-
-  boolean isReleaseVersion()
-  {
-    return !isDevelopmentVersion()
-  }
-
-  class Core
-  {
-    Dependency api = core( 'api' )
-    Dependency spi = core( 'spi' )
-    Dependency runtime = core( 'runtime' )
-    Dependency bootstrap = core( 'bootstrap' )
-    Dependency testsupport = core( 'testsupport' )
-  }
-
-  private Dependency core( String name )
-  {
-    return dependency( 'core', name )
-  }
-
-  Dependency library( String name )
-  {
-    return dependency( 'libraries', name )
-  }
-
-  Dependency extension( String name )
-  {
-    return dependency( 'extensions', name )
-  }
-
-  Dependency tool( String name )
-  {
-    return dependency( 'tools', name )
-  }
-
-  private Dependency dependency( String group, String name )
-  {
-    project.dependencies.project( path: ":$group:$name" )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
deleted file mode 100644
index a0de513..0000000
--- 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
+++ /dev/null
@@ -1,273 +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.polygene.gradle
-
-import groovy.transform.CompileStatic
-import org.apache.rat.gradle.RatTask
-import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
-import org.apache.polygene.gradle.dist.DistributionPlugin
-import org.apache.polygene.gradle.release.ReleaseSpecExtension
-import org.apache.polygene.gradle.release.ReleaseSpecPlugin
-import org.apache.polygene.gradle.test.AggregatedJacocoReportTask
-import org.gradle.api.GradleException
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.Configuration
-import org.gradle.api.plugins.JavaPluginConvention
-import org.gradle.api.tasks.Copy
-import org.gradle.api.tasks.javadoc.Javadoc
-import org.gradle.api.tasks.testing.Test
-import org.gradle.api.tasks.testing.TestReport
-import org.gradle.external.javadoc.StandardJavadocDocletOptions
-
-@CompileStatic
-class RootProjectPlugin implements Plugin<Project>
-{
-  static final String PROJECT_TITLE = 'Apache Polygene™ (Java Edition) SDK'
-  static final String PROJECT_DESCRIPTION = 'Apache Polygene™ (Java Edition) 
is a framework for domain centric ' +
-                                            'application development, 
including evolved concepts from AOP, DI and DDD.'
-
-  static class TaskNames
-  {
-    static final String GO_OFFLINE = 'goOffline'
-    static final String GLOBAL_TEST_REPORT = 'globalTestReport'
-    static final String JAVADOCS = 'javadocs'
-    static final String ARCHIVE_JAVADOCS = 'archiveJavadocs'
-    static final String BUILD_ALL = 'buildAll'
-  }
-
-  @Override
-  void apply( Project project )
-  {
-    project.plugins.apply ReleaseSpecPlugin
-
-    applyProjectMetadata( project )
-    applyHelperTasks( project )
-    applyPlugins( project )
-
-    configureJacoco( project )
-    configureTestReport( project )
-    configureJavadocs( project )
-    configureRat( project )
-
-    project.plugins.apply DistributionPlugin
-    configureReleaseTask( project )
-  }
-
-  private static void applyProjectMetadata( Project project )
-  {
-    def extraProperties = project.extensions.extraProperties
-    extraProperties.set 'title', PROJECT_TITLE
-    extraProperties.set 'description', PROJECT_DESCRIPTION
-  }
-
-  private static void applyHelperTasks( Project project )
-  {
-    project.tasks.create( TaskNames.GO_OFFLINE ) { Task task ->
-      task.group = TaskGroups.HELP
-      task.description = 'Resolves all dependencies configuration'
-      task.doLast {
-        def allConfigurations = project.allprojects.collect { Project each ->
-          each.configurations
-        }.flatten() as Set<Configuration>
-        allConfigurations*.resolvedConfiguration
-      }
-    }
-    def buildAll = project.tasks.create( TaskNames.BUILD_ALL )
-    buildAll.group = TaskGroups.BUILD
-    buildAll.description = 'Builds all'
-    buildAll.dependsOn 'javadocs', 'check', 'jar',
-                       project.subprojects
-                              .findAll { p -> 
CodeProjectsPlugin.isCodeProject( p ) }
-                              .collect { p -> p.tasks.getByName( 
'dependencyReport' ) },
-                       project.subprojects
-                              .findAll { p -> 
CodeProjectsPlugin.isCodeProject( p ) }
-                              .collect { p -> p.tasks.getByName( 'assemble' ) 
},
-                       ':manual:website'
-  }
-
-  private static void applyPlugins( Project project )
-  {
-    project.plugins.apply 'org.nosphere.apache.rat'
-  }
-
-  private static void configureJacoco( Project project )
-  {
-    def dependencies = project.rootProject.extensions.getByType( 
DependenciesDeclarationExtension )
-    project.configurations.create( 'jacoco' )
-    project.dependencies.add( 'jacoco', "org.jacoco:org.jacoco.ant:${ 
dependencies.buildToolsVersions.jacoco }" )
-    def task = project.tasks.create( 'coverageReport', 
AggregatedJacocoReportTask ) { AggregatedJacocoReportTask task ->
-      task.group = TaskGroups.VERIFICATION
-      task.description = 'Generates global coverage report'
-      task.dependsOn project.subprojects
-                            .findAll { p -> CodeProjectsPlugin.isCodeProject( 
p ) }
-                            .collect( { Project p -> p.tasks.getByName( 'test' 
) } )
-    }
-    project.tasks.getByName( 'check' ).dependsOn task
-  }
-
-  private static void configureTestReport( Project project )
-  {
-    project.tasks.create( TaskNames.GLOBAL_TEST_REPORT, TestReport ) { 
TestReport task ->
-      task.group = TaskGroups.VERIFICATION
-      task.description = 'Generates global test report'
-      task.destinationDir = project.file( "$project.buildDir/reports/tests" )
-      task.reportOn project.subprojects
-                           .findAll { p -> CodeProjectsPlugin.isCodeProject( p 
) }
-                           .collect { it.tasks.getByName( 'test' ) }
-    }
-    def test = project.tasks.getByName( 'test' ) as Test
-    test.dependsOn project.subprojects.collect { it.tasks.getByName( 'test' ) }
-    test.dependsOn project.tasks.getByName( TaskNames.GLOBAL_TEST_REPORT )
-    test.reports.html.enabled = false
-  }
-
-  private static void configureJavadocs( Project project )
-  {
-    def polygene = project.extensions.getByType( PolygeneExtension )
-    def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
-    project.tasks.create( TaskNames.JAVADOCS, Javadoc ) { Javadoc task ->
-      task.group = TaskGroups.DOCUMENTATION
-      task.description = 'Builds the whole SDK public Javadoc'
-      task.dependsOn ReleaseSpecPlugin.TaskNames.RELEASE_APPROVED_PROJECTS
-      def options = task.options as StandardJavadocDocletOptions
-      options.docFilesSubDirs = true
-      options.encoding = "UTF-8"
-      options.overview = "${ project.projectDir }/src/javadoc/overview.html"
-      task.title = "${ PROJECT_TITLE } ${ project.version }"
-      def apiSources = releaseSpec.approvedProjects.findAll { approved ->
-        ( approved.name.startsWith( 'org.apache.polygene.core' ) &&
-          !approved.name.startsWith( 'org.apache.polygene.core.runtime' ) ) ||
-        approved.name.startsWith( 'org.apache.polygene.library' ) ||
-        approved.name.startsWith( 'org.apache.polygene.extension' ) ||
-        approved.name.startsWith( 'org.apache.polygene.tool' )
-      }
-      task.source apiSources.collect { each ->
-        each.convention.getPlugin( JavaPluginConvention 
).sourceSets.getByName( 'main' ).allJava
-      }
-      task.destinationDir = project.file( "${ project.convention.getPlugin( 
JavaPluginConvention ).docsDir }/javadocs" )
-      task.classpath = project.files( apiSources.collect { apiProject ->
-        apiProject.convention.getPlugin( JavaPluginConvention 
).sourceSets.getByName( 'main' ).compileClasspath
-      } )
-      options.group( [
-        "Core API"      : [ "org.apache.polygene.api",
-                            "org.apache.polygene.api.*" ],
-        "Core Bootstrap": [ "org.apache.polygene.bootstrap",
-                            "org.apache.polygene.bootstrap.*" ],
-        "Core SPI"      : [ "org.apache.polygene.spi",
-                            "org.apache.polygene.spi.*" ],
-        "Libraries"     : [ "org.apache.polygene.library.*" ],
-        "Extensions"    : [ "org.apache.polygene.valueserialization.*",
-                            "org.apache.polygene.entitystore.*",
-                            "org.apache.polygene.index.*",
-                            "org.apache.polygene.metrics.*",
-                            "org.apache.polygene.cache.*",
-                            "org.apache.polygene.migration",
-                            "org.apache.polygene.migration.*" ],
-        "Tools"         : [ "org.apache.polygene.tools.*",
-                            "org.apache.polygene.envisage",
-                            "org.apache.polygene.envisage.*" ],
-        "Test Support"  : [ "org.apache.polygene.test",
-                            "org.apache.polygene.test.*" ]
-      ] )
-    }
-    project.tasks.create( TaskNames.ARCHIVE_JAVADOCS, Copy ) { Copy task ->
-      task.group = TaskGroups.DOCUMENTATION
-      task.description = 'Copy SDK public Javadoc to ../polygene-web'
-      task.dependsOn TaskNames.JAVADOCS
-      task.from 'build/docs/javadoc/'
-      if( polygene.developmentVersion )
-      {
-        task.into( 
"$project.projectDir/../polygene-web/site/content/java/develop/javadocs/" )
-      }
-      else
-      {
-        task.into( 
"$project.projectDir/../polygene-web/site/content/java/$project.version/javadocs/"
 )
-      }
-    }
-  }
-
-  private static void configureRat( Project project )
-  {
-    def rat = project.tasks.getByName( 'rat' ) as RatTask
-    rat.group = TaskGroups.VERIFICATION
-    rat.onlyIf { project.version != '0' }
-    rat.excludes = [
-      '**/.DS_Store/**', '**/._*',
-      // Git Files
-      '**/.git/**', '**/.gitignore',
-      // Gradle Files
-      'gradle/wrapper/**', '**/gradlew', '**/gradlew.bat', '**/.gradle/**',
-      // Build Output
-      '**/build/**', '**/derby.log', 'out/**',
-      // IDE Files
-      '**/.idea/**', '**/*.iml', '**/*.ipr', '**/*.iws',
-      '**/.settings/**', '**/.classpath', '**/.project',
-      '**/.gradletasknamecache', '**/private/cache/**',
-      '**/.nb-gradle-properties', '**/.nb-gradle/**',
-      // JSON files are not allowed to have comments, according to 
http://www.json.org/ and http://www.ietf.org/rfc/rfc4627.txt
-      '**/*.json',
-      // Various Text Resources
-      '**/README.*', '**/README*.*', '**/TODO',
-      '**/src/main/resources/**/*.txt',
-      '**/src/test/resources/**/*.txt',
-      'libraries/rest-server/src/main/resources/**/*.htm',
-      'libraries/rest-server/src/main/resources/**/*.atom',
-      'tools/qidea/src/main/resources/**/*.ft',
-      'tools/qidea/src/main/resources/**/*.template',
-      // Graphic Resources
-      '**/*.svg', '**/*.gif', '**/*.png', '**/*.jpg', '**/*.psd',
-      // Keystores
-      '**/*.jceks',
-      // Syntax Highlighter - MIT
-      'manual/**/sh*.css', 'manual/**/sh*.js',
-      // jQuery & plugins - MIT
-      'manual/**/jquery*.js',
-      // W3C XML Schemas - W3C Software License
-      'samples/rental/src/main/resources/*.xsd',
-      // Polygene Generator Heroes Templates - MIT
-      'tools/generator-polygene/app/templates/Heroes/**',
-      // templates that will become the user's source files, should not have 
license headers
-      'tools/shell/src/dist/etc/templates/**',
-    ]
-  }
-
-  private static void configureReleaseTask( Project project )
-  {
-    def polygene = project.extensions.getByType( PolygeneExtension )
-    def release = project.tasks.create( 'release' )
-    release.description = 'Builds, tests and uploads the release artifacts'
-    release.group = TaskGroups.RELEASE
-    release.doFirst {
-      if( polygene.developmentVersion )
-      {
-        throw new GradleException( "Cannot release development version 
$project.version, use '-Dversion=X.Y.Z'" )
-      }
-    }
-    release.dependsOn 'checkReleaseSpec',
-                      'rat',
-                      'archiveJavadocs',
-                      ':org.apache.polygene.manual:copyWebsite',
-                      project.allprojects
-                             .findAll { p -> CodeProjectsPlugin.isCodeProject( 
p ) }
-                             .collect { it.tasks.getByName( 'uploadArchives' ) 
},
-                      'uploadArchives',
-                      'dist'
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/TaskGroups.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/TaskGroups.groovy 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/TaskGroups.groovy
index 61d3d0d..bf435a7 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/TaskGroups.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/TaskGroups.groovy
@@ -17,19 +17,20 @@
  */
 package org.apache.polygene.gradle
 
-import org.gradle.api.plugins.ApplicationPlugin
+import groovy.transform.CompileStatic
 import org.gradle.api.plugins.BasePlugin
 import org.gradle.api.plugins.HelpTasksPlugin
 import org.gradle.api.plugins.JavaBasePlugin
 import org.gradle.language.base.plugins.LifecycleBasePlugin
 
+@CompileStatic
 class TaskGroups
 {
   static final String HELP = HelpTasksPlugin.HELP_GROUP
   static final String BUILD = LifecycleBasePlugin.BUILD_GROUP
   static final String VERIFICATION = LifecycleBasePlugin.VERIFICATION_GROUP
   static final String DOCUMENTATION = JavaBasePlugin.DOCUMENTATION_GROUP
-  static final String DISTRIBUTION = ApplicationPlugin.APPLICATION_GROUP
+  static final String DISTRIBUTION = 'distribution'
   static final String DISTRIBUTION_VERIFICATION = 'distribution verification'
   static final String PERFORMANCE = 'performance'
   static final String PERFORMANCE_VERIFICATION = 'performance verification'

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/CodePlugin.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/CodePlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/CodePlugin.groovy
new file mode 100644
index 0000000..6c143c8
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/CodePlugin.groovy
@@ -0,0 +1,201 @@
+/*
+ *  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.polygene.gradle.code
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.BasePlugin
+import org.apache.polygene.gradle.TaskGroups
+import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
+import org.apache.polygene.gradle.dependencies.DependenciesPlugin
+import org.gradle.api.JavaVersion
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.plugins.osgi.OsgiManifest
+import org.gradle.api.tasks.bundling.AbstractArchiveTask
+import org.gradle.api.tasks.compile.JavaCompile
+import org.gradle.api.tasks.testing.Test
+import org.gradle.api.tasks.testing.logging.TestExceptionFormat
+import org.gradle.jvm.tasks.Jar
+import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
+import org.gradle.testing.jacoco.tasks.JacocoReport
+
+@CompileStatic
+class CodePlugin implements Plugin<Project>
+{
+  @Override
+  void apply( Project project )
+  {
+    project.plugins.apply BasePlugin
+    applyJava project
+    project.plugins.apply DependenciesPlugin
+    configureDefaultDependencies project
+    configureTest project
+    configureJar project
+    configureArchivesBaseName project
+    configureJacoco project
+    configureCheckstyle project
+  }
+
+  private static void applyJava( Project project )
+  {
+    project.plugins.apply 'java'
+    def javaConvention = project.convention.getPlugin JavaPluginConvention
+    javaConvention.targetCompatibility = JavaVersion.VERSION_1_8
+    javaConvention.sourceCompatibility = JavaVersion.VERSION_1_8
+    project.tasks.withType( JavaCompile ) { JavaCompile task ->
+      task.options.encoding = 'UTF-8'
+      task.options.compilerArgs << '-Xlint:deprecation'
+    }
+  }
+
+  private static void configureDefaultDependencies( Project project )
+  {
+    def declaration = project.rootProject.extensions.getByType 
DependenciesDeclarationExtension
+    declaration.defaultDependencies.each { String configuration, List<Object> 
dependencies ->
+      dependencies.each { dependency ->
+        if( dependency instanceof Collection )
+        {
+          dependency.each { subdep ->
+            project.dependencies.add configuration, subdep
+          }
+        }
+        else
+        {
+          project.dependencies.add configuration, dependency
+        }
+      }
+    }
+  }
+
+  private static void configureTest( Project project )
+  {
+    // Match --max-workers and Test maxParallelForks, use 1 if parallel is 
disabled
+    def parallel = 
project.gradle.startParameter.parallelProjectExecutionEnabled
+    def maxTestWorkers = ( parallel ? 
project.gradle.startParameter.maxWorkerCount : 1 ) as int
+    // The space in the directory name is intentional
+    def allTestsDir = project.file "$project.buildDir/tmp/test files"
+    project.tasks.withType( Test ) { Test testTask ->
+      testTask.onlyIf { !project.hasProperty( 'skipTests' ) }
+      testTask.testLogging.info.exceptionFormat = TestExceptionFormat.FULL
+      testTask.maxHeapSize = '1g'
+      testTask.maxParallelForks = maxTestWorkers
+      testTask.systemProperties = [ 'proxySet' : System.properties[ 'proxySet' 
],
+                                    'proxyHost': System.properties[ 
'proxyHost' ],
+                                    'proxyPort': System.properties[ 
'proxyPort' ] ]
+      testTask.reports.html.enabled = true
+      def testDir = new File( allTestsDir, testTask.name )
+      def workDir = new File( testDir, 'work' )
+      def tmpDir = new File( testDir, 'tmp' )
+      def homeDir = new File( testDir, 'home' )
+      testTask.workingDir = workDir
+      testTask.systemProperties << ( [
+        'user.dir'      : workDir.absolutePath,
+        'java.io.tmpdir': tmpDir.absolutePath,
+        'home.dir'      : homeDir.absolutePath
+      ] as Map<String, Object> )
+      testTask.environment << ( [
+        'HOME'       : homeDir.absolutePath,
+        'USERPROFILE': homeDir.absolutePath
+      ] as Map<String, Object> )
+      testTask.doFirst { Test task ->
+        [ workDir, tmpDir, homeDir ]*.mkdirs()
+      }
+      testTask.doLast { Test task ->
+        if( !task.state.failure )
+        {
+          project.delete testDir
+        }
+      }
+    }
+  }
+
+  private static void configureJar( Project project )
+  {
+    project.plugins.apply 'osgi'
+    def jar = project.tasks.getByName( 'jar' ) as Jar
+    def manifest = jar.manifest as OsgiManifest
+    manifest.attributes( [
+      license    : 'http://www.apache.org/licenses/LICENSE-2.0.txt',
+      docURL     : 'https://polygene.apache.org/',
+      description: project.description ?:
+                   'Apache Polygene™ (Java Edition) is a platform for 
Composite Oriented Programming',
+      vendor     : 'The Apache Software Foundation, https://www.apache.org',
+    ] )
+    manifest.instruction '-debug', 'true'
+  }
+
+
+  private static void configureArchivesBaseName( Project project )
+  {
+    def publishedName = PublishNaming.publishedNameFor( project.path )
+    project.tasks.withType( AbstractArchiveTask ) { AbstractArchiveTask task ->
+      task.baseName = publishedName
+    }
+  }
+
+  private static void configureJacoco( Project project )
+  {
+    def dependencies = project.rootProject.extensions.getByType 
DependenciesDeclarationExtension
+    project.plugins.apply 'jacoco'
+    def jacoco = project.extensions.getByType JacocoPluginExtension
+    jacoco.toolVersion = dependencies.buildToolsVersions.jacoco
+    project.tasks.withType( JacocoReport ) { JacocoReport task ->
+      task.group = TaskGroups.VERIFICATION
+      task.description = 'Generates test coverage report.'
+    }
+  }
+
+  private static void configureCheckstyle( Project project )
+  {
+    // project.plugins.apply 'checkstyle'
+    //    if( name == "org.apache.polygene.core.runtime" )
+    //    {
+    //      checkstyleMain {
+    //        configFile = new File( 
"$rootProject.projectDir.absolutePath/etc/polygene-runtime-checkstyle.xml" )
+    //        ignoreFailures = true
+    //      }
+    //    }
+    //    else
+    //    {
+    //      checkstyleMain {
+    //        configFile = new File( 
rootProject.projectDir.absolutePath.toString() + 
'/etc/polygene-api-checkstyle.xml' )
+    //        ignoreFailures = true
+    //        reporting.baseDir = "$rootProject.reporting.baseDir/checkstyle"
+    //      }
+    //    }
+    //    checkstyleTest {
+    //      configFile = new File( 
"$rootProject.projectDir.absolutePath/etc/polygene-tests-checkstyle.xml" )
+    //      ignoreFailures = true
+    //    }
+    //
+    //    checkstyleVersion {
+    //      configFile = new File( 
"$rootProject.projectDir.absolutePath/etc/polygene-tests-checkstyle.xml" )
+    //      ignoreFailures = true
+    //    }
+    //    // Create checkstyle report
+    //    task checkstyleReport( type: XsltTask, dependsOn: check ) {
+    //      source project.checkstyle.reportsDir
+    //      include '*.xml'
+    //      destDir = file( "build/reports/checkstyle/" )
+    //      extension = 'html'
+    //      stylesheetFile = file( 
"$rootProject.projectDir/etc/checkstyle-noframes.xsl" )
+    //    }
+    //
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/MavenMetadata.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/MavenMetadata.groovy 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/MavenMetadata.groovy
new file mode 100644
index 0000000..c10ccda
--- /dev/null
+++ 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/MavenMetadata.groovy
@@ -0,0 +1,281 @@
+/*
+ *  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.polygene.gradle.code
+
+import org.gradle.api.artifacts.maven.MavenDeployer
+
+class MavenMetadata
+{
+  static void applyTo( MavenDeployer mavenDeployer )
+  {
+    mavenDeployer.pom {
+      project {
+        url 'https://polygene.apache.org/'
+        organization {
+          name 'The Apache Software Foundation'
+          url 'https://apache.org/'
+        }
+        inceptionYear '2007'
+        issueManagement {
+          system 'jira'
+          url 'https://issues.apache.org/jira/browse/POLYGENE'
+        }
+        scm {
+          url "https://github.com/apache/polygene-java";
+          connection 
"scm:git:https://git-wip-us.apache.org/repos/asf/polygene-java.git";
+          developerConnection 
"scm:git:https://git-wip-us.apache.org/repos/asf/polygene-java.git";
+        }
+        licenses {
+          license {
+            name 'Apache License, version 2.0.'
+            url 'http://www.apache.org/licenses/LICENSE-2.0'
+          }
+        }
+        mailingLists {
+          mailingList {
+            name 'Users List'
+            subscribe '[email protected]'
+            unsubscribe '[email protected]'
+            post '[email protected]'
+            archive 'https://mail-archives.apache.org/mod_mbox/polygene-users/'
+            otherArchives {
+              otherArchive 
'https://www.apache.org/foundation/mailinglists.html#archives'
+            }
+          }
+          mailingList {
+            name 'Development List'
+            subscribe '[email protected]'
+            unsubscribe '[email protected]'
+            post '[email protected]'
+            archive 'https://mail-archives.apache.org/mod_mbox/polygene-dev/'
+            otherArchives {
+              otherArchive 
'https://www.apache.org/foundation/mailinglists.html#archives'
+            }
+          }
+          mailingList {
+            name 'Commits List'
+            subscribe '[email protected]'
+            unsubscribe '[email protected]'
+            post '[email protected]'
+            archive 
'https://mail-archives.apache.org/mod_mbox/polygene-commits/'
+            otherArchives {
+              otherArchive 
'https://www.apache.org/foundation/mailinglists.html#archives'
+            }
+          }
+        }
+        developers {
+          developer {
+            id '[email protected]'
+            name 'Niclas Hedhman'
+            email '[email protected]'
+            roles {
+              role 'Core Team'
+            }
+            organizationUrl 'http://polygene.apache.org'
+            timezone 'UTC+8'
+          }
+          developer {
+            id 'rickardoberg'
+            name 'Rickard \u00F6berg'
+            email '[email protected]'
+            roles {
+              role 'Core Team'
+            }
+            url 'http://www.neotechnology.com'
+            organization 'Neo Technology AB'
+            organizationUrl 'http://www.neotechnology.com'
+            timezone 'UTC+8'
+          }
+          developer {
+            id '[email protected]'
+            name 'Edward Yakop'
+            email '[email protected]'
+            roles {
+              role 'Core Team'
+            }
+            organizationUrl 'http://polygene.apache.org'
+            timezone 'UTC+8'
+          }
+          developer {
+            id '[email protected]'
+            name 'Alin Dreghiciu'
+            email '[email protected]'
+            roles {
+              role 'Core Team'
+            }
+            organizationUrl 'http://polygene.apache.org'
+            timezone 'UTC+2'
+          }
+          developer {
+            id 'mesirii'
+            name 'Michael Hunger'
+            email '[email protected]'
+            roles {
+              role 'Core Team'
+            }
+            timezone 'CET'
+          }
+
+          developer {
+            id "muhdkamil"
+            name "Muhd Kamil bin Mohd Baki"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "[email protected]"
+            name "David Leangen"
+            organization "Bioscene"
+            email "[email protected]"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+9"
+          }
+
+          developer {
+            id "[email protected]"
+            name "Sonny Gill"
+            email "[email protected]"
+            roles {
+              role 'Community Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "taowen"
+            name "Tao Wen"
+            organization ""
+            email "[email protected]"
+            roles {
+              role 'Community Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "thobe"
+            name "Tobias Ivarsson"
+            email "[email protected]"
+            url "http://www.neotechnology.com";
+            organization "NeoTechnology"
+            organizationUrl "http://www.neotechnology.com";
+            roles {
+              role "Platform Team"
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "boon"
+            name "Lan Boon Ping"
+            email "[email protected]"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "[email protected]"
+            name "Jan Kronquist"
+            email "[email protected]"
+            organization "Jayway"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "nmwael"
+            name "Nino Saturnino Martinez Vazquez Wael"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "[email protected]"
+            name "Peter Neubauer"
+            email "[email protected]"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "rwallace"
+            name "Richard Wallace"
+            email "[email protected]"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC-7"
+          }
+
+          developer {
+            id "[email protected]"
+            name "Sianny Halim"
+            email "[email protected]"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "[email protected]"
+            name "Paul Merlin"
+            email "[email protected]"
+            roles {
+              role 'Core Team'
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "[email protected]"
+            name "Stanislav Muhametsin"
+            email "[email protected]"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+2"
+          }
+
+          developer {
+            id "tonny"
+            name "Tonny Kohar"
+            roles {
+              role "Community Team"
+            }
+            email "[email protected]"
+            timezone "UTC+7"
+          }
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishNaming.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishNaming.groovy 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishNaming.groovy
new file mode 100644
index 0000000..2347329
--- /dev/null
+++ 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishNaming.groovy
@@ -0,0 +1,40 @@
+/*
+ *  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.polygene.gradle.code
+
+class PublishNaming
+{
+  static String publishedNameFor( String projectPath )
+  {
+    def toName = { List<String> path -> path.drop( 1 ).join( '.' ) }
+    def path = projectPath.split( ':' ).drop( 1 ) as List<String>
+    if( path[ 0 ] == 'libraries' )
+    {
+      return "org.apache.polygene.library.${ toName( path ) }"
+    }
+    else if( path[ 0 ].endsWith( 's' ) )
+    {
+      return "org.apache.polygene.${ path[ 0 ].substring( 0, path[ 0 
].length() - 1 ) }.${ toName( path ) }"
+    }
+    else if( path.size() > 1 )
+    {
+      return "org.apache.polygene.${ path[ 0 ] }.${ toName( path ) }"
+    }
+    return "org.apache.polygene.${ path[ 0 ] }"
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishedCodePlugin.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishedCodePlugin.groovy
 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishedCodePlugin.groovy
new file mode 100644
index 0000000..a97b4d9
--- /dev/null
+++ 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishedCodePlugin.groovy
@@ -0,0 +1,152 @@
+/*
+ *  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.polygene.gradle.code
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.structure.manual.AsciidocBuildInfoPlugin
+import org.apache.polygene.gradle.structure.release.ReleaseSpecExtension
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.tasks.javadoc.Javadoc
+import org.gradle.external.javadoc.StandardJavadocDocletOptions
+import org.gradle.jvm.tasks.Jar
+import org.nosphere.honker.gradle.HonkerCheckTask
+import org.nosphere.honker.gradle.HonkerExtension
+import org.nosphere.honker.gradle.HonkerGenDependenciesTask
+import org.nosphere.honker.gradle.HonkerGenLicenseTask
+import org.nosphere.honker.gradle.HonkerGenNoticeTask
+import org.nosphere.honker.gradle.HonkerLicenseOverrideCandidate
+
+@CompileStatic
+class PublishedCodePlugin implements Plugin<Project>
+{
+  @Override
+  void apply( final Project project )
+  {
+    project.plugins.apply CodePlugin
+    configureJavadoc project
+    configureHonker( project )
+    project.plugins.apply VersionClassPlugin
+    project.plugins.apply AsciidocBuildInfoPlugin
+    applySupplementaryArchives project
+    project.plugins.apply PublishingPlugin
+  }
+
+  static void configureJavadoc( Project project )
+  {
+    def releaseSpec = project.extensions.getByType ReleaseSpecExtension
+    project.tasks.withType( Javadoc ) { Javadoc task ->
+      task.onlyIf { !releaseSpec.developmentVersion }
+      def options = task.options as StandardJavadocDocletOptions
+      options.encoding = 'UTF-8'
+      options.docEncoding = 'UTF-8'
+      options.charSet = 'UTF-8'
+      options.noTimestamp = true
+      options.links = [
+        'http://docs.oracle.com/javase/8/docs/api/',
+        'https://stleary.github.io/JSON-java/',
+        'http://junit.org/junit4/javadoc/latest/'
+      ]
+      // exclude '**/internal/**'
+    }
+  }
+
+  private static void configureHonker( Project project )
+  {
+    def releaseSpec = project.extensions.getByType ReleaseSpecExtension
+    if( releaseSpec.developmentVersion )
+    {
+      return
+    }
+    project.plugins.apply 'org.nosphere.honker'
+    def honkerGenDependencies = project.tasks.getByName( 
'honkerGenDependencies' ) as HonkerGenDependenciesTask
+    def honkerGenLicense = project.tasks.getByName( 'honkerGenLicense' ) as 
HonkerGenLicenseTask
+    def honkerGenNotice = project.tasks.getByName( 'honkerGenNotice' ) as 
HonkerGenNoticeTask
+    def honkerCheck = project.tasks.getByName( 'honkerCheck' ) as 
HonkerCheckTask
+    [ honkerGenDependencies, honkerGenLicense, honkerGenNotice, honkerCheck 
].group = null
+    def javaConvention = project.convention.getPlugin JavaPluginConvention
+    def mainSourceSet = javaConvention.sourceSets.getByName 'main'
+    mainSourceSet.output.dir( [ builtBy: honkerGenDependencies ] as 
Map<String, Object>,
+                              honkerGenDependencies.outputDir )
+    mainSourceSet.output.dir( [ builtBy: honkerGenLicense ] as Map<String, 
Object>,
+                              honkerGenLicense.outputDir )
+    mainSourceSet.output.dir( [ builtBy: honkerGenNotice ] as Map<String, 
Object>,
+                              honkerGenNotice.outputDir )
+    def honker = project.extensions.getByType HonkerExtension
+    // Project License, applied to all submodules
+    honker.license 'Apache 2'
+    // Dependencies (transitive or not) with no license information, 
overriding them
+    honker.licenseOverride { HonkerLicenseOverrideCandidate candidate ->
+      if( candidate.group == 'asm' || candidate.module == 'prefuse-core' )
+      {
+        candidate.license = 'BSD 3-Clause'
+      }
+      if( candidate.group == 'javax.json'
+        || candidate.group == 'javax.websocket'
+        || candidate.group == 'javax.xml.bind' )
+      {
+        candidate.license = 'CDDL'
+      }
+      if( candidate.group == 'org.apache.httpcomponents'
+        || candidate.group == 'net.java.dev.jna'
+        || candidate.group == 'lucene'
+        || candidate.group == 'jdbm'
+        || candidate.group == 'org.osgi'
+        || candidate.group.startsWith( 'org.restlet' ) )
+      {
+        candidate.license = 'Apache 2'
+      }
+    }
+    honkerGenNotice.header = 'Apache Polygene'
+    honkerGenNotice.footer = 'This product includes software developed at\n' +
+                             'The Apache Software Foundation 
(http://www.apache.org/).\n'
+    project.tasks.getByName( 'check' ).dependsOn honkerCheck
+  }
+
+  private static void applySupplementaryArchives( Project project )
+  {
+    def releaseSpec = project.extensions.getByType ReleaseSpecExtension
+    def javaConvention = project.convention.getPlugin JavaPluginConvention
+    def sourceJar = project.tasks.create( 'sourceJar', Jar ) { Jar task ->
+      task.description = 'Builds -sources.jar'
+      task.classifier = 'sources'
+      task.from javaConvention.sourceSets.getByName( 'main' ).allSource
+    }
+    def testSourceJar = project.tasks.create( 'testSourceJar', Jar ) { Jar 
task ->
+      task.description = 'Builds -testsources.jar'
+      task.classifier = 'testsources'
+      task.onlyIf { !releaseSpec.developmentVersion }
+      task.from javaConvention.sourceSets.getByName( 'test' ).allSource
+    }
+    def javadoc = project.tasks.getByName( 'javadoc' ) as Javadoc
+    def javadocJar = project.tasks.create( 'javadocJar', Jar ) { Jar task ->
+      task.description = 'Builds -javadoc.jar'
+      task.classifier = 'javadoc'
+      task.onlyIf { !releaseSpec.developmentVersion }
+      task.from javadoc.destinationDir
+      task.dependsOn javadoc
+    }
+    project.artifacts.add 'archives', sourceJar
+    if( !releaseSpec.developmentVersion )
+    {
+      project.artifacts.add 'archives', testSourceJar
+      project.artifacts.add 'archives', javadocJar
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishingPlugin.groovy
----------------------------------------------------------------------
diff --git 
a/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishingPlugin.groovy
 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishingPlugin.groovy
new file mode 100644
index 0000000..e8ec046
--- /dev/null
+++ 
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishingPlugin.groovy
@@ -0,0 +1,211 @@
+/*
+ *  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.polygene.gradle.code
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.structure.release.ReleaseSpecExtension
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.artifacts.maven.MavenDeployer
+import org.gradle.api.artifacts.maven.MavenDeployment
+import org.gradle.api.internal.plugins.DslObject
+import org.gradle.api.plugins.MavenRepositoryHandlerConvention
+import org.gradle.api.publication.maven.internal.deployer.BaseMavenDeployer
+import org.gradle.api.publication.maven.internal.deployer.MavenRemoteRepository
+import org.gradle.api.tasks.Upload
+import org.gradle.plugins.signing.Sign
+import org.gradle.plugins.signing.SigningExtension
+
+/**
+ * Publishing.
+ *
+ * <strong>Configuration</strong>
+ *
+ * By default RELEASES are signed, SNAPSHOTS are not.
+ * Signing can be turned on or off by setting the {@literal uploadSigned} 
property.
+ *
+ * By default RELEASES must satisfy {@link 
org.apache.polygene.gradle.structure.release.ModuleReleaseSpec}, SNAPSHOT don't.
+ * This can be turned on or off by setting the {@literal uploadReleaseSpec} 
property.
+ *
+ * By default RELEASES and SNAPSHOTS are uploaded using HTTP.
+ * Used Wagon can be overridden by setting the {@literal uploadWagon} property.
+ *
+ * By default RELEASES and SNAPSHOTS are uploaded to Apache Nexus.
+ * Target repository can be overridden by setting the {@literal 
uploadRepository} property.
+ *
+ * No username/password is provided by default.
+ * If needed set them using the uploadUsername and {@literal uploadPassword} 
properties.
+ */
+@CompileStatic
+class PublishingPlugin implements Plugin<Project>
+{
+  static final String WAGON_HTTP = 'org.apache.maven.wagon:wagon-http:2.2'
+  static final String WAGON_SSH = 'org.apache.maven.wagon:wagon-ssh:2.2'
+  static final String WAGON_WEBDAV = 
'org.apache.maven.wagon:wagon-webdav:1.0-beta-2'
+
+  static final String RELEASES_REPOSITORY_NAME = 'apache.releases.https'
+  static final String RELEASES_REPOSITORY_URL = 
'https://repository.apache.org/service/local/staging/deploy/maven2'
+  static final String SNAPSHOTS_REPOSITORY_NAME = 'apache.snapshots.https'
+  static final String SNAPSHOTS_REPOSITORY_URL = 
'https://repository.apache.org/content/repositories/snapshots'
+
+  static class Config
+  {
+    boolean snapshots
+    boolean releases
+    boolean signed
+    boolean releaseSpec
+    String wagon
+    String repositoryName
+    String repositoryUrl
+    String username
+    String password
+  }
+
+  @Override
+  void apply( final Project project )
+  {
+    Config config = configFor project
+    applyWagonConfiguration project, config
+    configureSigning project, config
+    configureUploadArchives project, config
+    configureStageArchives project
+    configureMavenMetadata project
+    applyMavenPublishAuth project
+  }
+
+  private static Config configFor( Project project )
+  {
+    def releaseSpec = project.extensions.getByType ReleaseSpecExtension
+    def config = new Config()
+    config.snapshots = releaseSpec.snapshotVersion
+    config.releases = releaseSpec.releaseVersion
+    config.signed = project.findProperty( 'uploadSigned' ) ?: config.releases
+    config.releaseSpec = project.findProperty( 'uploadReleaseSpec' ) ?: 
config.releases
+    config.wagon = project.findProperty( 'uploadWagon' ) ?: WAGON_HTTP
+    config.repositoryName = project.findProperty( 'uploadRepositoryName' ) ?:
+                            config.releases ? RELEASES_REPOSITORY_NAME : 
SNAPSHOTS_REPOSITORY_NAME
+    config.repositoryUrl = project.findProperty( 'uploadRepository' ) ?:
+                           config.releases ? RELEASES_REPOSITORY_URL : 
SNAPSHOTS_REPOSITORY_URL
+    config.username = project.findProperty( 'uploadUsername' )
+    config.password = project.findProperty( 'uploadPassword' )
+    return config
+  }
+
+  private static void applyWagonConfiguration( Project project, Config config )
+  {
+    project.configurations.create( 'deployersJars' )
+    project.dependencies.add( 'deployersJars', config.wagon )
+  }
+
+  private static void configureSigning( Project project, Config config )
+  {
+    project.plugins.apply 'signing'
+    def signing = project.extensions.getByType SigningExtension
+    signing.required = config.signed
+    signing.sign project.configurations.getByName( 'archives' )
+    def signArchives = project.tasks.getByName( 'signArchives' ) as Sign
+    signArchives.onlyIf { !project.findProperty( 'skipSigning' ) }
+  }
+
+  private static void configureUploadArchives( Project project, Config config )
+  {
+    project.plugins.apply 'maven'
+    def releaseSpec = project.extensions.getByType ReleaseSpecExtension
+    def uploadArchives = project.tasks.getByName( 'uploadArchives' ) as Upload
+    uploadArchives.doFirst {
+      if( !config.snapshots && !config.releases )
+      {
+        throw new GradleException( "'version' must be given as a system 
property to perform a release." )
+      }
+    }
+    uploadArchives.onlyIf {
+      def notSkipped = !project.hasProperty( 'skipUpload' )
+      def approvedProject = releaseSpec.publishedProjects.contains project
+      return notSkipped && ( !config.releaseSpec || ( approvedProject || 
project == project.rootProject ) )
+    }
+    uploadArchives.dependsOn project.tasks.getByName( 'check' )
+    def mavenDeployer = getMavenDeployer uploadArchives
+    if( config.signed )
+    {
+      mavenDeployer.beforeDeployment { MavenDeployment deployment ->
+        project.extensions.getByType( SigningExtension ).signPom deployment
+      }
+    }
+    mavenDeployer.configuration = project.configurations.getByName( 
'deployersJars' )
+    def repository = new MavenRemoteRepository()
+    repository.id = config.repositoryName
+    repository.url = config.repositoryUrl
+    if( config.username )
+    {
+      repository.authentication.userName = config.username
+      repository.authentication.password = config.password
+    }
+    if( config.releases )
+    {
+      mavenDeployer.repository = repository
+    }
+    else
+    {
+      mavenDeployer.snapshotRepository = repository
+    }
+  }
+
+  private static void configureStageArchives( Project project )
+  {
+    def stageConfiguration = project.configurations.create 'stageArchives'
+    stageConfiguration.extendsFrom project.configurations.getByName( 
'archives' )
+
+    def stageTask = project.tasks.getByName( 'uploadStageArchives' ) as Upload
+    stageTask.uploadDescriptor = true
+    def mavenDeployer = getMavenDeployer stageTask
+    def repository = new MavenRemoteRepository()
+    repository.id = 'stageArchives'
+    repository.url = "file://${ project.buildDir.absolutePath }/stage/archives"
+    mavenDeployer.repository = repository
+    mavenDeployer.snapshotRepository = repository
+  }
+
+  private static void configureMavenMetadata( Project project )
+  {
+    project.tasks.withType( Upload ) { Upload task ->
+      def mavenDeployer = task.repositories.findByName( 'mavenDeployer' ) as 
MavenDeployer
+      if( mavenDeployer )
+      {
+        MavenMetadata.applyTo mavenDeployer
+      }
+    }
+  }
+
+  private static void applyMavenPublishAuth( final Project project )
+  {
+    // Bug in maven-publish-auth require apply after uploadArchives setup
+    project.plugins.apply 'maven-publish-auth'
+  }
+
+  private static BaseMavenDeployer getMavenDeployer( Upload uploadTask )
+  {
+    // TODO Remove use of Gradle internals
+    // DslObject to get the Upload task convention
+    // MavenRepositoryHandlerConvention & BaseMavenDeployer to configure 
Wagon, Authentication and Signing
+    def repositoriesConvention = new DslObject( uploadTask.repositories )
+      .getConvention()
+      .getPlugin( MavenRepositoryHandlerConvention )
+    return repositoriesConvention.mavenDeployer() as BaseMavenDeployer
+  }
+}

Reply via email to