Include command-line arguments in comment.
This makes it clear exactly how a build file was generated and how to
reproduce it.
Bug: 158290206
Change-Id: Icf28a66bf0da708a3fcd0fe3d49893191fb1a8f1
diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py
index 62bd38d..38a816e 100755
--- a/scripts/cargo2android.py
+++ b/scripts/cargo2android.py
@@ -59,6 +59,7 @@
import os
import os.path
import re
+import sys
RENAME_MAP = {
# This map includes all changes to the default rust library module
@@ -71,7 +72,7 @@
}
# Header added to all generated Android.bp files.
-ANDROID_BP_HEADER = '// This file is generated by cargo2android.py.\n'
+ANDROID_BP_HEADER = '// This file is generated by cargo2android.py {args}.\n'
CARGO_OUT = 'cargo.out' # Name of file to keep cargo build -v output.
@@ -882,7 +883,7 @@
if name not in self.bp_files:
self.bp_files.add(name)
with open(name, 'w') as outf:
- outf.write(ANDROID_BP_HEADER)
+ outf.write(ANDROID_BP_HEADER.format(args=' '.join(sys.argv[1:])))
def claim_module_name(self, prefix, owner, counter):
"""Return prefix if not owned yet, otherwise, prefix+str(counter)."""