From a0e37c105f65f5c08ab65f038aeb55663050b05e Mon Sep 17 00:00:00 2001 From: Mohannad Farrag Date: Fri, 2 Dec 2022 14:46:08 +0000 Subject: [PATCH] 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 --- tools/gn2bp/gen_android_bp | 8 ++++---- tools/gn2bp/gn_utils.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp index 373713055f..faa303e1c0 100755 --- a/tools/gn2bp/gen_android_bp +++ b/tools/gn2bp/gen_android_bp @@ -108,7 +108,7 @@ buildtools_protobuf_src = '//buildtools/protobuf/src' # 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 @@ class BaseActionSanitizer(): # 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 8f33ca21ca..0511e8a25b 100644 --- a/tools/gn2bp/gn_utils.py +++ b/tools/gn2bp/gn_utils.py @@ -52,6 +52,8 @@ ODR_VIOLATION_IGNORE_TARGETS = { 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(