WO2024051290A1 - Procédé et appareil de compilation de code, support de stockage et dispositif électronique - Google Patents

Procédé et appareil de compilation de code, support de stockage et dispositif électronique 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
English (en)
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/fr

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

La présente demande, qui relève du domaine technique des ordinateurs, divulgue un procédé et un appareil de compilation de code, un support de stockage et un dispositif électronique. Le procédé comprend : l'injection d'un module d'extension d'accélération de compilation dans un compilateur, et la réalisation d'une analyse de changement pour obtenir un module de code inchangé ; l'obtention d'une logique de compilation accélérée au moyen du module d'extension d'accélération de compilation ; et l'exécution de la logique de compilation accélérée, et au moyen de la modification de la dépendance de module, la commande pour compiler uniquement un module de code changé. La présente demande améliore l'effet d'accélération de compilation de code et la fiabilité de compilation.
PCT/CN2023/102751 2022-09-09 2023-06-27 Procédé et appareil de compilation de code, support de stockage et dispositif électronique WO2024051290A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211102504.5A CN117170634A (zh) 2022-09-09 2022-09-09 代码编译方法、装置、存储介质及电子设备
CN202211102504.5 2022-09-09

Publications (1)

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

Family

ID=88935713

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/102751 WO2024051290A1 (fr) 2022-09-09 2023-06-27 Procédé et appareil de compilation de code, support de stockage et dispositif électronique

Country Status (2)

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

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118151948B (zh) * 2024-05-13 2024-07-23 恒生电子股份有限公司 编译处理方法、装置、设备、存储介质以及程序产品

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 (zh) * 2021-12-23 2022-05-10 北京达佳互联信息技术有限公司 代码编译方法、装置、电子设备及存储介质
CN114911481A (zh) * 2021-02-07 2022-08-16 腾讯科技(深圳)有限公司 代码编译方法、装置以及电子设备

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 (zh) * 2021-02-07 2022-08-16 腾讯科技(深圳)有限公司 代码编译方法、装置以及电子设备
CN114461217A (zh) * 2021-12-23 2022-05-10 北京达佳互联信息技术有限公司 代码编译方法、装置、电子设备及存储介质

Also Published As

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

Similar Documents

Publication Publication Date Title
CN111309335B (zh) 插件应用的编译方法、装置及计算机可读存储介质
CN110990019B (zh) 一种Java类分析方法、装置、存储介质及电子设备
US20120324454A1 (en) Control Flow Graph Driven Operating System
US8881115B2 (en) Compiling source code for debugging with expanded snapshots
WO2024051290A1 (fr) Procédé et appareil de compilation de code, support de stockage et dispositif électronique
CN111625289B (zh) 应用程序快速启动方法、装置和电子设备
JP2011198363A (ja) プログラムコンパイラ、プログラム設置装置、及びプログラム設置方法
CN110046100B (zh) 一种分组测试的方法、电子设备及介质
CN102375759B (zh) 利用有限状态机防止代码重入的方法
CN117252559B (zh) 业务流程的处理方法、装置、计算机设备、存储介质
CN112800091A (zh) 一种流批一体式计算控制系统及方法
WO2013165460A1 (fr) Système d'exploitation piloté par graphe de contrôle
CN111563000B (zh) 一种文件生成方法、智能终端及存储介质
CN115268909A (zh) 一种web前端创建并运行构建任务的方法、系统和终端
US9870257B1 (en) Automation optimization in a command line interface
JPH10240546A (ja) 実行時プログラム翻訳方法
WO2017128589A1 (fr) Procédé de génération d'un fichier exécutable et procédé et dispositif d'exécution de machine virtuelle
CN113268267B (zh) 一种数据包生成方法、装置、计算机设备及存储介质
WO2023221654A1 (fr) Procédé et appareil de mise à jour de sous-programme, ainsi que dispositif électronique, support de stockage lisible par ordinateur et produit-programme d'ordinateur
CN111399931A (zh) 一种LayaAir引擎导出UI资源的方法及终端
US11360813B1 (en) Timer object management for a multiprocessor virtual environment
US20230244519A1 (en) Cloud Platform and Cloud Platform-Based Program Code Processing Method
CN112733153B (zh) 源代码扫描方法、装置、电子设备和存储介质
CN115379263B (zh) 一种终端设备的播放内容的管控方法和管控系统
CN110806867B (zh) 一种Handle管理方法、存储介质、电子设备及系统

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