From dcc48b078f73040f361a8b515342832eba0fc131 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sat, 18 Jan 2014 09:58:41 +0100 Subject: [PATCH] Buck: Decouple plugin-api installation from deployment Currently the same pom_fake.xml controls both installing the plugin-api in local Maven repository (typical use case for a contributor) and deploying it on Google bucket (typical use case for a maintainer). To fit the both use cases that file contains stuff needed for uploading to Google bucket only: 'gs-maven-wagon' artifact and the repository to fetch it from. Because the "best" build tool in the world randomly and unreproducible fails to fetch that artifact [1], frustrating the potential contributors, for reasons that nobody knows and understands, separate these use cases from each other, and strip the stuff from pom_fake.xml needed for deployment of plugin-api. The cost is code duplication. The advantage of doing it: buck build api_install just works. Always. [1] https://gist.github.com/mulby/092fee5f5962aafbbb25#file-gerrit-build-error-txt Change-Id: I842335907ef8721f4126bcd90e395f7748aefc74 --- tools/maven/{fake_pom.xml => fake_pom_deploy.xml} | 0 tools/maven/fake_pom_install.xml | 6 ++++++ tools/maven/mvn.py | 8 +++++--- 3 files changed, 11 insertions(+), 3 deletions(-) rename tools/maven/{fake_pom.xml => fake_pom_deploy.xml} (100%) create mode 100644 tools/maven/fake_pom_install.xml diff --git a/tools/maven/fake_pom.xml b/tools/maven/fake_pom_deploy.xml similarity index 100% rename from tools/maven/fake_pom.xml rename to tools/maven/fake_pom_deploy.xml diff --git a/tools/maven/fake_pom_install.xml b/tools/maven/fake_pom_install.xml new file mode 100644 index 0000000000..d066a4a97c --- /dev/null +++ b/tools/maven/fake_pom_install.xml @@ -0,0 +1,6 @@ + + 4.0.0 + com.google.gerrit + Gerrit-Code-Review-Maven + 1 + diff --git a/tools/maven/mvn.py b/tools/maven/mvn.py index d4d39568c9..a4aaa5aba0 100644 --- a/tools/maven/mvn.py +++ b/tools/maven/mvn.py @@ -20,6 +20,9 @@ from os import path 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') @@ -39,12 +42,11 @@ common = [ ] self = path.dirname(path.abspath(__file__)) -mvn = ['mvn', '--file', path.join(self, 'fake_pom.xml')] if 'install' == args.a: - cmd = mvn + ['install:install-file'] + common + cmd = mvn(args.a) + ['install:install-file'] + common elif 'deploy' == args.a: - cmd = mvn + [ + cmd = mvn(args.a) + [ 'deploy:deploy-file', '-DrepositoryId=%s' % args.repository, '-Durl=%s' % args.url,