WO2024051290A1 - Code compiling method and apparatus, storage medium and electronic device - Google Patents

Code compiling method and apparatus, storage medium and electronic device Download PDF

Info

Publication number
WO2024051290A1
WO2024051290A1 PCT/CN2023/102751 CN2023102751W WO2024051290A1 WO 2024051290 A1 WO2024051290 A1 WO 2024051290A1 CN 2023102751 W CN2023102751 W CN 2023102751W WO 2024051290 A1 WO2024051290 A1 WO 2024051290A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
compilation
module
logic
file
Prior art date
Application number
PCT/CN2023/102751
Other languages
French (fr)
Chinese (zh)
Inventor
张超炯
Original Assignee
深圳Tcl新技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳Tcl新技术有限公司 filed Critical 深圳Tcl新技术有限公司
Publication of WO2024051290A1 publication Critical patent/WO2024051290A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Definitions

  • This application relates to the field of computer technology, and specifically to a code compilation method, device, storage medium and electronic equipment.
  • related setting operations are isolated from the compiler itself, and even more isolated from the compiler's compilation process. Moreover, it is difficult for related setting operations to implement adaptive settings for module dependencies. The overall accelerated compilation process has poor adaptability to project code, resulting in code Compilation reliability is poor, and the acceleration effect on code compilation is limited.
  • the embodiments of the present application provide a solution that can effectively improve the acceleration effect of code compilation and effectively improve the reliability of code compilation.
  • a code compilation method includes: injecting a compilation acceleration plug-in into a compiler, the compilation acceleration plug-in including change analysis logic and dependency modification logic; in response to the compiler executing a predetermined Compile process node, execute the change analysis logic to perform change analysis on the project code, and obtain the unchanged code module; modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into the Compile logic to obtain accelerated compilation logic; execute the accelerated compilation logic, and control only the changed code modules in the project code to be compiled in the compilation process by modifying the module dependencies of the unchanged code modules.
  • executing the change analysis logic to perform change analysis on the project code to obtain an unchanged code module includes: executing the change analysis logic, and comparing code file changes to the project code, Obtain the modified code file of the project code; search for the code module to which the modified file belongs according to the file path corresponding to the modified code file, and obtain the changed code module; search for the modified code module in the project code except for the changed code module other code modules to obtain the unchanged code modules.
  • executing the change analysis logic to perform change analysis on the project code to obtain unchanged code modules includes: executing the change analysis logic and recursively searching for each code module in the project code Download the modification time of the code file to obtain the current modification time of the code file under each code module; compare the current modification time of the code file under each code module with the historical modification time of the code file under each code module. , to obtain the unchanged code module.
  • the current modification time of the code file under each of the code modules is compared with the historical modification time of the code files under each of the code modules to obtain the unchanged code module
  • the method includes: performing information summary calculation on the current modification time of the code file under each code module to obtain the current summary corresponding to each code module; obtaining the historical summary corresponding to each code module, and the historical summary is It is obtained by calculating the information summary of the historical modification time of the code file under each code module; comparing the current summary and the historical summary corresponding to each code module, the unchanged code module is obtained.
  • the dependency modification logic includes module dependency graph analysis logic and dependency modification logic; the execution of the accelerated compilation logic controls the compilation process by modifying the module dependencies of the unchanged code modules.
  • Compiling only the changed code modules in the project code includes: executing the module dependency graph analysis logic in the accelerated compilation logic, performing dependency analysis on the code modules in the project code, and obtaining a module dependency graph; Execute the dependency modification logic in the accelerated compilation logic, modify the unchanged code module in the module dependency graph to the corresponding compiled file, and obtain the modified dependency graph; execute the accelerated compilation logic
  • the compilation logic is used to compile code according to the modified dependency graph, so as to compile only the changed code modules in the project code.
  • the compilation acceleration plug-in also includes a local warehouse; the dependency modification logic in the acceleration compilation logic is executed, and the unchanged code in the module dependency graph is Modifying the module into the corresponding compiled file and obtaining the modified dependency graph includes: executing the dependency modification logic in the accelerated compilation logic, and querying the compiled file corresponding to the unchanged code module from the local warehouse; Modify the changed code module in the module dependency graph into the compiled file to obtain a modified dependency graph.
  • the The method also includes: if the compilation of the modified code module is completed, packaging the compiled modified code module into a modified code module compiled file through the compilation acceleration plug-in; and storing the modified code module compiled file in the compiled file. Accelerate local repository in plugin.
  • a code compilation device includes: an injection unit for injecting a compilation acceleration plug-in into a compiler, where the compilation acceleration plug-in includes change analysis logic and dependency modification logic; an analysis unit for responding Execute to the predetermined compilation process node in the compiler, execute the change analysis logic to perform change analysis on the project code, and obtain the unchanged code module; the modification unit is used to compile the compiler through the compilation acceleration plug-in The logic is modified, and the dependency modification logic is dynamically injected into the compilation logic to obtain accelerated compilation logic; the compilation unit is used to execute the accelerated compilation logic and control the compilation process by modifying the module dependencies of the unchanged code modules. Only the changed code modules in the project code will be compiled.
  • the analysis unit is used to: execute the change analysis logic, perform code file change comparison on the project code, and obtain a modified code file of the project code; according to the modified code Find the file path corresponding to the file, search for the code module to which the modified file belongs, and obtain the changed code module; search for code modules in the project code other than the changed code module, and obtain the unchanged code module.
  • the analysis unit is used to: execute the change analysis logic, recursively search the modification time of the code files under each code module in the project code, and obtain the code files under each code module.
  • the current modification time of the code file under each code module is compared with the historical modification time of the code file under each code module to obtain the unchanged code module.
  • the analysis unit is used to: perform information summary calculation on the current modification time of the code file under each of the code modules to obtain the current summary corresponding to each of the code modules; obtain each A historical summary corresponding to each of the code modules.
  • the historical summary is obtained by calculating the information summary of the historical modification time of the code file under each of the code modules; compare the current summary and the historical summary corresponding to each of the code modules. , to obtain the unchanged code module.
  • the dependency modification logic includes module dependency graph analysis logic and dependency relationship modification logic; the compilation unit is used to: execute the module dependency graph analysis logic in the accelerated compilation logic, Perform dependency analysis on the code modules in the project code to obtain a module dependency graph; execute the dependency modification logic in the accelerated compilation logic to modify the unchanged code modules in the module dependency graph to the corresponding compiled files to obtain a modified dependency graph; execute the compilation logic in the accelerated compilation logic, and perform code compilation according to the modified dependency graph to compile only the changed code modules in the project code.
  • the compilation acceleration plug-in also includes a local warehouse; the compilation unit is used to: execute the dependency modification logic in the accelerated compilation logic, and query all the dependencies from the local warehouse.
  • the compiled file corresponding to the unchanged code module is modified; the changed code module in the module dependency graph is modified into the compiled file to obtain a modified dependency graph.
  • the device further includes a packaging unit, configured to: if the compilation of the modified code module is completed, package the compiled modified code module into a modified code module through the compilation acceleration plug-in. File; store the modified code module compiled file into the local warehouse in the compilation acceleration plug-in.
  • a storage medium has a computer program stored thereon.
  • the computer program is executed by a processor of a computer, the computer is caused to execute the method described in the embodiment of the present application.
  • an electronic device may include: a memory storing a computer program; and a processor reading the computer program stored in the memory to execute the method described in the embodiment of the present application.
  • a computer program product or computer program includes computer instructions stored in a computer-readable storage medium.
  • the processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementations described in the embodiments of this application.
  • a compilation acceleration plug-in is injected into the compiler, and the compilation acceleration plug-in includes change analysis logic and dependency modification logic; in response to the execution of the predetermined compilation process node in the compiler, the change analysis logic pair is executed Conduct change analysis on the project code to obtain the unchanged code module; modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into the compilation logic to obtain accelerated compilation logic; execute the above
  • the compilation process is controlled to only compile the changed code modules in the project code.
  • the acceleration logic is injected into the compiler as a plug-in, so that the acceleration logic cooperates with the compiler, and the compiler can use the change analysis logic to modify the project code.
  • the compilation acceleration plug-in can modify the compilation logic of the compiler, dynamically inject the dependency modification logic into the compilation logic, and obtain the accelerated compilation logic of deep collaborative acceleration logic and compilation logic.
  • the project code can be modified.
  • Module dependencies are adaptively modified to accelerate the compilation process, and the overall compilation process is adapted to the project code. It has high adaptability, which can effectively improve the acceleration effect of code compilation and effectively improve the reliability of code compilation.
  • Figure 1 shows a flow chart of a code compilation method according to an embodiment of the present application.
  • Figure 2 shows the module structure diagram of the compilation acceleration plug-in in one scenario.
  • Figure 3 shows a flow chart of code compilation using an embodiment of the present application in one scenario.
  • Figure 4 shows a block diagram of a code compilation device according to an embodiment of the present application.
  • Figure 5 shows a block diagram of an electronic device according to one embodiment of the present application.
  • Figure 1 schematically shows a flow chart of a code compilation method according to an embodiment of the present application.
  • the execution subject of the code compilation method can be any device, for example, terminals such as computers, mobile phones, smart watches, and home appliances, or servers such as server clusters and cloud servers.
  • the code compilation method may include steps S110 to S140.
  • Step S110 inject the compilation acceleration plug-in into the compiler.
  • the compilation acceleration plug-in includes change analysis logic and dependency modification logic;
  • Step S120 in response to the execution of the predetermined compilation process node in the compiler, execute the change analysis logic pair Perform change analysis on the project code to obtain the unchanged code module;
  • step S130 modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into the compilation logic to obtain accelerated compilation logic;
  • Step S140 Execute the accelerated compilation logic, and control only the changed code modules in the project code to be compiled in the compilation process by modifying the module dependencies of the unchanged code modules.
  • the compilation acceleration plug-in is a plug-in that contains acceleration logic to accelerate the compilation process.
  • the acceleration logic can include change analysis logic and dependency modification logic.
  • Change analysis logic can be code that analyzes changes in code modules in the project code.
  • the dependency modification logic can be analyzing the module dependencies of the code module and modifying the code of the module dependencies.
  • the compilation acceleration plug-in can be injected into the compiler in the form of plug-in injection.
  • the compiler is a tool used to compile the project code.
  • the compiler can be the Gradle tool.
  • the user can trigger the compiler to start the compilation process. After the compilation process is started, it will be executed to the predetermined compilation process node (for example, after the compilation process is started, the initialization phase will be carried out first, and then the configuration phase will be carried out (this phase can traverse the scripts of each code module to establish tasks). Execution relationship diagram), the completion of the configuration phase is regarded as execution to the scheduled compilation process node), the compiler can trigger the execution of the change analysis logic in the compilation acceleration plug-in, the change analysis logic can perform change analysis on the project code, and obtain the unchanged code module. Unchanged code modules may be code modules in the project code that have not been modified within a predetermined period of time.
  • the compilation logic of the compiler (that is, the code of the compiler itself) can be reflected or callback (HOOK) to modify the compilation logic, thereby dynamically injecting the dependency modification logic into the compilation logic, and injecting the compilation of the dependency modification logic.
  • the logic can be accelerated compilation logic.
  • Execute accelerated compilation logic that is, the module dependencies of unchanged code modules can be reliably modified through the injected dependency modification logic to control the compilation logic to only modify the changed code modules in the project code during the compilation process.
  • Line compilation that is, skipping the compilation of unchanged code modules and only compiling the changed code modules, thereby adaptively speeding up the compilation of the project code.
  • the acceleration logic is injected into the compiler as a plug-in, so that the acceleration logic cooperates with the compiler, and the compiler can Implement automatic change analysis on the project code through change analysis logic.
  • the compilation acceleration plug-in can modify the compilation logic of the compiler, dynamically inject the dependency modification logic into the compilation logic, and obtain the accelerated compilation logic of deep collaborative acceleration logic and compilation logic.
  • the compilation logic can adaptively modify the module dependencies in the project code, thereby accelerating the compilation process.
  • the overall accelerated compilation process is highly adaptable to the project code, which can effectively improve the acceleration effect of code compilation and effectively improve the reliability of code compilation.
  • step S120 the execution of the change analysis logic performs change analysis on the project code to obtain an unchanged code module, including:
  • Execute the change analysis logic compare the code file changes of the project code, and obtain the modified code file of the project code; according to the file path corresponding to the modified code file, search for the code module to which the modified file is subordinate, and obtain The changed code module; search for code modules other than the changed code module in the project code to obtain the unchanged code module.
  • the change analysis logic can efficiently and accurately analyze the changed code modules and unchanged code modules by comparing the code file changes of the project code and searching under the file path.
  • the change analysis logic can include the git diff command line. Executing the git diff command line can compare the current project code with the scheduled version of the project code, obtain the modified code files in the current project code, and obtain the modified code. File list of files. After the modified code file is determined, the path search command line in the change analysis logic can be used to find the code module to which each modified code file is dependent, and the code module to which the modified code file is dependent can be found based on the file path (path) corresponding to each modified code file.
  • the code module is the changed code module that has been modified. Furthermore, the code modules in the project code other than the changed code module can be determined as the unchanged code module.
  • step S120 the execution of the change analysis logic performs change analysis on the project code to obtain an unchanged code module, including:
  • Execute the change analysis logic recursively search the modification time of the code file under each code module in the project code, and obtain the current modification time of the code file under each code module; add the current modification time of the code file under each code module The modification time is compared with the historical modification time of the code file under each code module to obtain the unchanged code module.
  • the change analysis logic recursively searches the modification time of the code file under each code module and compares it.
  • the changed code module and the unchanged code module can be quickly analyzed.
  • the modification time can be recorded accordingly.
  • the change analysis logic can recursively search the modification time of the code file under each code module in the project code to obtain the current modification time of the code file under each code module. Furthermore, the change analysis logic can compare the current modification time of the code file under each code module with the historical modification time of the code file under each code module. If the current modification time under a certain code module is inconsistent with the historical modification time, the A certain code module is a changed code module, and the code modules in the project code other than the changed code modules can be determined as unchanged code modules.
  • the historical modification time can be the modification time of each code file recorded in a certain historical version of the project code.
  • the current modification time of the code file under each of the code modules is compared with the historical modification time of the code files under each of the code modules to obtain the unchanged code module, include:
  • the historical modification time of the code files under each of the code modules is obtained by calculating the information summary; comparing the current summary and the historical summary corresponding to each of the code modules, the unchanged code module is obtained.
  • the historical summary A2 is the code file under each code module. It is obtained by calculating the information summary of the historical modification time; compare the current summary A1 and the historical summary A2 corresponding to the A code module. If the current summary A1 and the historical summary A2 are consistent, the A code module is an unchanged code module. In this way, the efficiency of recursively searching and comparing the modification times of code files under each code module can be further improved.
  • the dependency modification logic includes module dependency graph analysis logic and dependency relationship modification logic; in step S140, the execution of the accelerated compilation logic controls compilation by modifying the module dependencies of the unchanged code modules. During the process, only the changed code modules in the project code are compiled, including:
  • Dependency modification logic includes module dependency graph analysis logic and dependency modification logic. Dependency modification logic is injected into compilation logic to obtain accelerated compilation logic. Furthermore, accelerated compilation logic can include collaborative module dependency graph analysis logic, dependency modification logic and compilation logic.
  • the module dependency graph analysis logic can be code that analyzes the dependencies between code modules.
  • the module dependency graph analysis logic in the accelerated compilation logic can be executed to perform dependency analysis on all code modules in the project code and analyze the dependencies between code modules. Calling relationships (i.e., dependencies), and obtaining a module dependency graph describing the calling relationships (i.e., dependencies) between code modules.
  • the dependency modification logic can be the code that modifies the dependencies in the module dependency graph.
  • the dependency modification logic in the accelerated compilation logic can be executed.
  • the unchanged code module in the module dependency graph can be modified into the corresponding compiled file to obtain the modified dependencies.
  • the compiled file may be an AAR file corresponding to the unchanged code module.
  • the compilation logic in the accelerated compilation logic is executed and the code is compiled according to the modified dependency graph, the compilation of the compiled files can be automatically skipped, so that only the changed code modules in the project code are compiled.
  • the compilation acceleration plug-in further includes a local warehouse; the execution of the dependency modification logic in the acceleration compilation logic modifies the changed code module in the module dependency graph to the corresponding Compiled files, get the modified dependency graph, including:
  • Execute the dependency modification logic in the accelerated compilation logic query the compiled file corresponding to the changed code module from the local warehouse; modify the changed code module in the module dependency graph to the changed code module Compile the file and get the modified dependency graph.
  • the compilation acceleration plug-in also includes a local warehouse, and the local warehouse that stores compiled files will also be injected into the compiler.
  • the dependency modification logic in the accelerated compilation logic is executed.
  • the compiled files corresponding to the changed code modules will be queried from the local warehouse injected into the compiler to make modifications. In this way, the stability and efficiency of accelerated compilation are further improved.
  • the accelerated compilation logic is executed and the module dependencies of the unchanged code modules are modified to control only the changed code modules in the project code to be compiled in the compilation process
  • the above methods also include:
  • the compiled modified code module is packaged into a modified code module compiled file through the compilation acceleration plug-in; and the modified code module compiled file is stored in a local location in the compiled acceleration plug-in. storehouse.
  • the compiler further uses the compilation acceleration plug-in to package the compiled change code module into a change code module compilation file.
  • the change code module compilation file is the AAR file corresponding to the change code module. , and then store the changed code module compiled files to the local warehouse in the compilation acceleration plug-in, which can be used as needed during subsequent compilation.
  • Figure 2 shows the module architecture diagram of the compilation acceleration plug-in in this scenario.
  • Figure 3 shows the flow chart of code compilation in this scenario.
  • the compilation acceleration plug-in at least includes engineering change awareness code, module dependency graph analysis code, dependency modification algorithm and local storage warehouse.
  • the engineering change awareness code is the change analysis logic
  • the module dependency graph analysis code is The module dependency graph analysis logic
  • the dependency modification algorithm is the dependency modification logic
  • the local storage warehouse is the local warehouse.
  • the code compilation process may include steps S210 to S2110.
  • Step S210 inject code.
  • a compilation acceleration plug-in is injected into the compiler.
  • the compilation acceleration plug-in includes change analysis logic, dependency modification logic, and a local warehouse.
  • the dependency modification logic includes module dependency graph analysis logic and dependency modification logic.
  • step S220 the developer clicks to start compilation, that is, the developer clicks on the compiler to trigger compilation.
  • Step S230 Obtain which module has not been changed. Specifically, in response to the execution of the predetermined compilation process node in the compiler, the change analysis logic is executed to perform change analysis on the project code, and an unchanged code module is obtained.
  • Executing the change analysis logic to perform change analysis on the project code to obtain an unchanged code module may include: executing the change analysis logic, comparing code file changes to the project code, and obtaining a modified code file of the project code; According to the file path corresponding to the modified code file, search for the code module to which the modified file is subordinate to obtain the changed code module; search for code modules other than the changed code module in the project code to obtain the unchanged code module. Change code modules.
  • executing the change analysis logic to perform change analysis on the project code to obtain unchanged code modules may include: executing the change analysis logic, recursively searching for the modification time of the code file under each code module in the project code, and obtaining The current modification time of the code file under each code module; compare the current modification time of the code file under each code module with the historical modification time of the code file under each code module to obtain the unchanged code module .
  • Comparing the current modification time of the code file under each code module with the historical modification time of the code file under each code module to obtain the unchanged code module may include: Calculate the information summary of the current modification time of the code file to obtain the current summary corresponding to each code module; obtain the historical summary corresponding to each code module, and the historical summary is the code file under each code module It is obtained by calculating the information summary of the historical modification time; compare the current summary corresponding to each code module with Historical summary, resulting in the unchanged code module.
  • Step S240 return the module list, that is, the module list of unchanged code modules obtained by the change analysis logic analysis is returned to the compilation acceleration plug-in.
  • the compilation logic of the compiler is modified through the compilation acceleration plug-in, and the dependency modification logic is dynamically injected into the compilation logic to obtain accelerated compilation logic.
  • step S250 the unchanged modules are fed to the modification algorithm, that is, the compilation acceleration plug-in feeds the module list of the unchanged code modules to the dependency modification logic.
  • Step S260 Obtain the dependency graph and return the dependency graph. Specifically, the module dependency graph analysis logic in the accelerated compilation logic is executed, dependency analysis is performed on the code modules in the project code, the module dependency graph is obtained, and the module dependency graph is given to the dependency modification logic.
  • Step S270 Obtain the AAR corresponding to the unchanged module and return the AAR. Specifically, the dependency modification logic in the accelerated compilation logic is executed, and the compiled files corresponding to the unchanged code modules (i.e., AAR files) are queried from the local warehouse.
  • the unchanged code modules i.e., AAR files
  • Step S280 Modify the dependencies of the entire project. Specifically, the dependency modification logic modifies the changed code module in the module dependency graph into a compiled file to obtain a modified dependency graph.
  • step S280 the dependency modification logic in the accelerated compilation logic is executed, and the unchanged code modules in the module dependency graph are modified into corresponding compiled files to obtain a modified dependency graph.
  • Step S290 After the modification is completed, compilation continues. Specifically, after obtaining the modified dependency graph, the compilation logic in the accelerated compilation logic is executed, and code compilation is performed according to the modified dependency graph, so that only the changed code modules in the project code are compiled.
  • step S260 the accelerated compilation logic is executed, and by modifying the module dependencies of the unchanged code modules, the compilation process is controlled to compile only the changed code modules in the project code.
  • Step S2100 Compilation is completed, that is, compilation of the changed code modules in the project code is completed.
  • Step S2110 After compilation is completed, the modified module is packaged into AAR. Specifically, if the compilation of the modified code module is completed, the compiled modified code module is packaged into a modified code module compilation file (ie, an AAR file) through the compilation acceleration plug-in.
  • a modified code module compilation file ie, an AAR file
  • Step S2120 Update the local warehouse for next compilation and use. Specifically, the changed code module compilation file is stored in a local warehouse in the compilation acceleration plug-in.
  • the overall accelerated compilation process has high adaptability to the project code, can effectively improve the acceleration effect of code compilation, and effectively improves the reliability of code compilation. .
  • the embodiment of the present application also provides a code compilation device based on the above code compilation method.
  • the meanings of the nouns are the same as in the above code compilation method.
  • Figure 3 shows a block diagram of a code compilation device according to an embodiment of the present application.
  • the code compilation device 300 may include an injection unit 310 , an analysis unit 320 , a modification unit 330 , and a compilation unit 340 .
  • the injection unit 310 can be used to inject the compilation acceleration plug-in into the compiler, the compilation acceleration plug-in includes change analysis logic and dependency modification logic; the analysis unit 320 can be used to respond to the execution of the predetermined compilation process node in the compiler, execute The change analysis logic performs change analysis on the project code to obtain an unchanged code module; the modification unit 330 can be used to modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into all The compilation logic is described above to obtain accelerated compilation logic; the compilation unit 340 can be used to execute the accelerated compilation logic by modifying the unchanged code. Module dependencies of code modules control the compilation process of only changed code modules in the project code.
  • the analysis unit is used to: execute the change analysis logic, perform code file change comparison on the project code, and obtain a modified code file of the project code; according to the modified code Find the file path corresponding to the file, search for the code module to which the modified file belongs, and obtain the changed code module; search for code modules in the project code other than the changed code module, and obtain the unchanged code module.
  • the analysis unit is used to: execute the change analysis logic, recursively search the modification time of the code files under each code module in the project code, and obtain the code files under each code module.
  • the current modification time of the code file under each code module is compared with the historical modification time of the code file under each code module to obtain the unchanged code module.
  • the analysis unit is used to: perform information summary calculation on the current modification time of the code file under each of the code modules to obtain the current summary corresponding to each of the code modules; obtain each A historical summary corresponding to each of the code modules.
  • the historical summary is obtained by calculating the information summary of the historical modification time of the code file under each of the code modules; compare the current summary and the historical summary corresponding to each of the code modules. , to obtain the unchanged code module.
  • the dependency modification logic includes module dependency graph analysis logic and dependency relationship modification logic; the compilation unit is used to: execute the module dependency graph analysis logic in the accelerated compilation logic, Perform dependency analysis on the code modules in the project code to obtain a module dependency graph; execute the dependency modification logic in the accelerated compilation logic to modify the unchanged code modules in the module dependency graph to the corresponding compiled files to obtain a modified dependency graph; execute the compilation logic in the accelerated compilation logic, and perform code compilation according to the modified dependency graph to compile only the changed code modules in the project code.
  • the compilation acceleration plug-in also includes a local warehouse; the compilation unit is used to: execute the dependency modification logic in the accelerated compilation logic, and query all the dependencies from the local warehouse.
  • the compiled file corresponding to the unchanged code module is modified; the changed code module in the module dependency graph is modified into the compiled file to obtain a modified dependency graph.
  • the device further includes a packaging unit, configured to: if the compilation of the modified code module is completed, package the compiled modified code module into a modified code module through the compilation acceleration plug-in. File; store the modified code module compiled file into the local warehouse in the compilation acceleration plug-in.
  • embodiments of the present application also provide an electronic device, which may be a terminal or a server, as shown in Figure 5, which shows a schematic structural diagram of the electronic device involved in the embodiment of the present application. Specifically:
  • the electronic device may include components such as a processor 401 of one or more processing cores, a memory 402 of one or more computer-readable storage media, a power supply 403, and an input unit 404.
  • a processor 401 of one or more processing cores a memory 402 of one or more computer-readable storage media
  • a power supply 403 a power supply 403
  • an input unit 404 an input unit 404.
  • the processor 401 is the control center of the electronic device, using various interfaces and lines to connect various parts of the entire computer device, by running or executing software programs and/or modules stored in the memory 402, and calling programs stored in the memory 402. Data, perform various functions of computer equipment and process data to provide overall monitoring of electronic equipment.
  • the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, where the application processor mainly processes operating systems, user pages, application programs, etc. , the modem processor mainly handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor 401.
  • the memory 402 can be used to store software programs and modules.
  • the processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402 .
  • the memory 402 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the storage data area may store data based on Data created by the use of computer equipment, etc.
  • memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402 .
  • the electronic device also includes a power supply 403 that supplies power to various components.
  • the power supply 403 can be logically connected to the processor 401 through a power management system, so that functions such as charging, discharging, and power consumption management can be implemented through the power management system.
  • the power supply 403 may also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
  • the electronic device may also include an input unit 404 that may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
  • an input unit 404 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
  • the electronic device may also include a display unit and the like, which will not be described again here.
  • the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more computer programs into the memory 402 according to the following instructions, and the processor 401 will run the executable files stored in the computer program.
  • the computer program in the memory 402 can realize various functions in the aforementioned embodiments of the present application.
  • the processor 401 can perform the following steps:
  • the compilation acceleration plug-in includes change analysis logic and dependency modification logic; in response to the execution of the compiler to a predetermined compilation process node, execute the change analysis logic to perform change analysis on the project code, Obtain the unchanged code module; modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into the compilation logic to obtain the accelerated compilation logic; execute the accelerated compilation logic, and through the modification
  • the module dependencies of the unchanged code modules control the compilation process of only the changed code modules in the project code.
  • executing the change analysis logic to perform change analysis on the project code to obtain an unchanged code module includes: executing the change analysis logic, and comparing code file changes to the project code, Obtain the modified code file of the project code; search for the code module to which the modified file belongs according to the file path corresponding to the modified code file, and obtain the changed code module; search for the modified code module in the project code except for the changed code module other code modules to obtain the unchanged code module.
  • executing the change analysis logic to perform change analysis on the project code to obtain unchanged code modules includes: executing the change analysis logic and recursively searching for each code module in the project code Download the modification time of the code file to obtain the current modification time of the code file under each code module; compare the current modification time of the code file under each code module with each code module The historical modification time of the code files under the block is compared to obtain the unchanged code module.
  • the current modification time of the code file under each of the code modules is compared with the historical modification time of the code files under each of the code modules to obtain the unchanged code module
  • the method includes: performing information summary calculation on the current modification time of the code file under each code module to obtain the current summary corresponding to each code module; obtaining the historical summary corresponding to each code module, and the historical summary is It is obtained by calculating the information summary of the historical modification time of the code file under each code module; comparing the current summary and the historical summary corresponding to each code module, the unchanged code module is obtained.
  • the dependency modification logic includes module dependency graph analysis logic and dependency modification logic; the execution of the accelerated compilation logic controls the compilation process by modifying the module dependencies of the unchanged code modules.
  • Compiling only the changed code modules in the project code includes: executing the module dependency graph analysis logic in the accelerated compilation logic, performing dependency analysis on the code modules in the project code, and obtaining a module dependency graph; Execute the dependency modification logic in the accelerated compilation logic, modify the unchanged code module in the module dependency graph to the corresponding compiled file, and obtain the modified dependency graph; execute the accelerated compilation logic
  • the compilation logic is used to compile code according to the modified dependency graph, so as to compile only the changed code modules in the project code.
  • the compilation acceleration plug-in also includes a local warehouse; the execution of the dependency modification logic in the accelerated compilation logic converts the unchanged code in the module dependency graph Modifying the module into the corresponding compiled file and obtaining the modified dependency graph includes: executing the dependency modification logic in the accelerated compilation logic, and querying the compiled file corresponding to the unchanged code module from the local warehouse; Modify the changed code module in the module dependency graph into the compiled file to obtain a modified dependency graph.
  • the method may include: if the compilation of the modified code module is completed, packaging the compiled modified code module into a modified code module compiled file through the compilation acceleration plug-in; and storing the modified code module compiled file in the compilation acceleration plug-in local repository in .
  • embodiments of the present application also provide a storage medium in which a computer program is stored, and the computer program can be loaded by the processor to execute steps in any method provided by the embodiments of the present application.
  • the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.
  • ROM read-only memory
  • RAM random access memory
  • magnetic disk or optical disk etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The present application relates to the technical field of computers. Disclosed are a code compiling method and apparatus, a storage medium and an electronic device. The method comprises: injecting a compilation accelerating plugin into a compiler, and carrying out change analysis to obtain an unchanged code module; obtaining accelerated compilation logic by means of the compilation accelerating plugin; and executing the accelerated compilation logic, and by means of modifying module dependency, controlling to only compile a changed code module. The present application improves the code compilation accelerating effect and compiling reliability.

