@@ -165,6 +165,69 @@ def _transitive_from_exports_test_impl(env, target):
165
165
classpath .contains (_file (env .ctx .attr .associate_jar ).short_path )
166
166
classpath .not_contains (_file (env .ctx .attr .associate_abi_jar ).short_path )
167
167
168
+ def _transitive_from_associates_test_impl (env , target ):
169
+ ##
170
+ # the one where target A associates with target B
171
+ # target B has a dependency to target C
172
+ # target A uses C, the world explodes
173
+ # what this means is the associates transitive_compile_time_jars has this
174
+ # <generated file B.jar>,
175
+ # <generated file C.jar>,
176
+ # <source file various-sdk-libs.jar>
177
+ # we will use the "direct jar" as a direct dep of the associate ie C
178
+ ##
179
+ associates_direct_deps = [
180
+ JavaInfo (
181
+ compile_jar = _file (env .ctx .attr .direct_dep_jar ),
182
+ output_jar = _file (env .ctx .attr .direct_dep_jar ),
183
+ ),
184
+ ]
185
+
186
+ associate_deps = [
187
+ {
188
+ JavaInfo : JavaInfo (
189
+ compile_jar = _file (env .ctx .attr .associate_jar ),
190
+ output_jar = _file (env .ctx .attr .associate_jar ),
191
+ deps = associates_direct_deps ,
192
+ ),
193
+ _KtJvmInfo : _KtJvmInfo (
194
+ module_name = "associate_name" ,
195
+ ),
196
+ },
197
+ ]
198
+
199
+ fake_ctx = struct (
200
+ label = target .label ,
201
+ attr = struct (
202
+ module_name = "" ,
203
+ tags = [],
204
+ ),
205
+ )
206
+
207
+ nothing_configured_toolchains = struct (
208
+ kt = struct (
209
+ experimental_remove_private_classes_in_abi_jars = False ,
210
+ experimental_prune_transitive_deps = False ,
211
+ experimental_strict_associate_dependencies = False ,
212
+ jvm_stdlibs = JavaInfo (
213
+ compile_jar = _file (env .ctx .attr .jvm_jar ),
214
+ output_jar = _file (env .ctx .attr .jvm_jar ),
215
+ ),
216
+ ),
217
+ )
218
+
219
+ result = _jvm_deps_utils .jvm_deps (
220
+ ctx = fake_ctx ,
221
+ toolchains = nothing_configured_toolchains ,
222
+ associate_deps = associate_deps ,
223
+ deps = [],
224
+ )
225
+
226
+ classpath = env .expect .that_depset_of_files (result .compile_jars )
227
+
228
+ classpath .contains (_file (env .ctx .attr .direct_dep_jar ).short_path )
229
+ classpath .contains (_file (env .ctx .attr .associate_jar ).short_path )
230
+
168
231
def _abi_test (name , impl ):
169
232
util .helper_target (
170
233
native .filegroup ,
@@ -200,12 +263,16 @@ def _fat_abi_test(name):
200
263
def _transitive_from_exports_test (name ):
201
264
_abi_test (name , _transitive_from_exports_test_impl )
202
265
266
+ def _transitive_from_associates_test (name ):
267
+ _abi_test (name , _transitive_from_associates_test_impl )
268
+
203
269
def jvm_deps_test_suite (name ):
204
270
test_suite (
205
271
name ,
206
272
tests = [
207
273
_strict_abi_test ,
208
274
_fat_abi_test ,
209
275
_transitive_from_exports_test ,
276
+ _transitive_from_associates_test ,
210
277
],
211
278
)
0 commit comments