Application program updating method and device, electronic equipment and storage medium
By updating the file inclusion relationship table during the application operation, determining and triggering the hot update of the included code files, the problem of missing hot updates in the prior art is solved, ensuring the integrity and functionality of the application.
Patent Information
- Application Number
- CN202410131695.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2025-08-01
AI Technical Summary
Existing hot update technologies cannot effectively trigger updates of code files (such as header files, link library files, etc.) that cannot be run directly in memory, resulting in missing hot updates of applications.
During the application running, the file contains the relationship table is updated in response to the file save instruction, and determine whether the code file is the included code file, and determine the code file that needs to be updated based on the latest relationship table, and perform corresponding hot updates.
It realizes that the hot updates contained code files are triggered accurately when any code file is saved, avoiding the omission of hot updates in the application and ensuring the integrity and functionality of the application.
Smart Images

Figure CN120406993A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer processing technologies, and in particular, to a method, apparatus, electronic device, and storage medium for updating an application program. Background Art
[0002] An update during program operation is called a hot update. The hot update can quickly fix problems, add functions, and optimize the system without stopping the machine, improving development efficiency and user experience.
[0003] Existing hot update technologies only monitor and update code files that can be directly run in memory. If these code files contain the content of other code files, and the included code files cannot be directly run in memory (such as common logic files like header files and library files), then when such included-only code files are modified or created, hot updates often cannot be triggered, and files containing such code content cannot be hot updated, resulting in omissions in the hot update of the application program. Summary of the Invention
[0004] In view of this, the purpose of the present disclosure is to provide a method, apparatus, electronic device, and storage medium for updating an application program to avoid omissions in the hot update of the application program.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for updating an application program, the method including: during the running of a target application program, in response to a file save instruction for a first code file, updating a preset file inclusion relationship table to obtain an up-to-date file inclusion relationship table; according to the up-to-date file inclusion relationship table, determining whether the first code file is an included code file; if the first code file is an included code file, determining at least one second code file that includes the content of the first code file according to the up-to-date file inclusion relationship table; and updating at least part of the second code files to obtain a target application program that runs based on the up-to-date at least part of the second code files.
[0006] In a second aspect, an embodiment of the present disclosure provides an update device for an application program. The device includes: a first update module configured to update a preset file inclusion relationship table during the running of a target application program in response to a file save instruction for a first code file, so as to obtain an up-to-date file inclusion relationship table; a first judgment module configured to judge, according to the up-to-date file inclusion relationship table, whether the first code file is an included code file; a first determination module configured to, if the first code file is an included code file, determine at least one second code file including the content of the first code file according to the up-to-date file inclusion relationship table; and a second update module configured to update at least part of the second code files to obtain a target application program running based on the up-to-date at least part of the second code files.
[0007] In a third aspect, an embodiment of the present disclosure provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-mentioned application program update method.
[0008] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the above-mentioned application program update method.
[0009] The embodiments of the present disclosure bring the following beneficial effects:
[0010] For the above-mentioned application program update method, device, electronic device and storage medium, during the running of the target application program, in response to a file save instruction for a first code file, a preset file inclusion relationship table is updated to obtain an up-to-date file inclusion relationship table; according to the up-to-date file inclusion relationship table, it is judged whether the first code file is an included code file; if the first code file is an included code file, at least one second code file including the content of the first code file is determined according to the up-to-date file inclusion relationship table; and at least part of the second code files are updated to obtain a target application program running based on the up-to-date at least part of the second code files. In this way, when any code file is saved, it is determined whether the saved code file is an included code file, thereby triggering the hot update of the code file including the content of the included code file, and avoiding omission in the hot update of the application program.
[0011] Other features and advantages of the present disclosure will be described in the subsequent description, and will be partly apparent from the description, or will be understood by implementing the present disclosure. The objectives and other advantages of the present disclosure are realized and obtained by the structures specifically pointed out in the description, claims and drawings.
[0012] To make the above objects, features, and advantages of the present disclosure more obvious and understandable, the following provides preferred embodiments in conjunction with the accompanying drawings and detailed descriptions are as follows. Description of the Drawings
[0013] To more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present disclosure. For those skilled in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0014] Figure 1 It is a flowchart of an embodiment of the application update method in the embodiments of the present disclosure;
[0015] Figure 2 It is a flowchart of another embodiment of the application update method in the embodiments of the present disclosure;
[0016] Figure 3 It is a schematic diagram of an application update device provided by the embodiments of the present disclosure;
[0017] Figure 4 It is a schematic diagram of an electronic device provided by the embodiments of the present disclosure. Detailed Embodiments
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the following will clearly and completely describe the technical solutions of the present disclosure in conjunction with the drawings. Obviously, the described embodiments are some, but not all, of the embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative efforts fall within the scope of protection of the present disclosure.
[0019] The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims, and drawings of the present disclosure are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" or "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0020] For ease of understanding, the following describes the specific process of the embodiments of the present disclosure. Please refer to Figure 1 , an embodiment of the update method of the application program in the embodiments of the present disclosure includes:
[0021] Step S10: During the running of the target application program, in response to a file saving instruction for the first code file, update a preset file inclusion relationship table to obtain the latest file inclusion relationship table;
[0022] It can be understood that when the target application program is running, an executable type of code file (referred to as the main code file for short) will be directly loaded into the memory. In the embodiments of the present disclosure, during the running of the target application program, the executable type of code file in the memory is updated, so as to update the target application program without stopping or restarting the target application program. The executable types of code files written in different programming languages are different. It is possible to determine whether a code file is of an executable type or other types according to the suffix of the code file. The code file types of the target application program also include non-executable types. Non-executable types of code files (referred to as common code files for short) will not be directly loaded into the memory for running. For example, a code file used to store common logic or common data is also a non-executable type of code file. The code in the common code file is run in the memory by being spliced into the executable type of code file. For example, if the second code file contains the content of the first code file, then when the compiler or interpreter of the code loads the second code file, the actually loaded is the second code file spliced with the content of the first code file. The first code file can be an executable type of code file of the target application program or a non-executable type of code file of the target application program. The embodiments of the present disclosure avoid omissions in the hot update of the application program by comprehensively monitoring changes in different types of code files.
[0023] The first code file can be an existing code file in the target application program or a newly added code file. When a file saving instruction for the target application program is triggered, update the preset file inclusion relationship table according to the first code file indicated by the file saving instruction to obtain the latest file inclusion relationship table. Among them, the preset file inclusion relationship table can be the original file inclusion relationship table generated before step S10, or the file inclusion relationship table with the closest update time to the current time. For example, the latest file inclusion relationship table obtained when the last file saving instruction for the target application program was triggered. Specifically, it is not limited here.
[0024] The file inclusion relationship table is used to indicate the inclusion relationship between code files. When the first code file is saved, the inclusion relationship between code files may change. Therefore, it is necessary to first update the preset file inclusion relationship table to obtain the latest file inclusion relationship table, and then determine the second code file to be updated based on the latest file inclusion relationship table, so as to avoid omissions in the hot update of the application.
[0025] In one implementation, when updating the preset file inclusion relationship table, first determine the code files included in the first code file according to the first code file, and then update the preset file inclusion relationship table according to the inclusion relationship between the first code file and the code files it includes to obtain the latest file inclusion relationship table.
[0026] The file inclusion relationship table can be used to indicate the inclusion relationship between code files or the included relationship between code files. For example, assuming that code file A includes code file B, and the file inclusion relationship table stores data in a key-value pair data structure, then code file A is the including code file and code file B is the included code file. What can be recorded in the file inclusion relationship table can be key: A; value: {B} (i.e., the inclusion relationship), or key: B; value: {A} (i.e., the included relationship). The specific details are not limited here.
[0027] Step S20: Determine whether the first code file is an included code file according to the latest file inclusion relationship table;
[0028] It can be understood that whether the file inclusion relationship table records the inclusion relationship between code files or the included relationship between code files, it can be used to determine whether the first code file is an included code file. If the file inclusion relationship table records the inclusion relationship between code files, then the values corresponding to all keys in the file inclusion relationship table can be traversed. If the identifier of the first code file is included in the value corresponding to any key, it is determined that the first code file is an included code file; if the file inclusion relationship table records the included relationship between code files, then directly search whether the identifier of the first code file exists in the keys of the file inclusion relationship table. If it exists, it is determined that the first code file is an included code file. Thus, recording the included relationship between code files in the file inclusion relationship table can more efficiently determine whether a code file is an included code file, and thus trigger the hot update of the main code file more quickly.
[0029] It should be noted that there can be an inclusion relationship between the main code files, and there can also be an inclusion relationship between the common code files. Since the common code files are usually the included code files, in this embodiment, by identifying the included code files, when the common code file changes, the hot update logic of the associated main code files can be automatically triggered, thereby avoiding omissions in the hot update of the application. If the first code file is not an included code file but belongs to the main code file, the first code file can be directly hot updated; if the first code file is not an included code file and does not belong to the main code file, no hot update is required.
[0030] In this embodiment, the file inclusion relationship table records the inclusion / being-included relationship between code files through code file identifiers. Among them, the code file identifier can be the hash code of the code file, a custom encoding, a file path, etc., which are symbols that can be used to identify files. Specifically, it is not limited here.
[0031] Step S30: If the first code file is an included code file, determine at least one second code file that includes the content of the first code file according to the latest file inclusion relationship table;
[0032] If the first code file is an included code file, the identifiers of at least one second code file can be extracted from the latest file inclusion relationship table to determine at least one second code file. Among them, the second code file is the containing code file, and each second code file contains the content of the first code file. For example, the execution of multiple main code files of the target application depends on a certain functional logic. Then, this functional logic can be encapsulated into a common code file and introduced by each main code file, which can simplify the development of the main code files and make the logic of the application more modular. If this common code file is the first code file, these main code files are the second code files that include the content of the first code file.
[0033] Step S40: Update at least some of the second code files to obtain a target application that runs based on the latest at least some of the second code files.
[0034] It should be noted that since the common logic of the program may be associated with a large number of main code files, the number of second code files containing the content of the first code file may be large. If all the included code files are updated every time the common code file is modified, it may cause the application to freeze. In this embodiment, generally, not all second code files will be updated, but at least some second code files will be updated. Among them, at least some second code files may be the second code files being executed in memory. The at least some second code files to be updated can be determined according to the number of file modifications or pre-divided functional modules, or at least some second code files can be specified. Specifically, it is not limited here.
[0035] In this embodiment, for all updates of the application, the code files are updated into memory, that is, hot updated, so that the target application can run without interruption and obtain the latest target application that runs based on at least some updated second code files, improving the comprehensiveness of the hot update.
[0036] For the application update method provided in the above embodiment, when any code file is saved, it is determined whether the saved code file is an included code file, thereby triggering the hot update of the code file containing the content of the included code file, avoiding omissions in the hot update of the application.
[0037] Please refer to Figure 2 , another embodiment of the application update method in the embodiments of the present disclosure includes:
[0038] Step S201: Scan the inclusion statements of all code files of the target application to determine the inclusion code files that contain the content of other code files, and the code files directly included by the inclusion code files, to obtain the original direct inclusion relationship table;
[0039] In this embodiment, the code files are associated with the content of other code files through inclusion statements. Therefore, when generating the original file inclusion relationship table, first scan all the code files of the target application to determine whether there is an inclusion statement in each code file. If there is, the code file with the inclusion statement is determined as the inclusion code file, then parse the inclusion statements in the inclusion code file to determine the code files directly included by the inclusion code file. Finally, construct the direct inclusion relationship between each inclusion code file and the code file it directly includes to obtain the original direct inclusion relationship table.
[0040] In one embodiment, step S201 includes: scanning all code files of the target application for inclusion statements to determine the including code files with inclusion statements; the inclusion statements include the path information of the included code files; determining whether the path information in each inclusion statement is legal absolute path information; if the path information in the inclusion statement is legal absolute path information, recording the path information in the inclusion statement as the code file directly included by the corresponding including file to obtain the original direct inclusion relationship table. In this embodiment, in order to more quickly determine the associated code files that need to be updated, the absolute path information of the code files is used as the identifier of the code files in the file inclusion relationship table for relationship binding. Therefore, when generating the original direct inclusion relationship table, the absolute path information of the code files is recorded, so that the other relationship tables generated based on the direct inclusion relationship table also correspondingly include the absolute path information of the code files. It can be understood that since the path information of the included code files associated through the inclusion statements may be relative path information or illegal path information, when an inclusion statement is scanned, by determining whether the path information in the inclusion statement is absolute path information and whether it is legal absolute path information, it is ensured that the location of the code files that need to be updated can be directly determined through the file inclusion relationship table. It should be noted that legal absolute path information means that the file directory indicated by the path information of the included code file contains the corresponding included code file.
[0041] In one embodiment, if the path information in the inclusion statement is legal relative path information, after converting the path information in the inclusion statement into absolute path information, it is recorded as the code file directly included by the corresponding including file.
[0042] Step S202: According to the original direct inclusion relationship table, determine the list of including code files corresponding to each included code file to obtain the original file inclusion relationship table;
[0043] After obtaining the original direct inclusion relationship table, the included code files in the direct inclusion relationship table can be converted into keys, and the including code files that include the included code files can be converted into the values corresponding to the keys, so as to obtain the original file inclusion relationship table. In one implementation, each key-value pair in the file inclusion relationship table can be used to indicate the direct inclusion relationship between the included code file and the list of including code files, or can also be used to indicate the direct inclusion relationship and the indirect inclusion relationship between the included code file and the list of including code files. Specifically, it is not limited here. For example, if the inclusion statement in code file A is associated with code file B, and the inclusion statement in code file B is associated with code file C, then code file A directly includes code file B, code file A indirectly includes code file C, code file B directly includes code file C. As an included code file, the corresponding list of including code files can include only code file B, or can include code file B and code file C.
[0044] In one implementation, step S202 includes: performing reverse data collection on the original direct inclusion relationship table to determine the list of direct including code files corresponding to each included code file, so as to obtain the original direct included relationship table; traversing and recursively searching the original direct included relationship table to determine the direct including code files and indirect including code files corresponding to each included code file, so as to obtain the original file inclusion relationship table. To improve the search efficiency of the including code files corresponding to the included code files, the file inclusion relationship is recorded in the file inclusion relationship table in the way that the identifier of the included code file is the key and the list of including code files is the value. Therefore, in this implementation, first reverse the keys and values in the original direct inclusion relationship table, that is, convert the values in the original direct inclusion relationship table into keys, and convert the values into keys, so as to obtain the original direct included relationship table. Then, traverse and recursively search the original direct included relationship table, and record the direct including code files and indirect including code files corresponding to each key as values, so as to obtain the original file inclusion relationship table. For example, assume that code file A directly includes code file B, and code file B directly includes code file C. Then, the key-value pairs recorded in the direct included relationship table include: B - A and C - B; the key-value pairs recorded in the file inclusion relationship table include: B - A and C - [A, B].
[0045] Step S203, during the running of the target application, in response to a file save instruction for the first code file, update the preset file inclusion relationship table to obtain the latest file inclusion relationship table;
[0046] In one embodiment, when updating a preset file inclusion relationship table, the file inclusion relationship table may be regenerated by the original generation method of the file inclusion relationship table, or the file inclusion relationship corresponding to the first code file in the preset file inclusion relationship table may be updated based on the list of directly included code files determined by the first code file, so as to obtain the latest file inclusion relationship table.
[0047] In one embodiment, step S203 includes: during the running of the target application, in response to a file save instruction for the first code file, scanning the inclusion statements of the first code file to determine the list of directly included code files corresponding to the first code file; updating the preset direct inclusion relationship table according to the list of directly included code files corresponding to the first code file to obtain the latest direct inclusion relationship table; where the preset direct inclusion relationship table is the direct inclusion relationship table with the update time closest to the current time; clearing the preset file inclusion relationship table; the preset file inclusion relationship table is the original file inclusion relationship table or the file inclusion relationship table with the update time closest to the current time; determining the list of including code files corresponding to each included code file according to the latest direct inclusion relationship table to obtain the latest file inclusion relationship table.
[0048] In this embodiment, first, by scanning the inclusion statements in the first code file, the directly included code files directly included by the first code file are determined to obtain the list of directly included code files corresponding to the first code file, and then the list of directly included code files corresponding to the first code file in the preset direct inclusion relationship table is updated to obtain the latest direct inclusion relationship table. Then, the preset file inclusion relationship table is cleared, and according to the latest direct inclusion relationship table, the list of including code files corresponding to each included code file is re-determined to obtain the latest file inclusion relationship table. In this embodiment, since the change or addition of a code file may affect multiple key-value pairs in the file inclusion relationship table, clearing and regenerating the preset file inclusion relationship table can store the included relationship between code files more accurately, avoiding omissions in the hot update of the application. And regenerating the file inclusion relationship table through the latest direct inclusion relationship table will not significantly reduce the efficiency of generating the file inclusion relationship compared to regenerating the file inclusion relationship table by scanning all code files again. It is an accurate and efficient generation method.
[0049] In one embodiment, based on the latest direct inclusion relationship table, determining the list of including code files corresponding to each included code file to obtain the latest file inclusion relationship table includes: performing reverse data collection on the latest direct inclusion relationship table to determine the list of direct including code files corresponding to each included code file, obtaining the latest direct inclusion relationship table; traversing and recursively searching the latest direct inclusion relationship table to determine the direct including code files and indirect including code files corresponding to each included code file, obtaining the latest file inclusion relationship table. In this embodiment, the generation method of the latest file inclusion relationship table is similar to that of the original file inclusion relationship table, and the details are not described here again.
[0050] In one embodiment, after step S203, it further includes: determining whether the first code file is a code file loaded during the operation of the target application; if the first code file is a code file loaded during the operation of the target application, then updating the first code file. It should be noted that when the first code file is saved, it can also be determined whether the first code file is a code file loaded during the operation of the target application, that is, determining whether the first code file is the main code file. If so, the first code file is updated to the memory. If not, the first code file does not need to be updated to the memory, making the hot update of the application more comprehensive.
[0051] Step S204: According to the latest file inclusion relationship table, determine whether the first code file is an included code file;
[0052] In one embodiment, step S204 includes: querying the latest file inclusion relationship table for the first code file to obtain a query result; wherein, the query result is used to indicate whether there is a corresponding including code file for the first code file; the including code file is a second code file that includes the content of the first code file; if the query result indicates that there is a corresponding including code file for the first code file, then determine that the first code file is an included code file. In this embodiment, when determining whether the first code file is an included code file, by querying whether the latest file inclusion relationship table contains a key-value pair with the identifier of the first code file as the key to obtain the query result. If it contains, it means that the first code file is an included file, and the including code file corresponding to the first code file in the query result is the second code file.
[0053] Step S205: If the first code file is an included code file, then according to the latest file inclusion relationship table, determine at least one second code file that includes the content of the first code file;
[0054] In one implementation, step S205 includes: if the first code file is an included code file, determining the including code file corresponding to the first code file in the latest file inclusion relationship table as the second code file including the content of the first code file, to obtain at least one second code file. It can be understood that the including code files in the list of the including code files corresponding to the first code file in the latest file inclusion relationship table are the second code files.
[0055] Step S206: Update at least some of the second code files to obtain a target application running based on the latest at least some of the second code files.
[0056] In one implementation, step S206 includes: if the target application runs in a test environment, updating at least some of the second code files among all the second code files according to the latest modification time of each second code file, to obtain a target application running based on the latest at least some of the second code files; if the target application runs in a production environment, updating all the second code files to obtain a target application running based on the latest all the second code files.
[0057] For the test environment, it is not necessary to update all the second code files. According to the latest modification time of each second code file, the second code files whose latest modification time is later than the preset modification time can be determined as the second code files to be updated, or the latest modification times can be sorted, and the preset number of second code files closest to the current time can be determined as the second code files to be updated. For example, it is possible to only update the second code files modified today or within this week, or to update the first 10 second code files modified most recently. Specifically, it is not limited here. It can be understood that in the test environment, only updating some of the second code files modified recently is usually sufficient to cover the function logic being developed or debugged recently. This implementation can improve the development efficiency of the application. For the production environment, the focus is on the integrity of the entire application function, and the hot update needs to cover all function logics. Therefore, if the target application runs in the production environment, all the second code files are updated, so as to obtain the latest running target application without stopping or restarting the target application.
[0058] For the application update method provided by the above implementation, first, by scanning the include statements in the code files, a file inclusion relationship table is constructed. When any code file is saved, the file inclusion relationship table is updated first, and then it is determined whether the saved code file is an included code file through the file inclusion relationship table, so as to more accurately trigger the hot update of the code file including the content of the included code file, and avoid omissions in the hot update of the application.
[0059] Corresponding to the above method embodiments, refer to Figure 3 The schematic diagram of an update device for an application program shown in the figure. The device includes: a first update module 32, configured to update a preset file inclusion relationship table during the running of the target application program in response to a file save instruction for a first code file, to obtain the latest file inclusion relationship table; a first judgment module 34, configured to judge whether the first code file is an included code file according to the latest file inclusion relationship table; a first determination module 36, configured to, if the first code file is an included code file, determine at least one second code file including the content of the first code file according to the latest file inclusion relationship table; a second update module 38, configured to update at least some of the second code files to obtain a target application program running based on the latest at least some of the second code files.
[0060] The above update device for an application program discriminates whether the saved code file is an included code file when any code file is saved, so as to trigger the hot update of the code file including the content of the included code file, and avoid omission in the hot update of the application program.
[0061] Optionally, the above device further includes: a code scanning module, configured to perform an inclusion statement scan on all code files of the target application program to determine the including code files including the content of other code files, and the code files directly included by the including code files, to obtain an original direct inclusion relationship table; a second determination module, configured to determine a list of including code files corresponding to each included code file according to the original direct inclusion relationship table, to obtain an original file inclusion relationship table.
[0062] Optionally, the above second determination module is specifically configured to: perform reverse data collection on the original direct inclusion relationship table to determine a list of direct including code files corresponding to each included code file, to obtain an original direct included relationship table; traverse and recursively search the original direct included relationship table to determine the direct including code files and indirect including code files corresponding to each included code file, to obtain an original file inclusion relationship table.
[0063] Optionally, the above-mentioned first update module 32 includes: a code scanning unit, configured to, during the running of the target application, in response to a file saving instruction for the first code file, perform an inclusion statement scan on the first code file to determine a list of directly included code files corresponding to the first code file; a first update unit, configured to update a preset direct inclusion relationship table according to the list of directly included code files corresponding to the first code file to obtain an up-to-date direct inclusion relationship table; wherein, the preset direct inclusion relationship table is the direct inclusion relationship table with the update time closest to the current time; a data clearing unit, configured to clear a preset file inclusion relationship table; the preset file inclusion relationship table is the original file inclusion relationship table or the file inclusion relationship table with the update time closest to the current time; a first determination unit, configured to determine a list of including code files corresponding to each included code file according to the up-to-date direct inclusion relationship table to obtain an up-to-date file inclusion relationship table.
[0064] Optionally, the above-mentioned first determination unit is specifically configured to: perform reverse data collection on the up-to-date direct inclusion relationship table to determine a list of directly including code files corresponding to each included code file to obtain an up-to-date directly included relationship table; traverse and recursively search the up-to-date directly included relationship table to determine the directly including code files and indirectly including code files corresponding to each included code file to obtain an up-to-date file inclusion relationship table.
[0065] Optionally, the above-mentioned code scanning module is specifically configured to: perform an inclusion statement scan on all code files of the target application to determine the including code files with inclusion statements; the inclusion statement includes the path information of the included code file; determine whether the path information in each inclusion statement is legal absolute path information; if the path information in the inclusion statement is legal absolute path information, record the path information in the inclusion statement as the code file directly included by the corresponding including file to obtain an original direct inclusion relationship table.
[0066] Optionally, the above-mentioned first judgment module 34 is specifically configured to: perform a query for the first code file on the up-to-date file inclusion relationship table to obtain a query result; wherein, the query result is used to indicate whether there is a corresponding including code file for the first code file; the including code file is a second code file including the content of the first code file; if the query result indicates that there is a corresponding including code file for the first code file, determine that the first code file is an included code file.
[0067] Optionally, the first determining module 36 is specifically configured to: if the first code file is an included code file, determine the including code file corresponding to the first code file in the latest file inclusion relationship table as the second code file including the content of the first code file, so as to obtain at least one second code file.
[0068] Optionally, the second updating module 38 is specifically configured to: if the target application runs in a test environment, update at least some of the second code files among all the second code files according to the latest modification time of each second code file, so as to obtain a target application running based on the latest at least some of the second code files; if the target application runs in a production environment, update all the second code files, so as to obtain a target application running based on the latest all the second code files.
[0069] Optionally, the apparatus further includes: a first judging module, configured to judge whether the first code file is a code file loaded during the running of the target application; a second updating module, configured to update the first code file if the first code file is a code file loaded during the running of the target application.
[0070] This embodiment further provides an electronic device, including a processor and a memory, where the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above application update method. The electronic device may be a server or a terminal device.
[0071] See Figure 4 As shown, the electronic device includes a processor 400 and a memory 401, and the memory 401 stores machine-executable instructions that can be executed by the processor 400, and the processor 400 executes the machine-executable instructions to implement the above application update method.
[0072] Furthermore, Figure 4 As shown, the electronic device further includes a bus 402 and a communication interface 403, and the processor 400, the communication interface 403 and the memory 401 are connected through the bus 402.
[0073] Among them, the memory 401 may include high-speed random access memory (RAM), and may also include non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 402 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 4 only a bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0074] The processor 400 may be an integrated circuit chip with signal processing capabilities. In the implementation process, the steps of the above method can be completed by the integrated logic circuit in the hardware of the processor 400 or the instructions in the form of software. The above-mentioned processor 400 can be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it can also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present disclosure can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers, etc. This storage medium is located in the memory 401, and the processor 400 reads the information in the memory 401 and combines its hardware to complete the steps of the method in the foregoing embodiments, for example:
[0075] During the running of the target application, in response to a file saving instruction for the first code file, update the preset file inclusion relationship table to obtain the latest file inclusion relationship table; according to the latest file inclusion relationship table, determine whether the first code file is an included code file; if the first code file is an included code file, then according to the latest file inclusion relationship table, determine at least one second code file that includes the content of the first code file; update at least part of the second code files to obtain the target application that runs based on the latest at least part of the second code files.
[0076] In this method, when any code file is saved, it is determined whether the saved code file is an included code file, so as to trigger the hot update of the code file that includes the content of the included code file, and avoid omission in the hot update of the application.
[0077] Optionally, during the running of the target application, before updating the preset file inclusion relationship table to obtain the latest file inclusion relationship table in response to a file saving instruction for the first code file, the method further includes: scanning the inclusion statements of all code files of the target application to determine the including code files that include the content of other code files, and the code files directly included by the including code files, to obtain the original direct inclusion relationship table; according to the original direct inclusion relationship table, determine the list of including code files corresponding to each included code file to obtain the original file inclusion relationship table.
[0078] Optionally, determining the list of including code files corresponding to each included code file according to the original direct inclusion relationship table to obtain the original file inclusion relationship table includes: performing reverse data collection on the original direct inclusion relationship table to determine the list of directly including code files corresponding to each included code file to obtain the original directly included relationship table; traversing and recursively searching the original directly included relationship table to determine the directly including code files and indirectly including code files corresponding to each included code file to obtain the original file inclusion relationship table.
[0079] Optionally, during the running of the target application, in response to a file saving instruction for the first code file, update the preset file inclusion relationship table to obtain the latest file inclusion relationship table, including: during the running of the target application, in response to a file saving instruction for the first code file, perform an inclusion statement scan on the first code file to determine the list of directly included code files corresponding to the first code file; update the preset direct inclusion relationship table according to the list of directly included code files corresponding to the first code file to obtain the latest direct inclusion relationship table; where the preset direct inclusion relationship table is the direct inclusion relationship table with the update time closest to the current time; clear the preset file inclusion relationship table; the preset file inclusion relationship table is the original file inclusion relationship table or the file inclusion relationship table with the update time closest to the current time; determine the list of including code files corresponding to each included code file according to the latest direct inclusion relationship table to obtain the latest file inclusion relationship table.
[0080] Optionally, determine the list of including code files corresponding to each included code file according to the latest direct inclusion relationship table to obtain the latest file inclusion relationship table, including: perform reverse data collection on the latest direct inclusion relationship table to determine the list of directly including code files corresponding to each included code file to obtain the latest directly included relationship table; traverse and recursively search the latest directly included relationship table to determine the directly including code files and indirectly including code files corresponding to each included code file to obtain the latest file inclusion relationship table.
[0081] Optionally, perform an inclusion statement scan on all code files of the target application to determine the including code files that contain the content of other code files and the code files directly included by the including code files to obtain the original direct inclusion relationship table, including: perform an inclusion statement scan on all code files of the target application to determine the including code files with inclusion statements; the inclusion statement includes the path information of the included code file; determine whether the path information in each inclusion statement is legal absolute path information; if the path information in the inclusion statement is legal absolute path information, record the path information in the inclusion statement as the code file directly included by the corresponding including file to obtain the original direct inclusion relationship table.
[0082] Optionally, according to the latest file inclusion relationship table, determine whether the first code file is an included code file, including: querying the first code file in the latest file inclusion relationship table to obtain a query result; wherein, the query result is used to indicate whether there is a corresponding including code file for the first code file; the including code file is a second code file that includes the content of the first code file; if the query result indicates that there is a corresponding including code file for the first code file, then determine that the first code file is an included code file.
[0083] Optionally, if the first code file is an included code file, then according to the latest file inclusion relationship table, determine at least one second code file that includes the content of the first code file, including: if the first code file is an included code file, then determine the including code file corresponding to the first code file in the latest file inclusion relationship table as the second code file that includes the content of the first code file, to obtain at least one second code file.
[0084] Optionally, update at least some of the second code files to obtain a target application running based on the latest at least some of the second code files, including: if the target application runs in a test environment, then according to the latest modification time of each second code file, update at least some of the second code files among all the second code files to obtain a target application running based on the latest at least some of the second code files; if the target application runs in a production environment, then update all the second code files to obtain a target application running based on the latest all the second code files.
[0085] Optionally, during the running of the target application, in response to a file saving instruction for the first code file, after updating the preset file inclusion relationship table to obtain the latest file inclusion relationship table, the method further includes: determining whether the first code file is a code file loaded during the running of the target application; if the first code file is a code file loaded during the running of the target application, then update the first code file.
[0086] This embodiment also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the above application update method, for example:
[0087] During the running of the target application, in response to a file saving instruction for the first code file, update the preset file inclusion relationship table to obtain the latest file inclusion relationship table; according to the latest file inclusion relationship table, determine whether the first code file is an included code file; if the first code file is an included code file, then according to the latest file inclusion relationship table, determine at least one second code file that includes the content of the first code file; update at least part of the second code files to obtain the target application that runs based on the latest at least part of the second code files.
[0088] In this method, when any code file is saved, it is determined whether the saved code file is an included code file, so as to trigger the hot update of the code file that includes the content of the included code file, avoiding omissions in the hot update of the application.
[0089] Optionally, during the running of the target application, before updating the preset file inclusion relationship table to obtain the latest file inclusion relationship table in response to a file saving instruction for the first code file, the method further includes: scanning the inclusion statements of all code files of the target application to determine the including code files that include the content of other code files, and the code files directly included by the including code files, to obtain the original direct inclusion relationship table; according to the original direct inclusion relationship table, determine the list of including code files corresponding to each included code file to obtain the original file inclusion relationship table.
[0090] Optionally, determining the list of including code files corresponding to each included code file according to the original direct inclusion relationship table to obtain the original file inclusion relationship table includes: performing reverse data collection on the original direct inclusion relationship table to determine the list of directly including code files corresponding to each included code file to obtain the original direct inclusion relationship table; traversing and recursively searching the original direct inclusion relationship table to determine the directly including code files and indirectly including code files corresponding to each included code file to obtain the original file inclusion relationship table.
[0091] Optionally, during the running of the target application, in response to a file saving instruction for the first code file, update the preset file inclusion relationship table to obtain the latest file inclusion relationship table, including: during the running of the target application, in response to a file saving instruction for the first code file, perform an inclusion statement scan on the first code file to determine the list of directly included code files corresponding to the first code file; update the preset direct inclusion relationship table according to the list of directly included code files corresponding to the first code file to obtain the latest direct inclusion relationship table; where the preset direct inclusion relationship table is the direct inclusion relationship table with the update time closest to the current time; clear the preset file inclusion relationship table; the preset file inclusion relationship table is the original file inclusion relationship table or the file inclusion relationship table with the update time closest to the current time; determine the list of including code files corresponding to each included code file according to the latest direct inclusion relationship table to obtain the latest file inclusion relationship table.
[0092] Optionally, determine the list of including code files corresponding to each included code file according to the latest direct inclusion relationship table to obtain the latest file inclusion relationship table, including: perform reverse data collection on the latest direct inclusion relationship table to determine the list of directly including code files corresponding to each included code file to obtain the latest direct inclusion relationship table; traverse and recursively search the latest direct inclusion relationship table to determine the directly including code files and indirectly including code files corresponding to each included code file to obtain the latest file inclusion relationship table.
[0093] Optionally, perform an inclusion statement scan on all code files of the target application to determine the including code files that contain the content of other code files and the code files directly included by the including code files to obtain the original direct inclusion relationship table, including: perform an inclusion statement scan on all code files of the target application to determine the including code files with inclusion statements; the inclusion statement includes the path information of the included code file; determine whether the path information in each inclusion statement is legal absolute path information; if the path information in the inclusion statement is legal absolute path information, record the path information in the inclusion statement as the code file directly included by the corresponding including file to obtain the original direct inclusion relationship table.
[0094] Optionally, according to the latest file inclusion relationship table, determine whether the first code file is an included code file, including: query the first code file in the latest file inclusion relationship table to obtain a query result; wherein, the query result is used to indicate whether there is a corresponding including code file for the first code file; the including code file is a second code file that includes the content of the first code file; if the query result indicates that there is a corresponding including code file for the first code file, then determine that the first code file is an included code file.
[0095] Optionally, if the first code file is an included code file, then according to the latest file inclusion relationship table, determine at least one second code file that includes the content of the first code file, including: if the first code file is an included code file, then determine the including code file corresponding to the first code file in the latest file inclusion relationship table as the second code file that includes the content of the first code file, to obtain at least one second code file.
[0096] Optionally, update at least some of the second code files to obtain a target application running based on the latest at least some of the second code files, including: if the target application runs in a test environment, then according to the latest modification time of each second code file, update at least some of the second code files among all the second code files to obtain a target application running based on the latest at least some of the second code files; if the target application runs in a production environment, then update all the second code files to obtain a target application running based on the latest all the second code files.
[0097] Optionally, during the running of the target application, in response to a file save instruction for the first code file, after updating the preset file inclusion relationship table to obtain the latest file inclusion relationship table, the method further includes: determining whether the first code file is a code file loaded during the running of the target application; if the first code file is a code file loaded during the running of the target application, then update the first code file.
[0098] The computer program product of the application update method, device, electronic device and storage medium provided by the embodiments of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the methods described in the foregoing method embodiments. For specific implementation, reference can be made to the method embodiments, which will not be elaborated here.
[0099] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments, which will not be elaborated here.
[0100] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly defined and limited, the terms "install", "connect", and "couple" should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the communication inside two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific situations.
[0101] If the above-mentioned functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present disclosure. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0102] In the description of the present disclosure, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation to the present disclosure. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0103] Finally, it should be noted that the above embodiments are only specific embodiments of the present disclosure, used to illustrate the technical solutions of the present disclosure, rather than limiting them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art within the technical scope disclosed by the present disclosure can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes, or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be covered by the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims
1. A method for updating an application program, characterized in that, The method includes: During the running of the target application, in response to a file save instruction for a first code file, updating a preset file inclusion relationship table to obtain an up-to-date file inclusion relationship table; Judging whether the first code file is an included code file according to the up-to-date file inclusion relationship table; If the first code file is an included code file, determining at least one second code file containing the content of the first code file according to the up-to-date file inclusion relationship table; Updating at least some of the second code files to obtain a target application that runs based on the up-to-date at least some of the second code files.
2. The method according to claim 1, wherein Before, during the running of the target application, in response to a file save instruction for a first code file, updating a preset file inclusion relationship table to obtain an up-to-date file inclusion relationship table, the method further includes: Performing an inclusion statement scan on all code files of the target application to determine an including code file containing the content of other code files and the code files directly included by the including code file, obtaining an original direct inclusion relationship table; Determining a list of including code files corresponding to each included code file according to the original direct inclusion relationship table to obtain an original file inclusion relationship table.
3. The method according to claim 2, wherein Determining a list of including code files corresponding to each included code file according to the original direct inclusion relationship table to obtain an original file inclusion relationship table, including: Performing reverse data collection on the original direct inclusion relationship table to determine a list of directly including code files corresponding to each included code file, obtaining an original directly included relationship table; Traversing and recursively searching the original directly included relationship table to determine the directly including code files and indirectly including code files corresponding to each included code file, obtaining an original file inclusion relationship table.
4. The method according to claim 2 or 3, characterized in that During the running of the target application, in response to a file save instruction for a first code file, updating a preset file inclusion relationship table to obtain an up-to-date file inclusion relationship table, including: During the running of the target application, in response to a file save instruction for a first code file, performing an inclusion statement scan on the first code file to determine a list of directly included code files corresponding to the first code file; Updating a preset direct inclusion relationship table according to the list of directly included code files corresponding to the first code file to obtain an up-to-date direct inclusion relationship table; wherein, the preset direct inclusion relationship table is the direct inclusion relationship table with the update time closest to the current time; Clearing the preset file inclusion relationship table; the preset file inclusion relationship table is the original file inclusion relationship table or the file inclusion relationship table with the update time closest to the current time; Determining a list of including code files corresponding to each included code file according to the up-to-date direct inclusion relationship table to obtain an up-to-date file inclusion relationship table.
5. The method according to claim 4, wherein Determining a list of including code files corresponding to each included code file according to the up-to-date direct inclusion relationship table to obtain an up-to-date file inclusion relationship table, including: Perform reverse data collection on the latest direct inclusion relationship table, determine the list of directly including code files corresponding to each included code file, and obtain the latest direct inclusion relationship table; Traverse and recursively search the latest direct inclusion relationship table to determine the directly including code files and indirectly including code files corresponding to each included code file, and obtain the latest file inclusion relationship table.
6. The method according to claim 2, wherein Scan the inclusion statements of all code files of the target application to determine the including code files that contain the content of other code files, and the code files directly included by the including code files, and obtain the original direct inclusion relationship table, including: Scan the inclusion statements of all code files of the target application to determine the including code files with inclusion statements; the inclusion statements include the path information of the included code files; Judge whether the path information in each inclusion statement is legal absolute path information; If the path information in the inclusion statement is legal absolute path information, record the path information in the inclusion statement as the code file directly included by the corresponding including file, and obtain the original direct inclusion relationship table.
7. The method according to any one of claims 1 to 3, characterized in that According to the latest file inclusion relationship table, judge whether the first code file is an included code file, including: Query the latest file inclusion relationship table for the first code file to obtain a query result; wherein, the query result is used to indicate whether there is a corresponding including code file for the first code file; the including code file is a second code file that contains the content of the first code file; If the query result indicates that there is a corresponding including code file for the first code file, determine that the first code file is an included code file.
8. The method according to claim 1, wherein If the first code file is an included code file, according to the latest file inclusion relationship table, determine at least one second code file that contains the content of the first code file, including: If the first code file is an included code file, determine the including code file corresponding to the first code file in the latest file inclusion relationship table as the second code file that contains the content of the first code file, and obtain at least one second code file.
9. The method according to claim 1, characterized in that Update at least some of the second code files to obtain a target application running based on the latest at least some of the second code files, including: If the target application runs in a test environment, update at least some of the second code files among all the second code files according to the latest modification time of each second code file, and obtain a target application running based on the latest at least some of the second code files; If the target application runs in a production environment, update all the second code files to obtain a target application running based on the latest all the second code files.
10. The method according to claim 1, characterized in that During the running of the target application, in response to a file save instruction for the first code file, after updating the preset file inclusion relationship table to obtain the latest file inclusion relationship table, the method further includes: Determine whether the first code file is the code file loaded during the operation of the target application; If the first code file is the code file loaded during the operation of the target application, update the first code file.
11. An update device for an application program, characterized in that, The device includes: A first update module, configured to update a preset file inclusion relationship table during the operation of the target application in response to a file save instruction for the first code file, to obtain the latest file inclusion relationship table; A first judgment module, configured to judge whether the first code file is an included code file according to the latest file inclusion relationship table; A first determination module, configured to, if the first code file is an included code file, determine at least one second code file containing the content of the first code file according to the latest file inclusion relationship table; A second update module, configured to update at least part of the second code files to obtain a target application that runs based on the latest at least part of the second code files.
12. An electronic device, characterized in that, It includes a processor and a memory, the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the update method of the application according to any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by the processor, the computer-executable instructions cause the processor to implement the update method of the application according to any one of claims 1-10.