gn2bp: Move response file to `gn_utils`
* This is a GN-specific flag that should live in gn_utils as it might be used in the future when converting to Bazel.
Test: update_results.sh
Change-Id: If870f757cf3ee57a00c571947a7ffea18a7db55d
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 3737130..faa303e 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -108,7 +108,7 @@
# Location of the protobuf src dir in the Android source tree.
android_protobuf_src = 'external/protobuf/src'
-response_file = '{{response_file_name}}'
+
# Compiler flags which are passed through to the blueprint.
cflag_allowlist = [
@@ -737,11 +737,11 @@
# Handle passing parameters via response file by piping them into the script
# and reading them from /dev/stdin.
- self.use_response_file = response_file in self.target.args
+ self.use_response_file = gn_utils.RESPONSE_FILE in self.target.args
if self.use_response_file:
# Replace {{response_file_contents}} with /dev/stdin
- self.target.args = ['/dev/stdin' if it == response_file else it for it in
- self.target.args]
+ self.target.args = ['/dev/stdin' if it == gn_utils.RESPONSE_FILE else it
+ for it in self.target.args]
def _sanitize_outputs(self):
pass
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 8f33ca2..0511e8a 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -52,6 +52,8 @@
ARCH_REGEX = r'(android_x86_64|android_x86|android_arm|android_arm64|host)'
DEX_REGEX = '.*__dex__%s$' % ARCH_REGEX
COMPILE_JAVA_REGEX = '.*__compile_java__%s$' % ARCH_REGEX
+RESPONSE_FILE = '{{response_file_name}}'
+
def repo_root():
"""Returns an absolute path to the repository root."""
return os.path.join(