2d2cf71d20
`set` is a deprecated alias of `depset` and will be removed from Bazel starting from 0.6. Change-Id: I0d9ca334d7fd32a36c1af4ca6baaed08d1600a9a
23 lines
624 B
Python
23 lines
624 B
Python
def _classpath_collector(ctx):
|
|
all = depset()
|
|
for d in ctx.attr.deps:
|
|
if hasattr(d, 'java'):
|
|
all += d.java.transitive_runtime_deps
|
|
all += d.java.compilation_info.runtime_classpath
|
|
elif hasattr(d, 'files'):
|
|
all += d.files
|
|
|
|
as_strs = [c.path for c in all]
|
|
ctx.file_action(output= ctx.outputs.runtime,
|
|
content="\n".join(sorted(as_strs)))
|
|
|
|
classpath_collector = rule(
|
|
attrs = {
|
|
"deps": attr.label_list(),
|
|
},
|
|
outputs = {
|
|
"runtime": "%{name}.runtime_classpath",
|
|
},
|
|
implementation = _classpath_collector,
|
|
)
|