Component generation method and device, computer equipment, readable storage medium and program product

By generating the virtual dependent code segment and decoupled dependence, the problem of low componentization efficiency of Java applications was solved, and rapid componentization and iteration were realized, and the stability of software and maintenance efficiency were improved.

CN119376721APending Publication Date: 2025-01-28DAWNING INFORMATION IND (BEIJING) CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411398951.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

The existing technology is inefficient when implementing the componentization of Java applications. It is necessary to sort out the dependencies of internal components from the business logic, or gradually dismantle one-way dependency components, resulting in maintenance difficulties and inefficient efficiency.

Method used

By determining the target code segment and its dependency code segment, and generating virtual dependent code segments based on the preset virtual declaration library, the dependency relationship of the component in decoupled software is achieved, thereby achieving rapid componentization processing and iteration.

Benefits of technology

The componentization process of the target code segment has been greatly accelerated, the componentization efficiency is improved, the maintenance process is simplified, and the stability and reliability of the software are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376721A_ABST
    Figure CN119376721A_ABST
Patent Text Reader

Abstract

The invention relates to a component generation method and device, computer equipment, a readable storage medium and a program product. The method comprises the following steps: determining a target code segment and a first dependent code segment corresponding to the target code segment, and generating a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library; and based on a dependency relationship between the target code segment and the virtual dependency code segment, performing componentization processing on the target code segment to obtain a target component of the target code segment. By adopting the method, the modularization efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a component generation method, apparatus, computer equipment, readable storage medium and program product. Background Art

[0002] As application functions increase and continue to iterate, non-cloud native Java (an object-oriented programming language) applications become larger and larger, forming huge monolithic software in the application, and the maintenance of different branches of the application becomes increasingly difficult. Software componentization is the main way to reduce maintenance costs and improve product quality.

[0003] In the related art, componentization is usually achieved by rewriting or gradually disassembling one-way dependent components. Componentization by rewriting requires sorting out the dependencies of internal components from the business logic and replanning the scope of components according to the dependencies between components; componentization by gradually disassembling one-way dependent components requires adjusting both componentized code and non-componentized code. Therefore, componentization by rewriting or gradually disassembling one-way dependent components is inefficient. Summary of the invention

[0004] Based on this, it is necessary to provide a component generation method, device, computer equipment, readable storage medium and program product that can improve componentization efficiency in response to the above technical problems.

[0005] In a first aspect, the present application provides a method for generating a component, comprising:

[0006] Determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library;

[0007] Based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain a target component of the target code segment.

[0008] A virtual dependent code segment of the first dependent code segment corresponding to the target code segment is generated based on a preset virtual declaration library, and based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain the target component of the target code segment. The target component is split based on the generation of the virtual dependent code segment, and rapid adjustment and iteration can be achieved during the componentization process, which greatly accelerates the componentization process of the target code segment and improves the componentization efficiency.

[0009] In this embodiment, the generation of virtual dependent code segments enables the splitting of target components, and rapid adjustment and iteration during the componentization process, which greatly accelerates the componentization process of the target code segments and improves the componentization efficiency.

[0010] In one embodiment, the preset virtual declaration library includes declaration information of the code segment, and the step of generating the virtual dependent code segment of the first dependent code segment based on the preset virtual declaration library includes:

[0011] Determining, in the preset virtual declaration library, target declaration information matching the declaration information of the first dependent code segment;

[0012] The target declaration information is determined to be a virtual dependent code segment of the first dependent code segment.

[0013] In this embodiment, virtual dependency code snippets are generated through a virtual declaration library, a non-unidirectional dependency relationship is implemented, and the dependency between implementation and components in the software is decoupled, so as to speed up the subsequent componentization process.

[0014] In one embodiment, the method further comprises:

[0015] The target component is compiled based on a preset compilation model to obtain a bytecode corresponding to the target component.

[0016] In this embodiment, by compiling the target component to obtain the bytecode, independent compilation and deployment of the target component is achieved, the componentization process is improved, and a basis is provided for subsequent software operation.

[0017] In one embodiment, the method further comprises:

[0018] Based on the dependency relationship between the target component and the code segment associated with the target component, the bytecode associated with the target component is integrated to obtain a target file;

[0019] The target file is loaded into a target execution environment and executed so as to parse the bytecode in the target file.

[0020] In this embodiment, the target file is obtained by integrating the bytecode associated with the target component, which improves the efficiency of deployment and the reliability of the software during operation. The purpose of multi-version reuse is achieved by loading the target file into the target operating environment for operation.

[0021] In one embodiment, the associated code segment of the target component includes the first dependent code segment and the second dependent code segment, the target code segment depends on the first dependent code segment, and the second dependent code segment depends on the target code segment, and based on the dependency relationship between the target component and the associated code segment of the target component, the bytecode associated with the target component is integrated to obtain a target file, including:

[0022] Obtaining the bytecode of the first dependent code segment and the bytecode of the second dependent code segment;

[0023] Based on the dependency relationship between the target component and the associated code segment of the target component, the bytecode corresponding to the target component, the bytecode of the first dependent code segment and the bytecode of the second dependent code segment are integrated to obtain a target file.

[0024] In this embodiment, by integrating the bytecodes based on the dependency relationship to obtain the target file, convenience is provided for subsequent operation and the stability of the software is improved.

[0025] In one embodiment, the method further comprises:

[0026] If the first dependent code segment meets the preset update condition, and the implementation relationship between the target code segment and the first dependent code segment does not meet the preset implementation condition, the target component corresponding to the target code segment remains unchanged.

[0027] In this embodiment, by adding a conditional usage policy, when the first dependent component changes, it is ensured that the target component is updated when the condition is met, thereby improving the stability and performance of the system where the software is located.

[0028] In a second aspect, the present application also provides a component generation device, including:

[0029] A determination module, configured to determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library;

[0030] The componentization module is used to componentize the target code segment based on the dependency relationship between the target code segment and the virtual dependent code segment to obtain a target component of the target code segment.

[0031] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0032] Determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library;

[0033] Based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain a target component of the target code segment.

[0034] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0035] Determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library;

[0036] Based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain a target component of the target code segment.

[0037] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0038] Determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library;

[0039] Based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain a target component of the target code segment.

[0040] The above-mentioned component generation method, apparatus, computer equipment, readable storage medium and program product generate a virtual dependent code segment of the first dependent code segment corresponding to the target code segment based on a preset virtual declaration library, and componentize the target code segment based on the dependency relationship between the target code segment and the virtual dependent code segment to obtain the target component of the target code segment. The target component is split based on the generation of the virtual dependent code segment, and can be quickly adjusted and iterated during the componentization process, thereby accelerating the componentization process of the target code segment and improving the componentization efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0042] FIG1 is a schematic diagram of a flow chart of a method for generating a component in one embodiment;

[0043] FIG2 is a schematic diagram of the structure of a target component in one embodiment;

[0044] FIG3 is a schematic diagram of the structure of a virtual declaration library in one embodiment;

[0045] FIG4 is a schematic diagram of the dependency relationship of a target component during runtime in one embodiment;

[0046] FIG5 is a structural block diagram of a component generation device in one embodiment;

[0047] FIG. 6 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0049] In an exemplary embodiment, as shown in FIG1 , a method for generating a component is provided. This embodiment is illustrated by applying the method to a terminal. It is understandable that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0050] Step 101: determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library.

[0051] Among them, the target code segment can be a code segment that needs to be componentized in the application, for example: a code segment that appears repeatedly in the application or a code segment specified by the user in the application development. Componentization can be a process of splitting the original single software into multiple running modules that can be run separately. The first dependent code segment can be a code segment that the target code segment depends on, and the first dependent code segment can include multiple code segments that the target code segment depends on. The preset virtual declaration library can be a virtual library (Virtual Library, vlib). The declaration information of the virtual dependent code segment corresponds to the declaration information of the first dependent code segment.

