bazel: generate the classpath in a file, for use with eclipse.

Change-Id: I6562c045a7e47c6661889d63f3103e1aeef113ec
This commit is contained in:
Han-Wen Nienhuys 2016-11-13 10:34:18 -08:00 committed by David Ostrovsky
parent 269cce1a82
commit 888f4ac705
4 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,7 @@
package(
default_visibility=["//visibility:public"]
)
load('//tools/bzl:junit.bzl', 'junit_tests')
SRCS = glob(

View File

@ -1,3 +1,7 @@
package(
default_visibility=["//visibility:public"]
)
load('//tools/bzl:gwt.bzl', 'gwt_module')
load('//tools/bzl:junit.bzl', 'junit_tests')

19
tools/bzl/classpath.bzl Normal file
View File

@ -0,0 +1,19 @@
def _classpath_collector(ctx):
all = set()
for d in ctx.attr.deps:
all += d.java.compilation_info.runtime_classpath
as_strs = [c.path for c in all]
ctx.file_action(output= ctx.outputs.runtime,
content="\n".join(sorted(as_strs)))
classpath_collector = rule(
implementation = _classpath_collector,
attrs = {
"deps": attr.label_list(),
},
outputs={
"runtime": "%{name}.runtime_classpath"
})

View File

@ -94,7 +94,7 @@ def _maven_jar_impl(ctx):
out = ctx.execute(args)
if out.return_code:
fail("failed %s: %s" % (args, out.stderr))
fail("failed %s: %s" % (' '.join(args), out.stderr))
_generate_build_file(ctx, "jar", binjar)
if ctx.attr.src_sha1 or ctx.attr.attach_source: