Method and device for automatically generating dependency relationship data structure

By automatically obtaining and processing compilation configuration information, generating dependency text and establishing a dependency diagram, the problems of complex dependency relationships and compilation errors in the open source Hongmeng system are solved, and efficient dependency display and development efficiency are achieved.

CN119621068APending Publication Date: 2025-03-14WEAPON EQUIP RES INST OF CHINA NAT WEAPON EQUIP GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411691350.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

During the development of open source Hongmeng system, the dependencies between functions are complex and require manual writing and inspection. The existing technology cannot effectively avoid circular dependencies and overlapping dependencies, resulting in compilation errors.

Method used

By obtaining the compilation configuration information of component functions, determine the real path of the function with the same name, extracting keywords to generate dependency text, checking and identifying the function name, establishing a dependency diagram between functions, avoiding circular dependencies and saving function identifiers.

Benefits of technology

It realizes automatic generation of dependency data structures, intuitively displaying dependencies between functions, avoiding compilation errors, improving development efficiency, and facilitating system maintenance and sustainable development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621068A_ABST
    Figure CN119621068A_ABST
Patent Text Reader

Abstract

The invention provides a dependency relationship data structure automatic generation method and device. The method comprises the following steps: acquiring compiling configuration information corresponding to each function of a component; compiling configuration information corresponding to the functions with the same name is selected, and a real path of the compiling configuration information is determined; key words in the compiling configuration information are extracted, the dependency relationship among the functions is extracted according to the key words, the dependency relationship is the names of other functions which the functions depend on when the functions are compiled, and then a dependency relationship text corresponding to the dependency relationship is generated; and checking function names in the dependency relationships of the functions in the dependency relationship text, and for the functions with the same names, combining the real paths of the compiling configuration information corresponding to the functions, the dependency relationship text and the function names as identifiers of the functions. According to the method, the development efficiency is improved, developers can apply limited time to key logic, and later system maintenance and sustainable development of products are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer operating systems, and in particular to a method and device for automatically generating a dependency relationship data structure. Background Art

[0002] The open source Hongmeng system is developed step by step according to the system>subsystem>component>function. Each system is composed of one or more subsystems, each subsystem includes one or more components, and each component contains one or more functions, eventually forming a complete operating system. In the development process of the open source Hongmeng subsystem, the dependencies between functions are intricate. During the development process, it is often necessary to write the dependencies of functions one by one, and at the same time, circular dependencies need to be avoided. New employees are not familiar with the open source Hongmeng system. For different subsystems, they need to manually write dependencies and check whether there are errors in the code dependencies.

[0003] The existing method of querying dependencies is to manually write the compilation configuration script, generate the dependency file through the system's own tools, and check whether the dependencies are correct by compiling. In the existing technology, for components with the same name, no secondary verification is performed, resulting in overlapping dependencies of some components and errors. It only supports searching for partial dependencies, but does not support searching for dependent relationships, overall dependency graphs, and error dependency checks. Summary of the invention

[0004] The present invention provides a method and device for automatically generating a dependency data structure, which solves the problem of manually writing dependency and checking whether there are errors in code dependency.

[0005] The present invention proposes a method for automatically generating a dependency relationship data structure, which comprises the following steps:

[0006] Get the compilation configuration information corresponding to each function of the component;

[0007] Select the compilation configuration information corresponding to the function with the same name, and determine the real path of the compilation configuration information;

[0008] Extract keywords from the compilation configuration information, extract dependencies between various functions according to the keywords, the dependencies are the names of other functions that the functions depend on when compiling, and then generate dependency text corresponding to the dependencies;

[0009] The function names in the dependencies of the functions in the dependency text are checked, and for functions with the same name, the real path of the compilation configuration information corresponding to the function, the dependency text and the function name are combined as the identifier of the function.

[0010] Furthermore, according to the dependency text in each function identifier, a dependency graph between the functions is established with one function as a dependency node.

[0011] Furthermore, for the compilation configuration information whose function cannot be determined, the processing is skipped, and it is determined that the compilation configuration information has errors, and a prompt is given to modify the erroneous compilation configuration information.

[0012] Furthermore, each function and its identifier are saved as a file.

[0013] The present invention also provides a device for automatically generating a dependency relationship data structure, which comprises:

[0014] A compilation information acquisition module obtains the compilation configuration information corresponding to each function of the component;

[0015] A path determination module selects the compilation configuration information corresponding to the function with the same name and determines the real path of the compilation configuration information;

[0016] A dependency generation module extracts keywords from the compilation configuration information, extracts dependencies between various functions based on the keywords, where the dependencies are the names of other functions that the functions depend on when compiling, and then generates dependency text corresponding to the dependencies;