[0052] Specifically, the terminal can identify the code segment that needs to be componentized according to the specific functions in the application, and determine the code segment that needs to be componentized as the target code segment. The terminal can use static analysis, code analysis or other dependency analysis methods to obtain the code segment associated with the target code segment. For example, the terminal can obtain the source code function call, class reference, etc. in the software program, and use the dependency tool to analyze the function call, class reference or other forms of data flow in the source code of the code segment to obtain the code segment associated with the target code segment, and the associated code segment includes the first dependent code segment on which the target code segment depends. For example, the dependency tool can be a rule in Makefile (a file used to automate the compilation and build process), an integrated development (IDE) build system, or a special static analysis tool such as a programming error detector (PMD), a copy-paste detector (CPD), etc., and the specific dependency tool is not limited here. The terminal can find a virtual dependent code segment that matches the first dependent code segment from a preset virtual declaration library.

[0053] Step 102: Based on the dependency relationship between the target code segment and the virtual dependent code segment, componentize the target code segment to obtain a target component of the target code segment.

[0054] The dependency relationship can be the interaction between various parts of the software program or the relationship between the required resources. The dependency relationship can include the dependency of a function on a library function, the dependency of a class on a class variable, etc. The target component can be a Java component or a Java archive file (jar file).

[0055] Specifically, the terminal may determine the dependency relationship between the target code segment and the first dependent code segment based on the first dependent code segment. The terminal may determine the dependency relationship between the target code segment and the first dependent code segment and the virtual code segment based on the dependency relationship between the target code segment and the first dependent code segment. The terminal may componentize the target code segment using a preset packaging tool based on the dependency relationship between the target code segment and the virtual code segment to obtain a target component of the target code segment.

[0056] Exemplarily, the preset packaging tool may be npm (a package manager for Node.js), Webpack (a front-end packaging tool), or a Java project building tool, etc., and the specific tool for componentizing the target code segment is not limited herein. As shown in FIG. 2 , FIG. 2 is a schematic diagram of the structure of a target component in an embodiment. Exemplarily, the code segment on which the target code segment depends includes a first code segment and a second code segment, and the first code segment is generated into a first virtual code segment based on a virtual declaration library, and the second code segment is generated into a second virtual code segment, and the dependency relationship between the target code segment and the first virtual code segment and the second virtual code segment is determined.

[0057] In the above-mentioned component generation method, a virtual dependent code segment of the first dependent code segment corresponding to the target code segment is generated based on a preset virtual declaration library, and based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain the target component of the target code segment. The target component is split based on the generation of the virtual dependent code segment, and can be quickly adjusted and iterated during the componentization process, which greatly accelerates the componentization process of the target code segment, thereby improving the componentization efficiency.

[0058] In an exemplary embodiment, generating a virtual dependent code segment of a first dependent code segment based on a preset virtual declaration library includes:

[0059] In a preset virtual declaration library, target declaration information matching the declaration information of the first dependent code segment is determined; and the target declaration information is determined to be a virtual dependent code segment of the first dependent code segment.

[0060] The preset virtual declaration library includes declaration information of various code segments, and the declaration information may include but is not limited to the definition of a function in the code segment or one or more of the classes.

[0061] Specifically, the preset virtual declaration library can pre-store declaration information of various code segments, as shown in Figure 3, which is a structural diagram of a virtual declaration library in an embodiment, and the virtual declaration library includes multiple declaration information (first declaration information, second declaration information, ..., nth declaration information). The preset virtual declaration library can also generate identification information corresponding to various declaration information according to the definition or class of the declaration information, and store the correspondence between the identification information and the declaration information in the preset virtual declaration library. The terminal can determine the identification information corresponding to the declaration information of the first dependent code segment, and search for declaration information matching the identification information in the preset virtual library according to the identification information. Exemplarily, if the identification information to be matched is consistent with the target identification information in the virtual declaration library, the match is considered successful. The terminal can determine the target declaration information corresponding to the target identification information based on the correspondence between the identification information and the declaration information, and determine the target declaration information as the virtual dependent code segment of the first dependent code segment.

[0062] In this embodiment, virtual dependency code snippets are generated through a virtual declaration library, a non-unidirectional dependency relationship is implemented, and the dependency between the implementation and the component in the application is decoupled, so as to speed up the subsequent componentization process.

