Skip to content

Commit d66c9d7

Browse files
committed
adding target/test-classes only if testonly
1 parent 30a64af commit d66c9d7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

scala/scala.bzl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,11 @@ def _write_launcher(ctx, rjars, main_class, jvm_flags, args="", wrapper_preamble
311311
runfiles_root = "${TEST_SRCDIR}/%s" % ctx.workspace_name
312312
# RUNPATH is defined here:
313313
# 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
314-
classpath2 = ":".join(["%s" % (j.short_path) for j in rjars])
315-
classpath = "target/test-classes:%s" % classpath2
314+
classpath = ":".join(["${RUNPATH}%s" % (j.short_path) for j in rjars])
315+
316+
if ctx.attr.testonly:
317+
classpath = ":".join(["%s" % (j.short_path) for j in rjars])
318+
classpath = "target/test-classes:%s" % classpath
316319

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

0 commit comments

Comments
 (0)