From 6a971631dff36769f8fff0729dde0d328994ebd7 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Mon, 6 May 2013 12:16:45 -0700 Subject: [PATCH 1/8] Always include documention in the build By default run AsciiDoc and package the documentation as part of the WAR. This ensures the default `mvn package` will include user documentation, as folks have come to expect it to exist in builds. If AsciiDoc is not available documentation can be skipped by passing -Dgerrit.documentation.skip=true on the command line. This naming convention matches with -Dmaven.test.skip=true as a way to avoid running unit tests. Change-Id: Ic433c5bb291c9abb48117d61c2eabc031a5c5ca0 --- gerrit-war/pom.xml | 4 ++-- tools/release.sh | 17 +++-------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml index 9802b68a8d..b359079e56 100644 --- a/gerrit-war/pom.xml +++ b/gerrit-war/pom.xml @@ -242,7 +242,7 @@ limitations under the License. include-documentation process-classes - + @@ -269,7 +269,7 @@ limitations under the License. include-release-notes process-classes - + diff --git a/tools/release.sh b/tools/release.sh index 7d4c4574ad..4d2b26b2f5 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,12 +1,12 @@ #!/bin/sh -include_docs=-Dgerrit.include-documentation=1 +flags=-Pall while [ $# -gt 0 ] do case "$1" in --no-documentation|--without-documentation) - include_docs= + flags="$flags -Dgerrit.documentation.skip=true" shift ;; *) @@ -24,19 +24,8 @@ then exit 1 fi - -if test -n "$include_docs" -then - BINARY=asciidoc - if ! command -v $BINARY >/dev/null 2>&1 - then - echo >&2 "error: $BINARY executable was not found. Either install $BINARY or use the --without-documentation option" - exit 1 - fi -fi - ./tools/version.sh --release && -mvn clean install $include_docs -P all +mvn clean install $flags rc=$? ./tools/version.sh --reset From 8d6dcac0b6f8d4daa162dcdb12b5689791c3e47f Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Mon, 6 May 2013 12:25:49 -0700 Subject: [PATCH 2/8] Always build all components of Gerrit If we are committed to Maven as a build tool we need to have Maven always building the correct targets when a user runs `mvn package`. Include all modules as part of the build, all of the time. Change-Id: I23f02cf040437bfe91e8badb6fdb6f765e707b6f --- pom.xml | 30 +++++++----------------------- tools/release.sh | 2 +- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/pom.xml b/pom.xml index 762329894d..5e6c9277a4 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,7 @@ limitations under the License. gerrit-common gerrit-cache-h2 gerrit-httpd + gerrit-gwtui gerrit-launcher gerrit-main gerrit-openid @@ -88,32 +89,15 @@ limitations under the License. gerrit-gwtdebug gerrit-war - gerrit-extension-api - - gerrit-gwtui - gerrit-acceptance-tests + gerrit-extension-api + gerrit-plugin-api + gerrit-plugin-archetype + gerrit-plugin-gwtui + gerrit-plugin-js-archetype + gerrit-plugin-gwt-archetype - - - all - - gerrit-plugin-api - gerrit-plugin-archetype - gerrit-plugin-gwtui - gerrit-plugin-js-archetype - gerrit-plugin-gwt-archetype - - - - - true - - no-plugins - - - Apache License, 2.0 diff --git a/tools/release.sh b/tools/release.sh index 4d2b26b2f5..d4590492ae 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,6 +1,6 @@ #!/bin/sh -flags=-Pall +flags= while [ $# -gt 0 ] do From 635f1f61d11959c2dee5adcce43ea1bfbb4334f5 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Mon, 6 May 2013 12:31:23 -0700 Subject: [PATCH 3/8] Run Documentation formatting in parallel AsciiDoc is slow. Run 8 forks in parallel, assuming most developers building Gerrit need at least 4 cores to get through the GWT builds. Change-Id: Icf1a244d528f91aa5b8fbc10aa905ce3b32a3535 --- gerrit-war/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml index b359079e56..3702d9857c 100644 --- a/gerrit-war/pom.xml +++ b/gerrit-war/pom.xml @@ -251,6 +251,7 @@ limitations under the License. + @@ -278,6 +279,7 @@ limitations under the License. + From c5f4ab29e64d5b7ab32a28454b91172fba19f762 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Mon, 6 May 2013 12:47:50 -0700 Subject: [PATCH 4/8] Always run acceptance tests when creating a release build Change-Id: I19fc734a5ab64ea7e18d828d6c76cbabde6d8d87 --- tools/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/release.sh b/tools/release.sh index d4590492ae..466490e6a2 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,6 +1,6 @@ #!/bin/sh -flags= +flags=-Pacceptance while [ $# -gt 0 ] do From a1c15ea10d9fba9224e601bbb58fe980aaaa8542 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Mon, 6 May 2013 21:28:39 +0000 Subject: [PATCH 5/8] Revert "Run Documentation formatting in parallel" This reverts commit db4e14f1a8d0a0aa0b4b39ac74242ac0962e7f47. Running AsciiDoc in parallel swamps some hardware, and there is no portable way to get the number of available cores. Since it is apparent the contributors want to keep using Maven, lets just go with correct and slow. Change-Id: I71c2c902dc1553b0316c21aaf48b481ffe0aaec6 --- gerrit-war/pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml index 3702d9857c..b359079e56 100644 --- a/gerrit-war/pom.xml +++ b/gerrit-war/pom.xml @@ -251,7 +251,6 @@ limitations under the License. - @@ -279,7 +278,6 @@ limitations under the License. - From b0c599d1fd9b650c206a24ed8fa7f95ae146a073 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Mon, 6 May 2013 14:23:26 -0700 Subject: [PATCH 6/8] 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 --- .gitmodules | 11 +++ Documentation/dev-release.txt | 92 ++------------------ gerrit-package-plugins/.gitignore | 6 -- gerrit-package-plugins/pom.xml | 108 ------------------------ gerrit-war/pom.xml | 45 ++++++++++ plugins/README | 11 +++ plugins/commit-message-length-validator | 1 + plugins/replication | 1 + plugins/reviewnotes | 1 + pom.xml | 17 ++++ tools/release.sh | 8 +- 11 files changed, 98 insertions(+), 203 deletions(-) create mode 100644 .gitmodules delete mode 100644 gerrit-package-plugins/.gitignore delete mode 100644 gerrit-package-plugins/pom.xml create mode 100644 plugins/README create mode 160000 plugins/commit-message-length-validator create mode 160000 plugins/replication create mode 160000 plugins/reviewnotes diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..32483d6b88 --- /dev/null +++ b/.gitmodules @@ -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 diff --git a/Documentation/dev-release.txt b/Documentation/dev-release.txt index d429a1cc22..ae2aed689e 100644 --- a/Documentation/dev-release.txt +++ b/Documentation/dev-release.txt @@ -132,45 +132,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 ==== + @@ -182,57 +151,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]] diff --git a/gerrit-package-plugins/.gitignore b/gerrit-package-plugins/.gitignore deleted file mode 100644 index c96b05c166..0000000000 --- a/gerrit-package-plugins/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/target -/.classpath -/.project -/.settings/org.maven.ide.eclipse.prefs -/.settings/org.eclipse.m2e.core.prefs -/gerrit-package-plugins.iml diff --git a/gerrit-package-plugins/pom.xml b/gerrit-package-plugins/pom.xml deleted file mode 100644 index 534a3ed960..0000000000 --- a/gerrit-package-plugins/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - 4.0.0 - - com.google.gerrit - gerrit-package-plugins - war - 2.6-SNAPSHOT - - Gerrit Code Review - Package Plugins - http://code.google.com/p/gerrit/ - - - - UTF-8 - - - - - - com.google.gerrit - gerrit-war - ${project.version} - war - - - com.googlesource.gerrit.plugins.replication - replication - 1.1-rc0 - provided - - - com.googlesource.gerrit.plugins.reviewnotes - reviewnotes - 1.0-rc1 - provided - - - com.googlesource.gerrit.plugins.validators - commit-message-length-validator - 1.0-rc1 - provided - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.1 - - - process-resources - - copy-dependencies - - - jar - true - ${project.build.directory}/${project.build.finalName}/WEB-INF/plugins - - - - - - - org.apache.maven.plugins - maven-war-plugin - 2.1.1 - - gerrit-full-${project.version} - - false - - Main - Gerrit Code Review - ${project.version} - - - - - - - - - gerrit-plugins - https://gerrit-plugins.commondatastorage.googleapis.com - - - diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml index b359079e56..0ebbc8ac72 100644 --- a/gerrit-war/pom.xml +++ b/gerrit-war/pom.xml @@ -120,6 +120,38 @@ limitations under the License. + + + plugins + + + !gerrit.plugins.skip + + + + + + com.googlesource.gerrit.plugins.replication + replication + ${project.version} + provided + + + com.googlesource.gerrit.plugins.reviewnotes + reviewnotes + ${project.version} + provided + + + com.googlesource.gerrit.plugins.validators + commit-message-length-validator + ${project.version} + provided + + + + + @@ -194,6 +226,19 @@ limitations under the License. copy-dependencies + + copy-plugins + + + commit-message-length-validator,replication,reviewnotes + jar + true + ${project.build.directory}/${project.build.finalName}/WEB-INF/plugins + + + copy-dependencies + + diff --git a/plugins/README b/plugins/README new file mode 100644 index 0000000000..00df3c55e9 --- /dev/null +++ b/plugins/README @@ -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 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. diff --git a/plugins/commit-message-length-validator b/plugins/commit-message-length-validator new file mode 160000 index 0000000000..2793491aef --- /dev/null +++ b/plugins/commit-message-length-validator @@ -0,0 +1 @@ +Subproject commit 2793491aefda6da23e94f87d910f3f92096cfb63 diff --git a/plugins/replication b/plugins/replication new file mode 160000 index 0000000000..0812161cf9 --- /dev/null +++ b/plugins/replication @@ -0,0 +1 @@ +Subproject commit 0812161cf90458fd0a6412ba7fb457a73f769be2 diff --git a/plugins/reviewnotes b/plugins/reviewnotes new file mode 160000 index 0000000000..2f24a1454e --- /dev/null +++ b/plugins/reviewnotes @@ -0,0 +1 @@ +Subproject commit 2f24a1454eb23437408adfa9ed6cb4f008f3dc84 diff --git a/pom.xml b/pom.xml index 5e6c9277a4..24da1a301f 100644 --- a/pom.xml +++ b/pom.xml @@ -98,6 +98,23 @@ limitations under the License. gerrit-plugin-gwt-archetype + + + plugins + + + !gerrit.plugins.skip + + + + + plugins/commit-message-length-validator + plugins/replication + plugins/reviewnotes + + + + Apache License, 2.0 diff --git a/tools/release.sh b/tools/release.sh index 466490e6a2..a63a7a16fc 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -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 From edf82ea72144bf74443eea7b8f64e5b01eb48a25 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Mon, 6 May 2013 14:57:50 -0700 Subject: [PATCH 7/8] Update plugin versions during release Change-Id: Ia8c7c1d5a2a8e6ca69c6f2f64d041e49f916484b --- tools/version.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/version.sh b/tools/version.sh index a620d9e18a..cc8a1fa154 100755 --- a/tools/version.sh +++ b/tools/version.sh @@ -6,7 +6,15 @@ # Java based Maven plugin so its fully portable. # -POM_FILES=$(git ls-files | grep pom.xml | grep -v /src/main/resources/archetype-resources/pom.xml) +SERVER_POMS=$(git ls-files | grep pom.xml | grep -v /src/main/resources/archetype-resources/pom.xml) +POM_FILES=$SERVER_POMS + +# CORE PLUGIN LIST +PLUGINS="commit-message-length-validator replication reviewnotes" +for p in $PLUGINS +do + POM_FILES="$POM_FILES $(cd plugins/$p && git ls-files | grep pom.xml | sed s,^,plugins/$p/,)" +done case "$1" in --snapshot=*) @@ -27,7 +35,11 @@ case "$1" in ;; --reset) - git checkout HEAD -- $POM_FILES + git checkout HEAD -- $SERVER_POMS + for p in $PLUGINS + do + (cd plugins/$p; git checkout $(git ls-files | grep pom.xml)) + done exit $? ;; From bd4e609c3d522d2f7f9efa78129de8f4163698c8 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Mon, 6 May 2013 15:22:48 -0700 Subject: [PATCH 8/8] Always run acceptance tests I can't trust Maven to run the tests with -Pacceptance. At least half of my attempts produced no tests run. This is of zero value to me as a build system, but our contributors have determined Gerrit will remain stuck with Maven. Stick contributors with the burden of running the acceptance tests by default. This way we know the tests are executed. Change-Id: I678e42651efc162f66929c605247583d7ef6cc8a --- gerrit-acceptance-tests/pom.xml | 5 +++++ tools/release.sh | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gerrit-acceptance-tests/pom.xml b/gerrit-acceptance-tests/pom.xml index 410ae66b60..e79f8a7f5f 100644 --- a/gerrit-acceptance-tests/pom.xml +++ b/gerrit-acceptance-tests/pom.xml @@ -115,6 +115,11 @@ limitations under the License. acceptance + + + !gerrit.acceptance-tests.skip + + diff --git a/tools/release.sh b/tools/release.sh index a63a7a16fc..88e4a00763 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,6 +1,6 @@ #!/bin/sh -flags=-Pacceptance +flags= while [ $# -gt 0 ] do @@ -13,8 +13,13 @@ do flags="$flags -Dgerrit.plugins.skip=true" shift ;; + --no-tests|--without-tests) + flags="$flags -Dgerrit.acceptance-tests.skip=true" + flags="$flags -Dmaven.tests.skip=true" + shift + ;; *) - echo >&2 "usage: $0 [--no-documentation] [--no-plugins]" + echo >&2 "usage: $0 [--no-documentation] [--no-plugins] [--no-tests]" exit 1 esac done @@ -29,7 +34,7 @@ then fi ./tools/version.sh --release && -mvn clean package $flags +mvn clean package verify $flags rc=$? ./tools/version.sh --reset