1# Build system 2 3The build system is designed to compile ArkTS1.2 source files. It takes source files and build configurations as input, compiles the source files, invokes plugins for transformation, and generates a merged bytecode file. 4 5## How to Run 6 7The build system has two usage scenarios: 8 91. **Compiling the Deveco Project**: The build system is initiated by hvigor, which calls the build method in the `entry.js` file, passing in the `projectConfig` object to perform the compilation. 10 112. **Compiling the Local Test Project**: The build system is initiated by executing `node entry.js`, where the `build_config.json` file is passed as a compilation parameter to perform the compilation. The `build_config.json` is a mock to the `projectConfig` for scenario 1. 12 13Below are the steps for compiling the local test project: 14 15### step 1 16Mock sdk 17There are 2 methods to mock sdk locally. 18Method 1: use soft links 19```bash 20mkdir -p test/mock_sdk/build-tools/ets2panda 21cd test/mock_sdk/build-tools/ets2panda 22ln -s ${path_to_ets2panda_lib} lib 23ln -s ${path_to_ets2panda_stdlib} lib/stdlib 24ln -s ${path_to_ets2panda_bin} bin 25``` 26 27Method 2: specify `pandaSdkPath` and `pandaStdlibPath` in build_config.json 28 29 30### step 2 31Mock koala-wrapper 32Modify `initKoalaWrapper` method in `src/init/process_build_config.ts`, set the `koalaWrapperPath` to the actual path in your environment. In OpenHarmony repo, it is now resides in `${path_to_oh_root}/developtools/ace_ets2bundle/koala_wrapper` 33 34### step 3 35Build build system source code 36```bash 37npm install 38npm run build 39``` 40 41### step 4 42Build specify local test project. 43In test directory, there are some demo projects. Each project has its own `build_config.json`. 44Replace the path to your own path before running. For example, use sed command in linux: 45``` 46sed -i 's|${absolute_path_to_build_system}|'"$(pwd)"'|g' test/*/build_config.json 47``` 48Then run the following command to build 49```bash 50npm run mixed_hap:gen_abc # build demo_mix_hap 51npm run demo_hap:gen_abc # build demo_hap 52``` 53