Merge branch 'stable-2.9'

* stable-2.9:
  Release docs: Describe in more details how to publish to Maven Central
  Document more details about the deploy configuration for Maven Central
  ChangeScreen2: Respect user preference for unified diff view

Change-Id: I423c9ce62d3f33d2ecf6c0c8cd2e669c09693976
This commit is contained in:
David Pursehouse
2014-06-04 10:34:02 +09:00
3 changed files with 149 additions and 37 deletions

View File

@@ -3,13 +3,22 @@
[[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.
Some Gerrit artifacts (e.g. the Gerrit WAR file, the Gerrit Plugin API
and the Gerrit Extension API) are published on Maven Central in the
`com.google.gerrit` repository.
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:
To be able to publish artifacts to Maven Central some preparations must
be done:
* Create a Sonatype account as described in the
link:https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-2.Signup[
Sonatype OSS Maven Repository Usage Guide].
+
Sonatype is the company that runs Maven Central and you need a Sonatype
account for uploading artifacts to Maven Central.
* Configure your Sonatype user and password in `~/.m2/settings.xml`:
+
----
<server>
<id>sonatype-nexus-staging</id>
@@ -18,11 +27,30 @@ Maven Repository Usage Guide]) and put Sonatype user and password in
</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:
* Request permissions to upload artifacts to the `com.google.gerrit`
repository on Maven Central:
+
Ask for this permission by adding a comment on the
link:https://issues.sonatype.org/browse/OSSRH-7392[OSSRH-7392] Jira
ticket at Sonatype.
+
The request needs to be approved by someone who already has this
permission by commenting on the same issue.
* Generate and publish a PGP key
+
Generate and publish a PGP key as described in
link:https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven[
How To Generate PGP Signatures With Maven].
+
Please be aware that after publishing your public key it may take a
while until it is visible to the Sonatype server.
+
The PGP key is needed to be able to sign the artifacts before the
upload to Maven Central.
+
The PGP passphrase can be put in `~/.m2/settings.xml`:
+
----
<settings>
<profiles>
@@ -39,9 +67,12 @@ put in ~/.m2/settings.xml:
</activeProfiles>
</settings>
----
+
It can also be included in the key chain on OS X.
[[deploy-configuration-settings-xml]]
== Deploy Configuration in Maven `settings.xml`
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
@@ -57,9 +88,6 @@ Jar.
+
Bucket to store Gerrit Subproject Artifacts (e.g. `gwtjsonrpc` etc.).
[[deploy-configuration-settings-xml]]
== Deploy Configuration in Maven `settings.xml`
To upload artifacts to a bucket the user must authenticate with a
username and password. The username and password need to be retrieved
from the link:https://code.google.com/apis/console/?noredirect[API Console]:

View File

