@@ -91,6 +91,7 @@ def _impl(ctx):
91
91
declared_dir ,
92
92
]))
93
93
94
+ # taken from rules_scala
94
95
def _collect_jars (targets ):
95
96
"""Compute the runtime and compile-time dependencies from the given targets""" # noqa
96
97
compile_jars = depset ()
@@ -104,11 +105,17 @@ def _collect_jars(targets):
104
105
runtime_jars = depset (transitive = [runtime_jars , target .scala .transitive_runtime_deps ])
105
106
runtime_jars = depset (transitive = [runtime_jars , target .scala .transitive_runtime_exports ])
106
107
found = True
107
- if hasattr (target , "java" ):
108
- compile_jars = depset (transitive = [compile_jars , target .java .transitive_deps ])
109
- runtime_jars = depset (transitive = [runtime_jars , target .java .transitive_runtime_deps ])
108
+ if hasattr (target , "JavaInfo" ):
109
+ # see JavaSkylarkApiProvider.java,
110
+ # this is just the compile-time deps
111
+ # this should be improved in bazel 0.1.5 to get outputs.ijar
112
+ # compile_jars = depset(transitive = [compile_jars, [target.java.outputs.ijar]])
113
+ compile_jars = depset (transitive = [compile_jars , target [JavaInfo ].transitive_deps ])
114
+ runtime_jars = depset (transitive = [runtime_jars , target [JavaInfo ].transitive_runtime_deps ])
110
115
found = True
111
116
if not found :
117
+ # support http_file pointed at a jar. http_jar uses ijar,
118
+ # which breaks scala macros
112
119
runtime_jars = depset (transitive = [runtime_jars , target .files ])
113
120
compile_jars = depset (transitive = [compile_jars , target .files ])
114
121
0 commit comments