[0017] The function identification module checks the function names in the dependencies of each function in the dependency text. For functions with the same name, the real path of the compilation configuration information corresponding to the function, the dependency text and the function name are combined as the identification of the function.

[0018] Furthermore, the relationship graph generation module establishes a dependency graph between the functions based on the dependency text in each function identifier and taking one function as a dependency node.

[0019] Furthermore, the functions of the compilation information acquisition module further include: skipping the compilation configuration information whose function cannot be determined, and judging that the compilation configuration information has errors, prompting to modify the erroneous compilation configuration information.

[0020] Furthermore, each function and its identifier are saved as a file.

[0021] Compared with the prior art, the present invention can automatically generate a dependency data structure, which is conducive to more intuitively displaying the dependency between various functions, effectively promoting developers to understand the relationship between the developed function and other functions, as well as the hierarchical structure of the function in the system, while avoiding compilation errors caused by circular dependencies. The present invention improves development efficiency, enables developers to spend limited time on key logic, and facilitates product later system maintenance and sustainable development. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A flowchart automatically generated for the dependency text of the present invention;

[0023] Figure 2 Generate a dependency text example graph for the present invention;

[0024] Figure 3 Generate dependency nodes and dependency flow chart for the present invention;

[0025] Figure 4 (a), (b), and (c) are example diagrams of dependency nodes and dependency text generated by the present invention;

[0026] Figure 5 Dependency display and dependency checking flow chart of the present invention;

[0027] Figure 6 (a) and (b) are example diagrams of dependency relationships of the present invention;

[0028] Figure 7 It is a script list diagram of the present invention;

[0029] Figure 8 generating a dependency graph for the present invention;

[0030] Fig. 9 A dependency graph is generated for the present invention. DETAILED DESCRIPTION

[0031] The present invention proposes a method and device for automatically generating a dependency relationship data structure. The specific implementation of the present invention is described in detail below.

[0032] The method for automatically generating a dependency relationship data structure of the present invention comprises the following steps:

[0033] Obtain the compilation configuration information corresponding to each function of the component; skip the compilation configuration information whose function cannot be determined, and determine that the compilation configuration information is wrong, and prompt to modify the wrong compilation configuration information.

[0034] Select the compilation configuration information corresponding to the function with the same name, and determine the real path of the compilation configuration information.

[0035] Keywords in the compilation configuration information are extracted, and dependencies between various functions are extracted according to the keywords. Dependencies are names of other functions that the functions depend on when compiling, and then dependency text corresponding to the dependencies is generated.

[0036] The function names in the dependencies of the functions in the dependency text are checked, and for functions with the same name, the real path of the compilation configuration information corresponding to the function, the dependency text and the function name are combined as the identifier of the function.

[0037] According to the dependency text in each function identifier, a dependency graph between functions is established with one function as a dependency node; and each function and its identifier can be saved as a file.

[0038] Example

[0039] Specifically, the present invention generates a dependency text, and represents the dependency relationships among the components of the operating system according to the dependency text. Figure 1 :

[0040] 1) Extract all compilation configuration information of each component: By executing the script, extract all compilation configuration information written by the user in each component, and find the smallest unit of all compilation in this component, that is, function.

[0041] 2) Modify the compilation configuration information with the same name: By executing the script, filter out the compilation configuration information that needs to be modified, that is, the functions with the same name. At this time, it is necessary to add the real path of this function in the overall code as one of the parameters for generating the function ID.

[0042] 3) Extract dependencies from compilation configuration information: By executing the script, the keywords in the compilation configuration information are automatically analyzed, such as subsystem internal dependency keywords, cross-subsystem external dependency keywords, and third-party dependency keywords, to extract the dependencies of the functions. Finally, a function generates a corresponding dependency text. Each dependency text stores all the dependencies of a function and the unique identifier of this function, namely the function identifier. The function identifier includes: the actual path of the function source code, the function name, and the subsystem name.

[0043] 4) Search and replace the function names pointed to in the dependency text: By executing the script, each dependency item in the dependency text is checked. The dependency item refers to the name of another function that this function depends on when it is compiled. Some functions with the same name need to be replaced with function identifiers based on the compilation configuration information. For function identifiers that cannot be determined, it is determined that the compilation configuration information written by the user is wrong, and the user needs to modify the compilation configuration information.

[0044] 5) Generate dependency text examples, refer to Figure 2 . Each file contains the dependency text for a feature.

[0045] Generate dependency nodes and dependencies, see the flowchart Figure 3 :

[0046] 1) By executing the script, a function ID list is generated according to the function name, source code path, and subsystem name information in the dependency text information. One function ID is one dependency node.

