A dependency mapping method, apparatus, and storage medium for a heterogeneous package management system.

By configuring virtual build targets and dependency graphs in the heterogeneous package management system, target description files and artifact structures compatible with the second package management system are automatically generated, solving the problems of inconsistent dependencies and version management difficulties between heterogeneous package management systems, and improving the efficiency and reliability of cross-platform development.

CN123114523APending Publication Date: 2026-11-17BEIJING BAILONG MAYUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611091396.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Heterogeneous package management systems suffer from problems in cross-platform software development, such as easy loss or synchronization of dependency information, difficulty in version management, and inconsistent build environments, resulting in low compilation efficiency and a high susceptibility to errors.

Method used

By configuring virtual build targets in the first package management system, a dependency graph is obtained, and based on this graph, metadata transformation and file reorganization are performed to generate target description files and artifact structures compatible with the second package management system, thereby achieving automated mapping and publishing.

Benefits of technology

It enables automatic mapping of dependencies between heterogeneous package management systems, reduces human error, ensures consistency of dependencies and integrity of version management, simplifies the development process in multi-configuration environments, and improves development efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123114523A_ABST
    Figure CN123114523A_ABST
Patent Text Reader

Abstract

This invention discloses a dependency mapping method, apparatus, and storage medium for a heterogeneous package management system, belonging to the field of computer software engineering technology. The method includes: configuring a virtual build target in a first package management system to capture a complete dependency graph; performing metadata transformation on each dependency node based on the graph to generate target metadata compatible with a second package management system; locating and extracting the build artifacts of each dependency, converting their file structure into a preset directory structure, uploading them to a network storage location, and obtaining a resource locator; generating a target description file containing target metadata and a resource locator for each dependency, and publishing it to the indexing service of the second package management system. This invention enables automated and precise synchronization of dependencies between heterogeneous package management systems, ensures consistency of dependency topology, eliminates manual maintenance costs, and significantly improves the efficiency and reliability of cross-platform development collaboration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer software engineering technology, and specifically to a dependency mapping method, apparatus, and storage medium for a heterogeneous package management system. Background Technology

[0002] In modern cross-platform software development practices, projects often adopt a hybrid programming model. For example, core business logic is written in system-level languages ​​such as C++ to achieve high performance and code reuse, while upper-level applications are developed using native languages ​​of each platform. This model leads to the emergence of heterogeneous development environments, where the underlying C++ code is typically managed and built by a first package management system, while the upper-level applications rely on a second package management system to integrate the compiled artifacts of these underlying libraries.

[0003] These two package management systems, or heterogeneous package management systems, are incompatible in terms of metadata format, dependency declaration syntax, version control specifications, and artifact storage structure, creating a technical barrier. For example, the first package management system uses its specific configuration file to describe dependencies, while the second package management system uses a different format of target description files. Currently, the mainstream way to bridge this barrier is manual synchronization: after C++ engineers compile the artifacts, they manually deliver them to platform engineers; the platform engineers then manually write or update the target description files, including manually translating and filling in all underlying dependencies, and finally manually publish the updated package to the indexing service.

[0004] However, this manual synchronization mode has significant drawbacks. First, dependency information is highly susceptible to loss or desynchronization. When the dependencies of the underlying C++ library change (e.g., a new transitive dependency is added), if the platform engineer fails to update the corresponding dependency declarations in the target description file in a timely and accurate manner, fatal errors such as undefined symbols will occur during the compilation and linking phase. For complex projects containing dozens of sub-libraries, manually tracking and maintaining the accuracy of dependency chains is virtually impossible. Second, version management becomes fragmented and extremely difficult. Manually maintaining version number consistency for a large number of sub-libraries is already a huge workload, making it even more difficult to effectively distinguish and manage the outputs of different build configuration identifiers. Furthermore, the configuration of the build environment (such as compiler options, C++ standards, etc.) also requires manual translation and synchronization between the two systems; any oversight can lead to inconsistencies and runtime crashes. Finally, the entire compile-copy-modify-upload process is full of repetitive labor, which is not only inefficient but also highly prone to introducing human error. Summary of the Invention

