Ensure core plugins are bundled by Maven

Require the core plugins whenever a Gerrit build is run.
These are pulled into the Maven Reactor by being inside
of git submodules. Plugins can be omitted by passing a
-Dgerrit.plugins.skip=true flag on the command line.

Change-Id: I7246389bcae9e98d5f1d46208ff515855eb7c474
This commit is contained in:
Shawn Pearce 2013-05-06 14:23:26 -07:00
parent ed95865d00
commit bf8ebbe90a
11 changed files with 98 additions and 203 deletions

11
.gitmodules vendored Normal file
View File

@ -0,0 +1,11 @@
[submodule "plugins/replication"]
path = plugins/replication
url = ../plugins/replication
[submodule "plugins/reviewnotes"]
path = plugins/reviewnotes
url = ../plugins/reviewnotes
[submodule "plugins/commit-message-length-validator"]
path = plugins/commit-message-length-validator
url = ../plugins/commit-message-length-validator

View File

@ -131,45 +131,14 @@ the subproject.
to the released version
[[prepare-gerrit]]
Prepare Gerrit
~~~~~~~~~~~~~~
[[build-gerrit]]
Build Gerrit
~~~~~~~~~~~~
In all example commands it is assumed that the last release was `2.4`
and that now the `2.5` release is prepared.
[[prepare-war-and-plugin-api]]
Prepare the Gerrit WAR and the Plugin API Jar
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* link:dev-readme.html#run-acceptance-tests[Run the acceptance tests]
* Create locally a `stable-2.5` branch for making the new release
* Check in the Gerrit parent `pom.xml` that no `SNAPSHOT` version of a
Subproject is referenced
+
If there is a dependency to a `SNAPSHOT` version,
link:#subproject[release the subproject] first.
* Create a tag for the Gerrit release
+
For an `RC` release:
+
====
git tag -a -m "gerrit 2.5-rc0" v2.5-rc0
====
+
For a final `stable` release:
+
====
git tag -a -m "gerrit 2.5" v2.5
====
* Build the Gerrit WAR (without plugins) and the Plugin API Jar
* Build the Gerrit WAR
+
====
rm -f ~/.m2/settings.xml
./tools/release.sh
====
+
@ -181,57 +150,6 @@ limits the compilation to a certain browser.
========================================================================
* Sanity check WAR
[[prepare-core-plugins]]
Prepare Core Plugins
^^^^^^^^^^^^^^^^^^^^
The core plugins to be prepared are:
* `plugins/replication`
For each core plugin do:
* link:dev-release-subproject.html#make-snapshot[Make a snapshot and test it]
* link:dev-release-subproject.html#prepare-release[Prepare the Release]
* Update the version of the Core Plugin in
`gerrit-package-plugins/pom.xml` to the released version
[WARNING]
========================================================================
Updating the plugin versions in `gerrit-package-plugins/pom.xml`
invalidates the Gerrit Release Tag which was created before.
If needed delete the tag and recreate it!
========================================================================
[[prepare-war-with-plugins]]
Prepare Gerrit WAR with Core Plugins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Ensure that the Core Plugins listed in `gerrit-package-plugins/pom.xml`
point to the latest release version (no dependency to `SNAPSHOT` versions)
* Ensure that the release tag points to the `HEAD` commit
* Include core plugins into WAR
+
====
$ ./tools/version.sh --release && mvn clean package -f gerrit-package-plugins/pom.xml
$ ./tools/version.sh --reset
====
* Find WAR that includes the core plugins at
`gerrit-package-plugins\target\gerrit-full-v2.5.war`
* Compare `gerrit-package-plugins\target\gerrit-full-v2.5.war` with
`gerrit-war\target\gerrit-v2.5.war`
+
The only difference should be the core plugins jars under
`WEB-INF\plugins`.
* Test the new Gerrit version
[[publish-gerrit]]

View File

@ -1,6 +0,0 @@
/target
/.classpath
/.project
/.settings/org.maven.ide.eclipse.prefs
/.settings/org.eclipse.m2e.core.prefs
/gerrit-package-plugins.iml

