Skip to content

Commit

Permalink
adding target/test-classes only if testonly
Browse files Browse the repository at this point in the history
  • Loading branch information
ittaiz committed Jun 17, 2017
1 parent 30a64af commit d66c9d7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scala/scala.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,11 @@ def _write_launcher(ctx, rjars, main_class, jvm_flags, args="", wrapper_preamble
runfiles_root = "${TEST_SRCDIR}/%s" % ctx.workspace_name
# RUNPATH is defined here:
# https://github.com/bazelbuild/bazel/blob/0.4.5/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt#L227
classpath2 = ":".join(["%s" % (j.short_path) for j in rjars])
classpath = "target/test-classes:%s" % classpath2
classpath = ":".join(["${RUNPATH}%s" % (j.short_path) for j in rjars])

if ctx.attr.testonly:
classpath = ":".join(["%s" % (j.short_path) for j in rjars])
classpath = "target/test-classes:%s" % classpath

jvm_flags = " ".join([ctx.expand_location(f, ctx.attr.data) for f in jvm_flags])
javabin = "%s/%s" % (runfiles_root, ctx.executable._java.short_path)
Expand Down

0 comments on commit d66c9d7

Please sign in to comment.