[0005] To address the technical problems in the background art, such as low efficiency, susceptibility to errors, and loss of dependencies due to incompatibility of heterogeneous package management systems, this invention provides a dependency mapping method, apparatus, and storage medium for a heterogeneous package management system.

[0006] This invention provides a dependency mapping method for a heterogeneous package management system, comprising: configuring a virtual build target in a first package management system for triggering dependency resolution; the virtual build target does not contain source code to be compiled and is configured to skip compilation steps; adding an entry dependency to the virtual build target; when the dependency resolution engine of the first package management system is triggered, obtaining a dependency graph containing the entry dependency and all direct and transitive dependencies of the entry dependency; based on the dependency graph, performing metadata transformation for each dependency node in the dependency graph to generate target metadata compatible with a second package management system; the metadata transformation includes: combining the version identifier of the dependency node with a build configuration identifier to generate a... The system includes: a target version identifier with build configuration differentiation; translating the dependency relationships of the dependency nodes into the dependency declaration format required by the second package management system; locating and extracting the build artifact corresponding to each dependency node in the dependency graph; converting the file structure of the build artifact into a preset directory structure required by the second package management system; packaging the converted build artifact and uploading it to a network-accessible storage location, and obtaining resource locators; generating a target description file for each dependency node in the dependency graph; and publishing the generated target description file to the indexing service of the second package management system; the target description file contains the target metadata and the resource locators.

[0007] In one implementation, before obtaining the dependency graph, the method further includes: driving the first package management system to compile the entry dependency and its dependencies for at least two build configurations using an automated build script, so as to generate a build artifact corresponding to the build configuration.

[0008] In one implementation, the at least two build configurations include a debug configuration and a release configuration; the build configuration identifier corresponds to the debug configuration or the release configuration.

[0009] In one implementation, combining the version identifier with the build configuration identifier includes: appending the build configuration identifier as a suffix to the version identifier to generate the target version identifier.

[0010] In one implementation, the preset directory structure includes an include directory for storing header files and a lib directory for storing library files.

[0011] In one implementation, locating and extracting the corresponding build artifact includes: extracting the build artifact from the local cache directory of the first package management system based on content hash.

[0012] In one implementation, the network-accessible storage location is Object Storage Service (OSS); the resource locator is the download URL of the uploaded packaged build artifact; and the indexing service is an index repository based on the Git version control system.

[0013] This invention provides a dependency mapping device for a heterogeneous package management system, comprising: a virtual build module configured to configure a virtual build target for triggering dependency resolution in a first package management system; the virtual build target does not contain source code to be compiled and is configured to skip the compilation step; adding an entry dependency to the virtual build target; and when the dependency resolution engine of the first package management system is triggered, obtaining a dependency graph containing the entry dependency and all direct and transitive dependencies of the entry dependency; and a data conversion module configured to perform metadata conversion for each dependency node in the dependency graph based on the dependency graph, thereby generating target metadata compatible with a second package management system; the metadata conversion includes: combining the version identifier of the dependency node with a build configuration identifier to generate... The system includes: a target version identifier with build configuration differentiation; a data extraction module configured to translate the dependency relationships of the dependency nodes into a dependency declaration format required by the second package management system; a data extraction module configured to locate and extract the build artifact corresponding to each dependency node in the dependency graph; convert the file structure of the build artifact into a preset directory structure required by the second package management system; package the converted build artifact and upload it to a network-accessible storage location, and obtain a resource locator; a file generation module configured to generate a target description file for each dependency node in the dependency graph; and publish the generated target description file to the indexing service of the second package management system; the target description file contains the target metadata and the resource locator.

[0014] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the methods described above.