[0063] In an exemplary embodiment, the component generation method further includes:

[0064] Compile the target component based on the preset compilation model to obtain the bytecode corresponding to the target component.

[0065] The preset compilation model may be a preset compiler, and the bytecode may be a code executed by a preset virtual machine.

[0066] Specifically, the terminal can use the javac (Java Compiler) command in the preset compiler to compile the source code of the target component to obtain the bytecode. Exemplarily, the terminal can convert the extension name in the target component based on the preset compiler, for example, converting the first extension name in the target component to the second extension name, where the first extension name can be .java and the second extension name can be .class. In addition, if the target component has an exception during the compilation process, such as an error in the code segment, javac will report an error message.

[0067] In this embodiment, by compiling the target component to obtain the bytecode, independent compilation and deployment of the target component is achieved, the componentization process is improved, and a basis is provided for subsequent application program operation.

[0068] In an exemplary embodiment, the component generation method further includes:

[0069] Based on the dependency relationship between the target component and the associated code segments of the target component, the bytecodes associated with the target component are integrated to obtain a target file; the target file is loaded into a target operating environment for execution, so that the bytecodes in the target file are parsed.

[0070] The associated code segment may be a code segment that depends on the target component or a code segment that is depended on by the target component. The bytecode associated with the target component includes the bytecode of the target code segment and the bytecode corresponding to the associated code segment of the target code segment. The target operating environment may be a Java Virtual Machine (JVM).

[0071] Specifically, the terminal can adopt static analysis, code analysis or other dependency analysis methods to obtain the code segment that depends on the target component or the code segment that the target component depends on. The specific method of how to analyze the source code in the code segment is detailed in the above embodiment and will not be repeated here. The terminal can determine the dependency relationship between the target component and the associated code segment based on the acquired associated code segment with the target code segment. The terminal can compile the code segment associated with the target component to obtain the bytecode of the associated code segment. Based on the dependency relationship between the target component and the associated code segment of the target component, the terminal integrates the target code segment, the associated code segment on which the target code segment depends, and the bytecode of the associated code that is dependent to obtain the target file. The terminal integrates and merges the target files to obtain the target file, and loads the target file into the Java virtual machine for execution, and parses and executes the bytecode in the target file in the Java virtual machine to obtain the parsing result.

[0072] In this embodiment, the target file is obtained by integrating the bytecode associated with the target component, which improves the efficiency of deployment and the reliability of the application during operation. The purpose of multi-version reuse is achieved by loading the target file into the target operating environment for operation.

[0073] In an exemplary embodiment, based on the dependency relationship between the target component and the code segment associated with the target component, the bytecode associated with the target component is integrated to obtain a target file, including:

[0074] Obtain the bytecode of the first dependent code segment and the bytecode of the second dependent code segment; based on the dependency relationship between the target component and the associated code segment of the target component, integrate the bytecode corresponding to the target component, the bytecode of the first dependent code segment and the bytecode of the second dependent code segment to obtain the target file.

[0075] The associated code segment of the target component includes a first dependent code segment and a second dependent code segment, the target code segment depends on the first dependent code segment, and the second dependent code segment depends on the target code segment.

[0076] Specifically, the terminal sets the first dependent code segment and the second dependent code segment on the same software component, and the first dependent code segment and the second dependent code segment in the software component have a dependency relationship with the target component respectively. The terminal can compile the source code in the first dependent code segment to obtain the bytecode of the first dependent code segment, and can compile the source code of the second dependent code segment to obtain the bytecode of the second dependent code segment. Based on the dependency relationship between the target component and the associated code segment of the target component, the terminal can integrate the bytecode corresponding to the target component, the bytecode of the first dependent code segment and the bytecode of the second dependent code segment into the same file to generate a target file. As shown in Figure 4, Figure 4 is a schematic diagram of the dependency relationship of the target component at runtime in one embodiment, the target component includes the target code segment, and the target software library includes the associated code segment of the target code segment. The target component includes the target code segment, and the target software library includes the first dependent code segment (the first code segment and the second code segment) and the second dependent code segment (the third code segment and the fourth code segment). It should be understood that the examples here are only for illustration and cannot constitute a specific limitation.