Description

代码编译方法、装置、存储介质及电子设备Code compilation method, device, storage medium and electronic equipment
本申请要求于2022年09月09日提交中国专利局、申请号为202211102504.5、申请名称为“代码编译方法、装置、存储介质及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on September 9, 2022, with the application number 202211102504.5 and the application name "Code Compilation Method, Device, Storage Medium and Electronic Equipment", the entire content of which is incorporated by reference. in this application.
技术领域Technical field
本申请涉及计算机技术领域,具体涉及一种代码编译方法、装置、存储介质及电子设备。This application relates to the field of computer technology, and specifically to a code compilation method, device, storage medium and electronic equipment.
背景技术Background technique
在各类应用项目(例如Android应用项目)的项目代码的体量越来越大的情况下,编译器(例如Gradle编译器)的编译速度也随着增长,有时项目代码的一个修改需要等待长达好几分钟的编译时间。As the size of the project code of various application projects (such as Android application projects) becomes larger and larger, the compilation speed of the compiler (such as the Gradle compiler) also increases. Sometimes a modification of the project code needs to wait for a long time. It takes several minutes to compile.
目前,相关技术中,存在预先对项目代码的模块依赖进行相关设置后,由编译器进行编译来加速编译的方案。Currently, in the related technology, there is a solution to accelerate the compilation by setting the module dependencies of the project code in advance and then having the compiler perform the compilation.
技术问题technical problem
相关技术中,相关设置操作与编译器本身孤立,更与编译器的编译流程孤立,且相关设置操作难以对模块依赖实现自适应设置,整体加速编译流程对项目代码的适应性较差,导致代码编译可靠性较差,对代码编译的加速效果有限。In related technologies, related setting operations are isolated from the compiler itself, and even more isolated from the compiler's compilation process. Moreover, it is difficult for related setting operations to implement adaptive settings for module dependencies. The overall accelerated compilation process has poor adaptability to project code, resulting in code Compilation reliability is poor, and the acceleration effect on code compilation is limited.
技术解决方案Technical solutions
本申请实施例提供一种方案,可以有效提升代码编译的加速效果且有效提升代码编译可靠性。The embodiments of the present application provide a solution that can effectively improve the acceleration effect of code compilation and effectively improve the reliability of code compilation.
本申请实施例提供以下技术方案:The embodiments of this application provide the following technical solutions:
根据本申请的一个实施例,一种代码编译方法,其包括:将编译加速插件注入编译器,所述编译加速插件中包括变动分析逻辑以及依赖修改逻辑;响应于所述编译器中执行至预定编译流程节点,执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块;通过所述编译加速插件对所述编译器的编译逻辑进行修改,将所述依赖修改逻辑动态注入所述编译逻辑,得到加速编译逻辑;执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译。According to one embodiment of the present application, a code compilation method includes: injecting a compilation acceleration plug-in into a compiler, the compilation acceleration plug-in including change analysis logic and dependency modification logic; in response to the compiler executing a predetermined Compile process node, execute the change analysis logic to perform change analysis on the project code, and obtain the unchanged code module; modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into the Compile logic to obtain accelerated compilation logic; execute the accelerated compilation logic, and control only the changed code modules in the project code to be compiled in the compilation process by modifying the module dependencies of the unchanged code modules.
在本申请的一些实施例中,所述执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,包括:执行所述变动分析逻辑,对所述项目代码进行代码文件变更对比,得到所述项目代码的修改代码文件;根据所述修改代码文件对应的文件路径,查找所述修改文件从属的代码模块,得到所述变动代码模块;查找所述项目代码中除所述变动代码模块之外的代码模块,得到所述未变动代码模块。In some embodiments of the present application, executing the change analysis logic to perform change analysis on the project code to obtain an unchanged code module includes: executing the change analysis logic, and comparing code file changes to the project code, Obtain the modified code file of the project code; search for the code module to which the modified file belongs according to the file path corresponding to the modified code file, and obtain the changed code module; search for the modified code module in the project code except for the changed code module other code modules to obtain the unchanged code modules.
在本申请的一些实施例中,所述执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,包括:执行所述变动分析逻辑,递归搜索所述项目代码中每个代码模块下代码文件的修改时间,得到每个代码模块下代码文件的当前修改时间;将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块。 In some embodiments of the present application, executing the change analysis logic to perform change analysis on the project code to obtain unchanged code modules includes: executing the change analysis logic and recursively searching for each code module in the project code Download the modification time of the code file to obtain the current modification time of the code file under each code module; compare the current modification time of the code file under each code module with the historical modification time of the code file under each code module. , to obtain the unchanged code module.
在本申请的一些实施例中,所述将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块,包括:将每个所述代码模块下代码文件的当前修改时间进行信息摘要计算,得到每个所述代码模块对应的当前摘要;获取每个所述代码模块对应的历史摘要,所述历史摘要为对每个所述代码模块下代码文件的历史修改时间进行信息摘要计算得到的;比较每个所述代码模块对应的当前摘要与历史摘要,得到所述未变动代码模块。In some embodiments of the present application, the current modification time of the code file under each of the code modules is compared with the historical modification time of the code files under each of the code modules to obtain the unchanged code module, The method includes: performing information summary calculation on the current modification time of the code file under each code module to obtain the current summary corresponding to each code module; obtaining the historical summary corresponding to each code module, and the historical summary is It is obtained by calculating the information summary of the historical modification time of the code file under each code module; comparing the current summary and the historical summary corresponding to each code module, the unchanged code module is obtained.
在本申请的一些实施例中,所述依赖修改逻辑包括模块依赖图分析逻辑以及依赖关系修改逻辑;所述执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译,包括:执行所述加速编译逻辑中的所述模块依赖图分析逻辑,对所述项目代码中的代码模块进行依赖分析,得到模块依赖图;执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图;执行所述加速编译逻辑中的所述编译逻辑,根据所述修改后依赖图进行代码编译,以仅对所述项目代码中的变动代码模块进行编译。In some embodiments of the present application, the dependency modification logic includes module dependency graph analysis logic and dependency modification logic; the execution of the accelerated compilation logic controls the compilation process by modifying the module dependencies of the unchanged code modules. Compiling only the changed code modules in the project code includes: executing the module dependency graph analysis logic in the accelerated compilation logic, performing dependency analysis on the code modules in the project code, and obtaining a module dependency graph; Execute the dependency modification logic in the accelerated compilation logic, modify the unchanged code module in the module dependency graph to the corresponding compiled file, and obtain the modified dependency graph; execute the accelerated compilation logic The compilation logic is used to compile code according to the modified dependency graph, so as to compile only the changed code modules in the project code.
在本申请的一些实施例中,所述编译加速插件中还包括本地仓库;所述执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图,包括:执行所述加速编译逻辑中的所述依赖关系修改逻辑,从所述本地仓库查询所述未变动代码模块对应的已编译文件;将所述模块依赖图中的所述变动代码模块修改为所述已编译文件,得到修改后依赖图。In some embodiments of the present application, the compilation acceleration plug-in also includes a local warehouse; the dependency modification logic in the acceleration compilation logic is executed, and the unchanged code in the module dependency graph is Modifying the module into the corresponding compiled file and obtaining the modified dependency graph includes: executing the dependency modification logic in the accelerated compilation logic, and querying the compiled file corresponding to the unchanged code module from the local warehouse; Modify the changed code module in the module dependency graph into the compiled file to obtain a modified dependency graph.
在本申请的一些实施例中,在所述执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译之后,所述方法还包括:若所述变动代码模块编译完成,通过所述编译加速插件将编译后的所述变动代码模块打包为变动代码模块编译文件;将所述变动代码模块编译文件存储至所述编译加速插件中的本地仓库。In some embodiments of the present application, after the accelerated compilation logic is executed and the module dependencies of the unchanged code modules are modified to control only the changed code modules in the project code to be compiled in the compilation process, the The method also includes: if the compilation of the modified code module is completed, packaging the compiled modified code module into a modified code module compiled file through the compilation acceleration plug-in; and storing the modified code module compiled file in the compiled file. Accelerate local repository in plugin.
根据本申请的一个实施例,一种代码编译装置,包括:注入单元,用于将编译加速插件注入编译器,所述编译加速插件中包括变动分析逻辑以及依赖修改逻辑;分析单元,用于响应于所述编译器中执行至预定编译流程节点,执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块;修改单元,用于通过所述编译加速插件对所述编译器的编译逻辑进行修改,将所述依赖修改逻辑动态注入所述编译逻辑,得到加速编译逻辑;编译单元,用于执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译。According to an embodiment of the present application, a code compilation device includes: an injection unit for injecting a compilation acceleration plug-in into a compiler, where the compilation acceleration plug-in includes change analysis logic and dependency modification logic; an analysis unit for responding Execute to the predetermined compilation process node in the compiler, execute the change analysis logic to perform change analysis on the project code, and obtain the unchanged code module; the modification unit is used to compile the compiler through the compilation acceleration plug-in The logic is modified, and the dependency modification logic is dynamically injected into the compilation logic to obtain accelerated compilation logic; the compilation unit is used to execute the accelerated compilation logic and control the compilation process by modifying the module dependencies of the unchanged code modules. Only the changed code modules in the project code will be compiled.
在本申请的一些实施例中,所述分析单元,用于:执行所述变动分析逻辑,对所述项目代码进行代码文件变更对比,得到所述项目代码的修改代码文件;根据所述修改代码文件对应的文件路径,查找所述修改文件从属的代码模块,得到所述变动代码模块;查找所述项目代码中除所述变动代码模块之外的代码模块,得到所述未变动代码模块。In some embodiments of the present application, the analysis unit is used to: execute the change analysis logic, perform code file change comparison on the project code, and obtain a modified code file of the project code; according to the modified code Find the file path corresponding to the file, search for the code module to which the modified file belongs, and obtain the changed code module; search for code modules in the project code other than the changed code module, and obtain the unchanged code module.
在本申请的一些实施例中,所述分析单元,用于:执行所述变动分析逻辑,递归搜索所述项目代码中每个代码模块下代码文件的修改时间,得到每个代码模块下代码文件的当前修改时间;将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块。 In some embodiments of this application, the analysis unit is used to: execute the change analysis logic, recursively search the modification time of the code files under each code module in the project code, and obtain the code files under each code module. The current modification time of the code file under each code module is compared with the historical modification time of the code file under each code module to obtain the unchanged code module.
在本申请的一些实施例中,所述分析单元,用于:将每个所述代码模块下代码文件的当前修改时间进行信息摘要计算,得到每个所述代码模块对应的当前摘要;获取每个所述代码模块对应的历史摘要,所述历史摘要为对每个所述代码模块下代码文件的历史修改时间进行信息摘要计算得到的;比较每个所述代码模块对应的当前摘要与历史摘要,得到所述未变动代码模块。In some embodiments of the present application, the analysis unit is used to: perform information summary calculation on the current modification time of the code file under each of the code modules to obtain the current summary corresponding to each of the code modules; obtain each A historical summary corresponding to each of the code modules. The historical summary is obtained by calculating the information summary of the historical modification time of the code file under each of the code modules; compare the current summary and the historical summary corresponding to each of the code modules. , to obtain the unchanged code module.
在本申请的一些实施例中,所述依赖修改逻辑包括模块依赖图分析逻辑以及依赖关系修改逻辑;所述编译单元,用于:执行所述加速编译逻辑中的所述模块依赖图分析逻辑,对所述项目代码中的代码模块进行依赖分析,得到模块依赖图;执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图;执行所述加速编译逻辑中的所述编译逻辑,根据所述修改后依赖图进行代码编译,以仅对所述项目代码中的变动代码模块进行编译。In some embodiments of the present application, the dependency modification logic includes module dependency graph analysis logic and dependency relationship modification logic; the compilation unit is used to: execute the module dependency graph analysis logic in the accelerated compilation logic, Perform dependency analysis on the code modules in the project code to obtain a module dependency graph; execute the dependency modification logic in the accelerated compilation logic to modify the unchanged code modules in the module dependency graph to the corresponding compiled files to obtain a modified dependency graph; execute the compilation logic in the accelerated compilation logic, and perform code compilation according to the modified dependency graph to compile only the changed code modules in the project code.
在本申请的一些实施例中,所述编译加速插件中还包括本地仓库;所述编译单元,用于:执行所述加速编译逻辑中的所述依赖关系修改逻辑,从所述本地仓库查询所述未变动代码模块对应的已编译文件;将所述模块依赖图中的所述变动代码模块修改为所述已编译文件,得到修改后依赖图。In some embodiments of the present application, the compilation acceleration plug-in also includes a local warehouse; the compilation unit is used to: execute the dependency modification logic in the accelerated compilation logic, and query all the dependencies from the local warehouse. The compiled file corresponding to the unchanged code module is modified; the changed code module in the module dependency graph is modified into the compiled file to obtain a modified dependency graph.
在本申请的一些实施例中,所述装置还包括打包单元,用于:若所述变动代码模块编译完成,通过所述编译加速插件将编译后的所述变动代码模块打包为变动代码模块编译文件;将所述变动代码模块编译文件存储至所述编译加速插件中的本地仓库。In some embodiments of the present application, the device further includes a packaging unit, configured to: if the compilation of the modified code module is completed, package the compiled modified code module into a modified code module through the compilation acceleration plug-in. File; store the modified code module compiled file into the local warehouse in the compilation acceleration plug-in.
根据本申请的另一实施例,一种存储介质,其上存储有计算机程序,当所述计算机程序被计算机的处理器执行时,使计算机执行本申请实施例所述的方法。According to another embodiment of the present application, a storage medium has a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer is caused to execute the method described in the embodiment of the present application.
根据本申请的另一实施例,一种电子设备可以包括:存储器,存储有计算机程序;处理器,读取存储器存储的计算机程序,以执行本申请实施例所述的方法。According to another embodiment of the present application, an electronic device may include: a memory storing a computer program; and a processor reading the computer program stored in the memory to execute the method described in the embodiment of the present application.
根据本申请的另一实施例,一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行本申请实施例所述的各种可选实现方式中提供的方法。According to another embodiment of the present application, a computer program product or computer program includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementations described in the embodiments of this application.
有益效果beneficial effects
本申请实施例中,将编译加速插件注入编译器,所述编译加速插件中包括变动分析逻辑以及依赖修改逻辑;响应于所述编译器中执行至预定编译流程节点,执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块;通过所述编译加速插件对所述编译器的编译逻辑进行修改,将所述依赖修改逻辑动态注入所述编译逻辑,得到加速编译逻辑;执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译。In the embodiment of the present application, a compilation acceleration plug-in is injected into the compiler, and the compilation acceleration plug-in includes change analysis logic and dependency modification logic; in response to the execution of the predetermined compilation process node in the compiler, the change analysis logic pair is executed Conduct change analysis on the project code to obtain the unchanged code module; modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into the compilation logic to obtain accelerated compilation logic; execute the above To accelerate the compilation logic, by modifying the module dependencies of the unchanged code modules, the compilation process is controlled to only compile the changed code modules in the project code.
以这种方式,通过提供包括变动分析逻辑及依赖修改逻辑的加速逻辑的编译加速插件,将加速逻辑以插件注入编译器,使得加速逻辑与编译器协同,编译器可以通过变动分析逻辑对项目代码实现自动的变动分析,编译加速插件可以对编译器的编译逻辑进行修改,将依赖修改逻辑动态注入编译逻辑,得到深度协同加速逻辑与编译逻辑的加速编译逻辑,通过加速编译逻辑可以对项目代码中的模块依赖实现自适应地修改,进而加速编译过程,整体加速编译流程对项目代码的适 应性高,可以有效提升代码编译的加速效果且有效提升代码编译可靠性。In this way, by providing a compilation acceleration plug-in that includes change analysis logic and acceleration logic that relies on modification logic, the acceleration logic is injected into the compiler as a plug-in, so that the acceleration logic cooperates with the compiler, and the compiler can use the change analysis logic to modify the project code. To realize automatic change analysis, the compilation acceleration plug-in can modify the compilation logic of the compiler, dynamically inject the dependency modification logic into the compilation logic, and obtain the accelerated compilation logic of deep collaborative acceleration logic and compilation logic. By accelerating the compilation logic, the project code can be modified. Module dependencies are adaptively modified to accelerate the compilation process, and the overall compilation process is adapted to the project code. It has high adaptability, which can effectively improve the acceleration effect of code compilation and effectively improve the reliability of code compilation.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without exerting creative efforts.
图1示出了根据本申请的一个实施例的代码编译方法的流程图。Figure 1 shows a flow chart of a code compilation method according to an embodiment of the present application.
图2示出了一种场景下编译加速插件的模块结构图。Figure 2 shows the module structure diagram of the compilation acceleration plug-in in one scenario.
图3示出了一种场景下应用本申请实施例的进行代码编译的流程图。Figure 3 shows a flow chart of code compilation using an embodiment of the present application in one scenario.
图4示出了根据本申请的一个实施例的代码编译装置的框图。Figure 4 shows a block diagram of a code compilation device according to an embodiment of the present application.
图5示出了根据本申请的一个实施例的电子设备的框图。Figure 5 shows a block diagram of an electronic device according to one embodiment of the present application.
本发明的实施方式Embodiments of the invention
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts fall within the scope of protection of this application.
图1示意性示出了根据本申请的一个实施例的代码编译方法的流程图。该代码编译方法的执行主体可以是任意的设备,例如,电脑、手机、智能手表以及家电设备等终端或者服务器集群、云服务器等服务器。Figure 1 schematically shows a flow chart of a code compilation method according to an embodiment of the present application. The execution subject of the code compilation method can be any device, for example, terminals such as computers, mobile phones, smart watches, and home appliances, or servers such as server clusters and cloud servers.
如图1所示,该代码编译方法可以包括步骤S110至步骤S140。As shown in Figure 1, the code compilation method may include steps S110 to S140.
步骤S110,将编译加速插件注入编译器,所述编译加速插件中包括变动分析逻辑以及依赖修改逻辑;步骤S120,响应于所述编译器中执行至预定编译流程节点,执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块;步骤S130,通过所述编译加速插件对所述编译器的编译逻辑进行修改,将所述依赖修改逻辑动态注入所述编译逻辑,得到加速编译逻辑;步骤S140,执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译。Step S110, inject the compilation acceleration plug-in into the compiler. The compilation acceleration plug-in includes change analysis logic and dependency modification logic; Step S120, in response to the execution of the predetermined compilation process node in the compiler, execute the change analysis logic pair Perform change analysis on the project code to obtain the unchanged code module; step S130, modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into the compilation logic to obtain accelerated compilation logic; Step S140: Execute the accelerated compilation logic, and control only the changed code modules in the project code to be compiled in the compilation process by modifying the module dependencies of the unchanged code modules.
编译加速插件即包含对编译进程进行加速的加速逻辑的插件,加速逻辑可以包括变动分析逻辑以及依赖修改逻辑。变动分析逻辑可以是分析项目代码中代码模块的变动情况的代码。依赖修改逻辑可以是分析代码模块的模块依赖以及修改模块依赖的代码。编译加速插件可以以插件注入方式注入编译器,编译器即用于对项目代码进行编译的工具,例如,编译器可以是Gradle工具。The compilation acceleration plug-in is a plug-in that contains acceleration logic to accelerate the compilation process. The acceleration logic can include change analysis logic and dependency modification logic. Change analysis logic can be code that analyzes changes in code modules in the project code. The dependency modification logic can be analyzing the module dependencies of the code module and modifying the code of the module dependencies. The compilation acceleration plug-in can be injected into the compiler in the form of plug-in injection. The compiler is a tool used to compile the project code. For example, the compiler can be the Gradle tool.
用户可以触发编译器启动编译流程,编译流程启动后执行至预定编译流程节点(例如,编译流程启动后,先进行初始化阶段,然后进行配置阶段(该阶段可以遍历每一个代码模块的脚本来建立任务执行关系图),配置阶段完成视为执行至预定编译流程节点),编译器中可以触发执行编译加速插件中的变动分析逻辑,变动分析逻辑可以对项目代码进行变动分析,得到未变动代码模块,未变动代码模块可以是项目代码中在预定时期内没有发生修改的代码模块。The user can trigger the compiler to start the compilation process. After the compilation process is started, it will be executed to the predetermined compilation process node (for example, after the compilation process is started, the initialization phase will be carried out first, and then the configuration phase will be carried out (this phase can traverse the scripts of each code module to establish tasks). Execution relationship diagram), the completion of the configuration phase is regarded as execution to the scheduled compilation process node), the compiler can trigger the execution of the change analysis logic in the compilation acceleration plug-in, the change analysis logic can perform change analysis on the project code, and obtain the unchanged code module. Unchanged code modules may be code modules in the project code that have not been modified within a predetermined period of time.
通过编译加速插件可以对编译器的编译逻辑(即编译器本身的代码)进行反射或回调(HOOK)而对编译逻辑进行修改,来将依赖修改逻辑动态注入编译逻辑中,注入依赖修改逻辑的编译逻辑即可以是加速编译逻辑。Through the compilation acceleration plug-in, the compilation logic of the compiler (that is, the code of the compiler itself) can be reflected or callback (HOOK) to modify the compilation logic, thereby dynamically injecting the dependency modification logic into the compilation logic, and injecting the compilation of the dependency modification logic. The logic can be accelerated compilation logic.
执行加速编译逻辑,即可以通过注入的依赖修改逻辑可靠地修改未变动代码模块的模块依赖,来控制编译逻辑在编译流程中仅对项目代码中变动代码模块进 行编译,也即跳过对未变动代码模块的编译仅对变动代码模块进行编译,从而自适应的对项目代码实现加速编译。Execute accelerated compilation logic, that is, the module dependencies of unchanged code modules can be reliably modified through the injected dependency modification logic to control the compilation logic to only modify the changed code modules in the project code during the compilation process. Line compilation, that is, skipping the compilation of unchanged code modules and only compiling the changed code modules, thereby adaptively speeding up the compilation of the project code.
以这种方式,基于步骤S110至步骤S140,通过提供包括变动分析逻辑及依赖修改逻辑的加速逻辑的编译加速插件,将加速逻辑以插件注入编译器,使得加速逻辑与编译器协同,编译器可以通过变动分析逻辑对项目代码实现自动的变动分析,编译加速插件可以对编译器的编译逻辑进行修改,将依赖修改逻辑动态注入编译逻辑,得到深度协同加速逻辑与编译逻辑的加速编译逻辑,通过加速编译逻辑可以对项目代码中的模块依赖实现自适应地修改,进而加速编译过程,整体加速编译流程对项目代码的适应性高,可以有效提升代码编译的加速效果且有效提升代码编译可靠性。In this way, based on steps S110 to S140, by providing a compilation acceleration plug-in including change analysis logic and acceleration logic that depends on modification logic, the acceleration logic is injected into the compiler as a plug-in, so that the acceleration logic cooperates with the compiler, and the compiler can Implement automatic change analysis on the project code through change analysis logic. The compilation acceleration plug-in can modify the compilation logic of the compiler, dynamically inject the dependency modification logic into the compilation logic, and obtain the accelerated compilation logic of deep collaborative acceleration logic and compilation logic. Through acceleration The compilation logic can adaptively modify the module dependencies in the project code, thereby accelerating the compilation process. The overall accelerated compilation process is highly adaptable to the project code, which can effectively improve the acceleration effect of code compilation and effectively improve the reliability of code compilation.
下面描述图1中实施例下进行代码编译时,所进行的各步骤的进一步具体可选实施例。The following describes further specific optional embodiments of each step performed when compiling code under the embodiment in Figure 1.
一种实施例中,在步骤S120中,所述执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,包括:In one embodiment, in step S120, the execution of the change analysis logic performs change analysis on the project code to obtain an unchanged code module, including:
执行所述变动分析逻辑,对所述项目代码进行代码文件变更对比,得到所述项目代码的修改代码文件;根据所述修改代码文件对应的文件路径,查找所述修改文件从属的代码模块,得到所述变动代码模块;查找所述项目代码中除所述变动代码模块之外的代码模块,得到所述未变动代码模块。Execute the change analysis logic, compare the code file changes of the project code, and obtain the modified code file of the project code; according to the file path corresponding to the modified code file, search for the code module to which the modified file is subordinate, and obtain The changed code module; search for code modules other than the changed code module in the project code to obtain the unchanged code module.
该实施例下,变动分析逻辑可以通过对项目代码进行代码文件变更对比、文件路径下查找的方式,高效准确地分析出变动代码模块及未变动代码模块。In this embodiment, the change analysis logic can efficiently and accurately analyze the changed code modules and unchanged code modules by comparing the code file changes of the project code and searching under the file path.
具体地,变动分析逻辑中可以包括git diff命令行,执行git diff命令行可以将当前的项目代码与预定版本的项目代码进行比对,得到当前的项目代码中发生修改的代码文件,得到修改代码文件的文件列表。确定了修改代码文件后,变动分析逻辑中的路径查找命令行,可以根据每个修改代码文件对应的文件路径(path)即可查找到每个修改代码文件从属的代码模块,修改代码文件从属的代码模块即发生了修改的变动代码模块,进一步的,将项目代码中除变动代码模块之外的代码模块即可确定为未变动代码模块。Specifically, the change analysis logic can include the git diff command line. Executing the git diff command line can compare the current project code with the scheduled version of the project code, obtain the modified code files in the current project code, and obtain the modified code. File list of files. After the modified code file is determined, the path search command line in the change analysis logic can be used to find the code module to which each modified code file is dependent, and the code module to which the modified code file is dependent can be found based on the file path (path) corresponding to each modified code file. The code module is the changed code module that has been modified. Furthermore, the code modules in the project code other than the changed code module can be determined as the unchanged code module.
一种实施例中,在步骤S120中,所述执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,包括:In one embodiment, in step S120, the execution of the change analysis logic performs change analysis on the project code to obtain an unchanged code module, including:
执行所述变动分析逻辑,递归搜索所述项目代码中每个代码模块下代码文件的修改时间,得到每个代码模块下代码文件的当前修改时间;将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块。Execute the change analysis logic, recursively search the modification time of the code file under each code module in the project code, and obtain the current modification time of the code file under each code module; add the current modification time of the code file under each code module The modification time is compared with the historical modification time of the code file under each code module to obtain the unchanged code module.
该实施例下,变动分析逻辑通过递归搜索每个代码模块下代码文件的修改时间进行比对的方式,在一定程序也可以快速分析出变动代码模块及未变动代码模块。In this embodiment, the change analysis logic recursively searches the modification time of the code file under each code module and compares it. In a certain program, the changed code module and the unchanged code module can be quickly analyzed.
具体地,代码文件每次被修改时可以对应记录修改时间,变动分析逻辑可以递归搜索项目代码中每个代码模块下代码文件的修改时间,得到每个代码模块下代码文件的当前修改时间。进一步的,变动分析逻辑可以将每个代码模块下代码文件的当前修改时间与每个代码模块下代码文件的历史修改时间进行比较,某个代码模块下的当前修改时间与历史修改时间不一致,该某个代码模块即变动代码模块,项目代码中除变动代码模块之外的代码模块即可确定为未变动代码模块。其中,历史修改时间可以时某个历史版本的项目代码中记录的每个代码文件的修改时间。 Specifically, each time a code file is modified, the modification time can be recorded accordingly. The change analysis logic can recursively search the modification time of the code file under each code module in the project code to obtain the current modification time of the code file under each code module. Furthermore, the change analysis logic can compare the current modification time of the code file under each code module with the historical modification time of the code file under each code module. If the current modification time under a certain code module is inconsistent with the historical modification time, the A certain code module is a changed code module, and the code modules in the project code other than the changed code modules can be determined as unchanged code modules. Among them, the historical modification time can be the modification time of each code file recorded in a certain historical version of the project code.
进一步的,一种实施例中,所述将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块,包括:Further, in one embodiment, the current modification time of the code file under each of the code modules is compared with the historical modification time of the code files under each of the code modules to obtain the unchanged code module, include:
将每个所述代码模块下代码文件的当前修改时间进行信息摘要计算,得到每个所述代码模块对应的当前摘要;获取每个所述代码模块对应的历史摘要,所述历史摘要为对每个所述代码模块下代码文件的历史修改时间进行信息摘要计算得到的;比较每个所述代码模块对应的当前摘要与历史摘要,得到所述未变动代码模块。Calculate the information summary of the current modification time of the code file under each code module to obtain the current summary corresponding to each code module; obtain the historical summary corresponding to each code module, and the historical summary is for each code module The historical modification time of the code files under each of the code modules is obtained by calculating the information summary; comparing the current summary and the historical summary corresponding to each of the code modules, the unchanged code module is obtained.
例如,将A代码模块下代码文件的当前修改时间进行信息摘要计算,得到A代码模块对应的当前摘要A1;获取A代码模块对应的历史摘要A2,历史摘要A2为对每个代码模块下代码文件的历史修改时间进行信息摘要计算得到的;比较A代码模块对应的当前摘要A1与历史摘要A2,若当前摘要A1与历史摘要A2一致,则A代码模块为未变动代码模块。以这种方式,可以进一步提升递归搜索每个代码模块下代码文件的修改时间进行比对的方式的效率。For example, calculate the information summary of the current modification time of the code file under the A code module to obtain the current summary A1 corresponding to the A code module; obtain the historical summary A2 corresponding to the A code module. The historical summary A2 is the code file under each code module. It is obtained by calculating the information summary of the historical modification time; compare the current summary A1 and the historical summary A2 corresponding to the A code module. If the current summary A1 and the historical summary A2 are consistent, the A code module is an unchanged code module. In this way, the efficiency of recursively searching and comparing the modification times of code files under each code module can be further improved.
一种实施例中,所述依赖修改逻辑包括模块依赖图分析逻辑以及依赖关系修改逻辑;步骤S140中,所述执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译,包括:In one embodiment, the dependency modification logic includes module dependency graph analysis logic and dependency relationship modification logic; in step S140, the execution of the accelerated compilation logic controls compilation by modifying the module dependencies of the unchanged code modules. During the process, only the changed code modules in the project code are compiled, including:
执行所述加速编译逻辑中的所述模块依赖图分析逻辑,对所述项目代码中的代码模块进行依赖分析,得到模块依赖图;执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图;执行所述加速编译逻辑中的所述编译逻辑,根据所述修改后依赖图进行代码编译,以仅对所述项目代码中的变动代码模块进行编译。Execute the module dependency graph analysis logic in the accelerated compilation logic to perform dependency analysis on the code modules in the project code to obtain a module dependency graph; execute the dependency modification logic in the accelerated compilation logic to obtain The unchanged code module in the module dependency graph is modified into the corresponding compiled file to obtain a modified dependency graph; the compilation logic in the accelerated compilation logic is executed, and code compilation is performed according to the modified dependency graph , to compile only the changed code modules in the project code.
依赖修改逻辑包括模块依赖图分析逻辑以及依赖关系修改逻辑,依赖修改逻辑注入编译逻辑得到加速编译逻辑,进而,加速编译逻辑中可以包括协同的模块依赖图分析逻辑、依赖关系修改逻辑及编译逻辑。Dependency modification logic includes module dependency graph analysis logic and dependency modification logic. Dependency modification logic is injected into compilation logic to obtain accelerated compilation logic. Furthermore, accelerated compilation logic can include collaborative module dependency graph analysis logic, dependency modification logic and compilation logic.
模块依赖图分析逻辑可以是分析代码模块之间的依赖关系的代码,执行加速编译逻辑中的模块依赖图分析逻辑,可以对项目代码中的所有代码模块进行依赖分析,分析出代码模块之间的调用关系(即依赖关系),得到描述代码模块之间的调用关系(即依赖关系)的模块依赖图。The module dependency graph analysis logic can be code that analyzes the dependencies between code modules. The module dependency graph analysis logic in the accelerated compilation logic can be executed to perform dependency analysis on all code modules in the project code and analyze the dependencies between code modules. Calling relationships (i.e., dependencies), and obtaining a module dependency graph describing the calling relationships (i.e., dependencies) between code modules.
依赖关系修改逻辑可以是修改模块依赖图中依赖关系的代码,执行加速编译逻辑中的依赖关系修改逻辑,可以将模块依赖图中的未变动代码模块修改为对应的已编译文件,得到修改后依赖图。其中,已编译文件可以是未变动代码模块对应的AAR文件。The dependency modification logic can be the code that modifies the dependencies in the module dependency graph. The dependency modification logic in the accelerated compilation logic can be executed. The unchanged code module in the module dependency graph can be modified into the corresponding compiled file to obtain the modified dependencies. picture. The compiled file may be an AAR file corresponding to the unchanged code module.
进而,执行加速编译逻辑中的编译逻辑,根据修改后依赖图进行代码编译时,可以自动跳过已编译文件的编译,从而仅对项目代码中的变动代码模块进行编译。Furthermore, when the compilation logic in the accelerated compilation logic is executed and the code is compiled according to the modified dependency graph, the compilation of the compiled files can be automatically skipped, so that only the changed code modules in the project code are compiled.
一种实施例中,所述编译加速插件中还包括本地仓库;所述执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述变动代码模块修改为对应的已编译文件,得到修改后依赖图,包括:In one embodiment, the compilation acceleration plug-in further includes a local warehouse; the execution of the dependency modification logic in the acceleration compilation logic modifies the changed code module in the module dependency graph to the corresponding Compiled files, get the modified dependency graph, including:
执行所述加速编译逻辑中的所述依赖关系修改逻辑,从所述本地仓库查询所述变动代码模块对应的已编译文件;将所述模块依赖图中的所述变动代码模块修改为所述已编译文件,得到修改后依赖图。Execute the dependency modification logic in the accelerated compilation logic, query the compiled file corresponding to the changed code module from the local warehouse; modify the changed code module in the module dependency graph to the changed code module Compile the file and get the modified dependency graph.
该实施例下,编译加速插件中还包括本地仓库,即将保存已编译文件的本地仓库也会注入编译器中。编译器中,执行加速编译逻辑中的依赖关系修改逻辑, 会从注入编译器中的本地仓库查询变动代码模块对应的已编译文件,从而进行修改。以这种方式,进一步提升加速编译的稳定性和效率。In this embodiment, the compilation acceleration plug-in also includes a local warehouse, and the local warehouse that stores compiled files will also be injected into the compiler. In the compiler, the dependency modification logic in the accelerated compilation logic is executed. The compiled files corresponding to the changed code modules will be queried from the local warehouse injected into the compiler to make modifications. In this way, the stability and efficiency of accelerated compilation are further improved.
进一步的,一种实施例中,在所述执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译之后,所述方法还包括:Further, in one embodiment, after the accelerated compilation logic is executed and the module dependencies of the unchanged code modules are modified to control only the changed code modules in the project code to be compiled in the compilation process, the The above methods also include:
若所述变动代码模块编译完成,通过所述编译加速插件将编译后的所述变动代码模块打包为变动代码模块编译文件;将所述变动代码模块编译文件存储至所述编译加速插件中的本地仓库。If the compilation of the modified code module is completed, the compiled modified code module is packaged into a modified code module compiled file through the compilation acceleration plug-in; and the modified code module compiled file is stored in a local location in the compiled acceleration plug-in. storehouse.
该实施例下,在对变动代码模块编译完成后,编译器中进一步通过编译加速插件将编译后的变动代码模块打包为变动代码模块编译文件,变动代码模块编译文件即变动代码模块对应的AAR文件,然后,将变动代码模块编译文件存储至编译加速插件中的本地仓库,可以在后续编译时根据需求使用。In this embodiment, after the compilation of the change code module is completed, the compiler further uses the compilation acceleration plug-in to package the compiled change code module into a change code module compilation file. The change code module compilation file is the AAR file corresponding to the change code module. , and then store the changed code module compiled files to the local warehouse in the compilation acceleration plug-in, which can be used as needed during subsequent compilation.
为便于更好的描述本申请实施例提供的代码编译方法,以下结合一种场景下进行代码编译的流程进一步描述前述实施例,该场景下通过应用本申请的前述实施例进行代码编译。图2示出该场景下编译加速插件的模块架构图。图3示出该场景下进行代码编译的流程图。In order to better describe the code compilation method provided by the embodiments of the present application, the foregoing embodiments are further described below in conjunction with the code compilation process in a scenario in which code compilation is performed by applying the foregoing embodiments of the present application. Figure 2 shows the module architecture diagram of the compilation acceleration plug-in in this scenario. Figure 3 shows the flow chart of code compilation in this scenario.
参阅图2,该场景下,编译加速插件中至少包括工程变动感知代码、模块依赖图分析代码、依赖修改算法以及本地存储仓库,其中,工程变动感知代码即变动分析逻辑、模块依赖图分析代码即模块依赖图分析逻辑、依赖修改算法即依赖关系修改逻辑,本地存储仓库即本地仓库。Refer to Figure 2. In this scenario, the compilation acceleration plug-in at least includes engineering change awareness code, module dependency graph analysis code, dependency modification algorithm and local storage warehouse. Among them, the engineering change awareness code is the change analysis logic, and the module dependency graph analysis code is The module dependency graph analysis logic, the dependency modification algorithm is the dependency modification logic, and the local storage warehouse is the local warehouse.
参阅图3,该场景下,代码编译的流程可以包括步骤S210至步骤S2110。Referring to Figure 3, in this scenario, the code compilation process may include steps S210 to S2110.
步骤S210,注入代码。具体地,将编译加速插件注入编译器,该编译加速插件中包括变动分析逻辑、依赖修改逻辑以及本地仓库,该依赖修改逻辑包括模块依赖图分析逻辑以及依赖关系修改逻辑。Step S210, inject code. Specifically, a compilation acceleration plug-in is injected into the compiler. The compilation acceleration plug-in includes change analysis logic, dependency modification logic, and a local warehouse. The dependency modification logic includes module dependency graph analysis logic and dependency modification logic.
步骤S220,开发者点击开始编译,即开发者点击编译器触发开始编译。In step S220, the developer clicks to start compilation, that is, the developer clicks on the compiler to trigger compilation.
步骤S230,获取哪个模块未作变动。具体地,响应于编译器中执行至预定编译流程节点,执行变动分析逻辑对项目代码进行变动分析,得到未变动代码模块。Step S230: Obtain which module has not been changed. Specifically, in response to the execution of the predetermined compilation process node in the compiler, the change analysis logic is executed to perform change analysis on the project code, and an unchanged code module is obtained.
其中,执行变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,可以包括:执行所述变动分析逻辑,对所述项目代码进行代码文件变更对比,得到所述项目代码的修改代码文件;根据所述修改代码文件对应的文件路径,查找所述修改文件从属的代码模块,得到所述变动代码模块;查找所述项目代码中除所述变动代码模块之外的代码模块,得到所述未变动代码模块。Executing the change analysis logic to perform change analysis on the project code to obtain an unchanged code module may include: executing the change analysis logic, comparing code file changes to the project code, and obtaining a modified code file of the project code; According to the file path corresponding to the modified code file, search for the code module to which the modified file is subordinate to obtain the changed code module; search for code modules other than the changed code module in the project code to obtain the unchanged code module. Change code modules.
或者,执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,可以包括:执行所述变动分析逻辑,递归搜索所述项目代码中每个代码模块下代码文件的修改时间,得到每个代码模块下代码文件的当前修改时间;将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块。将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块,可以包括:将每个所述代码模块下代码文件的当前修改时间进行信息摘要计算,得到每个所述代码模块对应的当前摘要;获取每个所述代码模块对应的历史摘要,所述历史摘要为对每个所述代码模块下代码文件的历史修改时间进行信息摘要计算得到的;比较每个所述代码模块对应的当前摘要与 历史摘要,得到所述未变动代码模块。Alternatively, executing the change analysis logic to perform change analysis on the project code to obtain unchanged code modules may include: executing the change analysis logic, recursively searching for the modification time of the code file under each code module in the project code, and obtaining The current modification time of the code file under each code module; compare the current modification time of the code file under each code module with the historical modification time of the code file under each code module to obtain the unchanged code module . Comparing the current modification time of the code file under each code module with the historical modification time of the code file under each code module to obtain the unchanged code module may include: Calculate the information summary of the current modification time of the code file to obtain the current summary corresponding to each code module; obtain the historical summary corresponding to each code module, and the historical summary is the code file under each code module It is obtained by calculating the information summary of the historical modification time; compare the current summary corresponding to each code module with Historical summary, resulting in the unchanged code module.
步骤S240,返回模块列表,即变动分析逻辑分析得到的未变动代码模块的模块列表返回至编译加速插件。Step S240, return the module list, that is, the module list of unchanged code modules obtained by the change analysis logic analysis is returned to the compilation acceleration plug-in.
进一步的,通过编译加速插件对编译器的编译逻辑进行修改,将依赖修改逻辑动态注入编译逻辑,得到加速编译逻辑。Furthermore, the compilation logic of the compiler is modified through the compilation acceleration plug-in, and the dependency modification logic is dynamically injected into the compilation logic to obtain accelerated compilation logic.
步骤S250,未变动的模块给到修改算法,即编译加速插件将未变动代码模块的模块列表给到依赖关系修改逻辑。In step S250, the unchanged modules are fed to the modification algorithm, that is, the compilation acceleration plug-in feeds the module list of the unchanged code modules to the dependency modification logic.
步骤S260,获取依赖图,以及返回依赖图。具体地,执行加速编译逻辑中的模块依赖图分析逻辑,对项目代码中的代码模块进行依赖分析,得到模块依赖图,并将模块依赖图给到依赖关系修改逻辑。Step S260: Obtain the dependency graph and return the dependency graph. Specifically, the module dependency graph analysis logic in the accelerated compilation logic is executed, dependency analysis is performed on the code modules in the project code, the module dependency graph is obtained, and the module dependency graph is given to the dependency modification logic.
步骤S270,获取未变动模块对应的AAR,以及返回AAR。具体地,执行加速编译逻辑中的依赖关系修改逻辑,从本地仓库查询未变动代码模块对应的已编译文件(即AAR文件)。Step S270: Obtain the AAR corresponding to the unchanged module and return the AAR. Specifically, the dependency modification logic in the accelerated compilation logic is executed, and the compiled files corresponding to the unchanged code modules (i.e., AAR files) are queried from the local warehouse.
步骤S280,修改整个工程的依赖关系。具体地,依赖关系修改逻辑将模块依赖图中的变动代码模块修改为已编译文件,得到修改后依赖图。Step S280: Modify the dependencies of the entire project. Specifically, the dependency modification logic modifies the changed code module in the module dependency graph into a compiled file to obtain a modified dependency graph.
即步骤S270至步骤S280,执行加速编译逻辑中的依赖关系修改逻辑,将模块依赖图中的未变动代码模块修改为对应的已编译文件,得到修改后依赖图。That is, from step S270 to step S280, the dependency modification logic in the accelerated compilation logic is executed, and the unchanged code modules in the module dependency graph are modified into corresponding compiled files to obtain a modified dependency graph.
步骤S290,修改完毕继续编译。具体地,得到修改后依赖图后,执行加速编译逻辑中的编译逻辑,根据修改后依赖图进行代码编译,以仅对项目代码中的变动代码模块进行编译。Step S290: After the modification is completed, compilation continues. Specifically, after obtaining the modified dependency graph, the compilation logic in the accelerated compilation logic is executed, and code compilation is performed according to the modified dependency graph, so that only the changed code modules in the project code are compiled.
即步骤S260至步骤S290,执行所述加速编译逻辑,通过修改未变动代码模块的模块依赖,控制编译流程中仅对项目代码中变动代码模块进行编译。That is, from step S260 to step S290, the accelerated compilation logic is executed, and by modifying the module dependencies of the unchanged code modules, the compilation process is controlled to compile only the changed code modules in the project code.
步骤S2100,编译完成,即对项目代码中的变动代码模块编译完成。Step S2100: Compilation is completed, that is, compilation of the changed code modules in the project code is completed.
步骤S2110,编译完成后把改动模块打包AAR。具体地,若所述变动代码模块编译完成,通过所述编译加速插件将编译后的所述变动代码模块打包为变动代码模块编译文件(即AAR文件)。Step S2110: After compilation is completed, the modified module is packaged into AAR. Specifically, if the compilation of the modified code module is completed, the compiled modified code module is packaged into a modified code module compilation file (ie, an AAR file) through the compilation acceleration plug-in.
步骤S2120,更新本地仓库,以便下次编译使用。具体地,将变动代码模块编译文件存储至编译加速插件中的本地仓库。Step S2120: Update the local warehouse for next compilation and use. Specifically, the changed code module compilation file is stored in a local warehouse in the compilation acceleration plug-in.
以这种方式,该场景下通过应用本申请的前述实施例,至少具有如下有益效果:整体加速编译流程对项目代码的适应性高,可以有效提升代码编译的加速效果且有效提升代码编译可靠性。In this way, by applying the aforementioned embodiments of the present application in this scenario, at least the following beneficial effects are achieved: the overall accelerated compilation process has high adaptability to the project code, can effectively improve the acceleration effect of code compilation, and effectively improves the reliability of code compilation. .
为便于更好的实施本申请实施例提供的代码编译方法,本申请实施例还提供一种基于上述代码编译方法的代码编译装置。其中名词的含义与上述代码编译方法中相同,具体实现细节可以参考方法实施例中的说明。图3示出了根据本申请的一个实施例的代码编译装置的框图。In order to facilitate better implementation of the code compilation method provided by the embodiment of the present application, the embodiment of the present application also provides a code compilation device based on the above code compilation method. The meanings of the nouns are the same as in the above code compilation method. For specific implementation details, please refer to the description in the method embodiment. Figure 3 shows a block diagram of a code compilation device according to an embodiment of the present application.
如图4所示,代码编译装置300中可以包括注入单元310、分析单元320、修改单元330、编译单元340。As shown in FIG. 4 , the code compilation device 300 may include an injection unit 310 , an analysis unit 320 , a modification unit 330 , and a compilation unit 340 .
注入单元310可以用于将编译加速插件注入编译器,所述编译加速插件中包括变动分析逻辑以及依赖修改逻辑;分析单元320可以用于响应于所述编译器中执行至预定编译流程节点,执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块;修改单元330可以用于通过所述编译加速插件对所述编译器的编译逻辑进行修改,将所述依赖修改逻辑动态注入所述编译逻辑,得到加速编译逻辑;编译单元340可以用于执行所述加速编译逻辑,通过修改所述未变动代 码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译。The injection unit 310 can be used to inject the compilation acceleration plug-in into the compiler, the compilation acceleration plug-in includes change analysis logic and dependency modification logic; the analysis unit 320 can be used to respond to the execution of the predetermined compilation process node in the compiler, execute The change analysis logic performs change analysis on the project code to obtain an unchanged code module; the modification unit 330 can be used to modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into all The compilation logic is described above to obtain accelerated compilation logic; the compilation unit 340 can be used to execute the accelerated compilation logic by modifying the unchanged code. Module dependencies of code modules control the compilation process of only changed code modules in the project code.
在本申请的一些实施例中,所述分析单元,用于:执行所述变动分析逻辑,对所述项目代码进行代码文件变更对比,得到所述项目代码的修改代码文件;根据所述修改代码文件对应的文件路径,查找所述修改文件从属的代码模块,得到所述变动代码模块;查找所述项目代码中除所述变动代码模块之外的代码模块,得到所述未变动代码模块。In some embodiments of the present application, the analysis unit is used to: execute the change analysis logic, perform code file change comparison on the project code, and obtain a modified code file of the project code; according to the modified code Find the file path corresponding to the file, search for the code module to which the modified file belongs, and obtain the changed code module; search for code modules in the project code other than the changed code module, and obtain the unchanged code module.
在本申请的一些实施例中,所述分析单元,用于:执行所述变动分析逻辑,递归搜索所述项目代码中每个代码模块下代码文件的修改时间,得到每个代码模块下代码文件的当前修改时间;将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块。In some embodiments of this application, the analysis unit is used to: execute the change analysis logic, recursively search the modification time of the code files under each code module in the project code, and obtain the code files under each code module. The current modification time of the code file under each code module is compared with the historical modification time of the code file under each code module to obtain the unchanged code module.
在本申请的一些实施例中,所述分析单元,用于:将每个所述代码模块下代码文件的当前修改时间进行信息摘要计算,得到每个所述代码模块对应的当前摘要;获取每个所述代码模块对应的历史摘要,所述历史摘要为对每个所述代码模块下代码文件的历史修改时间进行信息摘要计算得到的;比较每个所述代码模块对应的当前摘要与历史摘要,得到所述未变动代码模块。In some embodiments of the present application, the analysis unit is used to: perform information summary calculation on the current modification time of the code file under each of the code modules to obtain the current summary corresponding to each of the code modules; obtain each A historical summary corresponding to each of the code modules. The historical summary is obtained by calculating the information summary of the historical modification time of the code file under each of the code modules; compare the current summary and the historical summary corresponding to each of the code modules. , to obtain the unchanged code module.
在本申请的一些实施例中,所述依赖修改逻辑包括模块依赖图分析逻辑以及依赖关系修改逻辑;所述编译单元,用于:执行所述加速编译逻辑中的所述模块依赖图分析逻辑,对所述项目代码中的代码模块进行依赖分析,得到模块依赖图;执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图;执行所述加速编译逻辑中的所述编译逻辑,根据所述修改后依赖图进行代码编译,以仅对所述项目代码中的变动代码模块进行编译。In some embodiments of the present application, the dependency modification logic includes module dependency graph analysis logic and dependency relationship modification logic; the compilation unit is used to: execute the module dependency graph analysis logic in the accelerated compilation logic, Perform dependency analysis on the code modules in the project code to obtain a module dependency graph; execute the dependency modification logic in the accelerated compilation logic to modify the unchanged code modules in the module dependency graph to the corresponding compiled files to obtain a modified dependency graph; execute the compilation logic in the accelerated compilation logic, and perform code compilation according to the modified dependency graph to compile only the changed code modules in the project code.
在本申请的一些实施例中,所述编译加速插件中还包括本地仓库;所述编译单元,用于:执行所述加速编译逻辑中的所述依赖关系修改逻辑,从所述本地仓库查询所述未变动代码模块对应的已编译文件;将所述模块依赖图中的所述变动代码模块修改为所述已编译文件,得到修改后依赖图。In some embodiments of the present application, the compilation acceleration plug-in also includes a local warehouse; the compilation unit is used to: execute the dependency modification logic in the accelerated compilation logic, and query all the dependencies from the local warehouse. The compiled file corresponding to the unchanged code module is modified; the changed code module in the module dependency graph is modified into the compiled file to obtain a modified dependency graph.
在本申请的一些实施例中,所述装置还包括打包单元,用于:若所述变动代码模块编译完成,通过所述编译加速插件将编译后的所述变动代码模块打包为变动代码模块编译文件;将所述变动代码模块编译文件存储至所述编译加速插件中的本地仓库。In some embodiments of the present application, the device further includes a packaging unit, configured to: if the compilation of the modified code module is completed, package the compiled modified code module into a modified code module through the compilation acceleration plug-in. File; store the modified code module compiled file into the local warehouse in the compilation acceleration plug-in.
应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本申请的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。It should be noted that although several modules or units of equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above may be embodied in one module or unit. Conversely, the features and functions of one module or unit described above may be further divided into being embodied by multiple modules or units.
此外,本申请实施例还提供一种电子设备,该电子设备可以为终端或者服务器,如图5所示,其示出了本申请实施例所涉及的电子设备的结构示意图,具体来讲:In addition, embodiments of the present application also provide an electronic device, which may be a terminal or a server, as shown in Figure 5, which shows a schematic structural diagram of the electronic device involved in the embodiment of the present application. Specifically:
该电子设备可以包括一个或者一个以上处理核心的处理器401、一个或一个以上计算机可读存储介质的存储器402、电源403和输入单元404等部件。本领域技术人员可以理解,图5中示出的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中: The electronic device may include components such as a processor 401 of one or more processing cores, a memory 402 of one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art can understand that the structure of the electronic device shown in FIG. 5 does not constitute a limitation of the electronic device, and may include more or fewer components than shown, or combine certain components, or arrange different components. in:
处理器401是该电子设备的控制中心,利用各种接口和线路连接整个计算机设备的各个部分,通过运行或执行存储在存储器402内的软件程序和/或模块,以及调用存储在存储器402内的数据,执行计算机设备的各种功能和处理数据,从而对电子设备进行整体监控。可选的,处理器401可包括一个或多个处理核心;优选的,处理器401可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户页面和应用程序等,调制解调处理器主要处理无线通讯。可以理解的是,上述调制解调处理器也可以不集成到处理器401中。The processor 401 is the control center of the electronic device, using various interfaces and lines to connect various parts of the entire computer device, by running or executing software programs and/or modules stored in the memory 402, and calling programs stored in the memory 402. Data, perform various functions of computer equipment and process data to provide overall monitoring of electronic equipment. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, where the application processor mainly processes operating systems, user pages, application programs, etc. , the modem processor mainly handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor 401.
存储器402可用于存储软件程序以及模块,处理器401通过运行存储在存储器402的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器402可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据计算机设备的使用所创建的数据等。此外,存储器402可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器402还可以包括存储器控制器,以提供处理器401对存储器402的访问。The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402 . The memory 402 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the storage data area may store data based on Data created by the use of computer equipment, etc. In addition, memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402 .
电子设备还包括给各个部件供电的电源403,优选的,电源403可以通过电源管理系统与处理器401逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源403还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。The electronic device also includes a power supply 403 that supplies power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so that functions such as charging, discharging, and power consumption management can be implemented through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
该电子设备还可包括输入单元404,该输入单元404可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。The electronic device may also include an input unit 404 that may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
尽管未示出,电子设备还可以包括显示单元等,在此不再赘述。具体在本实施例中,电子设备中的处理器401会按照如下的指令,将一个或一个以上的计算机程序的进程对应的可执行文件加载到存储器402中,并由处理器401来运行存储在存储器402中的计算机程序,从而实现本申请前述实施例中各种功能,如处理器401可以执行下述步骤:Although not shown, the electronic device may also include a display unit and the like, which will not be described again here. Specifically, in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more computer programs into the memory 402 according to the following instructions, and the processor 401 will run the executable files stored in the computer program. The computer program in the memory 402 can realize various functions in the aforementioned embodiments of the present application. For example, the processor 401 can perform the following steps:
将编译加速插件注入编译器,所述编译加速插件中包括变动分析逻辑以及依赖修改逻辑;响应于所述编译器中执行至预定编译流程节点,执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块;通过所述编译加速插件对所述编译器的编译逻辑进行修改,将所述依赖修改逻辑动态注入所述编译逻辑,得到加速编译逻辑;执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译。Inject the compilation acceleration plug-in into the compiler, the compilation acceleration plug-in includes change analysis logic and dependency modification logic; in response to the execution of the compiler to a predetermined compilation process node, execute the change analysis logic to perform change analysis on the project code, Obtain the unchanged code module; modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into the compilation logic to obtain the accelerated compilation logic; execute the accelerated compilation logic, and through the modification The module dependencies of the unchanged code modules control the compilation process of only the changed code modules in the project code.
在本申请的一些实施例中,所述执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,包括:执行所述变动分析逻辑,对所述项目代码进行代码文件变更对比,得到所述项目代码的修改代码文件;根据所述修改代码文件对应的文件路径,查找所述修改文件从属的代码模块,得到所述变动代码模块;查找所述项目代码中除所述变动代码模块之外的代码模块,得到所述未变动代码模块。In some embodiments of the present application, executing the change analysis logic to perform change analysis on the project code to obtain an unchanged code module includes: executing the change analysis logic, and comparing code file changes to the project code, Obtain the modified code file of the project code; search for the code module to which the modified file belongs according to the file path corresponding to the modified code file, and obtain the changed code module; search for the modified code module in the project code except for the changed code module other code modules to obtain the unchanged code module.
在本申请的一些实施例中,所述执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,包括:执行所述变动分析逻辑,递归搜索所述项目代码中每个代码模块下代码文件的修改时间,得到每个代码模块下代码文件的当前修改时间;将每个所述代码模块下代码文件的当前修改时间与每个所述代码模 块下代码文件的历史修改时间进行比较,得到所述未变动代码模块。In some embodiments of the present application, executing the change analysis logic to perform change analysis on the project code to obtain unchanged code modules includes: executing the change analysis logic and recursively searching for each code module in the project code Download the modification time of the code file to obtain the current modification time of the code file under each code module; compare the current modification time of the code file under each code module with each code module The historical modification time of the code files under the block is compared to obtain the unchanged code module.
在本申请的一些实施例中,所述将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块,包括:将每个所述代码模块下代码文件的当前修改时间进行信息摘要计算,得到每个所述代码模块对应的当前摘要;获取每个所述代码模块对应的历史摘要,所述历史摘要为对每个所述代码模块下代码文件的历史修改时间进行信息摘要计算得到的;比较每个所述代码模块对应的当前摘要与历史摘要,得到所述未变动代码模块。In some embodiments of the present application, the current modification time of the code file under each of the code modules is compared with the historical modification time of the code files under each of the code modules to obtain the unchanged code module, The method includes: performing information summary calculation on the current modification time of the code file under each code module to obtain the current summary corresponding to each code module; obtaining the historical summary corresponding to each code module, and the historical summary is It is obtained by calculating the information summary of the historical modification time of the code file under each code module; comparing the current summary and the historical summary corresponding to each code module, the unchanged code module is obtained.
在本申请的一些实施例中,所述依赖修改逻辑包括模块依赖图分析逻辑以及依赖关系修改逻辑;所述执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译,包括:执行所述加速编译逻辑中的所述模块依赖图分析逻辑,对所述项目代码中的代码模块进行依赖分析,得到模块依赖图;执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图;执行所述加速编译逻辑中的所述编译逻辑,根据所述修改后依赖图进行代码编译,以仅对所述项目代码中的变动代码模块进行编译。In some embodiments of the present application, the dependency modification logic includes module dependency graph analysis logic and dependency modification logic; the execution of the accelerated compilation logic controls the compilation process by modifying the module dependencies of the unchanged code modules. Compiling only the changed code modules in the project code includes: executing the module dependency graph analysis logic in the accelerated compilation logic, performing dependency analysis on the code modules in the project code, and obtaining a module dependency graph; Execute the dependency modification logic in the accelerated compilation logic, modify the unchanged code module in the module dependency graph to the corresponding compiled file, and obtain the modified dependency graph; execute the accelerated compilation logic The compilation logic is used to compile code according to the modified dependency graph, so as to compile only the changed code modules in the project code.
在本申请的一些实施例中,所述编译加速插件中还包括本地仓库;所述执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图,包括:执行所述加速编译逻辑中的所述依赖关系修改逻辑,从所述本地仓库查询所述未变动代码模块对应的已编译文件;将所述模块依赖图中的所述变动代码模块修改为所述已编译文件,得到修改后依赖图。In some embodiments of the present application, the compilation acceleration plug-in also includes a local warehouse; the execution of the dependency modification logic in the accelerated compilation logic converts the unchanged code in the module dependency graph Modifying the module into the corresponding compiled file and obtaining the modified dependency graph includes: executing the dependency modification logic in the accelerated compilation logic, and querying the compiled file corresponding to the unchanged code module from the local warehouse; Modify the changed code module in the module dependency graph into the compiled file to obtain a modified dependency graph.
在本申请的一些实施例中,在所述执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译之后,还包括可以:若所述变动代码模块编译完成,通过所述编译加速插件将编译后的所述变动代码模块打包为变动代码模块编译文件;将所述变动代码模块编译文件存储至所述编译加速插件中的本地仓库。In some embodiments of the present application, after the accelerated compilation logic is executed, by modifying the module dependencies of the unchanged code modules, and controlling only the changed code modules in the project code to be compiled in the compilation process, there is also The method may include: if the compilation of the modified code module is completed, packaging the compiled modified code module into a modified code module compiled file through the compilation acceleration plug-in; and storing the modified code module compiled file in the compilation acceleration plug-in local repository in .
本领域普通技术人员可以理解,上述实施例的各种方法中的全部或部分步骤可以通过计算机程序来完成,或通过计算机程序控制相关的硬件来完成,该计算机程序可以存储于一计算机可读存储介质中,并由处理器进行加载和执行。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by a computer program, or by controlling relevant hardware by a computer program. The computer program can be stored in a computer-readable storage. media and loaded and executed by the processor.
为此,本申请实施例还提供一种存储介质,其中存储有计算机程序,该计算机程序能够被处理器进行加载,以执行本申请实施例所提供的任一种方法中的步骤。To this end, embodiments of the present application also provide a storage medium in which a computer program is stored, and the computer program can be loaded by the processor to execute steps in any method provided by the embodiments of the present application.
其中,该存储介质可以包括:只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)、磁盘或光盘等。Among them, the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.
由于该存储介质中所存储的计算机程序,可以执行本申请实施例所提供的任一种方法中的步骤,因此,可以实现本申请实施例所提供的方法所能实现的有益效果,详见前面的实施例,在此不再赘述。Since the computer program stored in the storage medium can execute steps in any of the methods provided by the embodiments of the present application, it is possible to achieve the beneficial effects that can be achieved by the methods provided by the embodiments of the present application. For details, see above The embodiments will not be described again here.
本领域技术人员在考虑说明书及实践这里公开的实施方式后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。Other embodiments of the present application will be readily apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary technical means in the technical field that are not disclosed in this application. .
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的实施例,而可以在不脱离其范围的情况下进行各种修改和改变。 It should be understood that the present application is not limited to the embodiments which have been described above and shown in the drawings, but various modifications and changes may be made without departing from the scope thereof.