[0015] Compared with existing technologies, this invention has the following advantages: First, it achieves automatic mapping of dependencies between heterogeneous package management systems, reducing the manual work of writing and maintaining dependency descriptions. By utilizing the dependency resolution engine of the first package management system to automatically generate a complete dependency graph and directly translating it into dependency declarations of the second package management system, the generation process of dependency descriptions is fully automated, reducing the risk of errors caused by manual operation. Second, this invention fundamentally guarantees the consistency of cross-system dependencies, reducing linking errors caused by lost or out-of-sync dependencies. Since the dependencies on the target side are directly derived from the actual dependency graph calculated by the source side at compile time, the dependencies of the two systems are strictly unified in terms of data source. Any dependency changes on the source side will be automatically reflected in the description file on the target side, thereby reducing compilation failures caused by manual omissions or incorrect dependency writing. Furthermore, by integrating the build configuration identifier into the version number, this invention achieves physical isolation and atomic release of different build artifacts (such as debug and release versions). This allows platform developers to switch dependencies for different build types as needed, just like managing regular software package versions, without manually replacing files or modifying project configurations, greatly simplifying the development and testing process in multi-configuration environments. Finally, this invention automates the entire chain from source code compilation, dependency resolution, metadata transformation, artifact reorganization and distribution to index release, forming a closed-loop process that requires no intervention. This not only significantly shortens the delivery cycle for underlying library updates but also greatly reduces the error rate caused by tedious manual operations, improving the efficiency and reliability of the entire cross-platform development process. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating the dependency mapping method of a heterogeneous package management system provided in an embodiment of the present invention.

[0017] Figure 2 This is a schematic diagram of the dependency mapping device of the heterogeneous package management system provided in an embodiment of the present invention.

[0018] Figure 3 A flowchart of a dependency mapping method for a heterogeneous package management system provided in an embodiment of the present invention; Figure 4 The dependency mapping method of the heterogeneous package management system provided in this embodiment of the invention uses virtual construction of the target... Figure 5 This is a schematic diagram illustrating the mapping of the constructed product catalog structure from the first package management system to the second package management system in an embodiment of the present invention. Detailed Implementation

[0019] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0020] In modern cross-platform software development, it is often necessary to use multiple programming languages ​​and their corresponding package management tools concurrently within the same project, thus forming a heterogeneous package management system. For example, the underlying core logic might be written in C++ and managed by a first package management system, while the upper-level application might be written in Swift / Objective-C and managed by a second package management system. Existing technologies typically rely on manual synchronization of dependencies and build artifacts between the two systems. This approach is not only inefficient but also highly susceptible to human error, leading to problems such as lost dependencies, chaotic version management, and inconsistent build environments, ultimately resulting in difficult-to-diagnose linking errors or runtime crashes. This invention aims to solve these problems by providing a fully automated dependency synchronization method and apparatus.

[0021] The core idea of ​​the technical solution proposed in this invention is to use the dependency resolution capability of the first package management system as a single source of fact to automatically generate a complete dependency graph. Based on this, through a series of automated transformation and distribution steps, metadata and artifact structures that are fully compatible with the second package management system are generated.

[0022] To better understand the technical solution of this invention, the core terms involved will be explained first.

[0023] Heterogeneous package management systems refer to two or more package management systems that coexist in the same software project, used for different programming languages ​​or platforms, with incompatible metadata formats and dependency management mechanisms. The first package management system is the source of dependencies, typically used to manage dependencies for low-level languages ​​such as C++, while the second package management system is the receiver of dependencies, typically used to manage dependencies for platform-native applications.

[0024] Dependency graph: A data structure generated by the dependency resolution engine of the first package management system, representing each dependency node and its dependency relationship.

[0025] Virtual build targets are special targets configured in the first package management system. They do not contain source code to be compiled and skip the compilation step. Their sole purpose is to trigger the dependency resolution engine to capture the dependency graph. This design allows pure utilization of the dependency analysis capabilities of the first package management system without concern for the specific compilation artifacts generated, thus decoupling dependency analysis from artifact generation.

