You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/12/17 10:28:25 UTC
[49/81] [abbrv] [partial] zest-java git commit: ZEST-195 ;
Replace all "zest" with "polygene"
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
new file mode 100644
index 0000000..f6e9707
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
@@ -0,0 +1,115 @@
+/*
+ * 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.doc
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.TaskGroups
+import org.apache.polygene.gradle.PolygeneExtension
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.tasks.Copy
+
+@CompileStatic
+class ManualPlugin implements Plugin<Project>
+{
+ static class TaskNames
+ {
+ static final String WEBSITE = "website"
+ static final String ARCHIVE_WEBSITE = "archiveWebsite"
+ static final String COPY_WEBSITE = "copyWebsite"
+ static final String MANUALS = "manuals"
+ }
+
+ @Override
+ void apply( final Project project )
+ {
+ def zest = project.extensions.getByType( PolygeneExtension )
+ project.tasks.create( TaskNames.WEBSITE, DocumentationTask ) { DocumentationTask task ->
+ task.group = TaskGroups.DOCUMENTATION
+ task.description = 'Generates documentation website'
+ task.dependsOn project.rootProject.allprojects.findResults { Project p ->
+ p.tasks.findByName AsciidocBuildInfoPlugin.TASK_NAME
+ }
+ task.onlyIf { isAsciidocInstalled( project, zest ) }
+ task.docName = 'website'
+ task.docType = 'article'
+ }
+ project.tasks.create( TaskNames.ARCHIVE_WEBSITE, Copy ) { Copy task ->
+ task.group = TaskGroups.DOCUMENTATION
+ task.description = 'Copy website to ../polygene-web'
+ task.dependsOn TaskNames.WEBSITE
+ task.onlyIf { isAsciidocInstalled( project, zest ) }
+ if( zest.developmentVersion )
+ {
+ task.into "$project.rootProject.projectDir/../polygene-web/site/content/java/develop"
+ }
+ else
+ {
+ task.into "$project.rootProject.projectDir/../polygene-web/site/content/java/$project.version"
+ }
+ task.from "$project.buildDir/docs/website/"
+ }
+ project.tasks.create( TaskNames.COPY_WEBSITE, Copy ) { Copy task ->
+ task.group = TaskGroups.RELEASE
+ task.description = 'Copy website to ../polygene-web LATEST'
+ task.dependsOn TaskNames.ARCHIVE_WEBSITE
+ task.onlyIf { zest.releaseVersion }
+ task.from "$project.rootProject.projectDir/../polygene-web/site/content/java/$project.version/"
+ task.into "$project.rootProject.projectDir/../polygene-web/site/content/java/latest/"
+ }
+ project.tasks.create( TaskNames.MANUALS ) { Task task ->
+ task.group = TaskGroups.DOCUMENTATION
+ task.description = 'Generates all documentation'
+ task.dependsOn TaskNames.COPY_WEBSITE
+ task.onlyIf { isAsciidocInstalled( project, zest ) }
+ }
+ }
+
+ private static Boolean asciidocInstalled = null
+
+ // Force when building a release version
+ // Skip if skipAsciidocIfAbsent property is set
+ // Skip if asciidoc is not found in PATH when building a development version
+ private static boolean isAsciidocInstalled( Project project, PolygeneExtension zest )
+ {
+ if( asciidocInstalled == null )
+ {
+ def skipAsciidocIfAbsent = project.findProperty 'skipAsciidocIfAbsent'
+ if( !skipAsciidocIfAbsent && zest.releaseVersion )
+ {
+ project.logger.info 'Asciidoc tasks forced for building a release version, hope you have Asciidoc installed'
+ asciidocInstalled = true
+ }
+ else
+ {
+ def pathDirs = System.getenv( 'PATH' ).split( File.pathSeparator )
+ def asciidocCandidates = pathDirs.collect( { String path ->
+ new File( path, 'asciidoc' )
+ } ).flatten() as List<File>
+ asciidocInstalled = asciidocCandidates.findAll( { it.isFile() } )
+ if( !asciidocInstalled )
+ {
+ project.logger.lifecycle 'WARNING Asciidoc not found in PATH, manual tasks will skip\n' +
+ ' Please install http://www.methods.co.nz/asciidoc/'
+ }
+ }
+ }
+ return asciidocInstalled
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
new file mode 100644
index 0000000..19ee6e0
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/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.polygene.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/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/performance/PerformanceTestsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/performance/PerformanceTestsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/performance/PerformanceTestsPlugin.groovy
new file mode 100644
index 0000000..1b676af
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/performance/PerformanceTestsPlugin.groovy
@@ -0,0 +1,62 @@
+/*
+ * 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.performance
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.TaskGroups
+import org.gradle.api.Action
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.tasks.bundling.Jar
+import org.gradle.api.tasks.testing.Test
+import org.gradle.language.base.plugins.LifecycleBasePlugin
+
+// TODO Add profiling tasks (jfr or honest? flamegraphs?)
+// TODO Add simple regression assertions, how? testing against a previous version?
+@CompileStatic
+class PerformanceTestsPlugin implements Plugin<Project>
+{
+ static class TaskNames
+ {
+ static final String PERFORMANCE_TEST = 'performanceTest'
+ static final String PERFORMANCE_PROFILE = 'performanceProfile'
+ static final String PERFORMANCE_CHECK = 'performanceCheck'
+ }
+
+ @Override
+ void apply( final Project project )
+ {
+ def sourceSets = project.convention.getPlugin( JavaPluginConvention ).sourceSets
+ sourceSets.create 'perf'
+ project.dependencies.add 'perfCompile', sourceSets.getByName( 'main' ).output
+ project.dependencies.add 'perfCompile', sourceSets.getByName( 'test' ).output
+ project.dependencies.add 'perfCompile', project.configurations.getByName( 'testCompile' )
+ project.dependencies.add 'perfRuntime', project.configurations.getByName( 'testRuntime' )
+ project.tasks.getByName( LifecycleBasePlugin.CHECK_TASK_NAME ).dependsOn 'compilePerfJava'
+ project.tasks.create( TaskNames.PERFORMANCE_TEST, Test, { Test task ->
+ task.group = TaskGroups.PERFORMANCE
+ task.description = 'Runs performance tests.'
+ task.maxParallelForks = 1
+ task.forkEvery = 1L
+ task.testClassesDir = sourceSets.getByName( 'perf' ).output.classesDir
+ task.classpath = sourceSets.getByName( 'perf' ).runtimeClasspath
+ task.systemProperty 'jar.path', ( project.tasks.getByName( 'jar' ) as Jar ).archivePath
+ } as Action<Test> )
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
new file mode 100644
index 0000000..74c5dcf
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/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.publish
+
+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/ZEST'
+ }
+ 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 'users-subscribe@polygene.apache.org'
+ unsubscribe 'users-unsubscribe@polygene.apache.org'
+ post 'users@polygene.apache.org'
+ 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 'dev-subscribe@polygene.apache.org'
+ unsubscribe 'dev-unsubscribe@polygene.apache.org'
+ post 'dev@polygene.apache.org'
+ 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 'commits-subscribe@polygene.apache.org'
+ unsubscribe 'commits-unsubscribe@polygene.apache.org'
+ post 'commits@polygene.apache.org'
+ archive 'https://mail-archives.apache.org/mod_mbox/polygene-commits/'
+ otherArchives {
+ otherArchive 'https://www.apache.org/foundation/mailinglists.html#archives'
+ }
+ }
+ }
+ developers {
+ developer {
+ id 'niclas@hedhman.org'
+ name 'Niclas Hedhman'
+ email 'niclas@hedhman.org'
+ roles {
+ role 'Core Team'
+ }
+ organizationUrl 'http://polygene.apache.org'
+ timezone 'UTC+8'
+ }
+ developer {
+ id 'rickardoberg'
+ name 'Rickard \u00F6berg'
+ email 'rickard.oberg@jayway.se'
+ roles {
+ role 'Core Team'
+ }
+ url 'http://www.neotechnology.com'
+ organization 'Neo Technology AB'
+ organizationUrl 'http://www.neotechnology.com'
+ timezone 'UTC+8'
+ }
+ developer {
+ id 'edward.yakop@gmail.com'
+ name 'Edward Yakop'
+ email 'efy@codedragons.com'
+ roles {
+ role 'Core Team'
+ }
+ organizationUrl 'http://polygene.apache.org'
+ timezone 'UTC+8'
+ }
+ developer {
+ id 'adreghiciu@gmail.com'
+ name 'Alin Dreghiciu'
+ email 'adreghiciu@codedragons.com'
+ roles {
+ role 'Core Team'
+ }
+ organizationUrl 'http://polygene.apache.org'
+ timezone 'UTC+2'
+ }
+ developer {
+ id 'mesirii'
+ name 'Michael Hunger'
+ email 'qi4j@jexp.de'
+ roles {
+ role 'Core Team'
+ }
+ timezone 'CET'
+ }
+
+ developer {
+ id "muhdkamil"
+ name "Muhd Kamil bin Mohd Baki"
+ roles {
+ role 'Platform Team'
+ }
+ timezone "UTC+8"
+ }
+
+ developer {
+ id "ops4j@leangen.net"
+ name "David Leangen"
+ organization "Bioscene"
+ email "ops4j@leangen.net"
+ roles {
+ role 'Platform Team'
+ }
+ timezone "UTC+9"
+ }
+
+ developer {
+ id "sonny.gill@jayway.net"
+ name "Sonny Gill"
+ email "sonny.public@gmail.com"
+ roles {
+ role 'Community Team'
+ }
+ timezone "UTC+8"
+ }
+
+ developer {
+ id "taowen"
+ name "Tao Wen"
+ organization ""
+ email "taowen@gmail.com"
+ roles {
+ role 'Community Team'
+ }
+ timezone "UTC+8"
+ }
+
+ developer {
+ id "thobe"
+ name "Tobias Ivarsson"
+ email "tobias@neotechnology.com"
+ 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 "boonping81@gmail.com"
+ roles {
+ role 'Platform Team'
+ }
+ timezone "UTC+8"
+ }
+
+ developer {
+ id "jan.kronquist@gmail.com"
+ name "Jan Kronquist"
+ email "jan.kronquist@gmail.com"
+ 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 "peter@neubauer.se"
+ name "Peter Neubauer"
+ email "peter@neubauer.se"
+ roles {
+ role 'Platform Team'
+ }
+ timezone "CET"
+ }
+
+ developer {
+ id "rwallace"
+ name "Richard Wallace"
+ email "rwallace@thewallacepack.net"
+ roles {
+ role 'Platform Team'
+ }
+ timezone "UTC-7"
+ }
+
+ developer {
+ id "siannyhalim@gmail.com"
+ name "Sianny Halim"
+ email "siannyhalim@gmail.com"
+ roles {
+ role 'Platform Team'
+ }
+ timezone "UTC+8"
+ }
+
+ developer {
+ id "paul@nosphere.org"
+ name "Paul Merlin"
+ email "paul@nosphere.org"
+ roles {
+ role 'Core Team'
+ }
+ timezone "CET"
+ }
+
+ developer {
+ id "stas.dev+qi4j@gmail.com"
+ name "Stanislav Muhametsin"
+ email "stas.dev+qi4j@gmail.com"
+ roles {
+ role 'Platform Team'
+ }
+ timezone "UTC+2"
+ }
+
+ developer {
+ id "tonny"
+ name "Tonny Kohar"
+ roles {
+ role "Community Team"
+ }
+ email "tonny.kohar@gmail.com"
+ timezone "UTC+7"
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
new file mode 100644
index 0000000..6d55b9d
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
@@ -0,0 +1,183 @@
+/*
+ * 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.publish
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.PolygeneExtension
+import org.apache.polygene.gradle.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.DefaultGroovyMavenDeployer
+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.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 )
+ configureMavenMetadata( project )
+ applyMavenPublishAuth( project )
+ }
+
+ private static Config configFor( Project project )
+ {
+ def zest = project.extensions.getByType( PolygeneExtension )
+ def config = new Config()
+ config.snapshots = zest.developmentVersion
+ config.releases = zest.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 uploadArchives = project.tasks.getByName( 'uploadArchives' ) as Upload
+ uploadArchives.doFirst {
+ if( project.version == "0" )
+ {
+ throw new GradleException( "'version' must be given as a system property to perform a release." )
+ }
+ }
+ uploadArchives.onlyIf {
+ def notSkipped = !project.hasProperty( 'skipUpload' )
+ def approvedProject = project.extensions.getByType( ReleaseSpecExtension ).approvedProjects.contains( project )
+ return notSkipped && ( !config.releaseSpec || ( approvedProject || project == project.rootProject ) )
+ }
+ uploadArchives.dependsOn project.tasks.getByName( 'check' )
+ def repositoriesConvention = new DslObject( uploadArchives.repositories )
+ .getConvention()
+ .getPlugin( MavenRepositoryHandlerConvention )
+ def mavenDeployer = repositoriesConvention.mavenDeployer() as DefaultGroovyMavenDeployer
+ 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 configureMavenMetadata( Project project )
+ {
+ def uploadArchives = project.tasks.getByName( 'uploadArchives' ) as Upload
+ def mavenDeployer = uploadArchives.repositories.getByName( 'mavenDeployer' ) as 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'
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/CheckReleaseSpecTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/CheckReleaseSpecTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/CheckReleaseSpecTask.groovy
new file mode 100644
index 0000000..d1fe082
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/CheckReleaseSpecTask.groovy
@@ -0,0 +1,75 @@
+/*
+ * 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.release
+
+import groovy.transform.CompileStatic
+import org.gradle.api.DefaultTask
+import org.gradle.api.GradleException
+import org.gradle.api.Project
+import org.gradle.api.artifacts.ProjectDependency
+import org.gradle.api.tasks.TaskAction
+
+@CompileStatic
+class CheckReleaseSpecTask extends DefaultTask
+{
+ CheckReleaseSpecTask()
+ {
+ description = 'Ensure that no releasable module depend on module(s) that don\'t fit the release criteria.'
+ doFirst {
+ def approvedProjects = project.extensions.getByType( ReleaseSpecExtension ).approvedProjects
+ dependsOn approvedProjects.collect { each -> each.configurations.getByName( 'runtime' ) }
+ }
+ }
+
+ @TaskAction
+ void check()
+ {
+ Map<Project, Set<ProjectDependency>> notReleasable = [ : ]
+ def approvedProjects = project.extensions.getByType( ReleaseSpecExtension ).approvedProjects
+ approvedProjects.each { approvedProject ->
+ def projectDependencies = approvedProject.configurations.getByName( 'runtime' ).allDependencies.findAll {
+ it instanceof ProjectDependency
+ } as Set<ProjectDependency>
+ projectDependencies.each { dep ->
+ def depNotReleaseApproved = approvedProjects.findAll { rp ->
+ rp.group == dep.dependencyProject.group && rp.name == dep.dependencyProject.name
+ }.isEmpty()
+ if( depNotReleaseApproved )
+ {
+ if( !notReleasable[ approvedProject ] )
+ {
+ notReleasable[ approvedProject ] = [ ] as Set
+ }
+ notReleasable[ approvedProject ] << dep
+ }
+ }
+ }
+ if( !notReleasable.isEmpty() )
+ {
+ def errorMessage = new StringBuilder()
+ errorMessage << "At least one releasable module depends on module(s) that don't fit the release criteria!\n"
+ errorMessage << "\tOffending module -> Non releasable dependencies\n"
+ notReleasable.each { k, v ->
+ def noRlsDeps = v.collect { d -> ':' + d.dependencyProject.group + ':' + d.dependencyProject.name }
+ errorMessage << "\t$k -> ${ noRlsDeps })\n"
+ }
+ errorMessage << "Check the dev-status.xml file content in each modules directory."
+ throw new GradleException( errorMessage.toString() )
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
new file mode 100644
index 0000000..13cbe09
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/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.polygene.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/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseApprovedProjectsTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseApprovedProjectsTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseApprovedProjectsTask.groovy
new file mode 100644
index 0000000..9a93925
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseApprovedProjectsTask.groovy
@@ -0,0 +1,57 @@
+/*
+ * 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.release
+
+import groovy.json.JsonBuilder
+import groovy.transform.CompileStatic
+import org.gradle.api.DefaultTask
+import org.gradle.api.file.FileCollection
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.OutputFile
+import org.gradle.api.tasks.TaskAction
+
+/**
+ * Write paths of release approved projects to a JSON file.
+ *
+ * This task sole purpose is proper up-do-date behaviour when changing {@literal dev-status.xml} files.
+ */
+@CompileStatic
+class ReleaseApprovedProjectsTask extends DefaultTask
+{
+ @InputFiles
+ FileCollection getDevStatusFiles()
+ {
+ return project.files( project.allprojects
+ .collect( { project -> project.file( 'dev-status.xml' ) } )
+ .findAll( { it.exists() } ) )
+ }
+
+ @OutputFile
+ File getJsonApprovedProjects()
+ {
+ return new File( new File( project.buildDir, 'release' ), 'approved-projects.json' )
+ }
+
+ @TaskAction
+ void approveProjects()
+ {
+ def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
+ jsonApprovedProjects.parentFile.mkdirs()
+ jsonApprovedProjects.text = new JsonBuilder( releaseSpec.approvedProjects.collect( { it.path } ) ).toPrettyString()
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecExtension.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecExtension.groovy
new file mode 100644
index 0000000..c5b0887
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecExtension.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.release
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Project
+
+/**
+ * Provide release approved projects.
+ *
+ * There's no up-to-date checking on Gradle extensions.
+ * Depend on {@link ReleaseApprovedProjectsTask} to get a good up-to-date behavior.
+ */
+@CompileStatic
+class ReleaseSpecExtension
+{
+ static final String NAME = 'releaseSpec'
+ Set<Project> approvedProjects
+
+ ReleaseSpecExtension( Project rootProject )
+ {
+ def spec = new ModuleReleaseSpec()
+ approvedProjects = rootProject.allprojects.findAll( { p -> spec.satisfiedBy( p ) } )
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecPlugin.groovy
new file mode 100644
index 0000000..34422a9
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecPlugin.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.polygene.gradle.release
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.TaskGroups
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+
+@CompileStatic
+class ReleaseSpecPlugin implements Plugin<Project>
+{
+ static class TaskNames
+ {
+ static final String RELEASE_APPROVED_PROJECTS = 'releaseSpecApprovedProjects'
+ static final String CHECK_RELEASE_SPEC = 'checkReleaseSpec'
+ }
+
+ @Override
+ void apply( final Project project )
+ {
+ if( project != project.rootProject )
+ {
+ throw new IllegalStateException( "This plugin is only applicable to the root project" )
+ }
+ applyReleaseSpec( project )
+ }
+
+ private static void applyReleaseSpec( Project project )
+ {
+ project.extensions.create( ReleaseSpecExtension.NAME, ReleaseSpecExtension, project.rootProject )
+ project.tasks.create( TaskNames.RELEASE_APPROVED_PROJECTS, ReleaseApprovedProjectsTask ) { Task task ->
+ task.group = TaskGroups.RELEASE
+ task.description = 'Apply release specification to projects in the build'
+ }
+ project.tasks.create( TaskNames.CHECK_RELEASE_SPEC, CheckReleaseSpecTask ) { Task task ->
+ task.group = TaskGroups.RELEASE_VERIFICATION
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/tasks/ExecLogged.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/tasks/ExecLogged.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/tasks/ExecLogged.groovy
new file mode 100644
index 0000000..01b4e71
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/tasks/ExecLogged.groovy
@@ -0,0 +1,117 @@
+/*
+ * 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.tasks
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Action
+import org.gradle.api.GradleException
+import org.gradle.api.Project
+import org.gradle.api.tasks.AbstractExecTask
+import org.gradle.api.tasks.OutputFile
+import org.gradle.api.tasks.TaskAction
+import org.gradle.internal.logging.ConsoleRenderer
+import org.gradle.process.ExecSpec
+
+@CompileStatic
+class ExecLogged extends AbstractExecTask<ExecLogged>
+{
+ @OutputFile
+ File stdoutFile = project.file( "$project.buildDir/tmp/${ getName() }/stdout.log" )
+
+ @OutputFile
+ File stderrFile = project.file( "$project.buildDir/tmp/${ getName() }/stderr.log" )
+
+ ExecLogged()
+ {
+ super( ExecLogged.class )
+ }
+
+ @TaskAction
+ protected void exec()
+ {
+ [ stdoutFile, stderrFile ].each { it.parentFile.mkdirs() }
+ def outStream = stdoutFile.newOutputStream()
+ def errStream = stderrFile.newOutputStream()
+ try
+ {
+ super.exec()
+ }
+ catch( Exception ex )
+ {
+ throw new GradleException( errorMessage( ex, stdoutFile, stderrFile ), ex )
+ }
+ finally
+ {
+ close outStream, errStream
+ }
+ }
+
+ static void execLogged( Project project, File stdoutFile, File stderrFile, Action<? super ExecSpec> specAction )
+ {
+ [ stdoutFile, stderrFile ].each { it.parentFile.mkdirs() }
+ def outStream = stdoutFile.newOutputStream()
+ def errStream = stderrFile.newOutputStream()
+ try
+ {
+ project.exec { ExecSpec spec ->
+ specAction.execute( spec )
+ spec.standardOutput = outStream
+ spec.errorOutput = errStream
+ }
+ }
+ catch( Exception ex )
+ {
+ throw new GradleException( errorMessage( ex, stdoutFile, stderrFile ), ex )
+ }
+ finally
+ {
+ close outStream, errStream
+ }
+ }
+
+ private static void close( Closeable... closeables )
+ throws IOException
+ {
+ def errors = [ ] as List<IOException>
+ for( Closeable closeable : closeables )
+ {
+ try
+ {
+ closeable.close()
+ }
+ catch( IOException ex )
+ {
+ errors.add( ex )
+ }
+ }
+ if( !errors.empty )
+ {
+ def ex = new IOException( 'Failed to close some' )
+ errors.each { ex.addSuppressed it }
+ throw ex
+ }
+ }
+
+ private static String errorMessage( Exception ex, File stdoutFile, File stderrFile )
+ {
+ def consoleRenderer = new ConsoleRenderer()
+ return "${ ex.message }\n" +
+ "\tSTDOUT ${ consoleRenderer.asClickableFileUrl( stdoutFile ) }\n" +
+ "\tSTDERR ${ consoleRenderer.asClickableFileUrl( stderrFile ) }"
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/test/AggregatedJacocoReportTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/test/AggregatedJacocoReportTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/test/AggregatedJacocoReportTask.groovy
new file mode 100644
index 0000000..ca10b80
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/test/AggregatedJacocoReportTask.groovy
@@ -0,0 +1,91 @@
+/*
+ * 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.test
+
+import org.gradle.api.DefaultTask
+import org.gradle.api.Project
+import org.gradle.api.file.FileCollection
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.OutputDirectory
+import org.gradle.api.tasks.TaskAction
+
+class AggregatedJacocoReportTask extends DefaultTask
+{
+ @InputFiles
+ FileCollection getJacocoExecDataDirectories()
+ {
+ return project.files( project.subprojects.collect( { Project p -> "${ p.buildDir.path }/jacoco" } ) )
+ }
+
+ @OutputDirectory
+ File getOutputDirectory()
+ {
+ return project.file( "$project.buildDir/reports/coverage" )
+ }
+
+ @TaskAction
+ void report()
+ {
+ def coveredProjects = project.subprojects.findAll { p -> new File( "${ p.buildDir.path }/jacoco" ).exists() }
+ def coreProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.core' ) }
+ def libProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.lib' ) }
+ def extProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.ext' ) }
+ def toolsProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.tool' ) }
+ def tutoProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.tuto' ) }
+ def samplesProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.sample' ) }
+ def classpath = project.configurations.getByName( 'jacoco' ).asPath
+ project.ant {
+ taskdef name: 'jacocoreport', classname: 'org.jacoco.ant.ReportTask', classpath: classpath
+ mkdir dir: outputDirectory
+ jacocoreport {
+ executiondata {
+ coveredProjects.collect { p -> fileset( dir: "${ p.buildDir.path }/jacoco" ) { include( name: '*.exec' ) } }
+ }
+ structure( name: "Apache Polygene\u2122 (Java Edition) SDK" ) {
+ group( name: "Core" ) {
+ classfiles { coreProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+ sourcefiles { coreProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+ }
+ group( name: "Libraries" ) {
+ classfiles { libProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+ sourcefiles { libProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+ }
+ group( name: "Extensions" ) {
+ classfiles { extProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+ sourcefiles { extProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+ }
+ group( name: "Tools" ) {
+ classfiles { toolsProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+ sourcefiles { toolsProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+ }
+ group( name: "Tutorials" ) {
+ classfiles { tutoProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+ sourcefiles { tutoProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+ }
+ group( name: "Samples" ) {
+ classfiles { samplesProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+ sourcefiles { samplesProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+ }
+ }
+ csv destfile: "${ outputDirectory }/jacoco.csv", encoding: "UTF-8"
+ xml destfile: "${ outputDirectory }/jacoco.xml", encoding: "UTF-8"
+ html destdir: outputDirectory, encoding: "UTF-8", locale: "en", footer: "Apache Polygene\u2122 (Java Edition) SDK"
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/version/VersionClassPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/version/VersionClassPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/version/VersionClassPlugin.groovy
new file mode 100644
index 0000000..2a99206
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/version/VersionClassPlugin.groovy
@@ -0,0 +1,98 @@
+/*
+ * 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.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:release:perf Placeholder for date for dev versions
+// TODO:release:perf Add git data, 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' )
+ makeVersionClassTask.doLast {
+ def now = new Date()
+ def tmpGroup = project.name
+ if( tmpGroup.startsWith( "org.apache.polygene.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/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
deleted file mode 100644
index 57a0ba3..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
+++ /dev/null
@@ -1,208 +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
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.dependencies.DependenciesPlugin
-import org.apache.zest.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.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.name == 'org.apache.zest' ?
- 'org.apache.zest' :
- project.name.substring( 0, project.name.lastIndexOf( '.' ) )
-
- applyDefaultVersion( project )
- applyPolygeneExtension( project )
-
- configureJava( project )
- project.plugins.apply DependenciesPlugin
- configureJavadoc( project )
- configureTest( project )
- if( CodeProjectsPlugin.isCodeProject( project ) )
- {
- project.plugins.apply CodeProjectsPlugin
- }
- 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( "zest", 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.zest.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'
- // TODO Fails with no task found
- // 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/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/CodeProjectsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/CodeProjectsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/CodeProjectsPlugin.groovy
deleted file mode 100644
index 7225fb9..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/CodeProjectsPlugin.groovy
+++ /dev/null
@@ -1,146 +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
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.dependencies.DependenciesDeclarationExtension
-import org.apache.zest.gradle.doc.AsciidocBuildInfoPlugin
-import org.apache.zest.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.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 )
-
- 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://zest.apache.org/',
- description: project.description ?:
- 'Apache Polygene\u2122 (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 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.zest.core.runtime" )
- // {
- // checkstyleMain {
- // configFile = new File( "$rootProject.projectDir.absolutePath/etc/zest-runtime-checkstyle.xml" )
- // ignoreFailures = true
- // }
- // }
- // else
- // {
- // checkstyleMain {
- // configFile = new File( rootProject.projectDir.absolutePath.toString() + '/etc/zest-api-checkstyle.xml' )
- // ignoreFailures = true
- // reporting.baseDir = "$rootProject.reporting.baseDir/checkstyle"
- // }
- // }
- // checkstyleTest {
- // configFile = new File( "$rootProject.projectDir.absolutePath/etc/zest-tests-checkstyle.xml" )
- // ignoreFailures = true
- // }
- //
- // checkstyleVersion {
- // configFile = new File( "$rootProject.projectDir.absolutePath/etc/zest-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/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
deleted file mode 100644
index 47e5404..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
+++ /dev/null
@@ -1,262 +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
-
-import groovy.transform.CompileStatic
-import org.apache.rat.gradle.RatTask
-import org.apache.zest.gradle.dependencies.DependenciesDeclarationExtension
-import org.apache.zest.gradle.dist.DistributionPlugin
-import org.apache.zest.gradle.release.ReleaseSpecExtension
-import org.apache.zest.gradle.release.ReleaseSpecPlugin
-import org.apache.zest.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\u2122 (Java Edition) SDK'
- static final String PROJECT_DESCRIPTION = 'Apache Polygene\u2122 (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.collect { p -> p.tasks.getByName( 'dependencyReport' ) },
- project.subprojects.collect { p -> p.tasks.getByName( 'assemble' ) },
- ':org.apache.zest.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.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.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 zest = 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.zest.core' ) &&
- !approved.name.startsWith( 'org.apache.zest.core.runtime' ) ) ||
- approved.name.startsWith( 'org.apache.zest.library' ) ||
- approved.name.startsWith( 'org.apache.zest.extension' ) ||
- approved.name.startsWith( 'org.apache.zest.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.zest.api",
- "org.apache.zest.api.*" ],
- "Core Bootstrap": [ "org.apache.zest.bootstrap",
- "org.apache.zest.bootstrap.*" ],
- "Core SPI" : [ "org.apache.zest.spi",
- "org.apache.zest.spi.*" ],
- "Libraries" : [ "org.apache.zest.library.*" ],
- "Extensions" : [ "org.apache.zest.valueserialization.*",
- "org.apache.zest.entitystore.*",
- "org.apache.zest.index.*",
- "org.apache.zest.metrics.*",
- "org.apache.zest.cache.*",
- "org.apache.zest.migration",
- "org.apache.zest.migration.*" ],
- "Tools" : [ "org.apache.zest.tools.*",
- "org.apache.zest.envisage",
- "org.apache.zest.envisage.*" ],
- "Test Support" : [ "org.apache.zest.test",
- "org.apache.zest.test.*" ]
- ] )
- }
- project.tasks.create( TaskNames.ARCHIVE_JAVADOCS, Copy ) { Copy task ->
- task.group = TaskGroups.DOCUMENTATION
- task.description = 'Copy SDK public Javadoc to ../zest-web'
- task.dependsOn TaskNames.JAVADOCS
- task.from 'build/docs/javadoc/'
- if( zest.developmentVersion )
- {
- task.into( "$project.projectDir/../zest-web/site/content/java/develop/javadocs/" )
- }
- else
- {
- task.into( "$project.projectDir/../zest-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-zest/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 zest = 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( zest.developmentVersion )
- {
- throw new GradleException( "Cannot release development version $project.version, use '-Dversion=X.Y.Z'" )
- }
- }
- release.dependsOn 'checkReleaseSpec',
- 'rat',
- 'archiveJavadocs',
- ':org.apache.zest.manual:copyWebsite',
- project.allprojects.collect { it.tasks.getByName( 'uploadArchives' ) },
- 'dist'
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/TaskGroups.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/TaskGroups.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/TaskGroups.groovy
deleted file mode 100644
index 53a5b5e..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/TaskGroups.groovy
+++ /dev/null
@@ -1,40 +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
-
-import org.gradle.api.plugins.ApplicationPlugin
-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
-
-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_VERIFICATION = 'distribution verification'
- static final String PERFORMANCE = 'performance'
- static final String PERFORMANCE_VERIFICATION = 'performance verification'
- static final String RELEASE = 'release'
- static final String RELEASE_VERIFICATION = 'release verification'
- static final String UPLOAD = BasePlugin.UPLOAD_GROUP
- static final String SAMPLES = 'samples'
-}