gerrit/tools/bzl/classpath.bzl
Han-Wen Nienhuys a667b4c439 Apply buildifier to .bzl files.
Buildifier is now also used for formatting .bzl files.

This change was created by running buildifier 0.12 over our source tree.

Change-Id: I9f15112d4fe23e5cec0700cfe47f1ca649f61d2a
2018-07-10 12:39:26 +02:00

25 lines
630 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,
)