Package Manager

Cangjie Package Manager (CJPM) provides project-level compilation and building capabilities, and automatic dependency management implements analysis and combination of multi-version third-party dependencies. Developers do not need to worry about dependency conflicts between different versions, greatly reducing their workload. It also provides a custom building mechanism based on the native Cangjie language, allowing developers to add pre-processing and post-processing steps in different phases of building. In this way, the building process can be flexibly customized to meet building requirements in different service scenarios.

Automatic Dependency Management

For multi-version dependent modules introduced in a project, CJPM performs dependency analysis and calculates the final dependency to implement automatic dependency management. Developers do not need to manually manage dependency conflicts in the project. After automatic dependency management is implemented, during compilation and building, CJPM scans all dependencies of the project and performs similar item combination for different versions of the same module dependency. In this way, compilation and building errors due to the import of dependencies of multiple versions are prevented. Developers only need to run the cjpm build command to implement project-level building, greatly reducing their workload. dependency

As shown in the preceding figure, the project directly depends on modules A and B. Module A depends on version 1.3 of module C, and module B depends on version 1.4 of module C. If dependency analysis and management are not performed, dependency conflicts occur due to multi-version dependencies during compilation, causing a compilation error. Through dependency management, CJPM performs dependency analysis on module C and performs version dependency combination.

Custom Building

When building a Cangjie project, the developer may have other custom behavior requirements related to the compilation of Cangjie code, such as environment variable configuration, external dependency library copy, and pre-operations for compiling C language files before cffi source code dependency, for example, the Rust language uses Cargo to provide pre-building developer-defined configurations.

CJPM allows developers to add custom pre- and post-building behaviors in any phase of building, helping them solve complex project building problems without using other build tools, thereby achieving one-stop building management of the project. widgets

As shown in the preceding figure, the developer has customized the stagePreBuild task for compiling the cffi module and the stagePostBuild task for deleting the cffi source code. When the build command is executed, CJPM executes the stagePreBuild task first. After execution of the build command is complete, CJPM executes the stagePostBuild task.