Claims (20)

  1. 一种代码编译方法,其中,包括:A code compilation method, including:
    将编译加速插件注入编译器,所述编译加速插件中包括变动分析逻辑以及依赖修改逻辑;Inject the compilation acceleration plug-in into the compiler, which includes change analysis logic and dependency modification logic;
    响应于所述编译器中执行至预定编译流程节点,执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块;In response to execution in the compiler reaching a predetermined compilation process node, executing the change analysis logic to perform change analysis on the project code to obtain an unchanged code module;
    通过所述编译加速插件对所述编译器的编译逻辑进行修改,将所述依赖修改逻辑动态注入所述编译逻辑,得到加速编译逻辑;Modify the compilation logic of the compiler through the compilation acceleration plug-in, and dynamically inject the dependency modification logic into the compilation logic to obtain accelerated compilation logic;
    执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译。Execute the accelerated compilation logic, and by modifying the module dependencies of the unchanged code modules, control the compilation process to compile only the changed code modules in the project code.
  2. 根据权利要求1所述的方法,其中,所述执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,包括:The method according to claim 1, wherein executing the change analysis logic to perform change analysis on the project code to obtain an unchanged code module includes:
    执行所述变动分析逻辑,对所述项目代码进行代码文件变更对比,得到所述项目代码的修改代码文件;Execute the change analysis logic, compare the code file changes of the project code, and obtain the modified code file of the project code;
    根据所述修改代码文件对应的文件路径,查找所述修改文件从属的代码模块,得到所述变动代码模块;According to the file path corresponding to the modified code file, search for the code module to which the modified file belongs, and obtain the changed code module;
    查找所述项目代码中除所述变动代码模块之外的代码模块,得到所述未变动代码模块。Search for code modules in the project code other than the changed code module to obtain the unmodified code module.
  3. 根据权利要求1所述的方法,其中,所述执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块,包括:The method according to claim 1, wherein executing the change analysis logic to perform change analysis on the project code to obtain an unchanged code module includes:
    执行所述变动分析逻辑,递归搜索所述项目代码中每个代码模块下代码文件的修改时间,得到每个代码模块下代码文件的当前修改时间;Execute the change analysis logic, recursively search the modification time of the code file under each code module in the project code, and obtain the current modification time of the code file under each code module;
    将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块。Compare the current modification time of the code file under each code module with the historical modification time of the code file under each code module to obtain the unchanged code module.
  4. 根据权利要求3所述的方法,其中,所述将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块,包括:The method according to claim 3, wherein the current modification time of the code file under each of the code modules is compared with the historical modification time of the code files under each of the code modules to obtain the unchanged code Modules, including:
    将每个所述代码模块下代码文件的当前修改时间进行信息摘要计算,得到每个所述代码模块对应的当前摘要;Calculate the information summary of the current modification time of the code file under each code module to obtain the current summary corresponding to each code module;
    获取每个所述代码模块对应的历史摘要,所述历史摘要为对每个所述代码模块下代码文件的历史修改时间进行信息摘要计算得到的;Obtain the historical summary corresponding to each of the code modules. The historical summary is obtained by calculating the information summary of the historical modification time of the code file under each of the code modules;
    比较每个所述代码模块对应的当前摘要与历史摘要,得到所述未变动代码模块。Compare the current summary and the historical summary corresponding to each code module to obtain the unchanged code module.
  5. 根据权利要求1所述的方法,其中,所述依赖修改逻辑包括模块依赖图分析逻辑以及依赖关系修改逻辑;The method according to claim 1, wherein the dependency modification logic includes module dependency graph analysis logic and dependency relationship modification logic;
    所述执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译,包括:The execution of the accelerated compilation logic, by modifying the module dependencies of the unchanged code modules, controls the compilation process to compile only the changed code modules in the project code, including:
    执行所述加速编译逻辑中的所述模块依赖图分析逻辑,对所述项目代码中的代码模块进行依赖分析,得到模块依赖图;Execute the module dependency graph analysis logic in the accelerated compilation logic, perform dependency analysis on the code modules in the project code, and obtain a module dependency graph;
    执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图;Execute the dependency modification logic in the accelerated compilation logic, modify the unchanged code module in the module dependency graph to the corresponding compiled file, and obtain a modified dependency graph;
    执行所述加速编译逻辑中的所述编译逻辑,根据所述修改后依赖图进行代码编译,以仅对所述项目代码中的变动代码模块进行编译。 Execute the compilation logic in the accelerated compilation logic, and perform code compilation according to the modified dependency graph to compile only the changed code modules in the project code.
  6. 根据权利要求4所述的方法,其中,所述编译加速插件中还包括本地仓库;The method according to claim 4, wherein the compilation acceleration plug-in further includes a local warehouse;
    所述执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图,包括:Execute the dependency modification logic in the accelerated compilation logic, modify the unchanged code module in the module dependency graph into the corresponding compiled file, and obtain a modified dependency graph, including:
    执行所述加速编译逻辑中的所述依赖关系修改逻辑,从所述本地仓库查询所述未变动代码模块对应的已编译文件;Execute the dependency modification logic in the accelerated compilation logic, and query the compiled files corresponding to the unchanged code modules from the local warehouse;
    将所述模块依赖图中的所述变动代码模块修改为所述已编译文件,得到修改后依赖图。Modify the changed code module in the module dependency graph into the compiled file to obtain a modified dependency graph.
  7. 根据权利要求1所述的方法,其中,在所述执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译之后,所述方法还包括:The method according to claim 1, wherein after the execution of the accelerated compilation logic, by modifying the module dependencies of the unchanged code modules, the compilation process is controlled to compile only the changed code modules in the project code. , the method also includes:
    若所述变动代码模块编译完成,通过所述编译加速插件将编译后的所述变动代码模块打包为变动代码模块编译文件;If the compilation of the modified code module is completed, the compiled modified code module is packaged into a modified code module compilation file through the compilation acceleration plug-in;
    将所述变动代码模块编译文件存储至所述编译加速插件中的本地仓库。The modified code module compilation file is stored in the local warehouse in the compilation acceleration plug-in.
  8. 根据权利要求2所述的方法,其中,所述执行所述变动分析逻辑,对所述项目代码进行代码文件变更对比,得到所述项目代码的修改代码文件,包括:The method according to claim 2, wherein the execution of the change analysis logic, comparing the code file changes of the project code, and obtaining the modified code file of the project code includes:
    执行所述变动分析逻辑中的git diff命令行,以将当前的所述项目代码与预定版本的项目代码进行比对,得到当前的所述项目代码中发生修改的修改代码文件。Execute the git diff command line in the change analysis logic to compare the current project code with the project code of the predetermined version to obtain the modified code files that have been modified in the current project code.
  9. 根据权利要求2所述的方法,其中,所述根据所述修改代码文件对应的文件路径,查找所述修改文件从属的代码模块,得到所述变动代码模块,包括:The method according to claim 2, wherein the step of searching for the code module to which the modified file belongs based on the file path corresponding to the modified code file to obtain the changed code module includes:
    执行所述变动分析逻辑中的路径查找命令行,以根据每个所述修改代码文件对应的文件路径查找到每个所述修改代码文件从属的代码模块,各所述修改代码文件从属的代码模块即发生了修改的所述变动代码模块。Execute the path search command line in the change analysis logic to find the code module to which each modified code file is subordinate based on the file path corresponding to each modified code file. The code module to which each modified code file is subordinate is found. That is, the modified code module has been modified.
  10. 根据权利要求3所述的方法,其中,所述将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块,包括:The method according to claim 3, wherein the current modification time of the code file under each of the code modules is compared with the historical modification time of the code files under each of the code modules to obtain the unchanged code Modules, including:
    将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到当前修改时间与历史修改时间不一致的代码模块;Compare the current modification time of the code file under each of the code modules with the historical modification time of the code file under each of the code modules to obtain the code module whose current modification time is inconsistent with the historical modification time;
    将所述当前修改时间与历史修改时间不一致的代码模块,确定为所述变动代码模块,其中,所述项目代码中除所述变动代码模块之外的代码模块为所述未变动代码模块。The code module whose current modification time is inconsistent with the historical modification time is determined as the changed code module, wherein the code modules in the project code other than the changed code module are the unchanged code modules.
  11. 根据权利要求1所述的方法,其中,所述响应于所述编译器中执行至预定编译流程节点,包括:The method according to claim 1, wherein the response to executing a predetermined compilation process node in the compiler includes:
    在所述编译器中启动编译流程后,若所述编译流程中完成遍历所述项目代码中每个代码模块的脚本来建立任务执行关系图的配置阶段,则确定所述编译器中执行至预定编译流程节点。After starting the compilation process in the compiler, if the compilation process completes the configuration phase of traversing the scripts of each code module in the project code to establish a task execution relationship graph, then it is determined that the compiler executes to the scheduled Compile process node.
  12. 一种代码编译装置,其中,包括:A code compilation device, which includes:
    注入单元,用于将编译加速插件注入编译器,所述编译加速插件中包括变动分析逻辑以及依赖修改逻辑;An injection unit is used to inject the compilation acceleration plug-in into the compiler. The compilation acceleration plug-in includes change analysis logic and dependency modification logic;
    分析单元,用于响应于所述编译器中执行至预定编译流程节点,执行所述变动分析逻辑对项目代码进行变动分析,得到未变动代码模块;An analysis unit, configured to execute the change analysis logic to perform change analysis on the project code in response to the execution of the predetermined compilation process node in the compiler to obtain an unchanged code module;
    修改单元,用于通过所述编译加速插件对所述编译器的编译逻辑进行修改, 将所述依赖修改逻辑动态注入所述编译逻辑,得到加速编译逻辑;a modification unit, used to modify the compilation logic of the compiler through the compilation acceleration plug-in, Dynamically inject the dependency modification logic into the compilation logic to obtain accelerated compilation logic;
    编译单元,用于执行所述加速编译逻辑,通过修改所述未变动代码模块的模块依赖,控制编译流程中仅对所述项目代码中变动代码模块进行编译。A compilation unit is used to execute the accelerated compilation logic and control only the changed code modules in the project code to be compiled in the compilation process by modifying the module dependencies of the unchanged code modules.
  13. 根据权利要求12所述的装置,其中,所述分析单元,用于:执行所述变动分析逻辑,对所述项目代码进行代码文件变更对比,得到所述项目代码的修改代码文件;根据所述修改代码文件对应的文件路径,查找所述修改文件从属的代码模块,得到所述变动代码模块;查找所述项目代码中除所述变动代码模块之外的代码模块,得到所述未变动代码模块。The device according to claim 12, wherein the analysis unit is configured to: execute the change analysis logic, perform code file change comparison on the project code, and obtain a modified code file of the project code; according to the Modify the file path corresponding to the code file, search for the code module to which the modified file is subordinate, and obtain the changed code module; search for the code modules in the project code other than the changed code module, and obtain the unchanged code module. .
  14. 根据权利要求12所述的装置,其中,所述分析单元,用于:执行所述变动分析逻辑,递归搜索所述项目代码中每个代码模块下代码文件的修改时间,得到每个代码模块下代码文件的当前修改时间;将每个所述代码模块下代码文件的当前修改时间与每个所述代码模块下代码文件的历史修改时间进行比较,得到所述未变动代码模块。The device according to claim 12, wherein the analysis unit is used to: execute the change analysis logic, recursively search the modification time of the code file under each code module in the project code, and obtain the modification time under each code module. The current modification time of the code file; compare the current modification time of the code file under each of the code modules with the historical modification time of the code file under each of the code modules to obtain the unchanged code module.
  15. 根据权利要求14所述的装置,其中,所述分析单元,用于:将每个所述代码模块下代码文件的当前修改时间进行信息摘要计算,得到每个所述代码模块对应的当前摘要;获取每个所述代码模块对应的历史摘要,所述历史摘要为对每个所述代码模块下代码文件的历史修改时间进行信息摘要计算得到的;比较每个所述代码模块对应的当前摘要与历史摘要,得到所述未变动代码模块。The device according to claim 14, wherein the analysis unit is used to: perform information summary calculation on the current modification time of the code file under each of the code modules to obtain the current summary corresponding to each of the code modules; Obtain the historical summary corresponding to each of the code modules. The historical summary is obtained by calculating the information summary of the historical modification time of the code file under each of the code modules; compare the current summary corresponding to each of the code modules with Historical summary, resulting in the unchanged code module.
  16. 根据权利要求12所述的装置,其中,所述依赖修改逻辑包括模块依赖图分析逻辑以及依赖关系修改逻辑;所述编译单元,用于:执行所述加速编译逻辑中的所述模块依赖图分析逻辑,对所述项目代码中的代码模块进行依赖分析,得到模块依赖图;执行所述加速编译逻辑中的所述依赖关系修改逻辑,将所述模块依赖图中的所述未变动代码模块修改为对应的已编译文件,得到修改后依赖图;执行所述加速编译逻辑中的所述编译逻辑,根据所述修改后依赖图进行代码编译,以仅对所述项目代码中的变动代码模块进行编译。The device according to claim 12, wherein the dependency modification logic includes module dependency graph analysis logic and dependency relationship modification logic; the compilation unit is configured to: perform the module dependency graph analysis in the accelerated compilation logic Logic: perform dependency analysis on the code modules in the project code to obtain a module dependency graph; execute the dependency modification logic in the accelerated compilation logic to modify the unchanged code modules in the module dependency graph For the corresponding compiled file, obtain a modified dependency graph; execute the compilation logic in the accelerated compilation logic, and perform code compilation according to the modified dependency graph to only modify the changed code modules in the project code. Compile.
  17. 根据权利要求16所述的装置,其中,所述编译加速插件中还包括本地仓库;所述编译单元,用于:执行所述加速编译逻辑中的所述依赖关系修改逻辑,从所述本地仓库查询所述未变动代码模块对应的已编译文件;将所述模块依赖图中的所述变动代码模块修改为所述已编译文件,得到修改后依赖图。The device according to claim 16, wherein the compilation acceleration plug-in further includes a local warehouse; the compilation unit is configured to: execute the dependency modification logic in the accelerated compilation logic, and obtain the dependency modification logic from the local warehouse. Query the compiled file corresponding to the unchanged code module; modify the changed code module in the module dependency graph to the compiled file to obtain a modified dependency graph.
  18. 根据权利要求12所述的装置,其中,所述装置还包括打包单元,用于:若所述变动代码模块编译完成,通过所述编译加速插件将编译后的所述变动代码模块打包为变动代码模块编译文件;将所述变动代码模块编译文件存储至所述编译加速插件中的本地仓库。The device according to claim 12, wherein the device further includes a packaging unit configured to: if the compilation of the modified code module is completed, package the compiled modified code module into modified code through the compilation acceleration plug-in. Module compilation file; store the changed code module compilation file in the local warehouse in the compilation acceleration plug-in.
  19. 一种存储介质,其中,其上存储有计算机程序,当所述计算机程序被计算机的处理器执行时,使计算机执行权利要求1至11任一项所述的方法。A storage medium, wherein a computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to perform the method described in any one of claims 1 to 11.
  20. 一种电子设备,其中,包括:存储器,存储有计算机程序;处理器,读取存储器存储的计算机程序,以执行权利要求1至11任一项所述的方法。 An electronic device, which includes: a memory storing a computer program; and a processor reading the computer program stored in the memory to execute the method according to any one of claims 1 to 11.
