gn2bp: Add get_srcs to the Sanitizer am: 80fa0b0e8d

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2327486

Change-Id: I0840efc3af6afedce0f6aaf1d40b968653cb67c8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Motomu Utsumi
2022-12-05 13:24:36 +00:00
committed by Automerger Merge Worker

View File

@@ -749,6 +749,13 @@ class BaseActionSanitizer():
def get_inputs(self):
return self.target.inputs
def get_srcs(self):
# gn treats inputs and sources for actions equally.
# soong only supports source files inside srcs, non-source files are added as
# tool_files dependency.
files = self.target.sources.union(self.target.inputs)
return {gn_utils.label_to_path(file) for file in files if is_supported_source_file(file)}
def _sanitize_args(self):
# Handle passing parameters via response file by piping them into the script
# and reading them from /dev/stdin.
@@ -938,6 +945,7 @@ def create_action_module(blueprint, target, type):
if sanitizer.is_header_generated():
module.genrule_headers.add(module.name)
target.inputs = sanitizer.get_inputs()
module.srcs = sanitizer.get_srcs()
if target.script == '//base/android/jni_generator/jni_generator.py':
# android_jar.classes should be part of the tools as it list implicit classes
@@ -960,9 +968,7 @@ def create_action_module(blueprint, target, type):
# soong only supports source files inside srcs, non-source files are added as
# tool_files dependency.
for it in target.sources.union(target.inputs):
if is_supported_source_file(it):
module.srcs.add(gn_utils.label_to_path(it))
else:
if not is_supported_source_file(it):
module.tool_files.add(gn_utils.label_to_path(it))
blueprint.add_module(module)