[0077] In this embodiment, by integrating the bytecodes based on the dependency relationship to obtain the target file, convenience is provided for subsequent operation and the stability of the software is improved.

[0078] In an exemplary embodiment, the component generation method further includes:

[0079] If the first dependent code segment meets the preset update condition, and the implementation relationship between the target code segment and the first dependent code segment does not meet the preset implementation condition, the target component corresponding to the target code segment remains unchanged.

[0080] The preset update condition is that the dependent code segment is updated, which may be a version change of the dependent code segment or a dependency change, etc. The dependency change may be that the dependent code segment is deleted or the specific implementation of the target code is changed, etc. The preset implementation condition is that the implementation of the target code includes the content of the first dependent code segment.

[0081] Specifically, the terminal can detect the associated code segments of the target code segment in real time or within a preset time interval, and determine whether the target component needs to be maintained and updated. If the terminal detects that the first dependent code segment has a version change or a dependency change, and the implementation of the target code segment does not require the declaration information of the first dependent code segment (does not meet the implementation relationship), then the update of the first dependent code segment will not affect the operation of the target code segment, and the target component corresponding to the target code segment can be kept unchanged. If the terminal detects that the first dependent code segment has a version change or a dependency change, and the implementation of the target code segment requires the declaration information of the first dependent code segment (satisfies the implementation relationship), the target component corresponding to the target code segment needs to be adjusted and updated according to the update information of the first dependent code segment.

[0082] Exemplarily, the process of the terminal specifically detecting whether the first dependent code segment meets the preset update condition may be that the terminal detects the update information of the first dependent code segment, determines that the first dependent code segment is updated based on the update information, and if the first dependent code segment is updated, the first dependent code segment meets the preset update condition; if the first dependent code segment is not updated, the first dependent code segment does not meet the preset update condition.

[0083] In this embodiment, by adding a conditional usage policy, when the first dependent component changes, it is ensured that the target component is updated only when the condition is met, thereby improving the stability and performance of the system where the application is located.

[0084] In an exemplary embodiment, an application includes five code segments fragment0-4, and fragment0 is used as a target code segment. There is a dependency relationship between the target code segment fragment0 and the first to fourth code segments fragment1-4. The target code segment depends on the first code segment fragment1 and the second code segment fragment2 respectively, and the target code segment is dependent on the third code segment fragment3 and the fourth code segment fragment4. The component generation method specifically includes:

[0085] During the compilation period, the terminal determines fragment0 as the target code segment, and identifies the dependent code segments fragment1 and fragment2 that fragment0 depends on. The terminal identifies the declaration information of fragment1 and fragment2 respectively, and selects the target declaration information of fragment1 and the target declaration information of fragment2 from the multiple declaration information contained in the preset virtual declaration library based on the declaration information of fragment1 and fragment2. The terminal generates a virtual dependent code segment virtual fragment1 from the target declaration information of fragment1, and generates a virtual dependent code segment virtual fragment3 from the target declaration information of fragment2. Based on the dependency relationship between fragment0 and virtual fragment1 and the dependency relationship with virtual fragment3, the terminal componentizes fragment0 to obtain the target component.

[0086] The terminal compiles the target component based on the preset compilation model to obtain the bytecode corresponding to the target component.

[0087] During the runtime, the terminal obtains the bytecode of the first dependent code segment (fragment1 and fragment2) and the bytecode of the second dependent code segment (fragment3 and fragment4); based on the dependency relationship between the target component and the associated code segment of the target component, the terminal integrates the bytecode corresponding to the target component, the bytecode of the first dependent code segment, and the bytecode of the second dependent code segment to obtain the target file. The terminal loads the target file into the target runtime environment for execution, and parses the bytecode in the target file in the target runtime environment.

[0088] During the maintenance period, if the first dependent code segment meets the preset update condition, and the implementation relationship between the target code segment and the first dependent code segment does not meet the preset implementation condition, the terminal keeps the target component corresponding to fragment0 unchanged.

