Skip to content

Commit 1b01367

Browse files
author
JiaYan Lin
committed
fixing android_local_test
1 parent 80fa1fe commit 1b01367

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

rules/android_local_test/attrs.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ def make_attrs(additional_aspects = [], native_libs_transition = None):
175175
env = attr.string_dict(
176176
doc = "A dictionary of environment variables set for the execution of the test. Will be subject to make variable and $(location) expansion.",
177177
),
178-
robolectric_properties_file = attr.string(
178+
robolectric_properties_file = attr.label(
179179
doc = "The classpath to robolectric-deps.properties file.",
180-
default = "${JAVA_RUNFILES}/robolectric/bazel/robolectric-deps.properties",
180+
allow_single_file = True,
181+
default = "@robolectric//bazel:android-all",
181182
),
182183
test_class = attr.string(
183184
doc = """

rules/android_local_test/impl.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ def _process_jvm(ctx, resources_ctx, **_unused_sub_ctxs):
169169
filter_jdeps(ctx, java_info.outputs.jdeps, filtered_jdeps, utils.only(resources_ctx.r_java.compile_jars.to_list()))
170170
providers.append(AndroidFilteredJdepsInfo(jdeps = filtered_jdeps))
171171
runfiles.append(filtered_jdeps)
172+
file = ctx.file.robolectric_properties_file
173+
print(">>>>>>>>>> ", file, ctx.file.robolectric_properties_file)
174+
properties = '${JAVA_RUNFILES}/' + '/'.join(file.path.split('/')[:-1]) + '/' + 'robolectric-deps.properties'
175+
print(">>>>>>>>>>>> ", properties)
172176

173177
return ProviderInfo(
174178
name = "jvm_ctx",
@@ -178,7 +182,7 @@ def _process_jvm(ctx, resources_ctx, **_unused_sub_ctxs):
178182
deps = deps,
179183
java_start_class = java_start_class,
180184
coverage_start_class = coverage_start_class,
181-
android_properties_file = ctx.attr.robolectric_properties_file,
185+
android_properties_file = properties,
182186
additional_jvm_flags = [],
183187
),
184188
runfiles = ctx.runfiles(files = runfiles),

0 commit comments

Comments
 (0)