mtk 安卓12 13开始 编译脚本就改为了V2.0 , 原来的编译脚本V1.0 编译完成后会显示编译花费的总时间, 现在的不显示导致有点不习惯, 只显示模块编译的时候, 合并和编译总时间没有显示;
效果图:
修改记录:
+++ b/vendor/mediatek/proprietary/scripts/releasetools/split_build.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
__author__ = 'mtk'
import time
+import datetime
import argparse
import os
import re
@@ -319,11 +320,13 @@ def main():
color_failed = "\033[0;31m"
color_success = "\033[0;32m"
color_reset = "\033[0m"
+
+ total_time_formatted = str(datetime.timedelta(seconds=(time.time() - start_log))).split('.')[0]
if result == 0:
shutil.rmtree(temp_dir)
- print(color_success + "\n#### split_build.py build completed successfully ####\n" + color_reset)
+ print(color_success + "\n#### split_build.py build completed successfully ({}) ####\n".format(total_time_formatted) + color_reset)
else:
- print(color_failed + "\n#### split_build.py failed to build some targets ####\n" + color_reset)
+ print(color_failed + "\n#### split_build.py failed to build some targets ({}) ####\n".format(total_time_formatted) + color_reset)
return result
if __name__ == '__main__':
@@ -332,6 +335,7 @@ if __name__ == '__main__':
MTK_SPLIT_BUILD_HELPER_TIME = os.environ['MTK_SPLIT_BUILD_HELPER_TIME']
else:
MTK_SPLIT_BUILD_HELPER_TIME = 0
+ start_log = time.time()
start_time = int(time.time()*1000000000)
result = main()
os.environ['MTK_SPLIT_BUILD_ARGV'] = ' '.join(sys.argv)
+++ b/vendor/mediatek/proprietary/scripts/releasetools/split_build_helper.py
@@ -7,6 +7,7 @@ import argparse
import subprocess
import threading
import time
+import datetime
import multiprocessing
ansi_csi = "\033["
@@ -55,8 +56,9 @@ def perform_run(command):
res = subprocess.Popen(command, shell=True, executable='/bin/bash')
out, err = res.communicate()
if res.returncode != 0:
+ total_time_formatted = str(datetime.timedelta(seconds=(time.time() - start_log))).split('.')[0]
print("command "{}" returned {}: {}".format(command, res.returncode, err))
- print(color_failed + "#### split_build_helper.py failed to build some targets ####" + color_reset)
+ print(color_failed + "#### split_build_helper.py failed to build some targets ({}) ####\n".format(total_time_formatted) + color_reset)
return res.returncode
def perform_parse(filename, option):
@@ -521,14 +523,16 @@ def main():
ret = res
if not args.keep_going:
return ret
+ total_time_formatted = str(datetime.timedelta(seconds=(time.time() - start_log))).split('.')[0]
if ret == 0:
- print(color_success + "\n#### split_build_helper.py build completed successfully ####\n" + color_reset)
+ print(color_success + "\n#### split_build_helper.py build completed successfully ({}) ####\n".format(total_time_formatted) + color_reset)
else:
- print(color_failed + "\n#### split_build_helper.py failed to build some targets ####\n" + color_reset)
+ print(color_failed + "\n#### split_build_helper.py failed to build some targets ({}) ####\n".format(total_time_formatted) + color_reset)
else:
print('\n'.join(commands))
return ret
if __name__ == '__main__':
+ start_log = time.time()
result = main()
sys.exit(result)