From 80e90be1b730bb1c4367cf483e4a0bf177fb51ea Mon Sep 17 00:00:00 2001 From: Andrew Walbran Date: Tue, 9 Jun 2020 14:33:18 +0100 Subject: [PATCH] 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 --- scripts/cargo2android.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py index 62bd38d64..38a816ee3 100755 --- a/scripts/cargo2android.py +++ b/scripts/cargo2android.py @@ -59,6 +59,7 @@ import argparse 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 @@ RENAME_MAP = { } # 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 @@ class Runner(object): 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)."""