13af6ab5fSopenharmony_ci# Automatic build performance
23af6ab5fSopenharmony_ci
33af6ab5fSopenharmony_ci## Purpose
43af6ab5fSopenharmony_cibuild specified projects serveral times and calculate the average value of build time and size of abc
53af6ab5fSopenharmony_ci
63af6ab5fSopenharmony_ci## How to use
73af6ab5fSopenharmony_ci### environmoent
83af6ab5fSopenharmony_ciWindows, pandas, json5, python3.9
93af6ab5fSopenharmony_ci### How to run
103af6ab5fSopenharmony_ciinput the command in cmd: python performance_entry.py
113af6ab5fSopenharmony_ci
123af6ab5fSopenharmony_ci### Details of settings
133af6ab5fSopenharmony_ciYou need to modify in the performance_config.py
143af6ab5fSopenharmony_ciproject_path, node_js_path, jbr_path. These params must be set according your envronment!!! Other params use default.  
153af6ab5fSopenharmony_ciIf you need to modify others, you can set in application_configs, refer to the 'HelloWorld'  
163af6ab5fSopenharmony_ciset run_list to run the projects  
173af6ab5fSopenharmony_ci```
183af6ab5fSopenharmony_ci    send_mail = True
193af6ab5fSopenharmony_ci    run_list = ["FTB", "FDY", "FWX"]
203af6ab5fSopenharmony_ci
213af6ab5fSopenharmony_ci    def __init__(self):
223af6ab5fSopenharmony_ci        # Default config settings for all projects, if it's not what you need, config them in application_configs
233af6ab5fSopenharmony_ci        self.cmd_prefix = r"hvigorw.bat"
243af6ab5fSopenharmony_ci```
253af6ab5fSopenharmony_ci
263af6ab5fSopenharmony_ci```
273af6ab5fSopenharmony_ci    def __init__(self):
283af6ab5fSopenharmony_ci        ...
293af6ab5fSopenharmony_ci
303af6ab5fSopenharmony_ci        # Do not build the project,use the test data if you need to debug the scripts
313af6ab5fSopenharmony_ci        self.developing_test_mode = False
323af6ab5fSopenharmony_ci        # set your node_js path
333af6ab5fSopenharmony_ci        self.node_js_path = r"C:/xxx"
343af6ab5fSopenharmony_ci        # Must set according environment
353af6ab5fSopenharmony_ci        self.jbr_path = r'xxx\DevEco Studio\jbr'
363af6ab5fSopenharmony_ci```
373af6ab5fSopenharmony_ci
383af6ab5fSopenharmony_ci```
393af6ab5fSopenharmony_ciapplication_configs = dict(
403af6ab5fSopenharmony_ci    [
413af6ab5fSopenharmony_ci        (    
423af6ab5fSopenharmony_ci            "FTB", dict
433af6ab5fSopenharmony_ci                (
443af6ab5fSopenharmony_ci                    project_path = r"D:\FTB",
453af6ab5fSopenharmony_ci                )
463af6ab5fSopenharmony_ci        ),
473af6ab5fSopenharmony_ci        (    
483af6ab5fSopenharmony_ci            "FDY", dict
493af6ab5fSopenharmony_ci                (
503af6ab5fSopenharmony_ci                    project_path = r"D:\FDY",
513af6ab5fSopenharmony_ci                )
523af6ab5fSopenharmony_ci        ),
533af6ab5fSopenharmony_ci        (    
543af6ab5fSopenharmony_ci            "FWX", dict
553af6ab5fSopenharmony_ci                (
563af6ab5fSopenharmony_ci                    project_path = r"D:\FWX",
573af6ab5fSopenharmony_ci                )
583af6ab5fSopenharmony_ci        ),
593af6ab5fSopenharmony_ci        (
603af6ab5fSopenharmony_ci            "HelloWorld", dict
613af6ab5fSopenharmony_ci                (
623af6ab5fSopenharmony_ci                    # The following params must be set according you environment
633af6ab5fSopenharmony_ci                    project_path = r"xxx",
643af6ab5fSopenharmony_ci                    
653af6ab5fSopenharmony_ci                    # The following params is not neccessary to be modified
663af6ab5fSopenharmony_ci                    debug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap',
673af6ab5fSopenharmony_ci                    release_package_path = r'entry\build\default\outputs\default\app\entry-default.hap',
683af6ab5fSopenharmony_ci                    incremental_code_path = r'entry\src\main\ets\pages\Index.ets',
693af6ab5fSopenharmony_ci                    incremental_code_end_pos = 'build() {',
703af6ab5fSopenharmony_ci                    incremental_code_str = "a: number = 5 + 6\n",
713af6ab5fSopenharmony_ci                    incremental_code_start_pos = "a: number = 5 + 6\n",
723af6ab5fSopenharmony_ci                )
733af6ab5fSopenharmony_ci        )
743af6ab5fSopenharmony_ci    ]
753af6ab5fSopenharmony_ci)
763af6ab5fSopenharmony_ci```  
773af6ab5fSopenharmony_ci
783af6ab5fSopenharmony_ciMore details:  
793af6ab5fSopenharmony_ci**path of jbr**
803af6ab5fSopenharmony_cijbr_path = r'xxx\DevEco Studio\jbr'
813af6ab5fSopenharmony_ci
823af6ab5fSopenharmony_ci**path of the project**
833af6ab5fSopenharmony_ciproject_path = r"xxx"
843af6ab5fSopenharmony_ci
853af6ab5fSopenharmony_ci**app name which showed in pictures**
863af6ab5fSopenharmony_ciname = r'FTB'
873af6ab5fSopenharmony_ci
883af6ab5fSopenharmony_ci**AS = 1  DevEco = 2**  
893af6ab5fSopenharmony_ciIDE = 2  
903af6ab5fSopenharmony_ci
913af6ab5fSopenharmony_ci**command for building**
923af6ab5fSopenharmony_cicmd_prefix = r"hvigorw.bat"
933af6ab5fSopenharmony_ci**Start with space**  
943af6ab5fSopenharmony_cicmd_debug_suffix = ' --mode module -p product=default assembleHap'  
953af6ab5fSopenharmony_cicmd_release_suffix = ' --mode project -p product=default assembleApp'  
963af6ab5fSopenharmony_ci
973af6ab5fSopenharmony_ci**The path of the package you have built**  
983af6ab5fSopenharmony_cidebug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap' 
993af6ab5fSopenharmony_cirelease_package_path = r'entry\build\default\outputs\default\app\entry-default.hap'  
1003af6ab5fSopenharmony_ci
1013af6ab5fSopenharmony_ci**When you test the incremental building, the code will be add into this file**  
1023af6ab5fSopenharmony_ciincremental_code_path = 'entry\src\main\ets\pages\Index.ets'  
1033af6ab5fSopenharmony_ci
1043af6ab5fSopenharmony_ci**add this code when incremental building test**  
1053af6ab5fSopenharmony_ciincremental_code_str = "let index = 5 + 6\n"  
1063af6ab5fSopenharmony_ci
1073af6ab5fSopenharmony_ci**the code will be add before the first position of this**  
1083af6ab5fSopenharmony_ciincremental_code_end_pos = 'this.num = num'  
1093af6ab5fSopenharmony_ci
1103af6ab5fSopenharmony_ci**when the code need to revert, this can help to find where the code you add**  
1113af6ab5fSopenharmony_ciincremental_code_start_pos = "let index = 5 + 6\n"  
1123af6ab5fSopenharmony_ci
1133af6ab5fSopenharmony_ci**file which controls aotCompileMode in type or not**  
1143af6ab5fSopenharmony_cijson5_path = 'xxx/build-profile.json5'  
1153af6ab5fSopenharmony_ci
1163af6ab5fSopenharmony_ci**the name of the directory which save the log files**   
1173af6ab5fSopenharmony_cilog_direct = r"buildTestData"  
1183af6ab5fSopenharmony_ci
1193af6ab5fSopenharmony_ci**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**  
1203af6ab5fSopenharmony_cioutput_split = "_"  
1213af6ab5fSopenharmony_ciIDE_filename = ["AS", "DevEco"]  
1223af6ab5fSopenharmony_cidebug_or_release = ["Debug", "Release"]  
1233af6ab5fSopenharmony_cibuild_type_of_log = ["Incremental", "fullBuild"]  
1243af6ab5fSopenharmony_ci**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**  
1253af6ab5fSopenharmony_cilog_filename = ["sizeAll.xlsx", "sizeAve.xlsx","timeAll.xlsx", "timeAve.xlsx"]  
1263af6ab5fSopenharmony_ci
1273af6ab5fSopenharmony_ci**show detailed build cost time in html, delete this setting to hide this info**
1283af6ab5fSopenharmony_cishow_time_detail_filter = ["createProgram", "arkTSLinter", "tsProgramEmit",
1293af6ab5fSopenharmony_ci                            "generate content and source map information", "write obfuscated source code",
1303af6ab5fSopenharmony_ci                            "write source map (async)", "generate merged abc by es2abc (async)", "total build cost"
1313af6ab5fSopenharmony_ci                        ]
1323af6ab5fSopenharmony_ci
1333af6ab5fSopenharmony_ci**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**  
1343af6ab5fSopenharmony_cideveloping_test_mode = ''