gn2bp: explicitly replace out arg
Test: //base:base
Change-Id: Ib40c38df7d464f9f2dec7c62af7a36fb27d3bb5c
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 47be818..5ff30de 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -682,7 +682,11 @@
for i, val in enumerate(target.args):
if val == '--gen-dir':
target.args[i + 1] = '.'
- break
+ elif val == '--output':
+ target.args[i + 1] = '$(out)'
+
+ elif target.script == '//build/write_build_date_header.py':
+ target.args[0] = '$(out)'
elif target.script == '//base/android/jni_generator/jni_generator.py':
# chromium builds against a prebuilt ndk that contains the jni_headers, so
@@ -724,11 +728,6 @@
script = gn_utils.label_to_path(target.script)
module.tool_files.add(script)
- # Replace arg by {$out} if possible
- if len(target.outputs) == 1:
- out = list(target.outputs)[0]
- target.args = ['$(out)' if arg == out or arg == 'gen/' + out else arg for arg in target.args]
-
# Handle passing parameters via response file by piping them into the script
# and reading them from /dev/stdin.
response_file = '{{response_file_name}}'