2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 from __future__
import print_function
9 from optparse
import OptionParser
10 from os
import path
, environ
11 from subprocess
import check_output
12 from sys
import stderr
15 'juh': 'javaunohelper',
20 'unoloader': 'ridljar',
24 opts
.add_option('--repository', help='maven repository id')
25 opts
.add_option('--url', help='maven repository url')
27 opts
.add_option('-a', help='action (valid actions are: install,deploy)')
28 opts
.add_option('-v', help='gerrit version')
29 opts
.add_option('-s', action
='append', help='triplet of artifactId:type:path')
31 args
, ctx
= opts
.parse_args()
33 print('version is empty', file=stderr
)
36 root
= path
.abspath(__file__
)
37 while not path
.exists(path
.join(root
, '.buckconfig')):
38 root
= path
.dirname(root
)
40 if 'install' == args
.a
:
43 'install:install-file',
44 '-Dversion=%s' % args
.v
,
46 elif 'deploy' == args
.a
:
49 'gpg:sign-and-deploy-file',
50 '-DrepositoryId=%s' % args
.repository
,
51 '-Durl=%s' % args
.url
,
54 print("unknown action -a %s" % args
.a
, file=stderr
)
58 artifact
, packaging_type
, src
= spec
.split(':')
60 '-DpomFile=%s' % path
.join(root
, '%s/pom.%s.xml' % (M
[artifact
], artifact
)),
61 '-Dpackaging=%s' % packaging_type
,
65 if environ
.get('VERBOSE'):
66 print(' '.join(exe
), file=stderr
)
68 except Exception as e
:
69 print('%s command failed: %s' % (args
.a
, e
), file=stderr
)
72 with
open(args
.o
, 'w') as fd
:
74 print('Repository: %s' % args
.repository
, file=fd
)
76 print('URL: %s' % args
.url
, file=fd
)
77 print('Version: %s' % args
.v
, file=fd
)