From 0ce2fdc1c22701745b8c3e1bb9b3f49de6b34de0 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sun, 20 Aug 2017 20:47:12 +0200 Subject: [PATCH] Simplify artifacts deployment to Maven Central De-duplicate the pom.xml definition in top-level directories and rename the single left pom.xml file as fake_pom.xml. Roll-back the process of version update in pom.xml file and remove the version.py utility. It's not needed, as the version is passed to the mvn program on the command line. This is the preparation change for flattening the directory structure and dissolving gerrit-* top-level directories. Change-Id: Ied4d580e5ce2e98858f1f8e248969da1cb7d3a9a --- Documentation/dev-release.txt | 21 ++--- gerrit-extension-api/pom.xml => fake_pom.xml | 4 +- gerrit-acceptance-framework/pom.xml | 86 -------------------- gerrit-plugin-api/pom.xml | 86 -------------------- gerrit-plugin-gwtui/pom.xml | 86 -------------------- gerrit-war/pom.xml | 86 -------------------- tools/maven/mvn.py | 12 +-- tools/version.py | 55 ------------- 8 files changed, 15 insertions(+), 421 deletions(-) rename gerrit-extension-api/pom.xml => fake_pom.xml (95%) delete mode 100644 gerrit-acceptance-framework/pom.xml delete mode 100644 gerrit-plugin-api/pom.xml delete mode 100644 gerrit-plugin-gwtui/pom.xml delete mode 100644 gerrit-war/pom.xml delete mode 100755 tools/version.py diff --git a/Documentation/dev-release.txt b/Documentation/dev-release.txt index e82e16a9bc..26193f41e7 100644 --- a/Documentation/dev-release.txt +++ b/Documentation/dev-release.txt @@ -89,22 +89,14 @@ To create a Gerrit release the following steps have to be done: . link:#merge-stable[Merge `stable` into `master`] -[[update-versions]] -=== Update Versions and Create Release Tag +[[update-version]] +=== Update Version and Create Release Tag Before doing the release build, the `GERRIT_VERSION` in the `version.bzl` file must be updated, e.g. change it from `2.5-SNAPSHOT` to `2.5`. -In addition the version must be updated in a number of pom.xml files. - -To do this run the `./tools/version.py` script and provide the new -version as parameter, e.g.: - ----- - ./tools/version.py 2.5 ----- - -Commit the changes and create a signed release tag on the new commit: +Commit the change in `version.bzl` and create a signed release tag on the +new commit: ---- git tag -s -m "v2.5" v2.5 @@ -147,9 +139,8 @@ Verify the versions: 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.bzl` file and in -the `pom.xml` files as described in the link:#update-versions[Update -Versions and Create Release Tag] section. +* Make sure that the version is updated in the `version.bzl` file as described +in the link:#update-version[Update Version and Create Release Tag] section. * Push the WAR to Maven Central: + diff --git a/gerrit-extension-api/pom.xml b/fake_pom.xml similarity index 95% rename from gerrit-extension-api/pom.xml rename to fake_pom.xml index 9468b67f5f..a91178b4f2 100644 --- a/gerrit-extension-api/pom.xml +++ b/fake_pom.xml @@ -1,8 +1,8 @@ 4.0.0 com.google.gerrit - gerrit-extension-api - 2.15-SNAPSHOT + gerrit + 1 jar Gerrit Code Review - Extension API API for Gerrit Extensions diff --git a/gerrit-acceptance-framework/pom.xml b/gerrit-acceptance-framework/pom.xml deleted file mode 100644 index 747f5d4646..0000000000 --- a/gerrit-acceptance-framework/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - com.google.gerrit - gerrit-acceptance-framework - 2.15-SNAPSHOT - jar - Gerrit Code Review - Acceptance Test Framework - Framework for Gerrit's acceptance tests - https://www.gerritcodereview.com/ - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - https://gerrit.googlesource.com/gerrit - https://gerrit.googlesource.com/gerrit - - - - - Alice Kober-Sotzek - - - Andrew Bonventre - - - Becky Siegel - - - Dave Borowitz - - - David Ostrovsky - - - David Pursehouse - - - Edwin Kempin - - - Hugo Arès - - - Kasper Nilsson - - - Logan Hanks - - - Martin Fick - - - Saša Živkov - - - Shawn Pearce - - - Viktar Donich - - - Wyatt Allen - - - - - - Repo and Gerrit Discussion - repo-discuss@googlegroups.com - https://groups.google.com/forum/#!forum/repo-discuss - https://groups.google.com/forum/#!forum/repo-discuss - https://groups.google.com/forum/#!forum/repo-discuss - - - - - https://bugs.chromium.org/p/gerrit/issues/list - Gerrit Issue Tracker - - diff --git a/gerrit-plugin-api/pom.xml b/gerrit-plugin-api/pom.xml deleted file mode 100644 index f9dc7e46be..0000000000 --- a/gerrit-plugin-api/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - com.google.gerrit - gerrit-plugin-api - 2.15-SNAPSHOT - jar - Gerrit Code Review - Plugin API - API for Gerrit Plugins - https://www.gerritcodereview.com/ - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - https://gerrit.googlesource.com/gerrit - https://gerrit.googlesource.com/gerrit - - - - - Alice Kober-Sotzek - - - Andrew Bonventre - - - Becky Siegel - - - Dave Borowitz - - - David Ostrovsky - - - David Pursehouse - - - Edwin Kempin - - - Hugo Arès - - - Kasper Nilsson - - - Logan Hanks - - - Martin Fick - - - Saša Živkov - - - Shawn Pearce - - - Viktar Donich - - - Wyatt Allen - - - - - - Repo and Gerrit Discussion - repo-discuss@googlegroups.com - https://groups.google.com/forum/#!forum/repo-discuss - https://groups.google.com/forum/#!forum/repo-discuss - https://groups.google.com/forum/#!forum/repo-discuss - - - - - https://bugs.chromium.org/p/gerrit/issues/list - Gerrit Issue Tracker - - diff --git a/gerrit-plugin-gwtui/pom.xml b/gerrit-plugin-gwtui/pom.xml deleted file mode 100644 index daabb46f7d..0000000000 --- a/gerrit-plugin-gwtui/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - com.google.gerrit - gerrit-plugin-gwtui - 2.15-SNAPSHOT - jar - Gerrit Code Review - Plugin GWT UI - Common Classes for Gerrit GWT UI Plugins - https://www.gerritcodereview.com/ - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - https://gerrit.googlesource.com/gerrit - https://gerrit.googlesource.com/gerrit - - - - - Alice Kober-Sotzek - - - Andrew Bonventre - - - Becky Siegel - - - Dave Borowitz - - - David Ostrovsky - - - David Pursehouse - - - Edwin Kempin - - - Hugo Arès - - - Kasper Nilsson - - - Logan Hanks - - - Martin Fick - - - Saša Živkov - - - Shawn Pearce - - - Viktar Donich - - - Wyatt Allen - - - - - - Repo and Gerrit Discussion - repo-discuss@googlegroups.com - https://groups.google.com/forum/#!forum/repo-discuss - https://groups.google.com/forum/#!forum/repo-discuss - https://groups.google.com/forum/#!forum/repo-discuss - - - - - https://bugs.chromium.org/p/gerrit/issues/list - Gerrit Issue Tracker - - diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml deleted file mode 100644 index f3dec88c41..0000000000 --- a/gerrit-war/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - com.google.gerrit - gerrit-war - 2.15-SNAPSHOT - war - Gerrit Code Review - WAR - Gerrit WAR - https://www.gerritcodereview.com/ - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - https://gerrit.googlesource.com/gerrit - https://gerrit.googlesource.com/gerrit - - - - - Alice Kober-Sotzek - - - Andrew Bonventre - - - Becky Siegel - - - Dave Borowitz - - - David Ostrovsky - - - David Pursehouse - - - Edwin Kempin - - - Hugo Arès - - - Kasper Nilsson - - - Logan Hanks - - - Martin Fick - - - Saša Živkov - - - Shawn Pearce - - - Viktar Donich - - - Wyatt Allen - - - - - - Repo and Gerrit Discussion - repo-discuss@googlegroups.com - https://groups.google.com/forum/#!forum/repo-discuss - https://groups.google.com/forum/#!forum/repo-discuss - https://groups.google.com/forum/#!forum/repo-discuss - - - - - https://bugs.chromium.org/p/gerrit/issues/list - Gerrit Issue Tracker - - diff --git a/tools/maven/mvn.py b/tools/maven/mvn.py index f7b5aa82e9..2426b9feb8 100755 --- a/tools/maven/mvn.py +++ b/tools/maven/mvn.py @@ -19,6 +19,10 @@ from os import path, environ from subprocess import check_output from sys import stderr + +def mvn(): + return ['mvn', '--file', path.join(root, 'fake_pom.xml'), '-DgroupId=com.google.gerrit'] + opts = OptionParser() opts.add_option('--repository', help='maven repository id') opts.add_option('--url', help='maven repository url') @@ -37,14 +41,12 @@ while not path.exists(path.join(root, 'WORKSPACE')): root = path.dirname(root) if 'install' == args.a: - cmd = [ - 'mvn', + cmd = mvn() + [ 'install:install-file', '-Dversion=%s' % args.v, ] elif 'deploy' == args.a: - cmd = [ - 'mvn', + cmd = mvn() + [ 'gpg:sign-and-deploy-file', '-DrepositoryId=%s' % args.repository, '-Durl=%s' % args.url, @@ -56,7 +58,7 @@ else: for spec in args.s: artifact, packaging_type, src = spec.split(':') exe = cmd + [ - '-DpomFile=%s' % path.join(root, '%s/pom.xml' % artifact), + '-DartifactId=%s' % artifact, '-Dpackaging=%s' % packaging_type, '-Dfile=%s' % src, ] diff --git a/tools/version.py b/tools/version.py deleted file mode 100755 index fed6d5dfc1..0000000000 --- a/tools/version.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# 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. - -from __future__ import print_function -from optparse import OptionParser -import os.path -import re -import sys - -parser = OptionParser() -opts, args = parser.parse_args() - -if not len(args): - parser.error('not enough arguments') -elif len(args) > 1: - parser.error('too many arguments') - -DEST_PATTERN = r'\g<1>%s\g<3>' % args[0] - - -def replace_in_file(filename, src_pattern): - try: - f = open(filename, "r") - s = f.read() - f.close() - s = re.sub(src_pattern, DEST_PATTERN, s) - f = open(filename, "w") - f.write(s) - f.close() - except IOError as err: - print('error updating %s: %s' % (filename, err), file=sys.stderr) - - -src_pattern = re.compile(r'^(\s*)([-.\w]+)(\s*)$', - re.MULTILINE) -for project in ['gerrit-acceptance-framework', 'gerrit-extension-api', - 'gerrit-plugin-api', 'gerrit-plugin-gwtui', - 'gerrit-war']: - pom = os.path.join(project, 'pom.xml') - replace_in_file(pom, src_pattern) - -src_pattern = re.compile(r'^(GERRIT_VERSION = ")([-.\w]+)(")$', re.MULTILINE) -replace_in_file('version.bzl', src_pattern)