PCT/CN2023/102751 2022-09-09 2023-06-27 Code compiling method and apparatus, storage medium and electronic device WO2024051290A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211102504.5A CN117170634A (en) 2022-09-09 2022-09-09 Code compiling method and device, storage medium and electronic equipment
CN202211102504.5 2022-09-09

Publications (1)

Publication Number Publication Date
WO2024051290A1 true WO2024051290A1 (en) 2024-03-14

Family

ID=88935713

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/102751 WO2024051290A1 (en) 2022-09-09 2023-06-27 Code compiling method and apparatus, storage medium and electronic device

Country Status (2)

Country Link
CN (1) CN117170634A (en)
WO (1) WO2024051290A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160092181A1 (en) * 2014-09-30 2016-03-31 Advanced Micro Devices, Inc. Automatic source code generation for accelerated function calls
CN114461217A (en) * 2021-12-23 2022-05-10 北京达佳互联信息技术有限公司 Code compiling method and device, electronic equipment and storage medium
CN114911481A (en) * 2021-02-07 2022-08-16 腾讯科技(深圳)有限公司 Code compiling method and device and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160092181A1 (en) * 2014-09-30 2016-03-31 Advanced Micro Devices, Inc. Automatic source code generation for accelerated function calls
CN114911481A (en) * 2021-02-07 2022-08-16 腾讯科技(深圳)有限公司 Code compiling method and device and electronic equipment
CN114461217A (en) * 2021-12-23 2022-05-10 北京达佳互联信息技术有限公司 Code compiling method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN117170634A (en) 2023-12-05

