/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /** * Gradle script used to perform Ace releases (really similar to Apache Ace build.gradle) */ import aQute.bnd.build.Workspace // Our release number, which has to be monotonically incremented each time we make a new release. version = '2.1.0' // Base name for release archives Full name will be ${archivesBaseName}-${version}-${classifier} (e.g. apache-ace-2.0.1-src) archivesBaseName = "apache-ace" // Our Apache svn Staging repo ext.svnStagingPath = "https://dist.apache.org/repos/dist/dev/ace" // Our Apache svn Release repo ext.svnReleasePath = "https://dist.apache.org/repos/dist/release/ace" apply plugin: 'java' apply from: file("rat.gradle") // Configure RAT plugin to ignore some files rat { excludes = [ '.git/**', '.gradle/**', '.metadata/**', 'org.apache.ace.client.repository/test/*.txt', 'org.apache.ace.client.repository/test/*.xml', 'org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/styles.css', '**/.project', '**/.classpath', '**/.settings/**', '**/.recommenders/**', '**/*.iml', '**/*.iws', '**/*.ipr', '**/build.xml', '**/DEPENDENCIES', '**/README*', '**/.gitignore', '**/generated/**', '**/packageinfo', '**/bundle-cache/**', '**/test-output/**', '**/store/**', '**/bin_test/**', '**/bin/**', 'cnf/**', 'gradle/wrapper/**', 'gradle.properties', 'gradlew', 'gradlew.bat', 'rat-report.xml', ] } // Setup the workspace Workspace workspace workspace = Workspace.getWorkspace(".") task stageSrc(type: Zip) { description = 'Create a source archive in the local staging folder' classifier = 'src' destinationDir = file('staging') with([ // LICENSE, NOTICE, README copySpec { from 'resources/src' }, copySpec { from '..' include('*/.project', '*/.classpath', '*/.settings/**', '*/src/**', '*/test/**', '*/resources/**', '*/*.bnd', '*/*.bndrun', 'run-*/conf/**', 'cnf/ext/**', 'cnf/gradle/*.gradle', 'build.gradle', 'settings.gradle', 'gradle.properties') } ] as CopySpec[]) into "${archivesBaseName}-${version}-src" } task stageDeps(type: Zip) { description = 'Create a deps archive in the local staging folder' classifier = 'deps' destinationDir = file('staging') with([ // LICENSE, NOTICE, README copySpec { from 'resources/deps' }, copySpec { from '..' include('cnf/buildrepo/**', 'cnf/localrepo/**', 'cnf/releaserepo/**', 'cnf/lib/**', 'cnf/plugins/**', 'cnf/gradle/*.jar', 'gradle/**', 'gradlew', 'gradlew.bat') } ] as CopySpec[]); into "${archivesBaseName}-${version}-src" } def aceLauncherCopySpec = copySpec { from '../org.apache.ace.agent.launcher/generated/org.apache.ace.agent.launcher.felix.jar' rename('org.apache.ace.agent.launcher.felix.jar', 'ace-launcher.jar') } def obrContentsCopySpec = [ aceLauncherCopySpec, copySpec { from '../cnf/localrepo/org.apache.felix.deployment.rp.autoconf/org.apache.felix.deployment.rp.autoconf-0.1.8.jar' } ] as CopySpec[]; task stageBin(type: Zip) { description = 'Create a binary release archive in the local staging folder' classifier = 'bin' destinationDir = file('staging') with([ // LICENSE, NOTICE, README copySpec { from 'resources/bin' }, // server-allinone copySpec { from '../run-server-allinone/generated/distributions/executable/server-allinone.jar' into 'server-allinone' }, copySpec { from '../run-server-allinone/conf' into 'server-allinone/conf' }, copySpec { with obrContentsCopySpec into 'server-allinone/store' }, // server copySpec { from '../run-server/generated/distributions/executable/server.jar' into 'server' }, copySpec { from '../run-server/conf' into 'server/conf' }, // relay copySpec { from '../run-relay/generated/distributions/executable/relay.jar' into 'relay' }, copySpec { from '../run-relay/conf' into 'relay/conf' }, // client copySpec { from '../run-client/generated/distributions/executable/client.jar' into 'client' }, copySpec { from '../run-client/conf' into 'client/conf' }, // obr copySpec { from '../run-obr/generated/distributions/executable/obr.jar' into 'obr' }, copySpec { from '../run-obr/conf' into 'obr/conf' }, copySpec { with obrContentsCopySpec into 'obr/store' }, //target copySpec { from '../run-target/conf' into 'target/conf' }, copySpec { from '../run-target/scripts' into 'target/bin' }, copySpec { with aceLauncherCopySpec into 'target/bin' } ] as CopySpec[]) into "${archivesBaseName}-${version}" } task stageMaven(type: Zip) { description = 'Create an archive in the local staging folder containing artifacts that can be uploaded to a maven repo' classifier = 'maven' destinationDir = file('staging') with([ // LICENSE, NOTICE, README copySpec { from 'resources/bin' }, // agent copySpec { from '../org.apache.ace.agent/generated' into 'org.apache.ace.agent' include('org.apache.ace.agent.pom', 'org.apache.ace.agent.jar', 'org.apache.ace.agent-sources.jar', 'org.apache.ace.agent-javadoc.jar') } ] as CopySpec[]); into "${archivesBaseName}-${version}-maven" } task signStaging() { description = 'Signs the local staging distribution.' dependsOn = ['stageSrc', 'stageDeps', 'stageBin', 'stageMaven'] doLast { fileTree("staging").visit { FileVisitDetails details -> logger.lifecycle(" Signing " + details.file.path) ant.exec(executable: 'gpg', dir: 'staging') { ant.arg(line: '--armor') ant.arg(line: '--output') ant.arg(line: details.file.name + ".asc") ant.arg(line: "--detach-sig") ant.arg(line: details.file.name) } ant.exec(executable: 'gpg', dir: 'staging', output: "staging/" + details.file.name + ".md5") { ant.arg(line: '--print-md') ant.arg(line: 'MD5') ant.arg(line: details.file.name) } ant.exec(executable: 'gpg', dir: 'staging', output: "staging/" + details.file.name + ".sha") { ant.arg(line: '--print-md') ant.arg(line: 'SHA512') ant.arg(line: details.file.name) } } } } task makeStaging() { description = 'Stage new release' group = 'release' dependsOn = ['signStaging'] } task commitToStaging() { description = 'Commits the local staging to the Apache svn staging repository.' group = 'release' doLast { getProject().exec { commandLine 'svn', 'import', 'staging', svnStagingPath + "/${archivesBaseName}-${version}" + "/", '-m', "Staging Apache Ace release ${version}." } } } task promoteToRelease() { description = 'Moves the staging repository to the Apache release repository.' group = 'release' doLast { // Move all artifacts from the staging repo to the release repo getProject().exec { commandLine 'svn', 'move', svnStagingPath + "/${archivesBaseName}-${version}" , svnReleasePath, '-m', "Releasing Apache Ace release ${version}." } } } task deleteFromStaging() { description = 'Cancels the staged distribution from the Apache staging repository.' group = 'release' doLast { getProject().exec { commandLine 'svn', 'delete', svnStagingPath + "/${archivesBaseName}-${version}/", "-m", "Removing Apache Ace release ${version} from staging." } } } task clean(overwrite: true) << { new File("build/staging").deleteDir() new File("rat-report.xml").delete() } task cleanStaging << { description = 'Clean the local staging directory.' new File("build/staging").deleteDir() new File("build/staging-copy").deleteDir() }