[0026] Figure 1 The flowchart below shows the dependency mapping method of the heterogeneous package management system provided by the present invention. Figure 1 Each step in the process will be explained in detail.

[0027] Step S110: In the first package management system, configure a virtual build target for triggering dependency resolution; the virtual build target does not contain the source code to be compiled and is configured to skip the compilation step; add the entry dependency to the virtual build target, and when the dependency resolution engine of the first package management system is triggered, obtain a dependency graph containing the entry dependency and all direct and transitive dependencies of the entry dependency.

[0028] The virtual build target is specially designed; it does not contain any source code to be compiled and is configured to skip the compilation step during execution. Its core function is as a dependency resolution probe. By adding one or more core libraries as entry dependencies to this virtual build target, the dependency resolution engine of the First Package Management System is triggered. This engine recursively resolves all direct and transitive dependencies starting from the entry dependency, ultimately constructing a complete dependency graph. This step leverages the mature dependency resolution capabilities of the First Package Management System to automatically and accurately capture the complete dependency structure of the project, avoiding omissions and errors from manual analysis.

[0029] Step S120: Based on the dependency graph, perform metadata transformation for each dependency node in the dependency graph to generate target metadata compatible with the second package management system.

[0030] The metadata transformation includes: combining the version identifier of the dependency node with a build configuration identifier to generate a target version identifier with build configuration differentiation; and translating the dependency relationship of the dependency node into the dependency declaration format required by the second package management system.

[0031] This step involves traversing each dependency node in the graph and performing metadata transformation to generate target metadata compatible with the second package management system. This transformation process is one of the core components of this invention, comprising two key operations. First, the dependency node's own version identifier is combined with a specified build configuration identifier to generate a target version identifier with build configuration distinctiveness. Second, the outgoing edges of this node in the dependency graph, i.e., the other nodes it depends on, are parsed, and this dependency relationship is translated into the dependency declaration format required by the second package management system. In this way, not only are the original dependency relationships fully preserved, but the artifacts of different build configurations (such as debug and release) are also given different identities, achieving version dimension expansion.

[0032] Step S130: For each dependency node in the dependency graph, locate and extract the corresponding build artifact; convert the file structure of the build artifact into the preset directory structure required by the second package management system; package the build artifact with the converted file structure, upload it to a network-accessible storage location, and obtain the resource locator.

[0033] In this step, for each dependency node in the dependency graph, the method locates and extracts its corresponding build artifacts, such as compiled library files and header files. Since the first and second package management systems typically have different requirements for the file directory structure of the artifacts, the extracted build artifact file structure needs to be converted to the preset directory structure required by the second package management system. After conversion, these files are packaged into a single archive file and uploaded to a network-accessible storage location, such as a cloud storage service, while simultaneously obtaining a resource locator for accessing the archive file. This step resolves the incompatibility issue of physical artifact organization between the two systems and lays the foundation for subsequent remote retrieval.

[0034] Step S140: Generate a target description file for each dependency node in the dependency graph; publish the generated target description file to the index service of the second package management system; the target description file contains target metadata and resource locators.

[0035] In this step, for each dependency node in the dependency graph, the method generates a target description file. This file serves as a specification for the second package management system to understand a software package, containing key information generated in previous steps: target version identifiers with build configuration differentiation, target metadata of the translated dependency declarations, and resource locators pointing to the packaged artifacts. After all node target description files are generated, they are uniformly published to the index service of the second package management system. At this point, all dependencies and their relationships in the first package management system have been successfully and automatically projected into the ecosystem of the second package management system, making them directly usable by upper-layer applications.

[0036] In one implementation, to support more complex development scenarios, the method can further automate the compilation of entry dependencies and all their dependencies for at least two build configurations using an automated build script before obtaining the dependency graph. This automated build script orchestrates a series of compilation commands to ensure that all necessary build artifacts corresponding to different build configurations are correctly generated and stored in the cache of the first package management system before dependency graph capture is performed. By introducing an automated build script, multi-configuration compilation and subsequent dependency synchronization processes are linked together, achieving end-to-end automation from source code to final release, significantly improving development and release efficiency.

