gn2bp: Add sanitize API to the BaseActionSanitizer

Currently, Sanitizer modifies target attributes in the get APIs.
However, some sanitize methods are not idempotent (e.g.
_add_location_tag).
Also, get API could depends on the same target attributes, at this
point, get_srcs and get_tool_files will depends on target.sources and
target.inputs.
This could easily cause issue by calling non idempotent sanitize methods
multiple times.
This CL introduces sanitize API to prevent this issue.
sanitize API modifies all the required target attributes and other get
APIs only read the sanitized target attributes.
This makes it easy to guarantee that sanitization is done only once.

Test: ./update_results.sh
Change-Id: I1b4033ae161284ef07153b56e05217b8557b4cba
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 032e5d7..4029837 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -731,6 +731,16 @@
   def get_outputs(self):
     return self.target.outputs
 
+  def _sanitize_args(self):
+    pass
+
+  def _sanitize_outputs(self):
+    pass
+
+  def sanitize(self):
+    self._sanitize_args()
+    self._sanitize_outputs()
+
   # Whether this target generates header files
   def is_header_generated(self):
     return any(os.path.splitext(it)[1] == '.h' for it in self.target.outputs)
@@ -860,6 +870,7 @@
   module = Module(type, bp_module_name, target.name)
 
   sanitizer = get_action_sanitizer(target)
+  sanitizer.sanitize()
   target.args = sanitizer.get_args()
   module.out = sanitizer.get_outputs()
   if sanitizer.is_header_generated():