View File

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2012 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-package-plugins</artifactId>
<packaging>war</packaging>
<version>2.7-SNAPSHOT</version>
<name>Gerrit Code Review - Package Plugins</name>
<url>http://code.google.com/p/gerrit/</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-war</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.googlesource.gerrit.plugins.replication</groupId>
<artifactId>replication</artifactId>
<version>1.1-rc0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlesource.gerrit.plugins.reviewnotes</groupId>
<artifactId>reviewnotes</artifactId>
<version>1.0-rc1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlesource.gerrit.plugins.validators</groupId>
<artifactId>commit-message-length-validator</artifactId>
<version>1.0-rc1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeTypes>jar</includeTypes>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/plugins</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<warName>gerrit-full-${project.version}</warName>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifestEntries>
<Main-Class>Main</Main-Class>
<Implementation-Title>Gerrit Code Review</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>gerrit-plugins</id>
<url>https://gerrit-plugins.commondatastorage.googleapis.com</url>
</repository>
</repositories>
</project>

View File

@ -120,6 +120,38 @@ limitations under the License.
</dependency>
</dependencies>
<profiles>
<profile>
<id>plugins</id>
<activation>
<property>
<name>!gerrit.plugins.skip</name>
</property>
</activation>
<dependencies>
<!-- CORE PLUGIN LIST -->
<dependency>
<groupId>com.googlesource.gerrit.plugins.replication</groupId>
<artifactId>replication</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlesource.gerrit.plugins.reviewnotes</groupId>
<artifactId>reviewnotes</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlesource.gerrit.plugins.validators</groupId>
<artifactId>commit-message-length-validator</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<pluginManagement>
<plugins>
@ -194,6 +226,19 @@ limitations under the License.
<goal>copy-dependencies</goal>
</goals>
</execution>
<execution>
<id>copy-plugins</id>
<configuration>
<!-- CORE PLUGIN LIST -->
<includeArtifactIds>commit-message-length-validator,replication,reviewnotes</includeArtifactIds>
<includeTypes>jar</includeTypes>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/plugins</outputDirectory>
</configuration>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>

11
plugins/README Normal file
View File

@ -0,0 +1,11 @@
If you are adding a directory here:
- Search all pom.xml files for "CORE PLUGIN LIST".
- Add the new plugin to that location.
- (optional) Thank the Maven developers for making this easy.
- Ensure the plugin's pom.xml <version> is the same as Gerrit's
own pom.xml(s). Gerrit will only embed a plugin that has the
same version as itself.
- Register the plugin as a submodule with git submodule.

@ -0,0 +1 @@
Subproject commit 2793491aefda6da23e94f87d910f3f92096cfb63

1
plugins/replication Submodule

@ -0,0 +1 @@
Subproject commit 0812161cf90458fd0a6412ba7fb457a73f769be2

1
plugins/reviewnotes Submodule

@ -0,0 +1 @@
Subproject commit 2f24a1454eb23437408adfa9ed6cb4f008f3dc84

17
pom.xml
View File

@ -98,6 +98,23 @@ limitations under the License.
<module>gerrit-plugin-gwt-archetype</module>
</modules>
<profiles>
<profile>
<id>plugins</id>
<activation>
<property>
<name>!gerrit.plugins.skip</name>
</property>
</activation>
<modules>
<!-- CORE PLUGIN LIST -->
<module>plugins/commit-message-length-validator</module>
<module>plugins/replication</module>
<module>plugins/reviewnotes</module>
</modules>
</profile>
</profiles>
<licenses>
<license>
<name>Apache License, 2.0</name>

View File

@ -9,8 +9,12 @@ do
flags="$flags -Dgerrit.documentation.skip=true"
shift
;;
--no-plugins|--without-plugins)
flags="$flags -Dgerrit.plugins.skip=true"
shift
;;
*)
echo >&2 "usage: $0 [--without-documentation]"
echo >&2 "usage: $0 [--no-documentation] [--no-plugins]"
exit 1
esac
done
@ -25,7 +29,7 @@ then
fi
./tools/version.sh --release &&
mvn clean install $flags
mvn clean package $flags
rc=$?
./tools/version.sh --reset