David Ostrovsky | b81b4f7 | 2016-05-21 19:55:01 +0200 | [diff] [blame] | 1 | # Copyright (C) 2016 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | # Merge maven files |
| 16 | |
David Ostrovsky | 20c2fd4 | 2019-08-30 10:19:56 +0200 | [diff] [blame] | 17 | load("@rules_java//java:defs.bzl", "java_import") |
| 18 | |
David Ostrovsky | b81b4f7 | 2016-05-21 19:55:01 +0200 | [diff] [blame] | 19 | def cmd(jars): |
Han-Wen Nienhuys | b6a4048 | 2018-07-10 11:51:36 +0200 | [diff] [blame] | 20 | return ("$(location //tools:merge_jars) $@ " + |
| 21 | " ".join(["$(location %s)" % j for j in jars])) |
David Ostrovsky | b81b4f7 | 2016-05-21 19:55:01 +0200 | [diff] [blame] | 22 | |
Yuxuan 'fishy' Wang | 75b98f7 | 2016-09-24 06:31:27 +0800 | [diff] [blame] | 23 | def merge_maven_jars(name, srcs, **kwargs): |
Han-Wen Nienhuys | b6a4048 | 2018-07-10 11:51:36 +0200 | [diff] [blame] | 24 | native.genrule( |
| 25 | name = "%s__merged_bin" % name, |
| 26 | cmd = cmd(srcs), |
| 27 | tools = srcs + ["//tools:merge_jars"], |
| 28 | outs = ["%s__merged.jar" % name], |
| 29 | ) |
David Ostrovsky | 20c2fd4 | 2019-08-30 10:19:56 +0200 | [diff] [blame] | 30 | java_import( |
Han-Wen Nienhuys | b6a4048 | 2018-07-10 11:51:36 +0200 | [diff] [blame] | 31 | name = name, |
| 32 | jars = [":%s__merged_bin" % name], |
| 33 | **kwargs |
| 34 | ) |