[0037] In one implementation, at least two build configurations can be specified as debug and release configurations. Debug configurations typically include full debug symbols and do not perform code optimizations, facilitating problem localization and debugging for developers; while release configurations remove debug symbols and enable high-level optimizations to achieve smaller size and higher runtime performance. Correspondingly, the build configuration identifier corresponds to tags such as debug or release. By generating different target version identifiers and artifact packages for different configurations, upper-layer application developers can transparently switch the versions of the underlying libraries they depend on, based on the current development stage (such as the development / debugging stage or the integration / release stage), achieving physical isolation and on-demand use of build artifacts.

[0038] In one implementation, the first package management system can be the Conan package manager, specifically designed for the C++ language, while the second package management system can be the CocoaPods package manager, widely used in iOS platform development. Conan's powerful dependency resolution and binary package management capabilities make it an ideal dependency source, while CocoaPods, as the de facto standard of the iOS ecosystem, has a mature dependency integration and indexing mechanism. Applying this invention between these two systems can effectively solve typical pain points encountered when developing iOS applications containing C++ core modules, and has high practical application value. In this specific application scenario, the virtual build target is specifically represented in Conan as a special Conan Recipe (i.e., the conanfile.py file), while the target description file corresponds to the podspec file in the CocoaPods ecosystem. The method of this invention essentially builds an automated bridge from the dependency resolution results of the Conan Recipe to the batch generation of podspec files.

[0039] In one implementation, combining the version identifier with the build configuration identifier can be achieved in a simple and efficient way: the build configuration identifier is appended as a suffix to the original version identifier using a specific separator. For example, a library with an original version of 1.0.0 would have its target version identifier become 1.0.0.debug under a debug build configuration. This naming convention is intuitive and easy to resolve, and can be correctly identified as different versions by most package management systems, thus leveraging the package management system's own version management mechanism to achieve isolation between different build configuration artifacts.

[0040] In one implementation, to ensure compatibility with the second package management system, the default directory structure typically follows an industry-standard approach. For example, it may include an `include` directory for storing all publicly available header files and a `lib` directory for storing all linked library files (such as .a or .so files). By uniformly collecting and reorganizing the artifact files that might be scattered across different subdirectories in the first package management system into this flat, standard structure, the second package management system can ensure that it correctly identifies and uses these files, for example, by automatically configuring header file search paths and library linking paths.

[0041] In one implementation, when retrieving build artifacts, since modern package managers typically maintain a local package cache, the method of this invention can precisely retrieve the build artifacts of a specified dependency and version directly from the content hash-based local cache directory of the first package management system. For example, Conan uses content hashes to uniquely identify the binary file of each package and stores them in a specific path under the user's home directory. Retrieving directly from this cache is more efficient and reliable than recompiling or copying from the project build directory because it ensures that the retrieved artifacts are completely consistent with the versions determined during the dependency resolution phase.

[0042] In one implementation, for artifact distribution, the network-accessible storage location can be a highly available, high-bandwidth object storage service (OSS), such as Alibaba Cloud OSS or Amazon S3. Uploading the packaged build artifacts to such a service provides a stable and high-speed download Uniform Resource Locator (URL), which serves as the resource locator. Using public or private cloud object storage services as artifact repositories not only solves the artifact storage and distribution problems but also leverages their mature permission management and CDN acceleration capabilities to ensure a smooth dependency pull experience for large-scale team collaborations.

[0043] In one implementation, during the release phase, the indexing service can be an index repository based on a Git version control system. For example, CocoaPods' Spec Repo is a Git repository that stores the podspec files for all available libraries. Pushing the generated target description files to such a Git repository is equivalent to registering the new library version with the index. Git's distributed and versioned nature makes index management and tracking very convenient, while also facilitating access control and automated releases.

