1# Automatic build performance 2 3## Purpose 4build specified projects serveral times and calculate the average value of build time and size of abc 5 6## How to use 7### environmoent 8Windows, pandas, json5, python3.9 9### How to run 10input the command in cmd: python performance_entry.py 11 12### Details of settings 13You need to modify in the performance_config.py 14project_path, node_js_path, jbr_path. These params must be set according your envronment!!! Other params use default. 15If you need to modify others, you can set in application_configs, refer to the 'HelloWorld' 16set run_list to run the projects 17``` 18 send_mail = True 19 run_list = ["FTB", "FDY", "FWX"] 20 21 def __init__(self): 22 # Default config settings for all projects, if it's not what you need, config them in application_configs 23 self.cmd_prefix = r"hvigorw.bat" 24``` 25 26``` 27 def __init__(self): 28 ... 29 30 # Do not build the project,use the test data if you need to debug the scripts 31 self.developing_test_mode = False 32 # set your node_js path 33 self.node_js_path = r"C:/xxx" 34 # Must set according environment 35 self.jbr_path = r'xxx\DevEco Studio\jbr' 36``` 37 38``` 39application_configs = dict( 40 [ 41 ( 42 "FTB", dict 43 ( 44 project_path = r"D:\FTB", 45 ) 46 ), 47 ( 48 "FDY", dict 49 ( 50 project_path = r"D:\FDY", 51 ) 52 ), 53 ( 54 "FWX", dict 55 ( 56 project_path = r"D:\FWX", 57 ) 58 ), 59 ( 60 "HelloWorld", dict 61 ( 62 # The following params must be set according you environment 63 project_path = r"xxx", 64 65 # The following params is not neccessary to be modified 66 debug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap', 67 release_package_path = r'entry\build\default\outputs\default\app\entry-default.hap', 68 incremental_code_path = r'entry\src\main\ets\pages\Index.ets', 69 incremental_code_end_pos = 'build() {', 70 incremental_code_str = "a: number = 5 + 6\n", 71 incremental_code_start_pos = "a: number = 5 + 6\n", 72 ) 73 ) 74 ] 75) 76``` 77 78More details: 79**path of jbr** 80jbr_path = r'xxx\DevEco Studio\jbr' 81 82**path of the project** 83project_path = r"xxx" 84 85**app name which showed in pictures** 86name = r'FTB' 87 88**AS = 1 DevEco = 2** 89IDE = 2 90 91**command for building** 92cmd_prefix = r"hvigorw.bat" 93**Start with space** 94cmd_debug_suffix = ' --mode module -p product=default assembleHap' 95cmd_release_suffix = ' --mode project -p product=default assembleApp' 96 97**The path of the package you have built** 98debug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap' 99release_package_path = r'entry\build\default\outputs\default\app\entry-default.hap' 100 101**When you test the incremental building, the code will be add into this file** 102incremental_code_path = 'entry\src\main\ets\pages\Index.ets' 103 104**add this code when incremental building test** 105incremental_code_str = "let index = 5 + 6\n" 106 107**the code will be add before the first position of this** 108incremental_code_end_pos = 'this.num = num' 109 110**when the code need to revert, this can help to find where the code you add** 111incremental_code_start_pos = "let index = 5 + 6\n" 112 113**file which controls aotCompileMode in type or not** 114json5_path = 'xxx/build-profile.json5' 115 116**the name of the directory which save the log files** 117log_direct = r"buildTestData" 118 119**filename of output logs, default name is [IDE_filename]_[debug_or_release]_[build_type_of_log]_[logFileName.xslx], for example: DevEco_Debug_Incremental_sizeAve.xlsx** 120output_split = "_" 121IDE_filename = ["AS", "DevEco"] 122debug_or_release = ["Debug", "Release"] 123build_type_of_log = ["Incremental", "fullBuild"] 124**size means this file record the size of abc in the package, time means the build cost time, All means it records all data, avg means it records the value of the data** 125log_filename = ["sizeAll.xlsx", "sizeAve.xlsx","timeAll.xlsx", "timeAve.xlsx"] 126 127**show detailed build cost time in html, delete this setting to hide this info** 128show_time_detail_filter = ["createProgram", "arkTSLinter", "tsProgramEmit", 129 "generate content and source map information", "write obfuscated source code", 130 "write source map (async)", "generate merged abc by es2abc (async)", "total build cost" 131 ] 132 133**Do not build the project,use the test data if you need to debug the scripts,use '' to close this mode,test_report.json will test in build succeed case,test_error_report.json will test in build failed case** 134developing_test_mode = ''