Merge branch 'stable-2.9'

* stable-2.9:
  Bash: Deploy plugin archetypes to Maven Central
  Fix documentation of how to publish artifacts to Maven Central
  Buck: Deploy plugin artifacts to Maven Central

Conflicts:
	.gitignore

Change-Id: I72aca7e13b55fbbe34bbf00d799a8a05dc96a955
This commit is contained in:
David Pursehouse 2014-05-27 09:58:38 +09:00
commit be108a3530
11 changed files with 234 additions and 87 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@
*.pyc
/gwt-unitCache
*.swp
*.asc

View File

@ -135,34 +135,12 @@ Install {extension,plugin,gwt}-api to the local maven repository:
buck build api_install
----
Deploy {extension,plugin,gwt}-api to the remote maven repository:
----
buck build api_deploy
----
Install gerrit.war to the local maven repository:
----
buck build war_install
----
Deploy gerrit.war to the remote maven repository:
----
buck build war_deploy
----
The type of the repo is induced from the Gerrit version name, i.e.
* `2.9-SNAPSHOT`: snapshot repo
* `2.9`: release repo
Deploying to the remote repository still depends on Maven, and the credentials
for the repository need to be
link:dev-release-deploy-config.html#deploy-configuration-settings-xml[
configured in Maven's settings.xml file].
=== Plugins
To build all core plugins:

View File

@ -1,6 +1,48 @@
= Deploy Gerrit Artifacts
Gerrit Artifacts are stored on
[[deploy-configuration-setting-maven-central]]
== Deploy Configuration settings for Maven Central
Gerrit Extension API Jar and the Gerrit Plugin API artifacts are stored on
Maven Central.
Prerequisites: Set up the Sonatype account (see link:https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-2.Signup[Sonatype
Maven Repository Usage Guide]) and put Sonatype user and password in
~/.m2/settings.xml:
----
<server>
<id>sonatype-nexus-staging</id>
<username>USER</username>
<password>PASSWORD</password>
</server>
----
PGP key must be generated and published, see
link:https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven[How
To Generate PGP Signatures With Maven] for details. PGP passphrase can also be
put in ~/.m2/settings.xml:
----
<settings>
<profiles>
<profile>
<id>gpg</id>
<properties>
<gpg.executable>gpg2</gpg.executable>
<gpg.passphrase>mypassphrase</gpg.passphrase>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>gpg</activeProfile>
</activeProfiles>
</settings>
----
It can also be included in the key chain on OS X.
Gerrit Subproject Artifacts are stored on
link:https://developers.google.com/storage/[Google Cloud Storage].
Via the link:https://code.google.com/apis/console/?noredirect[API Console] the
Gerrit maintainers have access to the `Gerrit Code Review` project.

View File

@ -141,29 +141,32 @@ for the Subproject in `/lib/BUCK` to the released version.
==== Publish the Extension and Plugin API Jars
* Make sure you have done the
link:dev-release-deploy-config.html#deploy-configuration-settings-xml[
link:dev-release-deploy-config.html#deploy-configuration-setting-maven-central[
configuration needed for deployment]
* Push the Jars to the storage bucket:
* Push the Jars to the Maven Central:
+
----
buck build api_deploy
----
* Troubleshooting: to see the commands that are execured in Buck build process
environment variable VERBOSE can be set:
+
----
VERBOSE=1 buck build api_deploy
----
[[publish-gerrit-war]]
==== Publish the Gerrit WAR (with Core Plugins)
* The WAR file to upload is `buck-out/gen/release.war`
* Upload WAR to the storage bucket via `https://cloud.google.com/console` (manual via web browser)
* Push the WAR file to the Maven storage bucket:
* Push the WAR to the Maven Central:
+
----
buck build war_deploy
----
[[push-stable]]
==== Push the Stable Branch
@ -293,6 +296,17 @@ included in the next Gerrit release. Update the Gerrit version in the
for review and get it merged.
[[publish-plugins-archetypes-to-maven-central]]
=== Publish plugin archetypes to Maven Central
Make sure you have done the
link:dev-release-deploy-config.html#deploy-configuration-setting-maven-central[
configuration needed for deployment]
----
./tools/plugin_archetype_deploy.sh
----
[[merge-stable]]
=== Merge `stable` into `master`

59
gerrit-war/pom.xml Normal file
View File

@ -0,0 +1,59 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-war</artifactId>
<version>2.9-SNAPSHOT</version>
<packaging>war</packaging>
<name>Gerrit Code Review - WAR</name>
<description>Gerrit WAR</description>
<url>http://code.google.com/p/gerrit/</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://gerrit.googlesource.com/gerrit</url>
<connection>https://gerrit.googlesource.com/gerrit</connection>
</scm>
<developers>
<developer>
<name>Dave Borowitz</name>
</developer>
<developer>
<name>David Pursehouse</name>
</developer>
<developer>
<name>Edwin Kempin</name>
</developer>
<developer>
<name>Martin Fick</name>
</developer>
<developer>
<name>Saša Živkov</name>
</developer>
<developer>
<name>Shawn Pearce</name>
</developer>
</developers>
<mailingLists>
<mailingList>
<name>Repo and Gerrit Discussion</name>
<post>repo-discuss@googlegroups.com</post>
<subscribe>https://groups.google.com/forum/#!forum/repo-discuss</subscribe>
<unsubscribe>https://groups.google.com/forum/#!forum/repo-discuss</unsubscribe>
<archive>https://groups.google.com/forum/#!forum/repo-discuss</archive>
</mailingList>
</mailingLists>
<issueManagement>
<url>http://code.google.com/p/gerrit/issues/list</url>
<system>Google Code Issue Tracker</system>
</issueManagement>
</project>

View File

