blob: 8fe9a13b69f3cf34597cf40c60576041063fe573 [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 = []
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))
genrule(
name = 'api_install',
cmd = ' '.join(cmd + api_cmd + ['-a', 'install']),
out = 'api_install.info',
)
if repository and url:
genrule(
name = 'api_deploy',
cmd = ' '.join(cmd + api_cmd + [
'-a', 'deploy',
'--repository', repository,
'--url', url]),
out = 'api_deploy.info',
)
war_cmd = []
for a,t in war.iteritems():
war_cmd.append('-s %s:war:$(location %s)' % (a,t))
genrule(
name = 'war_install',
cmd = ' '.join(cmd + war_cmd + ['-a', 'install']),
out = 'war_install.info',
)
if repository and url:
genrule(
name = 'war_deploy',
cmd = ' '.join(cmd + war_cmd + [
'-a', 'deploy',
'--repository', repository,
'--url', url]),
out = 'war_deploy.info',
)