[0047] 2) Generate a node dependency data structure based on the dependency relationship. This data structure identifies that a node needs to depend on another node when compiling, such as: node fbd51eac80a15ce3ebc13af60746da71 depends on 9a5540874d1d1cc1d7b9e7fcf0df4cbc.

[0048] 3) For examples of generated dependency nodes and dependency text, refer to Figure 4 (a)-(c). parse_data_module.csv and parse_data_module.json are dependency node lists, with the same data content but different data structures, used for different analysis, display and detection methods. parse_data_module_links.csv and parse_data_module_links.json are dependency lists, with the same data content but different data structures, used for different analysis, display and detection methods.

[0049] Dependency display and dependency checking, see the flowchart Figure 5 :

[0050] 1) Generate dependency display: By executing the script, the developer enters the dependency text name to display the function dependency or function dependency, supporting multi-layer display and full display. Example reference Figure 6 (a)-(b).

[0051] The above is one implementation of the method of the present invention. The developer only needs to place the template code locally, specify the code path, and the display method, and then analyze and display the detection dependency each time the script is executed.

[0052] For a list of scripts, see Figure 7 :

[0053] 1) Among them, deps_file_check_data.py is a script for generating dependency text, which is responsible for collecting compilation configuration information, extracting dependencies, and replacing dependent functions with unique identifiers.

[0054] 2) Among them, deps_file_parse_data.py is a script for generating dependency nodes and dependencies, which is responsible for generating node lists and node dependency data structures.

[0055] 3) file_dep_module.py is a dependency generation script responsible for generating a dependency display diagram. Figure 8 .

[0056] 4) file_bedep_module.py is a dependency generation script, responsible for generating a dependency display diagram. Fig. 9 .

[0057] The present invention also provides a device for automatically generating a dependency relationship data structure, which includes:

[0058] A compilation information acquisition module obtains the compilation configuration information corresponding to each function of the component;

[0059] A path determination module selects the compilation configuration information corresponding to the function with the same name and determines the real path of the compilation configuration information;

[0060] A dependency generation module extracts keywords from the compilation configuration information, extracts dependencies between various functions based on the keywords, where the dependencies are the names of other functions that the functions depend on when compiling, and then generates dependency text corresponding to the dependencies;

[0061] The function identification module checks the function names in the dependencies of each function in the dependency text. For functions with the same name, the real path of the compilation configuration information corresponding to the function, the dependency text and the function name are combined as the identification of the function.

[0062] The present invention improves development efficiency, enables developers to spend limited time on key logic, and facilitates later system maintenance and sustainable development of products.

Claims

1. A method for automatically generating a dependency relationship data structure, characterized in that: It includes the following steps: Get the compilation configuration information corresponding to each function of the component; Select the compilation configuration information corresponding to the function with the same name, and determine the real path of the compilation configuration information; Extract keywords from the compilation configuration information, extract dependencies between various functions according to the keywords, the dependencies are the names of other functions that the functions depend on when compiling, and then generate dependency text corresponding to the dependencies; The function names in the dependencies of the functions in the dependency text are checked, and for functions with the same name, the real path of the compilation configuration information corresponding to the function, the dependency text and the function name are combined as the identifier of the function.

2. The method according to claim 1, characterized in that: The method further comprises: establishing a dependency graph between the functions according to the dependency text in each function identifier and taking one function as a dependency node.

3. The method according to claim 1, characterized in that The method further includes: skipping the compilation configuration information whose function cannot be determined, determining that the compilation configuration information has errors, and prompting to modify the erroneous compilation configuration information.

4. The method according to claim 1, characterized in that: The method further includes: saving each function and its identification as a file.

5. A device for automatically generating a dependency relationship data structure, characterized in that: It includes: A compilation information acquisition module obtains the compilation configuration information corresponding to each function of the component; A path determination module selects the compilation configuration information corresponding to the function with the same name and determines the real path of the compilation configuration information; A dependency generation module extracts keywords from the compilation configuration information, extracts dependencies between various functions based on the keywords, where the dependencies are the names of other functions that the functions depend on when compiling, and then generates dependency text corresponding to the dependencies; The function identification module checks the function names in the dependencies of each function in the dependency text. For functions with the same name, the real path of the compilation configuration information corresponding to the function, the dependency text and the function name are combined as the identification of the function.

6. The device according to claim 5, characterized in that The device further comprises: a relationship graph generating module, which establishes a dependency graph between various functions based on the dependency text in each function identifier and takes one function as a dependency node.

7. The device according to claim 5, characterized in that The functions of the compilation information acquisition module further include: skipping the compilation configuration information whose function cannot be determined, and judging that the compilation configuration information has errors, prompting to modify the erroneous compilation configuration information.

8. The device according to claim 5, characterized in that The function of the function identification module further includes: saving each function and its identification as a file.