Similar Documents

Publication Publication Date Title
CN111309335B (en) Compiling method and device of plug-in application and computer readable storage medium
US20120324454A1 (en) Control Flow Graph Driven Operating System
CN110990019B (en) Java class analysis method and device, storage medium and electronic equipment
US20130275948A1 (en) Compiling Source Code For Debugging With Expanded Snapshots
CN111625289B (en) Method and device for quickly starting application program and electronic equipment
JP2011198363A (en) Program compiler, apparatus and method for installing program
EP1963965B1 (en) Run-time tunable sample time in programming or modeling environments
CN110046100B (en) Packet testing method, electronic device and medium
CN102375759B (en) Utilize the method that finite state machine prevents code rewriting
CN104714839A (en) Method and device for controlling life cycle of processes
WO2024051290A1 (en) Code compiling method and apparatus, storage medium and electronic device
CN113609101A (en) Real-time data task issuing method and device, electronic equipment and storage medium
WO2013165460A1 (en) Control flow graph driven operating system
CN111563000B (en) File generation method, intelligent terminal and storage medium
CN115268909A (en) Method, system and terminal for establishing and running construction task at web front end
JPH10240546A (en) Execution time program translation method
WO2017128589A1 (en) Method of generating executable file and art virtual machine execution method and device
CN112800091A (en) Flow-batch integrated calculation control system and method
US9870257B1 (en) Automation optimization in a command line interface
WO2023221654A1 (en) Subprogram updating method and apparatus, and electronic device, computer-readable storage medium and computer program product
US20230244519A1 (en) Cloud Platform and Cloud Platform-Based Program Code Processing Method
CN115379263B (en) Control method and control system for play content of terminal equipment
CN110806867B (en) Handle management method, storage medium, electronic device and system
WO2022140880A1 (en) Method and apparatus for controlling finite state machine, computer device, and storage medium
US11188324B2 (en) Methods, systems, and articles of manufacture to perform heterogeneous data structure selection via programmer annotations

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23861991

Country of ref document: EP

Kind code of ref document: A1