Adding additional_transformations am: c04c32fec1

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/common/+/22225602

Change-Id: I0f13c1a269a544c8aa46fe610a9e7034449a5e26
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Zhi Dou
2023-03-24 13:28:37 +00:00
committed by Automerger Merge Worker
3 changed files with 121 additions and 4 deletions

View File

@@ -117,10 +117,6 @@ class SoongConfigBoilerplateInserter(SoongConfigVarTransformation):
def config_module_type(self, module_type):
return self.configModuleTypePrefix + module_type
def apply(self, producer, path, build_release):
with open(path, "r+", encoding="utf8") as file:
self._apply_transformation(producer, file, build_release)
def _apply_transformation(self, producer, file, build_release):
# TODO(b/174997203): Remove this when we have a proper way to control
# prefer flags in Mainline modules.
@@ -864,6 +860,9 @@ class MainlineModule:
# Defaults to the last part of the apex name.
short_name: str = ""
# Additional transformations
additional_transformations: list[FileTransformation] = None
def __post_init__(self):
# If short_name is not set then set it to the last component of the apex
# name.
@@ -905,6 +904,9 @@ class MainlineModule:
"Android.bp", configVar=config_var)
transformations.append(transformation)
if self.additional_transformations and build_release > R:
transformations.extend(self.additional_transformations)
return transformations
def is_required_for(self, target_build_release):