[0044] After introducing the dependency mapping method of the heterogeneous package management system provided by this invention, the following will refer to... Figure 2The dependency mapping device of the heterogeneous package management system provided by the present invention will be described.

[0045] refer to Figure 2 The dependency mapping device 200 of the heterogeneous package management system includes: Virtual build module 210 is configured to configure a virtual build target in the first package management system to trigger dependency resolution; the virtual build target does not contain source code to be compiled and is configured to skip the compilation step; by adding an entry dependency to the virtual build target, the dependency resolution engine of the first package management system is triggered to obtain a dependency graph containing the entry dependency and all its direct and transitive dependencies. The data transformation module 220 is configured to perform metadata transformation for each dependency node in the dependency graph based on the dependency graph, thereby generating target metadata compatible with the second package management system. The metadata transformation includes: combining the version identifier of the dependency node with a build configuration identifier to generate a target version identifier with build configuration differentiation; and translating the dependency relationships of the dependency nodes into the dependency declaration format required by the second package management system. The data extraction module 230 is configured to locate and extract the corresponding build artifact for each dependency node in the dependency graph; convert the file structure of the build artifact into the preset directory structure required by the second package management system; package the build artifact with the converted file structure, upload it to a network-accessible storage location, and obtain a resource locator. The file generation module 240 is configured to generate a target description file for each dependency node in the dependency graph; the target description file contains target metadata and resource locators; and the generated target description file is published to the indexing service of the second package management system.

[0046] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it can implement all or part of the steps described in the foregoing method embodiments. The storage medium can be any electronic, magnetic, optical, or other physical device capable of storing program code, such as a read-only memory, random access memory, flash memory, hard disk, or optical disk. Furthermore, the present invention also provides an electronic device comprising a memory and a processor. The memory stores a computer program implementing the method of the present invention, and the processor is configured to execute the computer program to implement all or part of the steps described in the foregoing method embodiments. The electronic device can be a server, a personal computer, an embedded system, or any device with computing power.

[0047] The technical solution of the present invention will be illustrated more clearly below through a general embodiment that does not limit the specific package manager. Assume there is a first package management system A and a second package management system B, which are heterogeneous. This embodiment aims to automatically synchronize the dependencies in system A to system B. First, a virtual build target is defined in system A. This target is not associated with any source code, and its configuration is marked to skip compilation. Then, an entry dependency is declared in this virtual build target, for example: CoreLib / 1.0. The dependency resolution command of system A is executed and applied to this virtual build target. The dependency resolution engine of system A will identify the entry point CoreLib / 1.0 and begin recursively searching for its dependencies. Assume CoreLib / 1.0 depends on Utils / 2.3 and Networking / 1.5, and Networking / 1.5 depends on Crypto / 3.0. The resolution engine of system A will construct a dependency graph containing these four nodes. A structured representation of this graph, such as a JSON object, can be obtained through the API or command-line output provided by system A.

[0048] Next, we traverse each node in this dependency graph. Taking the Networking / 1.5 node as an example, assuming the current build configuration identifier is config-X. First, we combine its version identifier 1.5 with the build configuration identifier to generate the target version identifier 1.5.config-X. Then, we check its dependencies; it depends on Crypto / 3.0. Therefore, we generate a dependency declaration conforming to System B syntax, meaning: This package depends on Crypto, version 3.0.config-X. Note that the version number of its dependency is also appended with a suffix, ensuring consistency of the build configuration throughout the dependency chain. Simultaneously, for the Networking / 1.5 node, based on its location in System A's cache, we extract the corresponding build artifacts, such as libnetworking.a and networking.h. We create a temporary directory, within which we create the lib / and include / subdirectories required by System B, and place the extracted files into them respectively. Package this temporary directory into a file named networking-1.5.config-X.zip, upload it to a file server, and obtain its download URL, for example, http: / / server.com / pkgs / networking-1.5.config-X.zip. Finally, generate a target description file for System B. This file should contain the following: package name Networking, target version identifier 1.5.config-X, resource locator http: / / server.com / pkgs / networking-1.5.config-X.zip, dependency declaration as dependent on Crypto, version 3.0.config-X. Repeat this process for all other nodes in the dependency graph (CoreLib, Utils, Crypto), generating their respective target description files. Finally, publish all these target description files to System B's indexing service. This way, users of System B can automatically obtain the correct dependency chain and corresponding artifacts by declaring a dependency on CoreLib / 1.0.config-X.

