3ed0112115
Since I819954da56 JUnit test is added that depends on reviewdb_proto, however, this new dependency wasn't added to Eclipse classpath generation machinery. Widen the visibility of that library and add it to the transitive closure of Eclipse classpath generation. Ad a side effect, we need to conditionally query compilation_info attribute during classpath generation, because java_proto_library doesn't expose this attribute. Bug: Issue 9564 Change-Id: I4ef1be9b1f7db9764f6bc8e5571da6ba6ac211f6
26 lines
704 B
Python
26 lines
704 B
Python
def _classpath_collector(ctx):
|
|
all = depset()
|
|
for d in ctx.attr.deps:
|
|
if hasattr(d, "java"):
|
|
all += d.java.transitive_runtime_deps
|
|
if hasattr(d.java.compilation_info, "runtime_classpath"):
|
|
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,
|
|
)
|