Fix local var error, warn if no outputs, handle "}generate{"
1. UnboundLocalError: cannot access local variable 'output' where it is not associated with a value 2. `build/soong/tests/genrule_sandbox_test.py WmediumdServerProto_cc` would try to build the entire world due to 3) 3. WmediumdServerProto_cc 's module action desc had '}generate{' without a space which would cause 2) Bug: b/287470077 Test: build/soong/tests/genrule_sandbox_test.py WmediumdServerProto_cc Change-Id: Ie9d5db44195a6f700cc876ec889bd01c11e66cff
This commit is contained in:
@@ -69,7 +69,7 @@ def _find_outputs_for_modules(modules, out_dir, target_product):
|
|||||||
name = mod["Name"]
|
name = mod["Name"]
|
||||||
if name in modules:
|
if name in modules:
|
||||||
for act in mod["Module"]["Actions"]:
|
for act in mod["Module"]["Actions"]:
|
||||||
if "}generate " in act["Desc"]:
|
if "}generate" in act["Desc"]:
|
||||||
module_to_outs[name].update(act["Outputs"])
|
module_to_outs[name].update(act["Outputs"])
|
||||||
return module_to_outs
|
return module_to_outs
|
||||||
|
|
||||||
@@ -90,6 +90,7 @@ def _store_outputs_to_tmp(output_files):
|
|||||||
|
|
||||||
|
|
||||||
def _diff_outs(file1, file2, show_diff):
|
def _diff_outs(file1, file2, show_diff):
|
||||||
|
output = None
|
||||||
base_args = ["diff"]
|
base_args = ["diff"]
|
||||||
if not show_diff:
|
if not show_diff:
|
||||||
base_args.append("--brief")
|
base_args.append("--brief")
|
||||||
@@ -154,6 +155,10 @@ def main():
|
|||||||
modules = set(args.modules)
|
modules = set(args.modules)
|
||||||
|
|
||||||
module_to_outs = _find_outputs_for_modules(modules, out_dir, target_product)
|
module_to_outs = _find_outputs_for_modules(modules, out_dir, target_product)
|
||||||
|
if not module_to_outs:
|
||||||
|
print("No outputs found")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
if args.output_paths_only:
|
if args.output_paths_only:
|
||||||
for m, o in module_to_outs.items():
|
for m, o in module_to_outs.items():
|
||||||
print(f"{m} outputs: {o}")
|
print(f"{m} outputs: {o}")
|
||||||
|
Reference in New Issue
Block a user