A code updating method and device
The initial update code is converted into the target update code through the server and sent to the code running end, which solves the problem of long-time compilation after updating the code in application development and improves development efficiency.
Patent Information
- Application Number
- CN202011460101.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-11
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-12-11
AI Technical Summary
During the application development process, the entire code needs to be compiled after updating the code, which takes a long time and reduces development efficiency.
Convert the initial update code into the target update code through the server and send it to the code running end so that it can update the target application and avoid compiling the entire code.
Improves the efficiency of code updates, thereby improving the efficiency of application development.
Smart Images

Figure CN112486465B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a code updating method and device. Background Art
[0002] At present, in the process of developing applications (Application, APP), it is inevitable that new codes will be added or modified, and the application code needs to be updated. After the developer writes the updated code, it is necessary to run the code on the test device to check the effect of the updated code.
[0003] Before running the updated code on the test device, the entire updated application code needs to be compiled to convert the programming language of the code into a programming language that can be recognized and run by the test device, which is time-consuming and has low development efficiency. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a code updating method and device.
[0005] In a first aspect, an embodiment of the present disclosure provides a code update method, characterized by comprising:
[0006] Receiving an initial update code written in a first programming language; the initial update code is an initial update code updated in an original code of a target application written in the first programming language;
[0007] The initial update code is converted into a target update code written in a second programming language; the target update code is used to update the code of the target application.
[0008] In an optional implementation manner, converting the initial update code into a target update code written in a second programming language includes:
[0009] The initial update code is converted into the target update code using the syntax structure indicated in the abstract syntax tree of the initial update code.
[0010] In an optional implementation, the first programming language is Objective-C, and the second programming language is JavaScript.
[0011] In an optional implementation manner, the method further includes:
[0012] The target update code is sent to the code running end by using the established long connection between the server and the code running end, so that the code running end updates the code of the target application program by using the target update code.
[0013] In an optional implementation, the receiving of the initial update code written in the first programming language includes:
[0014] An initial update code written in a first programming language and sent by a code writing terminal is received.
[0015] In a second aspect, the embodiment of the present disclosure also provides another code update method, including:
[0016] When it is detected that the original code of the target application program written in the first programming language is updated, determining an updated initial update code from the original code;
[0017] The initial update code is sent to a server; the initial update code is used to be converted by the server into a target update code written in a second programming language.
[0018] In an optional implementation manner, determining the updated initial update code from the original code includes:
[0019] Determine the target class where the updated code segment in the original code is located using the grammatical structure indicated in the abstract syntax tree of the original code;
[0020] The code text in the target class is used as the initial update code.
[0021] In a third aspect, the present disclosure also provides another code update method, including:
[0022] Receiving a target update code written in a second programming language sent by a server; the target update code is obtained by the server converting an initial update code written in a first programming language; the initial update code is an updated initial update code in an original code of a target application written in the first programming language;
[0023] Based on the class name of the target updated code, the code of the target application is updated.
[0024] In an optional implementation manner, updating the code of the target application based on the class name of the target update code includes:
[0025] In the code of the target application, searching for the target code to be updated whose class name is the same as the target update code;
[0026] If the target code to be updated is found, the target update code is used to replace the target code to be updated;
[0027] If the target code to be updated is not found, the target update code is added to the code of the target application.
[0028] In a fourth aspect, an embodiment of the present disclosure further provides a code updating device, including:
[0029] A first receiving module is used to receive an initial update code written in a first programming language; the initial update code is an initial update code updated in an original code of a target application written in the first programming language;
[0030] The conversion module is used to convert the initial update code into a target update code written in a second programming language; the target update code is used to update the code of the target application program.
[0031] In an optional implementation manner, the conversion module is specifically used to:
[0032] The initial update code is converted into the target update code using the syntax structure indicated in the abstract syntax tree of the initial update code.
[0033] In an optional implementation, the first programming language is Objective-C, and the second programming language is JavaScript.
[0034] In an optional implementation manner, the code updating device further includes:
[0035] The first sending module is used to send the target update code to the code running end by using the established long connection between the server and the code running end.
[0036] In an optional implementation manner, the first receiving module is specifically configured to:
[0037] An initial update code written in a first programming language and sent by a code writing terminal is received.
[0038] In a fifth aspect, the embodiment of the present disclosure also provides another code updating device, including:
[0039] a determination module, configured to determine an updated initial update code from the original code when it is detected that the original code of the target application program written in the first programming language is updated;
[0040] The second sending module is used to send the initial update code to the server; the initial update code is used to be converted by the server into a target update code written in a second programming language.
[0041] In an optional implementation manner, the determining module is specifically configured to:
[0042] Determine the target class where the updated code segment in the original code is located using the grammatical structure indicated in the abstract syntax tree of the original code;
[0043] The code text in the target class is used as the initial update code.
[0044] In a sixth aspect, the present disclosure also provides another code updating device, including:
[0045] A second receiving module is used to receive a target update code written in a second programming language sent by a server; the target update code is obtained by the server converting an initial update code written in a first programming language; the initial update code is an initial update code updated in the original code of the target application written in the first programming language;
[0046] The update module is used to update the code of the target application based on the class name of the target update code.
[0047] In an optional implementation manner, the update module is specifically used to:
[0048] In the code of the target application, searching for the target code to be updated whose class name is the same as the target update code;
[0049] If the target code to be updated is found, the target update code is used to replace the target code to be updated;
[0050] If the target code to be updated is not found, the target update code is added to the code of the target application.
[0051] In the seventh aspect, an embodiment of the present disclosure further provides a computer device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory through the bus, and when the machine-readable instructions are executed by the processor, the steps of the first aspect or any possible implementation of the first aspect are executed, or the steps of the second aspect or any possible implementation of the second aspect are executed, or the steps of the third aspect or any possible implementation of the third aspect are executed.
[0052] In an eighth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computer program executes the steps of the above-mentioned first aspect, or any possible implementation of the first aspect, or executes the above-mentioned second aspect, or any possible implementation of the second aspect, or executes the above-mentioned third aspect, or any possible implementation of the third aspect.
[0053] For a description of the effects of the above-mentioned code updating apparatus, computer device, and computer-readable storage medium, please refer to the description of the above-mentioned code updating method, which will not be repeated here.
[0054] The code updating method and device provided by the embodiments of the present disclosure convert the updated initial update code into the target update code written in the second programming language through the server, so that the code running end can use the target update code to update the code of the target application program, and only compile the updated code, without the need to compile the entire amount of code after the target application program is updated. This can improve the efficiency of code updating, and further improve the efficiency of application development.
[0055] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0057] Figure 1 A schematic diagram of a code update system provided by an embodiment of the present disclosure is shown;
[0058] Figure 2 A flow chart of a code updating method provided by an embodiment of the present disclosure is shown;
[0059] Figure 3 A schematic diagram of a code updating device provided by an embodiment of the present disclosure is shown;
[0060] Figure 4 A schematic diagram showing another code updating device provided by an embodiment of the present disclosure is shown;
[0061] Figure 5 A schematic diagram of another code updating device provided by an embodiment of the present disclosure is shown;
[0062] Figure 6 A schematic diagram of a computer device provided by an embodiment of the present disclosure is shown;
[0063] Figure 7 A schematic diagram showing another computer device provided by an embodiment of the present disclosure is shown;
[0064] Figure 8 A schematic diagram of another computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0066] Research has found that before running the updated code on the test device, the entire updated application code needs to be compiled to convert the code's programming language into a programming language that can be recognized and run by the test device. However, as the application's functions gradually increase, the application's code size is also growing rapidly, and the time consumed for each compilation is getting longer and longer, resulting in low application development efficiency.
[0067] Based on the above research, the present disclosure provides a code updating method and device, which converts the updated initial update code sent by the code writing end into a target update code written in a second programming language through a server, and sends the target update code to the code running end, so that the code running end can update the code of the target application and only compile the updated code, avoiding compiling the full amount of code after the target application is updated, which can improve the efficiency of code updating and thus improve the efficiency of application development.
[0068] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0069] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0070] To facilitate understanding of this embodiment, a code update system disclosed in the embodiment of the present disclosure is first described in detail. Figure 1 As shown, it is a schematic diagram of the code update system provided by the embodiment of the present disclosure. The execution subject of the code update method provided by the embodiment of the present disclosure can be a code update system, and the code update system can include a code writing end, a code running end and a server. The code writing end, the code running end and the server are generally computer devices with certain computing capabilities, wherein the code writing end can be used by users to write codes, the code running end can run compiled codes, and the server can be a server cluster composed of one or more sub-servers, and the server can communicate with the code running end or the code writing end. In some possible implementations, the code update method can be implemented by a processor calling computer-readable instructions stored in a memory.
[0071] See also Figure 2 As shown, it is a flowchart of the code updating method provided by the embodiment of the present disclosure, and the method includes steps S201 to S205, wherein:
[0072] S201: When it is detected that the original code of the target application program written in the first programming language is updated, the code writing end determines the updated initial update code from the original code.
[0073] Among them, the initial update code is the initial update code that is updated in the original code of the target application written in the first programming language; the target application may be an application currently being developed or debugged, and the user may modify the original code of the target application on the code writing end. When the code writing end detects that the original code is updated, the updated initial update code can be determined from the original code.
[0074] The original code may include multiple class files, and a class file may include multiple code segments. The update of the original code may be to add, delete or modify the code in the class file, or to add an entire class file.
[0075] Specifically, S201 may include:
[0076] Determine the target class where the updated code segment in the original code is located using the grammatical structure indicated in the abstract syntax tree of the original code;
[0077] The code text in the target class is used as the initial update code.
[0078] Among them, the abstract syntax tree of the original code is a tree representation of the abstract syntax structure of the original code. Each node on the tree represents a structure in the original code. According to the syntax structure indicated in the abstract syntax tree, the target class where the updated code fragment is located can be determined. The target class can contain data descriptions and a set of functions that operate data or pass messages. This information is the code.
[0079] After determining the target class where the updated code snippet in the original code is located, the code text in the target class can be directly used as the initial update code.
[0080] Here, the original code of the target application may be written by the user on the code writing end, and the programming language used is the first programming language. The code running end cannot directly recognize and run these codes, and they need to be converted into codes written in a second programming language that the code running end can recognize.
[0081] Here, the first programming language may be Objective-C language.
[0082] S202: The code writing end sends the initial update code to the server.
[0083] In this step, the code writing end may send the determined initial update code to the server through a preset port.
[0084] S203: The server converts the initial update code into a target update code written in a second programming language.
[0085] Exemplarily, after the server receives the initial update code written in the first programming language sent by the code writing end, the server can convert the initial update code into the target update code using the syntax structure indicated in the abstract syntax tree of the initial update code.
[0086] Specifically, the initial update code may be parsed to obtain an abstract syntax tree of the initial update code, and then the syntax structure indicated by the abstract syntax tree may be input into a compiler, which may be used to convert the syntax structure into a target update code written in a second programming language.
[0087] Here, the second programming language may be JavaScript.
[0088] S204: The server sends the target update code to the code execution terminal.
[0089] In this step, since the frequency of code updates is high, in order to quickly send the target update code to the code running end, the server can use the established long connection between the server and the code running end to send the target update code to the code running end.
[0090] Here, the step of converting the initial update code into a target update code written in a second programming language and the step of sending the target update code to the code running end can be executed by different sub-servers in the server. After the sub-server performing the code conversion obtains the target update code, the target update code can be transmitted to the sub-server responsible for sending the target update code to the code running end, and the latter will then send it to the code running end. In this way, the compatibility of the server can be improved and the risk of errors can be reduced.
[0091] S205: The code execution end updates the code of the target application based on the class name of the target update code.
[0092] Specifically, S205 may include:
[0093] In the code of the target application, searching for the target code to be updated whose class name is the same as the target update code;
[0094] If the target code to be updated is found, the target update code is used to replace the target code to be updated;
[0095] If the target code to be updated is not found, the target update code is added to the code of the target application.
[0096] In this step, the code running end can search for the target code to be updated from the code of the target application according to the class name of the target update code, and directly replace the target code to be updated with the target update code if found. If the code of the target application does not include code with a class name consistent with the target update code, the target update code can be directly added to the code of the target application.
[0097] After the code running end completes the update of the target application code, if the code running end needs to run the target updated code, it can parse and run it through the built-in parsing module.
[0098] Here, the system of the code running end can be an IOS system.
[0099] The code updating method provided by the embodiment of the present disclosure converts the updated initial update code into a target update code written in a second programming language through a server, so that the code running end can use the target update code to update the code of the target application and only compile the updated code to avoid compiling the full amount of code after the target application is updated. This can improve the efficiency of code updating and further improve the efficiency of application development.
[0100] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0101] Based on the same inventive concept, a code updating device corresponding to the code updating method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned code updating method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0102] Reference Figure 3 , which is a schematic diagram of the architecture of a code updating device provided by an embodiment of the present disclosure, the code updating device 300 comprises: a first receiving module 310, a conversion module 320; wherein,
[0103] The first receiving module 310 is used to receive the initial update code written in the first programming language sent by the code writing end; the initial update code is the initial update code updated in the original code of the target application written in the first programming language;
[0104] The conversion module 320 is used to convert the initial update code into a target update code written in a second programming language; the target update code is used to update the code of the target application.
[0105] The code updating device provided by the embodiment of the present disclosure converts the updated initial update code into a target update code written in a second programming language through a server, so that the code running end can use the target update code to update the code of the target application and only compile the updated code, thereby avoiding compiling the full amount of code after the target application is updated, which can improve the efficiency of code updating and further improve the efficiency of application development.
[0106] In an optional implementation manner, the conversion module 320 is specifically configured to:
[0107] The initial update code is converted into the target update code using the syntax structure indicated in the abstract syntax tree of the initial update code.
[0108] In an optional implementation, the first programming language is Objective-C, and the second programming language is JavaScript.
[0109] In an optional implementation manner, the code updating device 300 further includes a first sending module 330, which is specifically configured to:
[0110] The target update code is sent to the code running end by utilizing the established long connection between the server and the code running end.
[0111] In an optional implementation manner, the first receiving module 310 is specifically configured to:
[0112] An initial update code written in a first programming language and sent by a code writing terminal is received.
[0113] Reference Figure 4 , which is a schematic diagram of the architecture of another code updating device provided by an embodiment of the present disclosure, the code updating device 400 includes: a determining module 410, a second sending module 420; wherein,
[0114] The determination module 410 is used to determine the updated initial update code from the original code when it is detected that the original code of the target application program written in the first programming language is updated;
[0115] The second sending module 420 is used to send the initial update code to the server; the initial update code is used to be converted by the server into a target update code written in a second programming language.
[0116] In an optional implementation manner, the determining module 410 is specifically configured to:
[0117] Determine the target class where the updated code segment in the original code is located using the grammatical structure indicated in the abstract syntax tree of the original code;
[0118] The code text in the target class is used as the initial update code.
[0119] Reference Figure 5 , which is a schematic diagram of the architecture of another code updating device provided by an embodiment of the present disclosure, the code updating device 500 comprises: a second receiving module 510, an updating module 520; wherein,
[0120] The second receiving module 510 is used to receive a target update code written in a second programming language sent by a server; the target update code is obtained by the server converting an initial update code written in a first programming language; the initial update code is an initial update code updated in the original code of the target application written in the first programming language;
[0121] The updating module 520 is used to update the code of the target application based on the class name of the target update code.
[0122] In an optional implementation manner, the updating module 520 is specifically configured to:
[0123] In the code of the target application, searching for the target code to be updated whose class name is the same as the target update code;
[0124] If the target code to be updated is found, the target update code is used to replace the target code to be updated;
[0125] If the target code to be updated is not found, the target update code is added to the code of the target application.
[0126] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0127] Based on the same technical concept, the embodiment of the present disclosure also provides a computer device. Figure 6 As shown, it is a schematic diagram of the structure of a computer device 600 provided in an embodiment of the present disclosure, including a processor 601, a memory 602, and a bus 603. Among them, the memory 602 is used to store execution instructions, including a memory 6021 and an external memory 6022; the memory 6021 here is also called an internal memory, which is used to temporarily store the operation data in the processor 601, and the data exchanged with the external memory 6022 such as a hard disk. The processor 601 exchanges data with the external memory 6022 through the memory 6021. When the computer device 600 is running, the processor 601 communicates with the memory 602 through the bus 603, so that the processor 601 executes the following instructions:
[0128] Receiving an initial update code written in a first programming language; the initial update code is an initial update code updated in an original code of a target application written in the first programming language;
[0129] The initial update code is converted into a target update code written in a second programming language; the target update code is used to update the code of the target application.
[0130] In a possible implementation manner, in the instructions executed by the processor 601, converting the initial update code into a target update code written in a second programming language includes:
[0131] The initial update code is converted into the target update code using the syntax structure indicated in the abstract syntax tree of the initial update code.
[0132] In a possible implementation, in the instructions executed by the processor 601, the first programming language is Objective-C, and the second programming language is JavaScript.
[0133] In a possible implementation manner, the processor 601 is further configured to execute:
[0134] The target update code is sent to the code running end by using the established long connection between the server and the code running end, so that the code running end updates the code of the target application program by using the target update code.
[0135] In a possible implementation manner, in the instructions executed by the processor 601, the receiving of the initial update code written in the first programming language includes:
[0136] An initial update code written in a first programming language and sent by a code writing terminal is received.
[0137] Based on the same technical concept, the embodiment of the present disclosure also provides another computer device. Figure 7 As shown, it is a schematic diagram of the structure of a computer device 700 provided in an embodiment of the present disclosure, including a processor 701, a memory 702, and a bus 703. Among them, the memory 702 is used to store execution instructions, including a memory 7021 and an external memory 7022; the memory 7021 here is also called an internal memory, which is used to temporarily store the operation data in the processor 701, and the data exchanged with the external memory 7022 such as a hard disk. The processor 701 exchanges data with the external memory 7022 through the memory 7021. When the computer device 700 is running, the processor 701 communicates with the memory 702 through the bus 703, so that the processor 701 executes the following instructions:
[0138] When it is detected that the original code of the target application program written in the first programming language is updated, determining an updated initial update code from the original code;
[0139] The initial update code is sent to a server; the initial update code is used to be converted by the server into a target update code written in a second programming language.
[0140] In a possible implementation manner, in the instructions executed by the processor 701, determining the updated initial update code from the original code includes:
[0141] Determine the target class where the updated code segment in the original code is located using the grammatical structure indicated in the abstract syntax tree of the original code;
[0142] The code text in the target class is used as the initial update code.
[0143] Based on the same technical concept, the embodiment of the present disclosure also provides another computer device. Figure 8 As shown, it is a schematic diagram of the structure of a computer device 800 provided in an embodiment of the present disclosure, including a processor 801, a memory 802, and a bus 803. Among them, the memory 802 is used to store execution instructions, including a memory 8021 and an external memory 8022; the memory 8021 here is also called an internal memory, which is used to temporarily store the operation data in the processor 801, and the data exchanged with the external memory 8022 such as a hard disk. The processor 801 exchanges data with the external memory 8022 through the memory 8021. When the computer device 800 is running, the processor 801 communicates with the memory 802 through the bus 803, so that the processor 801 executes the following instructions:
[0144] Receiving a target update code written in a second programming language sent by a server; the target update code is obtained by the server converting an initial update code written in a first programming language; the initial update code is an updated initial update code in an original code of a target application written in the first programming language;
[0145] Based on the class name of the target updated code, the code of the target application is updated.
[0146] In a possible implementation manner, in the instruction executed by the processor 801, updating the code of the target application based on the class name of the target update code includes:
[0147] In the code of the target application, searching for the target code to be updated whose class name is the same as the target update code;
[0148] If the target code to be updated is found, the target update code is used to replace the target code to be updated;
[0149] If the target code to be updated is not found, the target update code is added to the code of the target application.
[0150] The embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the code updating method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0151] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the code updating method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0152] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0153] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0155] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0156] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0157] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; 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 be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A code updating method, characterized in that: Applicable to servers, including: Receiving an initial update code written in a first programming language; the initial update code is an initial update code updated in an original code of a target application written in the first programming language; Converting the initial update code into a target update code written in a second programming language; the target update code is used to update the code of the target application; The method further includes: sending the target update code to a code execution end, so that the code execution end updates the code of the target application program using the target update code.
2. The method according to claim 1, characterized in that The converting the initial update code into a target update code written in a second programming language comprises: The initial update code is converted into the target update code using the syntax structure indicated in the abstract syntax tree of the initial update code.
3. The method according to claim 1 or 2, characterized in that: The first programming language is Objective-C, and the second programming language is JavaScript.
4. The method according to claim 1, characterized in that: The method further comprises: The target update code is sent to the code running end by using the established long connection between the server and the code running end, so that the code running end updates the code of the target application program by using the target update code.
5. The method according to claim 1, characterized in that The receiving of the initial update code written in the first programming language comprises: An initial update code written in a first programming language and sent by a code writing terminal is received.
6. A code updating method, characterized in that: Applied to the code writing end, including: When it is detected that the original code of the target application program written in the first programming language is updated, determining an updated initial update code from the original code; Sending the initial update code to a server; the initial update code is used to be converted by the server into a target update code written in a second programming language; The target update code is used to be sent by the server to the code execution end, so that the code execution end updates the code of the target application program using the target update code.
7. The method according to claim 6, characterized in that The step of determining the updated initial update code from the original code comprises: Determine the target class where the updated code segment in the original code is located using the grammatical structure indicated in the abstract syntax tree of the original code; The code text in the target class is used as the initial update code.
8. A code updating method, characterized in that: Applied to the code running end, including: Receiving a target update code written in a second programming language sent by a server; the target update code is obtained by the server converting an initial update code written in a first programming language; the initial update code is an updated initial update code determined by a code writing end in the original code of a target application written in the first programming language and sent to the server; Based on the class name of the target updated code, the code of the target application is updated.
9. The method according to claim 8, characterized in that The updating of the code of the target application based on the class name of the target update code includes: In the code of the target application, searching for the target code to be updated whose class name is the same as the target update code; If the target code to be updated is found, the target update code is used to replace the target code to be updated; If the target code to be updated is not found, the target update code is added to the code of the target application.
10. A code updating device, characterized in that: Applicable to servers, including: A first receiving module is used to receive an initial update code written in a first programming language; the initial update code is an initial update code updated in an original code of a target application written in the first programming language; A conversion module, used to convert the initial update code into a target update code written in a second programming language; the target update code is used to update the code of the target application; Wherein, the code updating device further comprises: The first sending module is used to send the target update code to the code running end, so that the code running end updates the code of the target application program by using the target update code.
11. A code updating device, characterized in that: Applied to the code writing end, including: a determination module, configured to determine an updated initial update code from the original code when it is detected that the original code of the target application program written in the first programming language is updated; The second sending module is used to send the initial update code to the server; the initial update code is used to be converted by the server into a target update code written in a second programming language, The target update code is used to be sent by the server to the code execution end, so that the code execution end updates the code of the target application program using the target update code.
12. A code updating device, characterized in that: Applied to the code running end, including: A second receiving module is used to receive a target update code written in a second programming language sent by a server; the target update code is obtained by the server converting an initial update code written in a first programming language; the initial update code is an updated initial update code determined by a code writing end in the original code of a target application written in the first programming language and sent to the server; The update module is used to update the code of the target application based on the class name of the target update code.
13. A computer device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the code update method according to any one of claims 1 to 5 are executed, or the steps of the code update method according to any one of claims 6 to 7 are executed, or the steps of the code update method according to claims 8 to 9 are executed.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the code updating method as described in any one of 1 to 5, or executes the steps of the code updating method as described in any one of claims 6 to 7, or executes the steps of the code updating method as described in claims 8 to 9.
Citation Information
Patent Citations
Processing method, processing device and equipment for program code update
CN106569844A
Code conversion method and apparatus, computer storage medium and code conversion terminal
CN108595184A
Code update method, graph update method and device, storage medium and terminal
CN108595200A
Operation method and device of application program, equipment and medium
CN109976793A
Code generation method, device and equipment and storage medium
CN111625224A
