gn2bp: Move 'sanitize_version_filepath' to base class
This method is needed for another subclass so it's better to move it to the base class and change the name.
Test: None
Change-Id: I763a5d30d9b35b585914f1c8dbb2d5989e1d55d6
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index e54cb31..4e4747b 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -696,6 +696,12 @@
self.target.args.append(arg)
self.target.args.append(value)
+ def _sanitize_filepath_with_location_tag(self, arg):
+ if arg.startswith('../../'):
+ arg = self._sanitize_filepath(arg)
+ arg = self._add_location_tag(arg)
+ return arg
+
# wrap filename in location tag.
def _add_location_tag(self, filename):
return '$(location %s)' % filename
@@ -760,12 +766,6 @@
return super().get_args()
class VersionSanitizer(BaseActionSanitizer):
- def _sanitize_version_filepath(self, arg):
- if arg.startswith('../../'):
- arg = self._sanitize_filepath(arg)
- arg = self._add_location_tag(arg)
- return arg
-
def _sanitize_eval(self):
assert (self._is_value_arg('-e'))
# arg for -e EVAL option should be passed in -e PATCH_HI=int(PATCH)//256 format.
@@ -780,7 +780,7 @@
self._set_value_arg('-o', '$(out)')
# args for the version.py contain file path without leading --arg key. So apply sanitize
# function for all the args.
- self._update_all_args(self._sanitize_version_filepath)
+ self._update_all_args(self._sanitize_filepath_with_location_tag)
self._sanitize_eval()
return super().get_args()