# koala_projects **Repository Path**: rri_opensource/koala_projects ## Basic Information - **Project Name**: koala_projects - **Description**: Research and developments of Koala project - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 12 - **Forks**: 96 - **Created**: 2025-02-17 - **Last Updated**: 2025-09-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README **Umbrella repo of `incremental engine` and `ArkUI` refactoring project** # Setup env Export these env variables: - `OPENLAB_USERNAME` - `OPENLAB_PASSWORD` Install: - `node.js` `18.20.4 LTS` - `meson` no older than `0.61` Make sure the workspace does not contain outdated artifacts of older builds. # How to build `arkoala.har` ``` $ npm install $ KOALA_BZ=1 npm run arkoala:har-arm32 $ file ./arkoala/har/app/arkoala/build/default/outputs/default/arkoala.har ``` # How to build `arkoala-arkts.har` ``` $ npm install $ cd arkoala-arkts $ KOALA_BZ=1 npm run trivial:all:har-arm32 $ file ./arkoala-arkts/har/app/arkoala/build/default/outputs/default/arkoala.har ``` # How to build `arkoala plugin` and patch `OHOS SDK` ``` $ npm install $ KOALA_BZ=1 npm run ohos-sdk $ export HOS_SDK_HOME=`pwd`/arkoala-arkts/ohos-sdk/ohos-sdk $ KOALA_BZ=1 npm run arkoala:plugin $ file ${HOS_SDK_HOME}/HarmonyOS-NEXT-DB1/openharmony/ets/build-tools/ets-loader/lib/fast_build/ets_ui/arkoala-plugin.js ``` # How to compare CJ and ArkTS incremetal engine performace ## Cangjie Go to `incremental-cj/runtime` and `sh CallsiteKey.sh`. Change directory to `incremental-cj/perf` and `cjpm run`. ``` First frame 0ms 100000 no change frames 4ms 100000 single state change frame 207ms ``` ## ArkTS Go to `incremental/benchmarks/memo-benchmark`. Run `npm run run:panda`. ``` First frame 2ms 100000 no change frames 23ms 100000 single state change frame 285ms ``` ## ArkTS with AOT Go to `incremental/benchmarks/memo-benchmark`. Run `npm run run:panda:aot`. ``` First frame 2ms 100000 no change frames 23ms 100000 single state change frame 219ms ``` # Building with GN GN (short for Generate Ninja) is a build system developed by Google and adopted in the [Open Harmony repositories](https://gitee.com/openharmony). Since Koala Projects is supposed to be part of the same system (and more over, it's continiously integrated via so-called mirroring technique) the repository targets are also required to be built with the given build system. ## Prerequisites You need `gn` and `ninja` tools installed in your system in order to employ gn build system. At the time of writing the following versions of the tool were sufficient: - gn: 1000 (0725d78) - ninja: 1.10.1 Also, under RRI the main toolchain requires clang/llvm compiler and lld linker: - clang: 14.0.0 - lld 14.0.0 ## Generate required files Some targets require generated files which cannot be output of a ninja build graph (since the graph cannot depend on files which don't exist in the source tree, only on files in the output directory). Thus, prior to runnin gn or ninja files, ensure you have dependent source generated: ``` bash ./tools/utils/gni/gen_gni_mirror.sh . ``` ## Generating Ninja files From the RRI repository root directory run the following command: ``` gn gen out/dir ``` The `out/dir` is a sample path to generate the ninja files in. You can specify any path you find appropriate ## Listing available targets After successful generation, you can list what ninja targets are available with this command (assuming your output dir at the previous step is `out/dir`): ``` ninja -C out/dir -t targets all ``` ## Leafs and roots of the build graph At the moment of writing the document, the entire build graph looked as follows: ![Build Graph](./gn/graph/graph.svg) The leaf (green) nodes in the graph don't depend on anything, while there are no target which depend on root (blue nodes). I.e. it means that in order to build all available targets you can simply run all root nodes. For convenience there is a target `koala_mr_all` defined in the root [`BUILD.gn`](./BUILD.gn) file which runs all root nodes available in the graph to check that the build flow is fine. You can trigger this target by this command (assuming your output dir is `out/dir`): ``` ninja -C out/dir koala_mr_all ``` ## RRI vs OHOS targets ### `koala_mr` scope OHOS and RRI may have different directory and source files structure and in order to reflect those differences there is a scope variable `koala_mr`. It predominantly contains paths and flags which are different depending on where you generate the targets. For RRI this variable is defined in [BUILDCONFIG.gn](./gn/config/BUILDCONFIG.gn), thus it automatically available to any `BUILD.gn` file in the dependency graph. For OHOS repos, however, this variable could not be placed in the same manner, because `BUILDCONFIG.gn` is located in the [build repository](https://gitee.com/openharmony/build), which doesn't belong to the team development stream, and the PR was rejected. ### `is_rri` flag Be advised, that despite being the same code base, building the GN targets under OHOS can sometimes be different from building the same targets under RRI. You can easily spot such a difference under `koala_mr.is_rri` flag, e.g.: ``` if (!koala_mr.is_rri) { action("ui2abc_panda_sdk") { ... } } ``` This could be required due to different reasons, but the main rationale is that some targets may overly depend on scripts and template defined in OHOS repository, so they had to be excluded from RRI.