[0049] like Figures 3 to 5 As shown below, taking a scenario where Conan is used as the first package management system and CocoaPods as the second package management system as an example, a complete implementation including all technical features is described. This implementation aims to automatically publish a complex project containing multiple C++ sub-libraries to a private indexing service for use by iOS applications.

[0050] like Figure 3As shown, firstly, as a multi-configuration compilation step, two automated build scripts were written: ios_debug_build.sh and ios_release_build.sh. In the ios_debug_build.sh script, the `conan create` command and the `-pr=ios_debug` parameter drive Conan to compile all C++ sub-libraries using the Debug configuration. This ios_debug configuration file specifies the compilation options as `-O0` (no optimization) and `-g` (preserve debug symbols). Similarly, the ios_release_build.sh script uses the `-pr=ios_release` parameter, specifying the compilation options as `-O2` (optimize) and `-s` (remove symbols), to generate artifacts for release. The execution of these two scripts ensures that both Debug and Release versions of the binary artifacts for all sub-libraries exist in Conan's local cache.

[0051] The next step is the topology capture step. For example... Figure 4 As shown, a special Conan Recipe is created as a virtual build target. The core of its `conanfile.py` file lies in the `requirements` method, which declares the project's entry dependencies, such as the entry dependency nodes `engine` and `connection`. When the `conan install` or `conan info` command is executed on this virtual build target, Conan's dependency resolution engine automatically resolves all transitive dependencies behind `engine` and `connection`, such as the transitive dependency node `jsoncpp`, and constructs a complete dependency graph. During the execution of the Recipe, the entire dependency graph object can be accessed through the `self.dependencies.host` API.

[0052] The next step is the heterogeneous metadata transformation, which is the core algorithm of this invention. A Python script iterates through each current dependency node (dep) in the dependency graph obtained from `self.dependencies.host`. For each node, firstly, based on the current build configuration (e.g., Debug), its Conan version number (e.g., 1.0.0) is mapped to a target version identifier in CocoaPods (e.g., 1.0.0.debug), implementing a suffix appending method. Next, the downstream dependency nodes (requirements) of the current node are iterated through, and they are also converted to version numbers with suffixes, generating the CocoaPods target dependency declaration `s.dependency`. For example, if `engine` depends on `jsoncpp`, then `s.dependency`, `jsoncpp`, and `1.9.7.debug` will be automatically generated in the `engine`'s target description file.

[0053] The subsequent product reassembly and distribution steps are responsible for handling physical files. For example... Figure 5 As shown, for each node in the dependency graph, the script locates the corresponding `include / ` and `lib / ` directories based on its package path in the Conan Hash Directory. Then, it copies all `.h` header files and `.a` static library files from these directories to a temporary, flattened CocoaPods Standard Directory, which contains the header file directory `include / ` and the library file directory `lib / `. This temporary directory is then compressed into a zip package, uploaded to the company's Alibaba Cloud Object Storage Service (OSS), and assigned a unique HTTP download URL. This URL is then populated into the `s.source` field of the target description file generated in the previous step.

[0054] Finally, there's the index deployment step. The script calls the `pod repo push` command to push all locally generated target description files (such as `engine.podspec`, `connection.podspec`, `jsoncpp.podspec`, etc.) one by one to the company's internal Git-based private indexing service. The `pod repo push` command automatically handles Git's add, commit, and push operations, completing the final step of deployment.

