Embed build number in non-apex build

Bug: 316978205
Test: m android.hardware.drm-service.widevine
Change-Id: Ibf77a0135fa832424f38619bdd2df0ccc53f5849
This commit is contained in:
Robert Shih
2024-01-12 22:33:50 -08:00
parent 0a0fea75a8
commit 8b52f39a58
3 changed files with 59 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
import argparse
import datetime
import json
import sys
if __name__ == "__main__":
description = 'APEX Manifest JSON (stdin) to C++ header (stdout)'
parser = argparse.ArgumentParser(description=description)
parser.add_argument('--guard', type=str,
default='WVCDM_WV_ANDROID_BUILD_ID_H_',
help='Include guard')
args = parser.parse_args()
apex_manifest = json.load(sys.stdin)
output = f'''\
// Copyright {datetime.date.today().year} Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
//
#ifndef {args.guard}
#define {args.guard}
#define WV_ANDROID_BUILD_ID "{apex_manifest['version']}"
#endif // {args.guard}'''
print(output)