blob: a9dc60c4d32d202f5335ba0b27ade17fd8c2a14e [file] [log] [blame]
# Copyright (C) 2013 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.
def maven_package(
version,
repository = None,
url = None,
jar = {},
src = {},
doc = {},
war = {}):
cmd = ['$(exe //tools/maven:mvn)', '-v', version, '-o', '$OUT']
api_cmd = []
api_deps = []
for type,d in [('jar', jar), ('java-source', src), ('javadoc', doc)]:
for a,t in d.iteritems():
api_cmd.append('-s %s:%s:$(location %s)' % (a,type,t))
api_deps.append(t)
genrule(
name = 'api_install',
cmd = ' '.join(cmd + api_cmd + ['-a', 'install']),
deps = api_deps + ['//tools/maven:mvn'],
out = 'api_install.info',
)
if repository and url:
genrule(
name = 'api_deploy',
cmd = ' '.join(cmd + api_cmd + [
'-a', 'deploy',
'--repository', repository,
'--url', url]),
deps = api_deps + ['//tools/maven:mvn'],
out = 'api_deploy.info',
)
war_cmd = []
war_deps = []
for a,t in war.iteritems():
war_cmd.append('-s %s:war:$(location %s)' % (a,t))
war_deps.append(t)
genrule(
name = 'war_install',
cmd = ' '.join(cmd + war_cmd + ['-a', 'install']),
deps = war_deps + ['//tools/maven:mvn'],
out = 'war_install.info',
)
if repository and url:
genrule(
name = 'war_deploy',
cmd = ' '.join(cmd + war_cmd + [
'-a', 'deploy',
'--repository', repository,
'--url', url]),
deps = war_deps + ['//tools/maven:mvn'],
out = 'war_deploy.info',
)