Avoid using resource provider in android
@@ -115,10 +115,11 @@ def get_res_artifacts(resources, retain_res_fileset_info):
"""Returns a map from the res folder to the set of resources within that folder. Given a set of resources, this method constructs a map where the keys are all the unique res folders that contain the given resources. The values are empty sets most of the time, but if the given predicate retail_fileset returns True for a given folder, then it contains all the resources that are present within that folder. Note that sets are implemented as dicts with values set to True"""
res_artifacts = dict()
for resource in resources:
- res_folder = source_directory_tuple(resource)
+ for file in resource.files:
+ res_folder = source_directory_tuple(file)
res_files = res_artifacts.setdefault(res_folder, dict())
if retain_res_fileset_info and retain_res_fileset_info(res_folder[0]):
- res_files.update({resource.path[len(res_folder[0]) + 1:]: True})
+ res_files.update({file.path[len(res_folder[0]) + 1:]: True})
return res_artifacts
def build_file_artifact_location(ctx):
@@ -701,7 +702,8 @@ def collect_android_info(target, ctx, semantics, ide_info, ide_info_file, output
android = target.android
resources = []
res_folders = []
- for artifact_path_fragments, res_files in get_res_artifacts(android.resources, android_semantics.retain_res_fileset_info if android_semantics else None).items():
+ if (hasattr(ctx.rule.attr, "resource_files")):
+ for artifact_path_fragments, res_files in get_res_artifacts(ctx.rule.attr.resource_files, android_semantics.retain_res_fileset_info if android_semantics else None).items():
# Generate unique ArtifactLocation for resource directories.
root = to_artifact_location(*artifact_path_fragments)
resources.append(root)
