gn2bp: try to put all common path operations in one function

This *might* just work. We'll see, I guess.

Test: none
Change-Id: Id78af8f1b1b7bc3b0e253e17c99049c72be49f08
This commit is contained in:
Patrick Rohr
2022-11-30 15:20:21 -08:00
parent 1bedf6ca4e
commit 0e24c5fd51

View File

@@ -678,9 +678,14 @@ class BaseActionSanitizer():
def _location_tag(self, filename):
return '$(location %s)' % filename
# deletes the leading ../../
def _rebase_directory(self, filename):
return re.sub('^\.\./\.\./', '', filename)
# applies common directory transformation that *should* be universally applicable.
# TODO: verify if it actually *is* universally applicable.
def _sanitize_dir(self, filepath):
# Careful, order matters!
filepath = re.sub('^\.\./\.\./', '', filepath)
filepath = re.sub('^gen/jni_headers', '$(genDir)', filepath)
filepath = re.sub('^gen', '$(genDir)', filepath)
return filepath
def get_args(self):
return self.target.args