[0089] In this embodiment, through non-unidirectional dependency componentization, the compilation period and the runtime period are processed with dependency relationships of different structures, thereby improving the speed of rapid iteration of components. Through rapid componentization, the maintenance cost of large-scale single Java software formed due to various reasons is reduced, and the quality and stability of the application are improved.

[0090] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0091] Based on the same inventive concept, the embodiment of the present application also provides a component generation device for implementing the component generation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the generation device of one or more components provided below can refer to the limitations of the component generation method above, and will not be repeated here.

[0092] In an exemplary embodiment, as shown in FIG5 , a component generation device is provided. The component generation device 50 includes: a determination module 51 and a componentization module 52, wherein:

[0093] A determination module 51 is used to determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library;

[0094] The componentization module 52 is used to componentize the target code segment based on the dependency relationship between the target code segment and the virtual dependent code segment to obtain a target component of the target code segment.

[0095] In one of the embodiments, the determination module 51 is used to determine, in a preset virtual declaration library, target declaration information that matches the declaration information of the first dependent code segment;

[0096] The target declaration information is determined to be a virtual dependent code segment of the first dependent code segment.

[0097] In one embodiment, the componentization module 52 is further used to compile the target component based on a preset compilation model to obtain the bytecode corresponding to the target component.

[0098] In one embodiment, the componentization module 52 is further used to integrate the bytecodes associated with the target component based on the dependency relationship between the target component and the associated code segments of the target component to obtain a target file;

[0099] The target file is loaded into the target execution environment and executed so as to parse the bytecode in the target file.

[0100] In one embodiment, the componentization module 52 is further used to obtain the bytecode of the first dependent code segment and the bytecode of the second dependent code segment;

[0101] Based on the dependency relationship between the target component and the associated code segment of the target component, the bytecode corresponding to the target component, the bytecode of the first dependent code segment, and the bytecode of the second dependent code segment are integrated to obtain a target file.

[0102] In one embodiment, the componentization module 52 is further used to keep the target component corresponding to the target code segment unchanged if the first dependent code segment meets the preset update condition and the implementation relationship between the target code segment and the first dependent code segment does not meet the preset implementation condition.

[0103] Each module in the generating device of the above components can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0104] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the dependency relationship between the target code segment and the virtual dependent code segment. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a component generation method is implemented.

[0105] Those skilled in the art will understand that the structure shown in FIG. 6 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0106] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0107] Determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library;

[0108] Based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain a target component of the target code segment.

[0109] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0110] Determine, in a preset virtual declaration library, target declaration information that matches the declaration information of the first dependent code segment;

[0111] The target declaration information is determined to be a virtual dependent code segment of the first dependent code segment.

[0112] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0113] Compile the target component based on the preset compilation model to obtain the bytecode corresponding to the target component.

[0114] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0115] Based on the dependency relationship between the target component and the associated code segments of the target component, the bytecodes associated with the target component are integrated to obtain a target file;

[0116] The target file is loaded into the target execution environment and executed so as to parse the bytecode in the target file.

[0117] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0118] Obtaining the bytecode of the first dependent code segment and the bytecode of the second dependent code segment;

[0119] Based on the dependency relationship between the target component and the associated code segment of the target component, the bytecode corresponding to the target component, the bytecode of the first dependent code segment, and the bytecode of the second dependent code segment are integrated to obtain a target file.

[0120] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0121] If the first dependent code segment meets the preset update condition, and the implementation relationship between the target code segment and the first dependent code segment does not meet the preset implementation condition, the target component corresponding to the target code segment remains unchanged.

[0122] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0123] Determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library;

[0124] Based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain a target component of the target code segment.

[0125] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0126] Determine, in a preset virtual declaration library, target declaration information that matches the declaration information of the first dependent code segment;

[0127] The target declaration information is determined to be a virtual dependent code segment of the first dependent code segment.

[0128] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0129] Compile the target component based on the preset compilation model to obtain the bytecode corresponding to the target component.

[0130] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0131] Based on the dependency relationship between the target component and the associated code segments of the target component, the bytecodes associated with the target component are integrated to obtain a target file;