[0055] After completing all the above steps, members of the iOS development team can integrate the entire complex C++ library with only a very simple configuration in their main application's Podfile.

[0056] The above are merely preferred embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention. For example, the first package management system can also be vcpkg, Bazel, or Maven, and the second package management system can also be Swift Package Manager or Gradle. The build configuration identifier, in addition to debug / release, can also be the architecture (arm64 / x86_64) or a combination of other function switches. The version number suffix format, the specific selection of the network storage location, and the implementation language of the automation script can all be flexibly adjusted according to the actual technology stack and requirements; these are all extensions of the present invention's ideas.

Claims

1. A dependency mapping method for a heterogeneous package management system, characterized in that, Comprising: In a first package management system, configuring a dummy build target for triggering dependency resolution; The dummy build target does not contain source code to be compiled and is configured to skip the compilation step; Adding an entry dependency to the dummy build target, when triggering a dependency resolution engine of the first package management system, obtaining a dependency graph containing the entry dependency and all direct and transitive dependencies of the entry dependency; Based on the dependency graph, performing metadata conversion for each dependency node in the dependency graph to generate target metadata compatible with a second package management system; The metadata conversion includes: combining a version identifier of the dependency node with a build configuration identifier to generate a target version identifier with build configuration discrimination; and translating dependencies of the dependency node into a dependency declaration format required by the second package management system; For each dependency node in the dependency graph, locating and extracting the build product corresponding to the dependency node; converting the file structure of the build product into a preset directory structure required by the second package management system; packaging the build product of the converted file structure and uploading it to a network-accessible storage location to obtain a resource locator; For each dependency node in the dependency graph, generating a target description file; publishing the generated target description file to an index service of the second package management system; the target description file contains the target metadata and the resource locator.

2. The method of claim 1, wherein, Before obtaining the dependency graph, the method further comprises: Driving the first package management system to compile the entry dependency and its dependencies for at least two build configurations through an automated build script to generate build products corresponding to the build configurations.

3. The method of claim 2, wherein, The at least two build configurations include: a debug configuration and a release configuration; the build configuration identifier corresponds to the debug configuration or the release configuration.

4. The method of claim 1, wherein, Combining the version identifier with the build configuration identifier includes: Appending the build configuration identifier as a suffix to the version identifier to generate the target version identifier.

5. The method of claim 1, wherein, The preset directory structure includes an include directory for storing header files and a lib directory for storing library files.

6. The method of claim 1, wherein, The locating and extracting the corresponding build product includes: Extracting the build product from a content-hash-based local cache directory of the first package management system.

7. The method of claim 1, wherein, The network-accessible storage location is an object storage service (OSS); the resource locator is a download URL of the uploaded packaged build product; and the index service is an index repository based on a Git version control system.

8. A dependency mapping apparatus of a heterogeneous package management system, characterized by, Comprising: A dummy build module configured to configure a dummy build target for triggering dependency resolution in a first package management system; The virtual build target does not contain source code to be compiled and is configured to skip the compilation step; an entry dependency is added to the virtual build target, and when a dependency resolution engine of the first package management system is triggered, a dependency graph containing the entry dependency and all direct and transitive dependencies of the entry dependency is obtained; a data conversion module configured to perform metadata conversion for each dependency node in the dependency graph based on the dependency graph, thereby generating target metadata compatible with the second package management system; The metadata conversion includes: combining the version identifier of the dependency node with a build configuration identifier to generate a target version identifier with build configuration discrimination; and translating the dependency relationship of the dependency node into a dependency declaration format required by the second package management system; a data extraction module configured to locate and extract the build product corresponding to each dependency node in the dependency graph; convert the file structure of the build product into a preset directory structure required by the second package management system; package the build product of the converted file structure and upload it to a network-accessible storage location, and obtain a resource locator; a file generation module configured to generate a target description file for each dependency node in the dependency graph; publish the generated target description file to an index service of the second package management system; the target description file contains the target metadata and the resource locator.