You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2016/12/24 10:29:28 UTC
[16/19] zest-java git commit: build: detangle buildSrc
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/VersionClassPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/VersionClassPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/VersionClassPlugin.groovy
new file mode 100644
index 0000000..345f25f
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/VersionClassPlugin.groovy
@@ -0,0 +1,94 @@
+/*
+ * 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 java.nio.file.Files
+import org.apache.polygene.gradle.util.Licensing
+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 Add build date, placeholder for dev versions
+// TODO Add git data, placeholders for dev versions
+@CompileStatic
+class VersionClassPlugin implements Plugin<Project>
+{
+ @Override
+ void apply( Project project )
+ {
+ project.getPlugins().apply JavaPlugin.class
+ def genSrc = 'generated-src/version'
+ project.task( 'generateVersionClass' ) { Task task ->
+ def headerFile = project.rootProject.file 'etc/header.txt'
+ def generatedSrcDir = new File( project.buildDir, genSrc )
+ task.inputs.file headerFile
+ task.inputs.property 'projectVersion', project.version
+ task.inputs.property 'projectName', project.name
+ task.inputs.property 'projectGroup', project.group
+ task.outputs.file generatedSrcDir
+ task.doLast {
+ def publishedName = PublishNaming.publishedNameFor project.path
+ def packageName = "${ publishedName }".replace '-', '_'
+ def outFilename = "java/" + packageName.replace( '.', '/' ) + "/BuildVersion.java"
+ def outFile = new File( generatedSrcDir, outFilename )
+ Files.createDirectories outFile.parentFile.toPath()
+ outFile.withWriter( 'UTF-8' ) { BufferedWriter out ->
+ out.write Licensing.withLicenseHeader( headerFile.text, 'java' )
+ out.writeLine """
+ package ${ packageName };
+
+ /**
+ * Build version.
+ */
+ public interface BuildVersion
+ {
+ /** {@literal ${ project.group }}. */
+ String GROUP = \"${ project.group }\";
+
+ /** {@literal ${ publishedName }}. */
+ String NAME = \"${ publishedName }\";
+
+ /** {@literal ${ project.version }}. */
+ String VERSION = \"${ project.version }\";
+
+ /** {@literal ${ project.group }:${ publishedName }:${ project.version }}. */
+ String GAV = GROUP + ':' + NAME + ':' + VERSION;
+ }
+ """.stripIndent().trim()
+ }
+ }
+ }
+ def sourceSets = project.convention.getPlugin( JavaPluginConvention ).sourceSets
+ sourceSets.create( "version" ) { SourceSet sourceSet ->
+ sourceSet.java { SourceDirectorySet dirSet ->
+ dirSet.srcDir project.buildDir.name + '/' + genSrc + '/java'
+ }
+ }
+ project.tasks.getByName( 'compileJava' ).dependsOn 'compileVersionJava'
+ project.tasks.getByName( 'compileVersionJava' ).dependsOn 'generateVersionClass'
+ project.tasks.getByName( 'jar' ) { Jar task ->
+ task.from sourceSets.getByName( 'version' ).output
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
index c91f0b2..b9dc1e0 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
@@ -18,9 +18,9 @@
package org.apache.polygene.gradle.dependencies
import groovy.transform.CompileStatic
+import java.util.function.BiConsumer
import org.gradle.api.artifacts.DependencySubstitution
import org.gradle.api.artifacts.component.ModuleComponentSelector
-import org.gradle.internal.BiAction
@CompileStatic
class DependenciesDeclarationExtension
@@ -28,6 +28,6 @@ class DependenciesDeclarationExtension
final Map<String, String> repositoriesUrls = [ : ]
final Map<String, Object> libraries = [ : ]
final Map<String, List<Object>> defaultDependencies = [ : ]
- BiAction<DependencySubstitution, ModuleComponentSelector> dependencySubstitutionSpec
+ BiConsumer<DependencySubstitution, ModuleComponentSelector> dependencySubstitutionSpec
final Map<String, String> buildToolsVersions = [ : ]
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationPlugin.groovy
index cb90182..73cb4d5 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationPlugin.groovy
@@ -17,9 +17,11 @@
*/
package org.apache.polygene.gradle.dependencies
+import groovy.transform.CompileStatic
import org.gradle.api.Plugin
import org.gradle.api.Project
+@CompileStatic
class DependenciesDeclarationPlugin implements Plugin<Project>
{
@Override
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDownloadTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDownloadTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDownloadTask.groovy
new file mode 100644
index 0000000..78230ea
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDownloadTask.groovy
@@ -0,0 +1,34 @@
+/*
+ * 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.dependencies
+
+import groovy.transform.CompileStatic
+import org.gradle.api.DefaultTask
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.tasks.TaskAction
+
+@CompileStatic
+class DependenciesDownloadTask extends DefaultTask
+{
+ @TaskAction
+ void downloadAllDependencies()
+ {
+ def allConfigurations = project.allprojects.collect { it.configurations }.flatten() as Set<Configuration>
+ allConfigurations*.resolvedConfiguration
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesPlugin.groovy
index 660406d..42b44b9 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesPlugin.groovy
@@ -18,9 +18,11 @@
package org.apache.polygene.gradle.dependencies
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.Task
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.DependencySubstitution
import org.gradle.api.artifacts.component.ModuleComponentSelector
@@ -29,14 +31,19 @@ import org.gradle.api.artifacts.repositories.MavenArtifactRepository
@CompileStatic
class DependenciesPlugin implements Plugin<Project>
{
+ static class TaskNames
+ {
+ static final String DOWNLOAD_DEPENDENCIES = 'downloadDependencies'
+ }
+
@Override
void apply( final Project project )
{
- def dependenciesDeclaration = project.rootProject.extensions.getByType( DependenciesDeclarationExtension )
- applyRepositories( project, dependenciesDeclaration )
- applyLibraries( project, dependenciesDeclaration )
- applyDependencyResolutionRules( project, dependenciesDeclaration )
- applyDefaultDependencies( project, dependenciesDeclaration )
+ def dependenciesDeclaration = project.rootProject.extensions.getByType DependenciesDeclarationExtension
+ applyRepositories project, dependenciesDeclaration
+ applyLibraries project, dependenciesDeclaration
+ applyDependencyResolutionRules project, dependenciesDeclaration
+ applyDependenciesDownloadTask project
}
private static void applyRepositories( Project project, DependenciesDeclarationExtension declaration )
@@ -54,36 +61,32 @@ class DependenciesPlugin implements Plugin<Project>
project.extensions.extraProperties.set 'libraries', declaration.libraries
}
- private static void applyDependencyResolutionRules( Project project, DependenciesDeclarationExtension declaration )
+ static void applyDependencyResolutionRules( Project project, DependenciesDeclarationExtension declaration )
{
project.configurations.all(
{ Configuration configuration ->
- configuration.resolutionStrategy.dependencySubstitution.all(
- { DependencySubstitution dep ->
- if( dep.requested instanceof ModuleComponentSelector )
- {
- def selector = dep.requested as ModuleComponentSelector
- declaration.dependencySubstitutionSpec.execute dep, selector
- }
- } as Action<DependencySubstitution> )
+ applyDependencyResolutionRules configuration, declaration
} as Action<Configuration> )
}
- private static void applyDefaultDependencies( Project project, DependenciesDeclarationExtension declaration )
+ static void applyDependencyResolutionRules( Configuration configuration,
+ DependenciesDeclarationExtension declaration )
{
- declaration.defaultDependencies.each { String configuration, List<Object> dependencies ->
- dependencies.each { dependency ->
- if( dependency instanceof Collection )
- {
- dependency.each { subdep ->
- project.dependencies.add( configuration, subdep )
- }
- }
- else
+ configuration.resolutionStrategy.dependencySubstitution.all(
+ { DependencySubstitution dep ->
+ if( dep.requested instanceof ModuleComponentSelector )
{
- project.dependencies.add( configuration, dependency )
+ def selector = dep.requested as ModuleComponentSelector
+ declaration.dependencySubstitutionSpec.accept dep, selector
}
- }
+ } as Action<DependencySubstitution> )
+ }
+
+ private static void applyDependenciesDownloadTask( Project project )
+ {
+ project.tasks.create( TaskNames.DOWNLOAD_DEPENDENCIES, DependenciesDownloadTask ) { Task task ->
+ task.group = TaskGroups.HELP
+ task.description = 'Download all dependencies'
}
}
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/PolygeneExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/PolygeneExtension.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/PolygeneExtension.groovy
new file mode 100644
index 0000000..435f278
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/PolygeneExtension.groovy
@@ -0,0 +1,69 @@
+/*
+ * 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.dependencies
+
+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()
+ }
+
+ 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/dist/DistributionPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/DistributionPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/DistributionPlugin.groovy
deleted file mode 100644
index 0a4a49b..0000000
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/DistributionPlugin.groovy
+++ /dev/null
@@ -1,387 +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.dist
-
-import groovy.transform.CompileStatic
-import groovy.transform.TypeCheckingMode
-import org.apache.rat.gradle.RatTask
-import org.apache.tools.ant.filters.ReplaceTokens
-import org.apache.polygene.gradle.RootProjectPlugin
-import org.apache.polygene.gradle.TaskGroups
-import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
-import org.apache.polygene.gradle.release.ReleaseSpecExtension
-import org.apache.polygene.gradle.release.ReleaseSpecPlugin
-import org.gradle.api.Action
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.file.CopySpec
-import org.gradle.api.file.FileCopyDetails
-import org.gradle.api.tasks.Copy
-import org.gradle.api.tasks.GradleBuild
-import org.gradle.api.tasks.bundling.Compression
-import org.gradle.api.tasks.bundling.Tar
-import org.gradle.api.tasks.bundling.Zip
-
-@CompileStatic
-class DistributionPlugin implements Plugin<Project>
-{
- static class TaskNames
- {
- static final String UNPACK_SOURCE_DIST = 'unpackSrcDist'
- static final String UNPACK_BINARY_DIST = 'unpackBinDist'
- static final String CHECK_SOURCE_DIST = 'checkSrcDist'
- static final String CHECK_BINARY_DIST = 'checkBinDist'
- static final String CHECK_BINARY_DIST_RAT = 'checkBinDist_rat'
- static final String GENERATE_MAVEN_OFFLINE_HELPERS = 'generateMavenGoOfflineHelpers'
- static final String GENERATE_GRADLE_OFFLINE_HELPERS = 'generateGradleGoOfflineHelpers'
- static final String CHECK_MAVEN_OFFLINE_HELPERS = 'checkMavenGoOfflineHelpers'
- static final String CHECK_GRADLE_OFFLINE_HELPERS = 'checkGradleGoOfflineHelpers'
- }
-
- @Override
- void apply( final Project project )
- {
- configureSourceDistribution( project )
- configureBinaryDistribution( project )
- configureDistributionChecksums( project )
- configureHelperTasks( project )
- }
-
- private static void configureSourceDistribution( Project project )
- {
- def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
- def srcDistFilesCopySpec = project.copySpec { CopySpec spec ->
- spec.from '.'
- spec.include '*.txt'
- spec.include 'doap.rdf'
- spec.include '*.gradle'
- spec.include 'gradlew*'
- spec.include 'gradle/**'
- spec.include 'etc/**'
- spec.include 'buildSrc/**'
- spec.include 'src/**'
- releaseSpec.approvedProjects.each { p ->
- def relPath = new File( project.projectDir.toURI().relativize( p.projectDir.toURI() ).toString() )
- spec.include "$relPath/**"
- }
- spec.include 'manual/**'
- spec.include 'samples/**'
- spec.include 'tests/**'
- spec.include 'tutorials/**'
- spec.include 'tools/shell/**'
- // Filtered, see below
- spec.exclude 'settings.gradle'
- spec.exclude 'gradle.properties'
- // Excludes
- spec.exclude '**/build/**' // Build output
- spec.exclude 'derby.log' // Derby test garbage
- spec.exclude '**/*.iml' // IDEA files
- spec.exclude '**/*.ipr' // IDEA files
- spec.exclude '**/*.iws' // IDEA files
- spec.exclude '**/.idea' // IDEA files
- spec.exclude '**/out/**' // IDEA build output
- spec.exclude '**/.classpath' // Eclipse files
- spec.exclude '**/.project' // Eclipse files
- spec.exclude '**/.settings' // Eclipse files
- spec.exclude '**/.nb-gradle/**' // Netbeans files
- spec.exclude '**/.nb-gradle*' // Netbeans files
- spec.exclude '**/.git/**' // Git directories
- spec.exclude '**/.git*' // Git files
- spec.exclude '**/.gradle/**' // Gradle management files
- spec.exclude '**/.gradletasknamecache' // Gradle cache
- spec.into '.'
- }
- def srcDistFilteredFilesTask = project.tasks.create( 'srcDistFilteredFiles' )
- srcDistFilteredFilesTask.description = 'Apply release specification to source distribution build scripts'
- // Generates various files for the source distribution
- // - settings.gradle
- // - gradle.properties to set version !
- def filteredDir = new File( "$project.buildDir/tmp/srcDistFilteredFiles" )
- srcDistFilteredFilesTask.outputs.file filteredDir
- srcDistFilteredFilesTask.doLast {
- // Settings
- def settingsFile = new File( filteredDir, 'settings.gradle' )
- settingsFile.parentFile.mkdirs()
- def filteredSettings = ''
- project.file( 'settings.gradle' ).readLines().each { line ->
- if( line.contains( '\'libraries:' ) || line.contains( '\'extensions:' ) || line.contains( '\'tools:' ) )
- {
- def accepted = false
- releaseSpec.approvedProjects.collect { it.projectDir }.each { acceptedProjectDir ->
- if( line.contains( "'${ acceptedProjectDir.parentFile.name }:${ acceptedProjectDir.name }'" ) )
- {
- accepted = true
- }
- }
- if( accepted )
- {
- filteredSettings += "$line\n"
- }
- }
- else
- {
- filteredSettings += "$line\n"
- }
- }
- settingsFile.text = filteredSettings
- // gradle.properties
- def gradlePropsFile = new File( filteredDir, 'gradle.properties' )
- gradlePropsFile.parentFile.mkdirs()
- gradlePropsFile.text = project.file( 'gradle.properties' ).text +
- "\nskipSigning=true\nskipAsciidocIfAbsent=true\n\nversion=$project.version\n"
- }
- def srcDistFilteredFilesCopySpec = project.copySpec { CopySpec spec ->
- spec.from srcDistFilteredFilesTask
- spec.into '.'
- }
- def srcDistCopySpec = project.copySpec { CopySpec spec ->
- spec.into "apache-polygene-java-$project.version-src"
- spec.with srcDistFilesCopySpec
- spec.with srcDistFilteredFilesCopySpec
- }
-
- def zipSources = project.tasks.create( 'zipSources', Zip ) { Zip task ->
- task.group = TaskGroups.DISTRIBUTION
- task.description = 'Assemble .zip source distribution'
- task.baseName = 'apache-polygene-java'
- task.with srcDistCopySpec
- task.classifier = 'src'
- }
- def tarSources = project.tasks.create( 'tarSources', Tar ) { Tar task ->
- task.group = TaskGroups.DISTRIBUTION
- task.description = 'Assemble .tar.gz source distribution'
- task.baseName = 'apache-polygene-java'
- task.with srcDistCopySpec
- task.compression = Compression.GZIP
- task.classifier = 'src'
- }
- project.artifacts.add( 'archives', zipSources )
- project.artifacts.add( 'archives', tarSources )
-
- project.tasks.create( TaskNames.UNPACK_SOURCE_DIST, Copy ) { Copy task ->
- task.group = TaskGroups.DISTRIBUTION
- task.description = "Unpack source distribution"
- task.with srcDistCopySpec
- task.into 'build/unpacked-distributions/src'
- }
-
- def unpackedSrcDistDir = project.file( "build/unpacked-distributions/src/apache-polygene-java-$project.version-src" )
- project.tasks.create( TaskNames.CHECK_SOURCE_DIST, GradleBuild.class, { GradleBuild task ->
- task.group = TaskGroups.DISTRIBUTION_VERIFICATION
- task.description = "Check the source distribution by running the 'check' and 'assemble' tasks inside"
- task.dependsOn TaskNames.UNPACK_SOURCE_DIST
- task.buildFile = "$unpackedSrcDistDir/build.gradle"
- task.tasks = [ 'check', 'assemble' ]
- } as Action<GradleBuild> )
- }
-
- private static void configureBinaryDistribution( Project project )
- {
- configureGoOfflineHelpers( project )
-
- def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
- def reportsDistCopySpec = project.copySpec { CopySpec spec ->
- spec.from "$project.buildDir/reports"
- spec.into 'docs/reports'
- }
- def docsCopySpec = project.copySpec { CopySpec spec ->
- spec.from 'build/docs'
- spec.from 'manual/build/docs/website'
- spec.into 'docs'
- }
- def runtimeDependenciesListCopySpec = project.copySpec { CopySpec spec ->
- releaseSpec.approvedProjects.collect { p ->
- spec.into( 'libs/' ) { CopySpec sub ->
- sub.from "$p.buildDir/reports/project/dependencies.txt"
- sub.rename 'dependencies.txt', "${ p.name }-${ p.version }-runtime-deps.txt"
- }
- }
- spec.into( '.' ) { CopySpec sub ->
- sub.from project.tasks.getByName( TaskNames.GENERATE_MAVEN_OFFLINE_HELPERS ).outputs
- sub.from project.tasks.getByName( TaskNames.GENERATE_GRADLE_OFFLINE_HELPERS ).outputs
- }
- }
- def libsCopySpec = project.copySpec { CopySpec spec ->
- releaseSpec.approvedProjects.collect { proj ->
- spec.into( 'libs/' ) { CopySpec sub ->
- sub.from proj.configurations.getByName( 'archives' ).artifacts.files
- sub.exclude '**-testsources.jar'
- sub.exclude '**/*.asc'
- }
- }
- }
- def extraDistTextCopySpec = project.copySpec { CopySpec spec ->
- releaseSpec.approvedProjects.collect { p ->
- spec.from project.fileTree( dir: "$p.projectDir/src/dist/", include: '**', exclude: "**/*.jar*" )
- spec.eachFile { FileCopyDetails fcd ->
- fcd.filter( ReplaceTokens, tokens: [ version: project.version ] )
- }
- }
- spec.into '.'
- }
- def extraDistBinCopySpec = project.copySpec { CopySpec spec ->
- releaseSpec.approvedProjects.collect { p ->
- spec.from "$p.projectDir/src/dist/"
- spec.include '**/*.jar'
- spec.include '**/*.jar_'
- }
- spec.into '.'
- }
- def binDistNoticesCopySpec = project.copySpec { CopySpec spec ->
- spec.from "$project.projectDir/LICENSE.txt"
- spec.from "$project.projectDir/src/bin-dist"
- spec.into '.'
- }
- def binDistImage = project.copySpec { CopySpec spec ->
- spec.into "apache-polygene-java-$project.version-bin"
- spec.with binDistNoticesCopySpec
- spec.with docsCopySpec
- spec.with reportsDistCopySpec
- spec.with runtimeDependenciesListCopySpec
- spec.with extraDistTextCopySpec
- spec.with extraDistBinCopySpec
- spec.with libsCopySpec
- }
-
- def zipBinaries = project.tasks.create( 'zipBinaries', Zip ) { Zip task ->
- task.group = TaskGroups.DISTRIBUTION
- task.description = 'Assemble .zip binary distribution'
- task.dependsOn project.tasks.getByName( RootProjectPlugin.TaskNames.BUILD_ALL )
- task.baseName = 'apache-polygene-java'
- task.classifier = 'bin'
- task.with binDistImage
- }
- def tarBinaries = project.tasks.create( 'tarBinaries', Tar ) { Tar task ->
- task.group = TaskGroups.DISTRIBUTION
- task.description = 'Assemble .tar.gz binary distribution'
- task.dependsOn project.tasks.getByName( RootProjectPlugin.TaskNames.BUILD_ALL )
- task.baseName = 'apache-polygene-java'
- task.classifier = 'bin'
- task.compression = Compression.GZIP
- task.with binDistImage
- }
- project.artifacts.add( 'archives', zipBinaries )
- project.artifacts.add( 'archives', tarBinaries )
-
- project.tasks.create( TaskNames.UNPACK_BINARY_DIST, Copy ) { Copy task ->
- task.group = TaskGroups.DISTRIBUTION
- task.description = "Unpack binary distribution"
- task.with binDistImage
- task.into 'build/unpacked-distributions/bin'
- }
-
- configureBinaryDistributionCheck( project )
- }
-
- private static void configureGoOfflineHelpers( Project project )
- {
- def externalRepos = project.rootProject.extensions.getByType( DependenciesDeclarationExtension ).repositoriesUrls
- def approvedProjectsTask = project.tasks.getByName( ReleaseSpecPlugin.TaskNames.RELEASE_APPROVED_PROJECTS )
- def genOfflineMaven = project.tasks.create( TaskNames.GENERATE_MAVEN_OFFLINE_HELPERS,
- GoOfflineHelpersTasks.GenerateMaven )
- def genOfflineGradle = project.tasks.create( TaskNames.GENERATE_GRADLE_OFFLINE_HELPERS,
- GoOfflineHelpersTasks.GenerateGradle )
- genOfflineMaven.repositories = externalRepos
- genOfflineGradle.repositories = externalRepos
- [ genOfflineMaven, genOfflineGradle ].each { task ->
- task.group = TaskGroups.DISTRIBUTION
- task.dependsOn approvedProjectsTask
- }
- def checkOfflineMaven = project.tasks.create( TaskNames.CHECK_MAVEN_OFFLINE_HELPERS,
- GoOfflineHelpersTasks.CheckMaven )
- checkOfflineMaven.group = TaskGroups.DISTRIBUTION_VERIFICATION
- checkOfflineMaven.description = 'Check binary distribution Maven dependencies download helper'
- checkOfflineMaven.dependsOn genOfflineMaven
- def checkOfflineGradle = project.tasks.create( TaskNames.CHECK_GRADLE_OFFLINE_HELPERS,
- GoOfflineHelpersTasks.CheckGradle )
- checkOfflineGradle.group = TaskGroups.DISTRIBUTION_VERIFICATION
- checkOfflineGradle.description = 'Check binary distribution Gradle dependencies download helper'
- checkOfflineGradle.dependsOn genOfflineGradle
- [ checkOfflineMaven, checkOfflineGradle ].each { task ->
- task.group = TaskGroups.DISTRIBUTION_VERIFICATION
- task.dependsOn TaskNames.UNPACK_BINARY_DIST
- }
- }
-
- private static void configureBinaryDistributionCheck( Project project )
- {
- def unpackedBinDistDir = project.file( "build/unpacked-distributions/bin/apache-polygene-java-$project.version-bin" )
- project.tasks.create( TaskNames.CHECK_BINARY_DIST_RAT, RatTask, { RatTask task ->
- task.group = TaskGroups.DISTRIBUTION_VERIFICATION
- task.description = "Checks binary distribution using Apache RAT"
- task.dependsOn TaskNames.UNPACK_BINARY_DIST
- task.inputDir = unpackedBinDistDir.absolutePath
- task.reportDir = project.file( 'build/reports/rat-bin-dist' )
- task.excludes = [
- '.gradle/**',
- 'docs/reports/**',
- 'docs/javadocs/**',
- 'etc/templates/**',
- 'libs/**'
- ]
- } as Action<RatTask> )
- project.tasks.getByName( TaskNames.CHECK_MAVEN_OFFLINE_HELPERS ) { GoOfflineHelpersTasks.CheckMaven task ->
- task.directory = unpackedBinDistDir
- }
- project.tasks.getByName( TaskNames.CHECK_GRADLE_OFFLINE_HELPERS ) { GoOfflineHelpersTasks.CheckGradle task ->
- task.directory = unpackedBinDistDir
- task.mustRunAfter TaskNames.CHECK_MAVEN_OFFLINE_HELPERS
- }
- project.tasks.create( TaskNames.CHECK_BINARY_DIST ) { Task task ->
- task.group = TaskGroups.DISTRIBUTION_VERIFICATION
- task.description = 'Checks binary distribution'
- task.dependsOn TaskNames.CHECK_BINARY_DIST_RAT
- task.dependsOn TaskNames.CHECK_MAVEN_OFFLINE_HELPERS
- task.dependsOn TaskNames.CHECK_GRADLE_OFFLINE_HELPERS
- }
- }
-
- @CompileStatic( TypeCheckingMode.SKIP )
- private static void configureDistributionChecksums( Project project )
- {
- project.tasks.withType( Zip ) { Zip task ->
- task.doLast {
- project.ant.checksum file: task.archivePath, algorithm: 'MD5'
- project.ant.checksum file: task.archivePath, algorithm: 'SHA-512'
- }
- }
- project.tasks.withType( Tar ) { Tar task ->
- task.doLast {
- project.ant.checksum file: task.archivePath, algorithm: 'MD5'
- project.ant.checksum file: task.archivePath, algorithm: 'SHA-512'
- }
- }
- }
-
- private static void configureHelperTasks( Project project )
- {
- project.tasks.create( 'dist', Copy ) { Copy task ->
- task.group = TaskGroups.DISTRIBUTION
- task.description = "Assembles source and binary distributions"
- task.dependsOn 'install'
- task.from project.tasks.getByName( 'unpackBinDist' )
- task.into "$project.buildDir/dist"
- }
- project.tasks.create( 'checkDists' ) { Task task ->
- task.group = TaskGroups.DISTRIBUTION_VERIFICATION
- task.description = "Checks source and binary distributions"
- task.dependsOn TaskNames.CHECK_SOURCE_DIST, TaskNames.CHECK_BINARY_DIST
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/GoOfflineHelpersTasks.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/GoOfflineHelpersTasks.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/GoOfflineHelpersTasks.groovy
deleted file mode 100644
index 415a0bb..0000000
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/GoOfflineHelpersTasks.groovy
+++ /dev/null
@@ -1,345 +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.dist
-
-import groovy.transform.CompileStatic
-import org.apache.polygene.gradle.release.ReleaseSpecExtension
-import org.apache.polygene.gradle.tasks.ExecLogged
-import org.gradle.api.DefaultTask
-import org.gradle.api.GradleException
-import org.gradle.api.Project
-import org.gradle.api.artifacts.Dependency
-import org.gradle.api.artifacts.ProjectDependency
-import org.gradle.api.artifacts.result.ResolvedComponentResult
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputFile
-import org.gradle.api.tasks.Internal
-import org.gradle.api.tasks.OutputFile
-import org.gradle.api.tasks.TaskAction
-import org.gradle.process.ExecSpec
-
-/**
- * Tasks to generate and check go-offline maven and gradle helpers bundled with the binary distribution.
- */
-@CompileStatic
-interface GoOfflineHelpersTasks
-{
- class GenerateMaven extends DefaultTask
- {
- static final String POM_FILENAME = 'go-offline.pom'
-
- @Input
- Map<String, String> repositories = [ : ]
-
- @Internal
- File outputDir = new File( project.buildDir, 'go-offline-helpers' )
-
- @OutputFile
- File getMavenGoOfflineHelper()
- {
- return new File( outputDir, POM_FILENAME )
- }
-
- GenerateMaven()
- {
- super();
- outputs.upToDateWhen { false }
- }
-
- @TaskAction
- void generate()
- {
- outputDir.mkdirs()
- def components = Utils.resolveAllRuntimeComponents( project )
- def maven = generateMaven( components )
- mavenGoOfflineHelper.text = maven
- }
-
- private String generateMaven( Set<ResolvedComponentResult> components )
- {
- def pom = Utils.licenseHeader( project.file( 'etc/header.txt' ).text, 'xml' )
- pom += '<project>\n <modelVersion>4.0.0</modelVersion>\n'
- pom +=
- " <groupId>org.apache.polygene</groupId>\n <artifactId>go-offline-helper</artifactId>\n <version>$project.version</version>\n"
- pom += ' <packaging>pom</packaging>\n'
- pom +=
- ' <!--\n This pom has the sole purpose of downloading all dependencies in a directory relative to this file named \'dependencies\'.\n'
- pom += " Use the following command:\n\n mvn -f $POM_FILENAME validate\n -->\n <repositories>\n"
- repositories.entrySet().each { repo ->
- pom += " <repository><id>go-offline-repo-$repo.key</id><url>${ repo.value }</url></repository>\n"
- }
- pom += ' </repositories>\n <dependencies>\n'
- components.each { comp ->
- pom += ' <dependency>\n'
- pom += " <groupId>$comp.moduleVersion.group</groupId>\n"
- pom += " <artifactId>$comp.moduleVersion.name</artifactId>\n"
- pom += " <version>$comp.moduleVersion.version</version>\n"
- pom += ' </dependency>\n'
- }
- pom += """ </dependencies>\n <build><plugins><plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.10</version>
- <executions>
- <execution>
- <id>go-offline-jars</id><phase>validate</phase>
- <goals><goal>copy-dependencies</goal></goals>
- <configuration>
- <outputDirectory>\${project.basedir}/dependencies</outputDirectory>
- <excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- <execution>
- <id>go-offline-sources</id><phase>validate</phase>
- <goals><goal>copy-dependencies</goal></goals>
- <configuration>
- <classifier>sources</classifier><failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
- <outputDirectory>\${project.basedir}/dependencies</outputDirectory>
- <excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- <execution>
- <id>go-offline-javadocs</id><phase>validate</phase>
- <goals><goal>copy-dependencies</goal></goals>
- <configuration>
- <classifier>javadoc</classifier><failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
- <outputDirectory>\${project.basedir}/dependencies</outputDirectory>
- <excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- </executions>
- </plugin></plugins></build>
-</project>
-"""
- return pom
- }
- }
-
- class GenerateGradle extends DefaultTask
- {
- static final String BUILD_SCRIPT_FILENAME = 'go-offline.gradle'
-
- @Input
- Map<String, String> repositories = [ : ]
-
- @Internal
- File outputDir = new File( project.buildDir, 'go-offline-helpers' )
-
- @OutputFile
- File getGradleGoOfflineHelper()
- {
- return new File( outputDir, BUILD_SCRIPT_FILENAME )
- }
-
- GenerateGradle()
- {
- super();
- outputs.upToDateWhen { false }
- }
-
- @TaskAction
- void generate()
- {
- outputDir.mkdirs()
- def components = Utils.resolveAllRuntimeComponents( project )
- def gradle = generateGradle( components )
- gradleGoOfflineHelper.text = gradle
- }
-
- private String generateGradle( Set<ResolvedComponentResult> components )
- {
- def build = Utils.licenseHeader( project.file( 'etc/header.txt' ).text, 'java' )
- build += '// This gradle build file has the sole purpose of downloading all dependencies in a directory\n'
- build += '// relative to this file named \'dependencies\'.\n'
- build += "// Use the following command: gradle -b $BUILD_SCRIPT_FILENAME download\n"
- build += 'apply plugin: \'java\'\nconfigurations { download }\nrepositories {\n'
- repositories.entrySet().each { repo ->
- build += " maven { url '${ repo.value }' }\n"
- }
- build += '}\ndependencies {\n'
- components.each { comp ->
- def depCoords = "${ comp.moduleVersion.group }:${ comp.moduleVersion.name }:${ comp.moduleVersion.version }"
- build += " download( '$depCoords' ) { transitive = false }\n"
- }
- build += """}
-task download( type: Copy ) {
- outputs.upToDateWhen { false }
- def sources = configurations.download.resolvedConfiguration.resolvedArtifacts.collect { artifact ->
- project.dependencies.create( [ group: artifact.moduleVersion.id.group, name: artifact.moduleVersion.id.name, version: artifact.moduleVersion.id.version, classifier: 'sources' ] )
- }
- def javadocs = configurations.download.resolvedConfiguration.resolvedArtifacts.collect { artifact ->
- project.dependencies.create( [ group: artifact.moduleVersion.id.group, name: artifact.moduleVersion.id.name, version: artifact.moduleVersion.id.version, classifier: 'javadoc' ] )
- }
- from configurations.download
- from configurations.detachedConfiguration( sources as Dependency[] ).resolvedConfiguration.lenientConfiguration.getFiles( Specs.SATISFIES_ALL )
- from configurations.detachedConfiguration( javadocs as Dependency[] ).resolvedConfiguration.lenientConfiguration.getFiles( Specs.SATISFIES_ALL )
- into file( 'dependencies/' )
-}
-"""
- return build
- }
- }
-
- class CheckMaven extends DefaultTask
- {
- @Internal
- File directory
-
- @InputFile
- File getMavenGoOfflineHelper()
- {
- return new File( directory, GenerateMaven.POM_FILENAME )
- }
-
- CheckMaven()
- {
- super();
- description = 'Check the binary distribution Maven go-offline helper'
- outputs.upToDateWhen { false }
- onlyIf { Utils.isMvnInstalled() }
- }
-
- @TaskAction
- void check()
- {
- def dependenciesDir = new File( directory, 'dependencies' )
- project.delete dependenciesDir
- def outLog = project.file( "$project.buildDir/tmp/$name/stdout.log" )
- def errLog = project.file( "$project.buildDir/tmp/$name/stderr.log" )
- def command = [ 'mvn', '-e', '-f', GenerateMaven.POM_FILENAME, 'validate' ] as Object[]
- ExecLogged.execLogged( project, outLog, errLog ) { ExecSpec spec ->
- spec.workingDir directory
- spec.commandLine command
- }
- Utils.checkAllJarsArePresent( project, dependenciesDir, GenerateMaven.POM_FILENAME )
- }
- }
-
- class CheckGradle extends DefaultTask
- {
- @Internal
- File directory
-
- @InputFile
- File getGradleGoOfflineHelper()
- {
- return new File( directory, GenerateGradle.BUILD_SCRIPT_FILENAME )
- }
-
- CheckGradle()
- {
- super();
- description = 'Check the binary distribution Gradle go-offline helper'
- outputs.upToDateWhen { false }
- }
-
- @TaskAction
- void check()
- {
- def buildScript = new File( directory, GenerateGradle.BUILD_SCRIPT_FILENAME )
- def dependenciesDir = new File( directory, 'dependencies' )
- project.delete dependenciesDir
- def outLog = project.file( "$project.buildDir/tmp/$name/stdout.log" )
- def errLog = project.file( "$project.buildDir/tmp/$name/stderr.log" )
- ExecLogged.execLogged( project, outLog, errLog ) { ExecSpec spec ->
- spec.workingDir project.projectDir
- spec.commandLine './gradlew', '-u', '-s', '-b', buildScript.absolutePath, 'download'
- }
- Utils.checkAllJarsArePresent( project, dependenciesDir, GenerateGradle.BUILD_SCRIPT_FILENAME )
- }
- }
-
- static class Utils
- {
- // Do the global dependency resolution here so there won't be any surprise when using the helpers
- // This also allow to apply the resolution strategy defined in libraries.gradle
- // WARN some of our modules depends on != versions of some artifacts, this resolution flatten this using the most up to date
- private static Set<ResolvedComponentResult> resolveAllRuntimeComponents( Project rootProject )
- {
- def allRuntimeDeps = getAllRuntimeDependencies( rootProject )
- def configuration = rootProject.configurations.findByName( 'goOfflineHelpers' )
- if( !configuration )
- {
- configuration = rootProject.configurations.create( 'goOfflineHelpers' )
- allRuntimeDeps.each { set -> rootProject.dependencies.add( configuration.name, set ) }
- }
- return configuration.incoming.resolutionResult.allComponents.findAll { ResolvedComponentResult comp ->
- !comp.moduleVersion.group.startsWith( 'org.apache.polygene' )
- } as Set<ResolvedComponentResult>
- }
-
- private static List<Dependency> getAllRuntimeDependencies( Project rootProject )
- {
- def releaseSpec = rootProject.extensions.getByType( ReleaseSpecExtension )
- def allDependencies = releaseSpec.approvedProjects.collect { project ->
- project.configurations.getByName( 'runtime' ).allDependencies
- }.flatten() as List<Dependency>
- return allDependencies.findAll { Dependency dep ->
- !( dep instanceof ProjectDependency ) && dep.name != null && !dep.group.startsWith( 'org.apache.polygene' )
- }
- }
-
- private static void checkAllJarsArePresent( Project rootProject, File dependenciesDir, String helper )
- {
- def allDependencies = getAllRuntimeDependencies( rootProject )
- allDependencies.each { Dependency dep ->
- def jarName = "${ dep.name }-${ dep.version }.jar"
- def jarFile = new File( dependenciesDir, jarName )
- if( !jarFile.exists() )
- {
- throw new GradleException( "Binary distribution $helper failed!\n" +
- "\tMissing: $dep\n" +
- "\tin $jarFile" );
- }
- }
- }
-
- private static boolean isMvnInstalled()
- {
- def pathDirs = System.getenv( 'PATH' ).split( File.pathSeparator )
- def flattened = pathDirs.collect( { String pathDir -> new File( pathDir, 'mvn' ) } ).flatten() as List<File>
- return flattened.find( { File pathDir -> pathDir.isFile() } ) != null
- }
-
- // Generate license headers with comment styles
- private static String licenseHeader( String base, String flavour )
- {
- def header
- switch( flavour )
- {
- case 'java': case 'groovy': case 'js':
- header = licenseHeader_wrap( base, '/*', ' * ', ' */' ); break
- case 'xml': case 'html':
- header = licenseHeader_wrap( base, '<!--', ' ', '-->' ); break
- case 'txt': case 'shell': case 'python': case 'ruby':
- header = licenseHeader_wrap( base, null, '# ', null ); break
- case 'adoc': case 'asciidoc':
- header = licenseHeader_wrap( base, null, '// ', null ); break
- default:
- header = base
- }
- header
- }
-
- private static String licenseHeader_wrap( String base, String top, String left, String bottom )
- {
- ( top ? "$top\n" : '' ) + base.readLines().collect { "${ left }${ it }" }.join( '\n' ) + '\n' +
- ( bottom ? "$bottom\n" : '' )
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/AsciidocBuildInfoPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/AsciidocBuildInfoPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/AsciidocBuildInfoPlugin.groovy
deleted file mode 100644
index f8edcfb..0000000
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/AsciidocBuildInfoPlugin.groovy
+++ /dev/null
@@ -1,60 +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.doc
-
-import groovy.transform.CompileStatic
-import org.apache.polygene.gradle.TaskGroups
-import org.gradle.api.Project
-import org.gradle.api.Plugin
-
-@CompileStatic
-class AsciidocBuildInfoPlugin implements Plugin<Project>
-{
- final static String TASK_NAME = 'makeAsciidocBuildInfo'
-
- def void apply( Project project )
- {
- def buildInfoDir = new File( project.buildDir, "docs/buildinfo" );
-
- def makeAsciidocBuildInfoTask = project.tasks.create( TASK_NAME )
- makeAsciidocBuildInfoTask.group = TaskGroups.DOCUMENTATION
- makeAsciidocBuildInfoTask.description = 'Generates asciidoc artifact snippet'
- makeAsciidocBuildInfoTask.doLast {
- buildInfoDir.mkdirs()
-
- // GroupID, ArtifactID, Version table in artifact.txt
- def artifactTableFile = new File( buildInfoDir, "artifact.txt" )
- def artifactTable = """
- |.Artifact
- |[role="artifact", options="header,autowidth"]
- ||===================================================
- ||Group ID|Artifact ID|Version
- ||${ project.group }|${ project.name }|${ project.version }
- ||===================================================
- """.stripMargin()
- artifactTableFile.withWriter { out -> out.println( artifactTable ) }
- }
-
- // Declare inputs/outputs
- if( project.getBuildFile() != null && project.getBuildFile().exists() )
- {
- makeAsciidocBuildInfoTask.getInputs().file( project.getBuildFile() )
- }
- makeAsciidocBuildInfoTask.getOutputs().file( buildInfoDir )
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
deleted file mode 100644
index 574f081..0000000
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
+++ /dev/null
@@ -1,292 +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.doc
-
-import groovy.io.FileType
-import groovy.transform.CompileStatic
-import groovy.transform.TypeCheckingMode
-import java.security.MessageDigest
-import org.apache.polygene.gradle.PolygeneExtension
-import org.apache.polygene.gradle.release.ReleaseSpecExtension
-import org.apache.polygene.gradle.tasks.ExecLogged
-import org.gradle.api.Action;
-import org.gradle.api.DefaultTask
-import org.gradle.api.file.CopySpec
-import org.gradle.api.tasks.Internal
-import org.gradle.api.tasks.TaskAction
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputDirectory
-import org.gradle.api.tasks.InputFiles
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.process.ExecSpec
-
-// TODO: try to use dependencies for FOP and execute within the same JVM.
-// TODO: move the bulk of resources into this plugin, instead of sitting in the project.
-@CompileStatic
-class DocumentationTask extends DefaultTask
-{
- @Input def String docName
- @Input def String docType
-
- @InputDirectory def File getCommonResourcesDir() { project.file( 'src/resources' ) }
- @InputDirectory def File getConfigDir() { project.file( 'src/conf' ) }
- @InputDirectory def File getDocsDir() { project.file( 'src/docs' ) }
- @InputDirectory def File getSrcMainDir() { project.file( 'src/main' ) }
- @InputDirectory def File getXslDir() { project.file( 'src/xsl' ) }
- @InputDirectory def File getBuildSrcDir() { project.rootProject.file( 'buildSrc/src' ) }
-
- @InputFiles def getSubProjectsDocsDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/docs' ) } }
- @InputFiles def getSubProjectsTestDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/test' ) } }
-
- @OutputDirectory def File getOutputDir() { project.file( "${ project.buildDir }/docs/${ docName }/" ) }
-
- @Internal def File getTempAsciidocDir() { project.file( "${ project.buildDir }/tmp-asciidoc" ) }
- @Internal def File getTempDir() { project.file( "${ project.buildDir }/tmp/docs/${ docName }" ) }
-
- @TaskAction
- def void generate()
- {
- installAsciidocFilters()
-
- [ outputDir, tempAsciidocDir, tempDir ].each { it.deleteDir() }
- [ outputDir, tempAsciidocDir, tempDir ].each { it.mkdirs() }
-
- copySubProjectsDocsResources()
- generateAsciidocAccordingToReleaseSpecification()
- generateXDoc()
- generateChunkedHtml()
- // generateSingleHtml()
- // generatePdf()
- }
-
- def void installAsciidocFilters()
- {
- def digester = MessageDigest.getInstance( 'SHA' )
- def filtersDir = project.rootProject.file( 'buildSrc/src/asciidoc/filters' )
- def userHome = new File( System.getProperty( 'user.home' ) )
- def dotAsciidocFiltersDir = new File( userHome, '.asciidoc/filters' )
- def installSnippets = false
- filtersDir.eachFileRecurse( FileType.FILES ) { originalFile ->
- def targetFile = new File( dotAsciidocFiltersDir,
- ( originalFile.toURI() as String ) - ( filtersDir.toURI() as String ) )
- if( !targetFile.exists() )
- {
- installSnippets = true
- }
- else
- {
- def originalDigest = digester.digest( originalFile.bytes )
- def targetDigest = digester.digest( targetFile.bytes )
- if( originalDigest != targetDigest )
- {
- installSnippets = true
- }
- }
- }
- if( installSnippets )
- {
- dotAsciidocFiltersDir.mkdirs()
- project.rootProject.copy { CopySpec spec ->
- spec.from filtersDir
- spec.into dotAsciidocFiltersDir
- }
- dotAsciidocFiltersDir.eachFileRecurse( FileType.FILES ) { file ->
- if( file.name.endsWith( '.py' ) )
- {
- chmod( file, '755' )
- }
- }
- println "Polygene Asciidoc Filters Installed!"
- }
- }
-
- @CompileStatic( TypeCheckingMode.SKIP )
- def void chmod( File file, String permissions )
- {
- ant.chmod( file: file.absolutePath, perm: permissions )
- }
-
- def void copySubProjectsDocsResources()
- {
- project.rootProject.subprojects.each { p ->
- p.copy { CopySpec spec ->
- spec.from p.file( 'src/docs/resources' )
- spec.into outputDir
- spec.include '**'
- }
- }
- }
-
- def void generateAsciidocAccordingToReleaseSpecification()
- {
- def polygene = project.extensions.getByType( PolygeneExtension )
- project.copy { CopySpec spec ->
- spec.from docsDir
- spec.into tempAsciidocDir
- spec.include '**'
- }
- if( polygene.releaseVersion )
- {
- def licenseFile = new File( tempAsciidocDir, 'userguide/libraries.txt' )
- def extensionsFile = new File( tempAsciidocDir, 'userguide/extensions.txt' )
- def toolsFile = new File( tempAsciidocDir, 'userguide/tools.txt' )
- [ licenseFile, extensionsFile, toolsFile ].each { asciidocFile ->
- def filteredFileContent = ''
- asciidocFile.readLines().each { line ->
- if( line.startsWith( 'include::' ) )
- {
- def approved = false
- def releaseApprovedProjects = project.rootProject.extensions.
- getByType( ReleaseSpecExtension ).approvedProjects
- releaseApprovedProjects.collect { it.projectDir }.each { approvedProjectDir ->
- if( line.contains( "${ approvedProjectDir.parentFile.name }/${ approvedProjectDir.name }" ) )
- {
- approved = true
- }
- }
- if( approved )
- {
- filteredFileContent += "$line\n"
- }
- }
- else
- {
- filteredFileContent += "$line\n"
- }
- }
- asciidocFile.text = filteredFileContent
- }
- }
- }
-
- def void generateXDoc()
- {
- def outLog = getLogFile( 'adoc-2-docbook', 'stdout' )
- def errLog = getLogFile( 'adoc-2-docbook', 'stderr' )
- ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
- spec.executable = 'asciidoc'
- spec.workingDir = '..'
- def commonResourcesPath = relativePath( project.rootDir, commonResourcesDir )
- def asciidocConfigPath = relativePath( project.rootDir, new File( configDir, 'asciidoc.conf' ) )
- def docbookConfigPath = relativePath( project.rootDir, new File( configDir, 'docbook45.conf' ) )
- def linkimagesConfigPath = relativePath( project.rootDir, new File( configDir, 'linkedimages.conf' ) )
- def xdocOutputPath = relativePath( project.rootDir, new File( tempDir, 'xdoc-temp.xml' ) )
- def asciidocIndexPath = relativePath( project.rootDir, new File( tempAsciidocDir, "$docName/index.txt" ) )
- spec.args = [
- '--attribute', 'revnumber=' + project.version,
- '--attribute', 'level1=' + ( docType == 'article' ? 1 : 0 ),
- '--attribute', 'level2=' + ( docType == 'article' ? 2 : 1 ),
- '--attribute', 'level3=' + ( docType == 'article' ? 3 : 2 ),
- '--attribute', 'level4=' + ( docType == 'article' ? 4 : 3 ),
- '--attribute', 'importdir=' + commonResourcesPath,
- '--backend', 'docbook',
- '--attribute', 'docinfo1',
- '--doctype', docType,
- '--conf-file=' + asciidocConfigPath,
- '--conf-file=' + docbookConfigPath,
- '--conf-file=' + linkimagesConfigPath,
- '--out-file', xdocOutputPath,
- asciidocIndexPath
- ]
- } as Action<? super ExecSpec> )
- }
-
- def void generateChunkedHtml()
- {
- project.copy { CopySpec spec ->
- spec.from commonResourcesDir
- spec.into outputDir
- spec.include '**'
- }
- project.copy { CopySpec spec ->
- spec.from "$docsDir/$docName/resources"
- spec.into outputDir
- spec.include '**'
- }
- def outLog = getLogFile( 'docbook-2-chunked-html', 'stdout' )
- def errLog = getLogFile( 'docbook-2-chunked-html', 'stderr' )
- ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
- def xsltFile = "$docsDir/$docName/xsl/chunked.xsl"
- def outputPath = relativePath( project.projectDir, outputDir ) + '/'
- spec.executable = 'xsltproc'
- spec.args = [
- '--nonet',
- '--noout',
- '--output', outputPath,
- xsltFile,
- "$tempDir/xdoc-temp.xml"
- ]
- } as Action<? super ExecSpec> )
- }
-
- def void generateSingleHtml()
- {
- def outLog = getLogFile( 'docbook-2-html', 'stdout' )
- def errLog = getLogFile( 'docbook-2-html', 'stderr' )
- ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
- // XML_CATALOG_FILES=
- String xsltFile = "$xslDir/xhtml.xsl"
- spec.executable = 'xsltproc'
- spec.args = [
- '--nonet',
- '--noout',
- '--output', "$outputDir/${ docName }.html",
- xsltFile,
- "$tempDir/xdoc-temp.xml"
- ]
- } as Action<? super ExecSpec> )
- }
-
- def void generatePdf()
- {
- // $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
- def outLog = getLogFile( 'docbook-2-fo', 'stdout' )
- def errLog = getLogFile( 'docbook-2-fo', 'stderr' )
- ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
- String xsltFile = "$xslDir/fo.xsl"
- spec.executable = 'xsltproc'
- spec.args = [
- '--nonet',
- '--output', "$tempDir/${ docName }.fo",
- xsltFile,
- "$tempDir/xdoc-temp.xml"
- ]
- } as Action<? super ExecSpec> )
-
- // $ fop article.fo article.pdf
- outLog = getLogFile( 'fo-2-pdf', 'stdout' )
- errLog = getLogFile( 'fo-2-pdf', 'stderr' )
- ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
- spec.executable = 'fop'
- spec.args = [
- "$tempDir/${ docName }.fo",
- "$outputDir/${ docName }.pdf"
- ]
- } as Action<? super ExecSpec> )
- }
-
- private File getLogFile( String step, String stream )
- {
- return project.file( "${ project.buildDir }/tmp/${ name }/${ step }-${ stream }.log" )
- }
-
- private static String relativePath( File root, File target )
- {
- new File( root.toURI().relativize( target.toURI() ).toString() ).path
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/de73010f/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
deleted file mode 100644
index 16aff3c..0000000
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
+++ /dev/null
@@ -1,115 +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.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 polygene = 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, polygene ) }
- 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, polygene ) }
- if( polygene.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 { polygene.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, polygene ) }
- }
- }
-
- 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 polygene )
- {
- if( asciidocInstalled == null )
- {
- def skipAsciidocIfAbsent = project.findProperty 'skipAsciidocIfAbsent'
- if( !skipAsciidocIfAbsent && polygene.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/de73010f/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
deleted file mode 100644
index 87c7937..0000000
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
+++ /dev/null
@@ -1,100 +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.doc
-
-import groovy.transform.CompileStatic
-import org.gradle.api.file.EmptyFileVisitor
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.SourceTask
-import org.gradle.api.tasks.OutputDirectory
-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
- File destDir
-
- @Input
- String extension = 'html'
-
- @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( '[.][^\\.]*$', '' )
- 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/de73010f/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
deleted file mode 100644
index 1b676af..0000000
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/performance/PerformanceTestsPlugin.groovy
+++ /dev/null
@@ -1,62 +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.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/de73010f/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
deleted file mode 100644
index 85f9ebd..0000000
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
+++ /dev/null
@@ -1,281 +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.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/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 '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"
- }
- }
- }
- }
- }
-}