Dynamic compiling environment matching generation method, device and system
By obtaining the target description file and compilation mapping table, dynamically generate the compilation environment, the inefficiency problem caused by the differences in the compilation environment of different platforms is solved, and an efficient compilation process and a simplified development process are achieved.
Patent Information
- Application Number
- CN202211725541.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-08-08
AI Technical Summary
The architecture and operating system differences of different computer devices lead to inefficient compilation environments that require developers to develop separately for different platforms.
By obtaining the target description file and the compilation mapping table, dynamically generate a matching compilation environment, including integrating the server to compile on the cloud platform, and using the target platform description file and the compilation map table to match or automatically generate the compilation method to realize the compilation of the file.
Simplifies the compilation process, improves compilation efficiency, facilitates developers to maintain, and reduces inconvenience caused by changes in the compilation environment.
Smart Images

Figure CN120447901A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software development, and in particular relates to a dynamic compilation environment matching generation method, device and system. Background Art
[0002] Because different computers have different architectures and operating systems, their internal word lengths, system environments, and function libraries vary, resulting in different compilation environments required for program compilation. This requires developers to develop separate scripts or code to generate different compilation environments for different platforms, which is inefficient. Summary of the Invention
[0003] In view of this, the present invention can dynamically generate the environment required for compilation, for example, generating different compilation environments required when compiling on different cloud devices. Specifically, a dynamic compilation environment matching generation method is provided, including the following steps:
[0004] P10, obtain the target description file, project file and compilation mapping table;
[0005] P20, matching and generating the corresponding compilation method, can match or automatically generate the compilation method according to the target platform description file and the compilation mapping table;
[0006] P30, compile the file to be compiled into the target file according to the corresponding compilation method.
[0007] Preferably, the data formats of the target platform description file include xml, json and yaml, and the content includes the operating system information, CPU information and library functions of the target platform.
[0008] Preferably, the compilation mapping table stores a matching mapping table between compilation related information and compilation methods, and the compilation method and compilation environment are determined by target platform description file information.
[0009] Preferably, when used for cloud platform compilation, it is executed by a cloud platform compilation device and can be integrated into the server and used in conjunction with the target platform description obtained from the client.
[0010] Preferably, when used for cloud platform compilation, the following steps are specifically included:
[0011] S10, the client sends the compilation instruction, the project file and the target platform description file;
[0012] S20, the server obtains the compilation mapping table and matches the corresponding compilation method according to the content described by the target platform;
[0013] S30, compiling the file to be compiled into a target file according to the compilation method;
[0014] S40, obtain the compiled target file and return it to the client.
[0015] Preferably, the S10 specifically includes the following steps:
[0016] S11, the user sets the target platform parameters according to needs, including the operating system type and CPU type;
[0017] S12, the client obtains the library function information required to compile the project file based on the project file content;
[0018] S13, the client integrates the acquired target platform parameters and library function information into a target platform description file;
[0019] S14, the client sends a compilation request, sending the project file to be compiled and the target platform description file.
[0020] Preferably, the step S20 specifically includes the following steps:
[0021] S21, the server obtains the project file and the target description file;
[0022] S22, the server loads a mapping table between target description file parameters and compilation methods;
[0023] S23: The server matches the compilation method according to the mapping table information.
[0024] Based on the above purpose, the present invention also provides a dynamic compilation environment matching generation device, which adopts the above dynamic compilation environment matching generation method, and the device includes:
[0025] An acquisition module is used to receive a compilation request, wherein the compilation request includes the project file and target description file to be compiled;
[0026] A matching module is used to match the corresponding compilation method according to the obtained target description file and project file;
[0027] Generation module, used to dynamically generate the final compilation environment according to the compilation method;
[0028] Compile module, used to compile project files and generate compilation results;
[0029] Send module and return compilation results to the client program.
[0030] Based on the above purpose, the present invention also provides a dynamic compilation environment matching generation system, which adopts the above dynamic compilation environment matching generation method, and the system includes: a client, a main server and a compilation server, wherein the main server and the client are in communication with each other, and the main server and the compilation server are in communication with each other;
[0031] The client is used to send a project compilation request to the server and obtain the compilation result; wherein the files sent when the project compilation request is sent include the project file to be compiled and the target platform description file;
[0032] The main server is used to receive compilation requests and related files, and assign compilation tasks to compilation servers;
[0033] The compilation server receives the target description file and the project file, and performs static matching or dynamic generation of a compilation method and a compilation environment according to relevant parameters, compiles in the final generated compilation environment, and returns the compilation result to the client.
[0034] Preferably, the statically matched compilation environment is a cloud platform compilation environment that already exists in the compilation server; and the dynamically generated compilation environment is a compilation environment dynamically generated according to compilation parameters.
[0035] Compared to the prior art, the present invention uses the acquired target platform description file to accurately match or dynamically generate the corresponding compilation environment. This simplifies the compilation process, making the compilation and build process for different platform devices simpler and easier to control, while also facilitating maintenance for developers. Through this invention, users can implement compilation for different platforms with simple configurations and parameters, significantly reducing the inconvenience caused by changes in the compilation environment and improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to make the purpose, technical solutions and beneficial effects of the present invention more clear, the present invention provides the following drawings for illustration:
[0037] Figure 1 This is a flowchart of the steps of the dynamic compilation environment matching generation method according to the first embodiment of the present invention;
[0038] Figure 2 This is a flowchart of the steps of the dynamic compilation environment matching generation method according to the second embodiment of the present invention;
[0039] Figure 3 This is a flow chart of step S10 of the dynamic compilation environment matching and generation method according to the second embodiment of the present invention;
[0040] Figure 4 This is a flow chart of step S20 of the dynamic compilation environment matching generation method according to the second embodiment of the present invention;
[0041] Figure 5 Schematic diagram of a module of a matching generation device of a dynamic compilation environment matching generation method according to a third embodiment of the present invention;
[0042] Figure 6A schematic diagram of a module of a matching generation system of a dynamic compilation environment matching generation method according to a fourth embodiment of the present invention;
[0043] Figure 7 A schematic diagram of the specific structure of a compiling server of a matching generation system of a dynamic compiling environment matching generation method according to a fourth embodiment of the present invention;
[0044] Figure 8 This is a flow chart of a dynamic compilation environment generation method of a matching generation system of a dynamic compilation environment matching generation method according to a fourth embodiment of the present invention. DETAILED DESCRIPTION
[0045] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0046] Example 1
[0047] This embodiment provides a dynamic compilation environment matching generation method, see Figure 1 These are the basic steps involved in the dynamic compilation environment matching generation method embodiment of this embodiment.
[0048] P10, obtain the target description file, project file and compilation mapping table.
[0049] In a specific embodiment, the target platform description file may be in a data format such as XML, JSON, or YAML, and may include compilation-related information such as the target platform's operating system information, CPU information, and library functions. A compilation mapping table stores a matching mapping table between compilation-related information and compilation methods, allowing the compilation method and compilation environment to be determined based on the target platform description file information.
[0050] P20, matching and generating the corresponding compilation method. According to the target platform description file and the compilation mapping table, the compilation method can be matched or automatically generated.
[0051] P30, compile the file to be compiled into the target file according to the corresponding compilation method.
[0052] Example 2
[0053] See also Figure 2 The present invention is applicable to cloud platform compilation. The method can be executed by a cloud platform compilation device and can be integrated into a server and used in conjunction with the target platform description obtained from the client. The method includes the following steps:
[0054] S10, the client sends compilation instructions, project files and target platform description files.
[0055] Figure 3 This is a detailed flow chart of S10 in this embodiment:
[0056] S11, the user sets the target platform parameters as needed, such as operating system type, CPU type, etc.;
[0057] S12, the client obtains the library function information required to compile the project file based on the project file content;
[0058] S13, the client integrates the acquired target platform parameters, library function information, etc. into a target platform description file;
[0059] S14, the client sends a compilation request, sending the project file to be compiled and the target platform description file.
[0060] S20: The server obtains a compilation mapping table and matches the corresponding compilation method according to the content described by the target platform.
[0061] Figure 4 This is a detailed flow chart of S20 in the first embodiment of the present invention:
[0062] S21, the server obtains the project file and the target description file;
[0063] S22, the server loads a mapping table between target description file parameters and compilation methods;
[0064] S23: The server matches the compilation method according to the mapping table information.
[0065] In this embodiment, the server is equipped with multiple compilation methods, which can be matched based on the compiled related information.
[0066] S30, compiling the file to be compiled into a target file according to the compilation method.
[0067] In this embodiment, the server is equipped with compilation resources of multiple mixed environment libraries, and the server matches the compilation environment that meets the requirements according to the target platform description file for compilation.
[0068] S40, obtain the compiled target file and return it to the client.
[0069] In the embodiment of the present invention, the server is primarily responsible for completing three tasks: (1) receiving compilation requests from the client and providing relevant feedback; (2) determining the compilation environment and compilation method based on the target platform description file and project file; and (3) performing compilation in the matching compilation environment using the matching compilation method.
[0070] Example 3
[0071] Figure 5 Schematic diagram of a dynamic compilation environment matching and generation device of the present invention, comprising:
[0072] An acquisition module is used to receive a compilation request, wherein the compilation request includes the project file and target description file to be compiled;
[0073] A matching module is used to match the corresponding compilation method according to the obtained target description file and project file;
[0074] Generation module, used to dynamically generate the final compilation environment according to the compilation method;
[0075] Compile module, used to compile project files and generate compilation results;
[0076] Send module and return compilation results to the client program.
[0077] Example 4
[0078] Figure 6 It is a structural diagram of a dynamic compilation environment matching and generation system provided by an embodiment of the present invention.
[0079] The structure includes a client, a main server and a compiling server; the main server is connected to the client, and the main server is connected to the compiling server.
[0080] The client is used to send project compilation requests to the server and obtain compilation results; the files sent when the project compilation request is sent include the project file to be compiled and the target platform description file.
[0081] The main server is used to receive compilation requests and related files and assign compilation tasks to compilation servers.
[0082] The compilation server receives the target description file and project file and, based on relevant parameters, either statically matches or dynamically generates a compilation method and compilation environment. The compiled code is compiled in the resulting compilation environment and the compilation result is returned to the client. A statically matched compilation environment can be a commonly used cloud platform compilation environment already present on the compilation server. A dynamically generated compilation environment can be one dynamically generated based on compilation parameters.
[0083] Figure 7 It is a schematic diagram of the specific structure of the compilation server in this embodiment.
[0084] The compilation server includes a cloud platform compilation device that can match existing common environment libraries and compilation methods, and can also dynamically create a new compilation environment in a new container as needed.
[0085] Figure 8 This is a method for generating a dynamic compilation environment provided in a compilation server according to a fourth embodiment of the present invention.
[0086] S310, generating the initial environment required for compilation;
[0087] S320, dynamically add the environment library required for compilation according to the mapping table between the target description file parameters and the required environment library to form the final compilation environment. In this embodiment, lightweight container technology is used to dynamically generate the environment library based on the mapping relationship;
[0088] S330, performing a compilation operation in the final compilation environment and returning a compilation result.
[0089] Accordingly, the dynamic compilation environment generation method can be applied to generate a compilation environment in all of the above embodiments.
[0090] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A dynamic compilation environment matching generation method, characterized in that: The following steps are involved: P10, obtain the target description file, project file and compilation mapping table; P20, matching and generating the corresponding compilation method, can match or automatically generate the compilation method according to the target platform description file and the compilation mapping table; P30, compile the file to be compiled into the target file according to the corresponding compilation method.
2. The dynamic compilation environment matching generation method according to claim 1, characterized in that: The data formats of the target platform description file include xml, json and yaml, and the content includes the operating system information, CPU information and library functions of the target platform.
3. The dynamic compilation environment matching generation method according to claim 1, characterized in that: The compilation mapping table stores a matching mapping table between compilation related information and compilation methods, and the compilation method and compilation environment are determined through target platform description file information.
4. The dynamic compilation environment matching generation method according to claim 1, characterized in that: When used for cloud platform compilation, it is executed by the cloud platform compilation device and can be integrated into the server and used in conjunction with the target platform description obtained from the client.
5. The dynamic compilation environment matching generation method according to claim 4, characterized in that: When used for cloud platform compilation, the specific steps include: S10, the client sends the compilation instruction, the project file and the target platform description file; S20, the server obtains the compilation mapping table and matches the corresponding compilation method according to the content described by the target platform; S30, compiling the file to be compiled into a target file according to the compilation method; S40, obtain the compiled target file and return it to the client.
6. The dynamic compilation environment matching generation method according to claim 5, characterized in that: The S10 specifically includes the following steps: S11, the user sets the target platform parameters according to needs, including the operating system type and CPU type; S12, the client obtains the library function information required to compile the project file based on the project file content; S13, the client integrates the acquired target platform parameters and library function information into a target platform description file; S14, the client sends a compilation request, sending the project file to be compiled and the target platform description file.
7. The dynamic compilation environment matching generation method according to claim 5, characterized in that: The S20 specifically includes the following steps: S21, the server obtains the project file and the target description file; S22, the server loads a mapping table between target description file parameters and compilation methods; S23: The server matches the compilation method according to the mapping table information.
8. A dynamic compilation environment matching generation device, characterized in that: The dynamic compilation environment matching generation method according to any one of claims 1 to 7 is adopted, and the device comprises: An acquisition module is used to receive a compilation request, wherein the compilation request includes the project file and target description file to be compiled; A matching module is used to match the corresponding compilation method according to the obtained target description file and project file; Generation module, used to dynamically generate the final compilation environment according to the compilation method; Compile module, used to compile project files and generate compilation results; Send module and return compilation results to the client program.
9. A dynamic compilation environment matching generation system, characterized in that: The method for matching and generating a dynamic compilation environment according to any one of claims 1 to 7 is adopted, wherein the system comprises: a client, a main server and a compilation server, wherein the main server and the client, and the main server and the compilation server are in communication connection with each other; The client is used to send a project compilation request to the server and obtain the compilation result; wherein the files sent when the project compilation request is sent include the project file to be compiled and the target platform description file; The main server is used to receive compilation requests and related files, and assign compilation tasks to compilation servers; The compilation server receives the target description file and the project file, and performs static matching or dynamic generation of a compilation method and a compilation environment according to relevant parameters, compiles in the final generated compilation environment, and returns the compilation result to the client.
10. The dynamic compilation environment matching generation system according to claim 9, characterized in that: The static matching compilation environment is a cloud platform compilation environment that already exists in the compilation server; the dynamically generated compilation environment is a compilation environment that is dynamically generated according to compilation parameters.