@@ -164,31 +164,121 @@ Commit the changes and create the release tag on the new commit:
** make sure you are signed in with your Gmail account
** manually upload the Gerrit WAR file by using the `Upload` button
[[publish-to-maven-central]]
==== Publish the Gerrit artifacts to Maven Central
* Make sure you have done the
link:dev-release-deploy-config.html#deploy-configuration-setting-maven-central[
configuration] for deploying to Maven Central
* Make sure that the version is updated in the `VERSION` file and in
the `pom.xml` files as described in the link:#update-versions[Update
Versions and Create Release Tag] section.
* Push the WAR to Maven Central:
+
----
buck build war_deploy
----
[[extension-and-plugin-api]]
==== Publish the Extension and Plugin API Jars
* Make sure you have done the
link:dev-release-deploy-config.html#deploy-configuration-setting-maven-central[
configuration needed for deployment]
* Push the Jars to Maven Central:
* Push the plugin artifacts to Maven Central:
+
----
buck build api_deploy
----
* Troubleshooting: to see the commands that are execured in Buck build process
environment variable VERBOSE can be set:
+
For troubleshooting, the environment variable `VERBOSE` can be set. This
prints out the commands that are executed by the Buck build process:
+
----
VERBOSE=1 buck build api_deploy
----
+
If no artifacts are uploaded, clean the `buck-out` folder and retry:
+
----
rm -rf buck-out
----
* Push the plugin Maven archetypes to Maven Central:
+
----
./tools/plugin_archetype_deploy.sh
----
* To where the artifacts are uploaded depends on the `GERRIT_VERSION` in
the `VERSION` file:
** SNAPSHOT versions are directly uploaded into the Sonatype snapshots
repository and no further action is needed:
+
https://oss.sonatype.org/content/repositories/snapshots/com/google/gerrit/
** Release versions are uploaded into a staging repository in the
link:https://oss.sonatype.org/[Sonatype Nexus Server].
* Verify the staging repository
+
How to do this is described in the
link:https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-8.a.1.ClosingaStagingRepository[
Sonatype OSS Maven Repository Usage Guide].
** Go to the link:https://oss.sonatype.org/[Sonatype Nexus Server] and
sign in with your Sonatype credentials.
** Click in the left navigation bar under `Build Promotion` on
`Staging Repositories` and find the `comgooglegerrit-XXXX` staging
repository.
** Verify its content
+
While the staging repository is open you can upload further content and
also replace uploaded artifacts. If something is wrong with the staging
repository you can drop it by selecting it and clicking on `Drop`.
** Run Sonatype validations on the staging repository
+
Select the staging repository and click on `Close`. This runs the
Sonatype validations on the staging repository. The repository will
only be closed if everything is OK. A closed repository cannot be
modified anymore, but you may still drop it if you find any issues.
** Test closed staging repository
+
Once a repository is closed you can find the URL to it in the `Summary`
section, e.g. https://oss.sonatype.org/content/repositories/comgooglegerrit-1029
+
Use this URL for further testing of the artifacts in this repository,
e.g. to try building a plugin against the plugin API in this repository
update the version in the `pom.xml` and configure the repository:
+
----
<repositories>
<repository>
<id>gerrit-staging-repository</id>
<url>https://oss.sonatype.org/content/repositories/comgooglegerrit-1029</url>
</repository>
</repositories>
----
* Release the staging repository
+
How to release a staging repository is described in the
link:https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-8.a.2.ReleasingaStagingRepository[
Sonatype OSS Maven Repository Usage Guide].
+
[WARNING]
Releasing artifacts to Maven Central cannot be undone!
** Find the closed staging repository in the
link:https://oss.sonatype.org/[Sonatype Nexus Server], select it and
click on `Release`.
** It may take up to 2 hours until the artifacts appear on Maven
Central:
+
https://oss.sonatype.org/content/repositories/releases/com/google/gerrit/
[[push-stable]]
@@ -319,17 +409,6 @@ 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`

View File

@@ -673,6 +673,12 @@ public class Dispatcher {
if ("".equals(panel)) {
if (isChangeScreen2()) {
if (Gerrit.isSignedIn()
&& DiffView.UNIFIED_DIFF.equals(Gerrit.getUserAccount()
.getGeneralPreferences().getDiffView())) {
return new PatchScreen.Unified(id, patchIndex, patchSetDetail,
patchTable, top, baseId);
}
return new SideBySide2(baseId, id.getParentKey(), id.get(),
side, line);
}
@@ -693,8 +699,7 @@ public class Dispatcher {
top, //
baseId //
);
} else if (("cm".equals(panel) && Gerrit.getConfig().getNewFeatures())
|| ("".equals(panel) && isChangeScreen2())) {
} else if ("cm".equals(panel) && Gerrit.getConfig().getNewFeatures()) {
if (Gerrit.isSignedIn()
&& DiffView.UNIFIED_DIFF.equals(Gerrit.getUserAccount()
.getGeneralPreferences().getDiffView())) {