blob: 8bd672055ec4b4af5dc4d989b3603f6310c55e3f [file] [log] [blame]
# Install and deploy artifacts into local and remote Maven repositories
#
# Example:
#
# maven_package(
# repository = 'gerrit-api-repository',
# url = 'gs://gerrit-api/release',
# version = '1.0',
# jar = {'gitiles-servlet': '//gitiles-servlet:servlet'},
# src = {'gitiles-servlet': '//gitiles-servlet:src'},
# doc = {'gitiles-servlet': '//gitiles-servlet:javadoc'},
# )
#
def maven_package(
version,
repository = None,
url = None,
jar = {},
src = {},
doc = {}):
cmd = ['$(exe //bucklets/tools:mvn)', '-v', version, '-o', '$OUT']
dep = []
for type,d in [('jar', jar), ('java-source', src), ('javadoc', doc)]:
for a,t in d.iteritems():
cmd.append('-s %s:%s:$(location %s)' % (a,type,t))
dep.append(t)
genrule(
name = 'install',
cmd = ' '.join(cmd + ['-a', 'install']),
deps = dep + ['//bucklets/tools:mvn'],
out = 'install.info',
)
if repository and url:
genrule(
name = 'deploy',
cmd = ' '.join(cmd + [
'-a', 'deploy',
'--repository', repository,
'--url', url]),
deps = dep + ['//bucklets/tools:mvn'],
out = 'deploy.info',
)