gn2bp: remove script from sources
Actions using template "action_with_pydeps" put the script inside
inputs.
In soong, a file cannot be in both tool_files and srcs, so remove it
from the latter if it is there.
This got me to successfully build a valid Android.bp file for the first
time! (All the way to the first compile error, yay!) Note that this only
works with perfetto removed via 'enable_base_tracing = false' in gn
args.
Also note that likely none of the actions are correct yet.
{{response_file_name}} tags are not handled yet and all script args that
reference a file or directory are most certainly wrong.
Test: //base:base
Change-Id: I779141121c63982f001fb82a9705439cde36dd48
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 46caec4..75266ab 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -685,6 +685,11 @@
module.srcs.update(gn_utils.label_to_path(it) for it in target.inputs)
module.srcs.update(gn_utils.label_to_path(it) for it in target.sources)
+ # Actions using template "action_with_pydeps" also put script inside inputs.
+ # TODO: it might make sense to filter inputs inside GnParser.
+ if script in module.srcs:
+ module.srcs.remove(script)
+
module.out.update(target.outputs)
blueprint.add_module(module)
return module