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',
21 'libreoffice': 'ridljar',
25 opts
.add_option('--repository', help='maven repository id')
26 opts
.add_option('--url', help='maven repository url')
28 opts
.add_option('-a', help='action (valid actions are: install,deploy)')
29 opts
.add_option('-v', help='gerrit version')
30 opts
.add_option('-s', action
='append', help='triplet of artifactId:type:path')
32 args
, ctx
= opts
.parse_args()
34 print('version is empty', file=stderr
)
37 root
= path
.abspath(__file__
)
38 while not path
.exists(path
.join(root
, '.buckconfig')):
39 root
= path
.dirname(root
)
41 if 'install' == args
.a
:
44 'install:install-file',
45 '-Dversion=%s' % args
.v
,
47 elif 'deploy' == args
.a
:
50 'gpg:sign-and-deploy-file',
51 '-DrepositoryId=%s' % args
.repository
,
52 '-Durl=%s' % args
.url
,
55 print("unknown action -a %s" % args
.a
, file=stderr
)
59 artifact
, packaging_type
, src
= spec
.split(':')
61 '-DpomFile=%s' % path
.join(root
, '%s/pom.%s.xml' % (M
[artifact
], artifact
)),
62 '-Dpackaging=%s' % packaging_type
,
66 if environ
.get('VERBOSE'):
67 print(' '.join(exe
), file=stderr
)
69 except Exception as e
:
70 print('%s command failed: %s' % (args
.a
, e
), file=stderr
)
73 with
open(args
.o
, 'w') as fd
:
75 print('Repository: %s' % args
.repository
, file=fd
)
77 print('URL: %s' % args
.url
, file=fd
)
78 print('Version: %s' % args
.v
, file=fd
)