[0132] The target file is loaded into the target execution environment and executed so as to parse the bytecode in the target file.

[0133] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0134] Obtaining the bytecode of the first dependent code segment and the bytecode of the second dependent code segment;

[0135] Based on the dependency relationship between the target component and the associated code segment of the target component, the bytecode corresponding to the target component, the bytecode of the first dependent code segment, and the bytecode of the second dependent code segment are integrated to obtain a target file.

[0136] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0137] If the first dependent code segment meets the preset update condition, and the implementation relationship between the target code segment and the first dependent code segment does not meet the preset implementation condition, the target component corresponding to the target code segment remains unchanged.

[0138] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0139] Determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library;

[0140] Based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain a target component of the target code segment.

[0141] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0142] Determine, in a preset virtual declaration library, target declaration information that matches the declaration information of the first dependent code segment;

[0143] The target declaration information is determined to be a virtual dependent code segment of the first dependent code segment.

[0144] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0145] Compile the target component based on the preset compilation model to obtain the bytecode corresponding to the target component.

[0146] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0147] Based on the dependency relationship between the target component and the associated code segments of the target component, the bytecodes associated with the target component are integrated to obtain a target file;

[0148] The target file is loaded into the target execution environment and executed so as to parse the bytecode in the target file.

[0149] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0150] Obtaining the bytecode of the first dependent code segment and the bytecode of the second dependent code segment;

[0151] Based on the dependency relationship between the target component and the associated code segment of the target component, the bytecode corresponding to the target component, the bytecode of the first dependent code segment, and the bytecode of the second dependent code segment are integrated to obtain a target file.

[0152] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0153] If the first dependent code segment meets the preset update condition, and the implementation relationship between the target code segment and the first dependent code segment does not meet the preset implementation condition, the target component corresponding to the target code segment remains unchanged.

[0154] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0155] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0156] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for generating a component, characterized in that: The method comprises: Determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library; Based on the dependency relationship between the target code segment and the virtual dependent code segment, the target code segment is componentized to obtain a target component of the target code segment.

2. The method according to claim 1, characterized in that The preset virtual declaration library includes declaration information of the code segment, and the step of generating the virtual dependent code segment of the first dependent code segment based on the preset virtual declaration library includes: Determining, in the preset virtual declaration library, target declaration information matching the declaration information of the first dependent code segment; The target declaration information is determined to be a virtual dependent code segment of the first dependent code segment.

3. The method according to claim 1, characterized in that The method further comprises: The target component is compiled based on a preset compilation model to obtain a bytecode corresponding to the target component.

4. The method according to claim 3, characterized in that The method further comprises: Based on the dependency relationship between the target component and the code segment associated with the target component, the bytecode associated with the target component is integrated to obtain a target file; The target file is loaded into a target execution environment and executed so as to parse the bytecode in the target file.

5. The method according to claim 4, characterized in that The associated code segment of the target component includes the first dependent code segment and the second dependent code segment, the target code segment depends on the first dependent code segment, and the second dependent code segment depends on the target code segment, and based on the dependency relationship between the target component and the associated code segment of the target component, the bytecode associated with the target component is integrated to obtain a target file, including: Obtaining the bytecode of the first dependent code segment and the bytecode of the second dependent code segment; Based on the dependency relationship between the target component and the associated code segment of the target component, the bytecode corresponding to the target component, the bytecode of the first dependent code segment and the bytecode of the second dependent code segment are integrated to obtain a target file.

6. The method according to claim 1, characterized in that The method further comprises: If the first dependent code segment meets the preset update condition, and the implementation relationship between the target code segment and the first dependent code segment does not meet the preset implementation condition, the target component corresponding to the target code segment remains unchanged.

7. A component generation device, characterized in that: The device comprises: A determination module, configured to determine a target code segment and a first dependent code segment corresponding to the target code segment, and generate a virtual dependent code segment of the first dependent code segment based on a preset virtual declaration library; The componentization module is used to componentize the target code segment based on the dependency relationship between the target code segment and the virtual dependent code segment to obtain a target component of the target code segment.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.