@ -1,11 +1,13 @@
include_defs('//VERSION')
include_defs('//tools/maven/package.defs')
TYPE = 'snapshot' if GERRIT_VERSION.endswith('-SNAPSHOT') else 'release'
URL = 'https://oss.sonatype.org/content/repositories/snapshots' \
if GERRIT_VERSION.endswith('-SNAPSHOT') else \
'https://oss.sonatype.org/service/local/staging/deploy/maven2'
maven_package(
repository = 'gerrit-api-repository',
url = 'gs://gerrit-api/%s' % TYPE,
repository = 'sonatype-nexus-staging',
url = URL,
version = GERRIT_VERSION,
jar = {
'gerrit-extension-api': '//gerrit-extension-api:extension-api',

View File

@ -1,29 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gerrit</groupId>
<artifactId>Gerrit-Code-Review-Maven</artifactId>
<version>1</version>
<distributionManagement>
<repository>
<id>gerrit-api-repository</id>
<name>Gerrit API Repository</name>
<url>gs://gerrit-api</url>
<uniqueVersion>true</uniqueVersion>
</repository>
</distributionManagement>
<build>
<extensions>
<extension>
<groupId>com.googlesource.gerrit</groupId>
<artifactId>gs-maven-wagon</artifactId>
<version>3.3</version>
</extension>
</extensions>
</build>
<pluginRepositories>
<pluginRepository>
<id>gerrit-maven-repository</id>
<url>https://gerrit-maven.storage.googleapis.com/</url>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -1,6 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gerrit</groupId>
<artifactId>Gerrit-Code-Review-Maven</artifactId>
<version>1</version>
</project>

View File

@ -15,14 +15,11 @@
from __future__ import print_function
from optparse import OptionParser
from os import path
from os import path, environ
from sys import stderr
from tools.util import check_output
def mvn(action):
return ['mvn', '--file', path.join(self, 'fake_pom_%s.xml' % action)]
opts = OptionParser()
opts.add_option('--repository', help='maven repository id')
opts.add_option('--url', help='maven repository url')
@ -36,33 +33,38 @@ if not args.v:
print('version is empty', file=stderr)
exit(1)
common = [
'-DgroupId=com.google.gerrit',
'-Dversion=%s' % args.v,
]
self = path.dirname(path.abspath(__file__))
root = path.abspath(__file__)
for _ in range(0, 3):
root = path.dirname(root)
if 'install' == args.a:
cmd = mvn(args.a) + ['install:install-file'] + common
cmd = [
'mvn',
'install:install-file',
'-Dversion=%s' % args.v,
]
elif 'deploy' == args.a:
cmd = mvn(args.a) + [
'deploy:deploy-file',
cmd = [
'mvn',
'gpg:sign-and-deploy-file',
'-DrepositoryId=%s' % args.repository,
'-Durl=%s' % args.url,
] + common
]
else:
print("unknown action -a %s" % args.a, file=stderr)
exit(1)
for spec in args.s:
artifact, packaging_type, src = spec.split(':')
exe = cmd + [
'-DpomFile=%s' % path.join(root, '%s/pom.xml' % artifact),
'-Dpackaging=%s' % packaging_type,
'-Dfile=%s' % src,
]
try:
check_output(cmd + [
'-DartifactId=%s' % artifact,
'-Dpackaging=%s' % packaging_type,
'-Dfile=%s' % src,
])
if environ.get('VERBOSE'):
print(' '.join(exe), file=stderr)
check_output(exe)
except Exception as e:
print('%s command failed: %s' % (args.a, e), file=stderr)
exit(1)

View File

@ -0,0 +1,83 @@
#!/bin/bash
# Copyright (C) 2014 The Android Open Source Project
#
# Licensed 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.
help()
{
cat <<'eof'
Usage: plugin_archetype_deploy [option]
Deploys Gerrit plugin Maven archetypes to Maven Central
Valid options:
--help show this message
--dry-run don't execute commands, just print them
eof
exit
}
function getver
{
grep "$1" $root/VERSION | sed "s/.*'\(.*\)'/\1/"
}
function instroot
{
bindir=${0%/*}
case $bindir in
./*) bindir=$PWD/$bindir ;;
esac
cd $bindir/..
pwd
}
function doIt
{
case $dryRun in
true) echo "$@" ;;
*) "$@" ;;
esac
}
function build_and_deploy
{
module=${PWD##*/}
doIt mvn package gpg:sign-and-deploy-file \
-Durl=$url \
-DrepositoryId=sonatype-nexus-staging \
-DpomFile=pom.xml \
-Dfile=target/$module-$ver.jar
}
while [ $# -gt 0 ]; do
test "$1" == --dry-run && dryRun=true
test "$1" == --help && help
shift
done
root=$(instroot)
cd "$root"
ver=$(getver GERRIT_VERSION)
[[ $ver == *-SNAPSHOT ]] \
&& url="https://oss.sonatype.org/content/repositories/snapshots" \
|| url="https://oss.sonatype.org/service/local/staging/deploy/maven2"
for d in gerrit-plugin-archetype \
gerrit-plugin-js-archetype \
gerrit-plugin-gwt-archetype ; do
(cd "$d"; build_and_deploy)
done

View File

@ -32,7 +32,8 @@ pattern = re.compile(r'(\s*)<version>[-.\w]+</version>')
for project in ['gerrit-extension-api', 'gerrit-plugin-api',
'gerrit-plugin-archetype', 'gerrit-plugin-gwt-archetype',
'gerrit-plugin-gwtui', 'gerrit-plugin-js-archetype']:
'gerrit-plugin-gwtui', 'gerrit-plugin-js-archetype',
'gerrit-war']:
pom = os.path.join(project, 'pom.xml')
try:
outxml = ""