Skip to content

Commit

Permalink
fixing android_local_test
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaYan Lin committed Jan 25, 2024
1 parent 80fa1fe commit 1b01367
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions rules/android_local_test/attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@ def make_attrs(additional_aspects = [], native_libs_transition = None):
env = attr.string_dict(
doc = "A dictionary of environment variables set for the execution of the test. Will be subject to make variable and $(location) expansion.",
),
robolectric_properties_file = attr.string(
robolectric_properties_file = attr.label(
doc = "The classpath to robolectric-deps.properties file.",
default = "${JAVA_RUNFILES}/robolectric/bazel/robolectric-deps.properties",
allow_single_file = True,
default = "@robolectric//bazel:android-all",
),
test_class = attr.string(
doc = """
Expand Down
6 changes: 5 additions & 1 deletion rules/android_local_test/impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ def _process_jvm(ctx, resources_ctx, **_unused_sub_ctxs):
filter_jdeps(ctx, java_info.outputs.jdeps, filtered_jdeps, utils.only(resources_ctx.r_java.compile_jars.to_list()))
providers.append(AndroidFilteredJdepsInfo(jdeps = filtered_jdeps))
runfiles.append(filtered_jdeps)
file = ctx.file.robolectric_properties_file
print(">>>>>>>>>> ", file, ctx.file.robolectric_properties_file)
properties = '${JAVA_RUNFILES}/' + '/'.join(file.path.split('/')[:-1]) + '/' + 'robolectric-deps.properties'
print(">>>>>>>>>>>> ", properties)

return ProviderInfo(
name = "jvm_ctx",
Expand All @@ -178,7 +182,7 @@ def _process_jvm(ctx, resources_ctx, **_unused_sub_ctxs):
deps = deps,
java_start_class = java_start_class,
coverage_start_class = coverage_start_class,
android_properties_file = ctx.attr.robolectric_properties_file,
android_properties_file = properties,
additional_jvm_flags = [],
),
runfiles = ctx.runfiles(files = runfiles),
Expand Down

0 comments on commit 1b01367

Please sign in to comment.