invalid_targets.extend(vt.targets)
for target in invalid_targets:
// "input_dirs" is the folder containing the Android dex file.
input_dirs = []
// "gen_out" holds resource folders (e.g. "res").
gen_out = []
mapping = self.context.products.get("dex")
for basedir in mapping.get(target):
input_dirs.append(basedir)
def gather_resources(target):
Gather the "resource_dir" of the target.
if isinstance(target, AndroidResources):
gen_out.append(os.path.join(get_buildroot(), target.resource_dir))
target.walk(gather_resources)
args = self.render_args(target, gen_out, input_dirs)
with self.context.new_workunit(name="apk-bundle", labels=[WorkUnit.MULTITOOL]) as workunit:
returncode = subprocess.call(args, stdout=workunit.output("stdout"),
stderr=workunit.output("stderr"))
if returncode:
After Change
dex_files.append(dex)
resource_deps = self.context.build_graph.transitive_subgraph_of_addresses([binary.address])
resource_dirs = [t.resource_dir for t in resource_deps if isinstance(t, AndroidResources)]
// Priority for resources is left to right, so reverse the collection order (DFS preorder).
args = self._render_args(binary, reversed(resource_dirs), dex_files)
with self.context.new_workunit(name="apk-bundle",
labels=[WorkUnit.MULTITOOL]) as workunit:
returncode = subprocess.call(args, stdout=workunit.output("stdout"),
stderr=workunit.output("stderr"))