Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions scala/scala.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def _build_nosrc_jar(ctx, buildijar):
if buildijar:
outs.extend([ctx.outputs.ijar])

inputs = ctx.files.resources + [
# _jdk added manually since _java doesn't currently setup runfiles
inputs = ctx.files.resources + ctx.files._jdk + [
ctx.outputs.manifest,
ctx.executable._jar,
ctx.executable._java,
Expand Down Expand Up @@ -207,6 +208,9 @@ SourceJars: {srcjars}
outs = [ctx.outputs.jar]
if buildijar:
outs.extend([ctx.outputs.ijar])
# _jdk added manually since _java doesn't currently setup runfiles
# _scalac, as a java_binary, should already have it in its runfiles; however,
# adding does ensure _java not orphaned if _scalac ever was not a java_binary
ins = (list(jars) +
list(dep_srcjars) +
list(srcjars) +
Expand All @@ -215,6 +219,7 @@ SourceJars: {srcjars}
ctx.files.plugins +
ctx.files.resources +
ctx.files.resource_jars +
ctx.files._jdk +
[ctx.outputs.manifest,
ctx.executable._ijar,
ctx.executable._java,
Expand Down Expand Up @@ -362,7 +367,7 @@ def _collect_jars(targets):
# see JavaSkylarkApiProvider.java,
# this is just the compile-time deps
# this should be improved in bazel 0.1.5 to get outputs.ijar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and remove this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted that part of the change. Amended comment.

My fear is that transitive_deps to ijar COULD break code (although technically code that was making incorrect assumptions anyway). However, I was hoping for this PR to strictly decrease number of breakages.

# compile_jars += [target.java.outputs.ijar]
# compile_jars += [output.ijar for output in target.java.outputs.jars]
compile_jars += target.java.transitive_deps
runtime_jars += target.java.transitive_runtime_deps
found = True
Expand Down Expand Up @@ -444,8 +449,9 @@ def _scala_binary_common(ctx, cjars, rjars):
outputs = _compile_or_empty(ctx, cjars, [], False) # no need to build an ijar for an executable
_build_deployable(ctx, list(rjars))

# _jdk added manually since _java doesn't currently setup runfiles
runfiles = ctx.runfiles(
files = list(rjars) + [ctx.outputs.executable],
files = list(rjars) + [ctx.outputs.executable] + ctx.files._jdk,
transitive_files = _get_runfiles(ctx.attr._java),
collect_data = True)

Expand Down Expand Up @@ -509,8 +515,9 @@ fi
""",
)

# _jdk added manually since _java doesn't currently setup runfiles
runfiles = ctx.runfiles(
files = list(rjars) + [ctx.outputs.executable],
files = list(rjars) + [ctx.outputs.executable] + ctx.files._jdk,
transitive_files = _get_runfiles(ctx.attr._java),
collect_data = True)

Expand Down