CN113448605B - Software updating method and device, electronic equipment and storage medium - Google Patents

Software updating method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113448605B
CN113448605B CN202110728350.XA CN202110728350A CN113448605B CN 113448605 B CN113448605 B CN 113448605B CN 202110728350 A CN202110728350 A CN 202110728350A CN 113448605 B CN113448605 B CN 113448605B
Authority
CN
China
Prior art keywords
function
target
tree structure
field
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110728350.XA
Other languages
Chinese (zh)
Other versions
CN113448605A (en
Inventor
刘白
苏魁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gaotu Yunji Education Technology Co Ltd
Original Assignee
Beijing Gaotu Yunji Education Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gaotu Yunji Education Technology Co Ltd filed Critical Beijing Gaotu Yunji Education Technology Co Ltd
Priority to CN202110728350.XA priority Critical patent/CN113448605B/en
Publication of CN113448605A publication Critical patent/CN113448605A/en
Application granted granted Critical
Publication of CN113448605B publication Critical patent/CN113448605B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The application discloses a software updating method, a device, electronic equipment and a storage medium, which can solve the problems that in the prior art, updating failure or retesting is easy to occur when updating software by writing new codes on the basis of original codes. The software updating method comprises the following steps: when an add command for a project file is detected, adding a first target tree structure for realizing a first target function to the project file; the first target tree structure comprises at least one execution logic, each execution logic being used for realizing one function point; and operating the project file, and calling a parser to parse the first target tree structure so as to add the first target function to the software.

Description

Software updating method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a software updating method, a device, an electronic apparatus, and a storage medium.
Background
In the prior art, when the existing software needs to be updated, a new code is often written on the basis of the original code, but the newly written code may affect the original code, so that the updating is failed.
Disclosure of Invention
The embodiment of the application provides a software updating method, a device, electronic equipment and a storage medium, which can solve the problem that update failure easily occurs when updating software by writing new codes on the basis of original codes in the prior art.
In a first aspect, an embodiment of the present application provides a software updating method, applied to an electronic device, where an item file is stored in the electronic device, where the item file includes an parsing program, and the method includes:
adding a first target tree structure for realizing a first target function to the project file when an add command for the project file is detected; wherein the first target tree structure comprises at least one execution logic, each execution logic being configured to implement a functional point;
and operating the project file, and calling the analysis program to analyze the first target tree structure so as to add the first target function to the software.
In this embodiment of the present application, an item file is stored in an electronic device, where the item file includes an analysis program. When the software needs to be updated, only the first target tree structure for realizing the first target function is required to be added into the project file, then the project file is operated, and the analysis program is called to analyze the first target tree structure, so that the first target function is added into the software. In the method, the target tree structure for realizing the target function is independently added to the project file, and the target tree structure is analyzed by using an independent analysis program, so that codes for realizing other functions in the project file are not influenced, the possibility of failure in software update is reduced, and the efficiency of software update is improved.
Optionally, the project file further includes a second target tree structure for implementing a second target function, the second target tree structure including at least one execution logic, each execution logic for implementing a function point, the method further including:
when a modification command for the project file is detected, modifying the second target tree structure into a third target tree structure, wherein the third target tree structure is used for realizing a third target function, the third target tree structure comprises at least one execution logic, each execution logic is used for realizing one function point, and the number of the same function points in the third target tree structure and the second target tree structure exceeds a set threshold;
and operating the project file, and calling the analysis program to analyze the third target tree structure so as to modify the second target function in the software into the third target function.
In this embodiment of the present application, the project file stores a second target tree structure for implementing a second target function, and if the function of the software needs to be updated, the second target tree structure may be directly modified to obtain a third target tree structure. And then running the project file, and calling an analysis program to analyze the third target tree structure, so that the second target function is modified into the third target function. In the method, if the software update only involves updating part of function points of the existing function, the modification can be directly performed on the basis of the existing target tree structure without regenerating the whole target tree structure for realizing the new function, thereby improving the efficiency of the software update.
Optionally, the project file further includes a second target tree structure for implementing a second target function, the second target tree structure including at least one execution logic, each execution logic for implementing a function point, the method further including:
when a replacement command for the project file is detected, replacing the second target tree structure with a third target tree structure, wherein the third target tree structure is used for realizing a third target function, the third target tree structure comprises at least one execution logic, each execution logic is used for realizing one function point, and the number of the same function points in the third target tree structure and the second target tree structure does not exceed a set threshold value;
and operating the project file, and calling the parsing program to parse the third target tree structure so as to delete the second target function in the software and add the third target function to the software.
In this embodiment of the present application, the project file stores a second target tree structure for implementing a second target function, and if the function of the software needs to be updated, a third target tree structure for implementing a third target function may be used to replace the second target tree structure. And then running the project file, and calling a parser to parse the third target tree structure, so that the second target function is deleted and the third target function is added into the software. In the method, if more function points of the existing function are changed during software updating, the existing target tree structure can be replaced by the new target tree structure, so that errors caused by more changes to the existing target tree structure are avoided, and the efficiency of software updating is improved.
Optionally, any of the target tree structures is an abstract syntax tree.
In the embodiment of the application, the target tree structure for realizing the target function may be an abstract syntax tree, so that the target function may be described more simply.
Optionally, any target function includes a plurality of function points, and each abstract syntax tree is defined with a plurality of nodes, and the function points are in one-to-one correspondence with the nodes.
In the embodiment of the application, any target function can be divided into a plurality of function points, and then one function point is described based on one node in the abstract syntax tree, so that management of each function point is facilitated.
Optionally, each node has a corresponding preset attribute set, where the preset attribute set includes at least a first field, a second field, a third field and a fourth field, where the first field is used to indicate a function code of the current function point, the second field is used to indicate a function type of the current function point, the third field is used to indicate a function value of the current function point, and the fourth field is used to indicate whether the current function point has an association relationship with other function points, and the association relationship is used to indicate that an execution process of the current function point depends on an execution result of the other function points.
In the embodiment of the application, each node manages one function point through the preset attribute set of the node, so that unified analysis on the abstract syntax tree is convenient to follow.
Optionally, the plurality of nodes are divided into root nodes and leaf nodes, a preset field is set in the first target abstract syntax tree, the preset field is used for representing a functional code of a functional point corresponding to the root node, and the calling the parsing program to parse the first target tree structure includes:
determining a root node from the first target abstract syntax tree based on the preset field;
traversing all nodes included in the first target abstract syntax tree by taking the root node as a starting point, and creating corresponding types of function points according to the root node and a second field in a preset attribute set corresponding to each leaf node;
executing corresponding function points from the root node as a starting point, determining at least one leaf node associated with the root node based on a fourth field in a preset attribute set corresponding to the root node, and executing the function point corresponding to each leaf node in the at least one leaf node;
if the fact that the at least one leaf node has no association relation with other leaf nodes is determined, acquiring an execution result of a function point corresponding to each leaf node in the at least one leaf node;
And determining the execution result of the function point corresponding to the root node based on the execution result of the function point corresponding to each leaf node in the at least one leaf node.
In the embodiment of the application, the target abstract syntax tree can be parsed in a unified manner, and different parsing programs are not required to be designed for different target abstract syntax trees independently.
In a second aspect, an embodiment of the present application provides a software updating apparatus, where a project file is stored in the apparatus, where the project file includes a parsing program, and the apparatus includes:
an adding unit configured to add a first target tree structure for realizing a first target function to the project file when an addition command for the project file is detected; wherein the first target tree structure comprises at least one execution logic, each execution logic being configured to implement a functional point;
and the updating unit is used for running the project file, calling the analysis program to analyze the first target tree structure so as to add the first target function to the software.
Optionally, the project file further includes a second target tree structure for implementing a second target function, the second target tree structure including at least one execution logic, each execution logic being configured to implement a function point, and the apparatus further includes:
The modification unit is used for modifying the second target tree structure into a third target tree structure when a modification command for the project file is detected, wherein the third target tree structure is used for realizing a third target function and comprises at least one execution logic, each execution logic is used for realizing one function point, and the number of the same function points in the third target tree structure and the second target tree structure exceeds a set threshold;
the updating unit is further configured to: and operating the project file, and calling the analysis program to analyze the third target tree structure so as to modify the second target function in the software into the third target function.
Optionally, the apparatus further includes:
a replacing unit, configured to replace, when a replacement command for the project file is detected, the second target tree structure with a third target tree structure, where the third target tree structure is used to implement a third target function, and the third target tree structure includes at least one execution logic, where each execution logic is used to implement a function point, and the number of identical function points in the third target tree structure and the second target tree structure does not exceed a set threshold;
The updating unit is further configured to run the project file, and call the parsing program to parse the third target tree structure, so as to delete the second target function in the software and add the third target function to the software.
Optionally, any of the target tree structures is an abstract syntax tree.
Optionally, any target function includes a plurality of function points, and each abstract syntax tree is defined with a plurality of nodes, and the function points are in one-to-one correspondence with the nodes.
Optionally, each node has a corresponding preset attribute set, where the preset attribute set includes at least a first field, a second field, a third field and a fourth field, where the first field is used to indicate a function code of the current function point, the second field is used to indicate a function type of the current function point, the third field is used to indicate a function value of the current function point, and the fourth field is used to indicate whether the current function point has an association relationship with other function points, and the association relationship is used to indicate that the current function point depends on an execution result of the other function points.
Optionally, the plurality of nodes are divided into root nodes and leaf nodes, a preset field is set in the first target abstract syntax tree, the preset field is used for representing a functional code of a functional point corresponding to the root node, and the updating unit is specifically configured to:
Determining a root node from the first target abstract syntax tree based on the preset field;
traversing all nodes included in the first target abstract syntax tree by taking the root node as a starting point, and creating corresponding types of function points according to the root node and a second field in a preset attribute set corresponding to each leaf node;
executing corresponding function points from the root node as a starting point, determining at least one leaf node associated with the root node based on a fourth field in a preset attribute set corresponding to the root node, and executing the function point corresponding to each leaf node in the at least one leaf node;
if the fact that the at least one leaf node has no association relation with other leaf nodes is determined, acquiring an execution result of a function point corresponding to each leaf node in the at least one leaf node;
and determining the execution result of the function point corresponding to the root node based on the execution result of the function point corresponding to each leaf node in the at least one leaf node.
In a third aspect, embodiments of the present application provide an electronic device comprising a processor and a memory, the processor being configured to implement the steps of the method according to any of the embodiments of the first aspect when executing a computer program stored in the memory.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method according to any of the embodiments of the first aspect.
Drawings
Fig. 1 is a flow chart of a software updating method according to an embodiment of the present application;
FIG. 2 is a schematic structural diagram of a first target abstract syntax tree according to an embodiment of the present application;
FIG. 3 is a schematic structural diagram of a first target abstract syntax tree according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a software updating apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples.
In the prior art, when existing software needs to be updated, a plurality of functional modules are usually developed based on the update requirement, and each functional module is reserved with an interface, and then input codes call each functional module to realize the function to be updated, namely, the software update is realized by writing new codes on the basis of the original codes, but the newly written codes may influence the original codes, so that the software update fails.
In view of this, in the embodiment of the present application, a software updating method is provided, in which a target tree structure for implementing a target function is separately added to a project file, and the target tree structure is parsed by using a separate parsing program, so that codes for implementing other functions in the project file are not affected, the possibility of failure in software updating is reduced, and the efficiency of software updating is improved.
The following describes the technical scheme provided by the embodiment of the application with reference to the accompanying drawings. Referring to fig. 1, an embodiment of the present application provides a software updating method, and the flow of the method is described as follows:
step 101: when an add command for a project file is detected, adding a first target tree structure for realizing a first target function to the project file; the first target tree structure comprises at least one execution logic, and each execution logic is used for realizing one function point.
Considering that in the comparative embodiment, a developer manually inputs a new code (the new code is used for realizing the target function) based on the original code, and then runs all the codes (the original code and the new code) to update the software, so that the newly input code may collide with the original code, and the software update fails, so that the software update efficiency is lower, and the new function needs to be tested again and again before being online, thereby ensuring that the software can be formally online after no error.
In view of this, in this embodiment, the code that needs to be newly input may be described through a specific data structure (i.e., the target function to be added is described through a specific data structure), when the software needs to be updated, the software update may be completed directly by parsing the data structure that describes the target function, and since the code that implements the original function is independent of the data structure that implements the target function to be added, and the parsing process for the data structure is also independent of the execution process of the original code, no influence is caused on the original code, thereby reducing the probability of failure of the software update, improving the efficiency of the software update, and no new code is added, so long as the accuracy of the target tree structure is ensured. Before this, the above-described data structure for describing the target function to be added needs to be added to the project file corresponding to the software.
As a possible implementation manner, the electronic device stores a project file, where the project file may be considered to be used to implement an existing function of software, and the project file further includes a parsing program, where the parsing program may be used to parse a tree structure, so as to implement a function described by the tree structure. I.e. the parsing program is designed for parsing a tree structure. When the electronic device detects an add instruction for the project file, a first target tree structure implementing a first target function may be added to the project file. It should be understood that the first target tree structure may be originally stored in the electronic device and stored separately from the project file, or the first target tree structure may be newly added to the electronic device, which is not particularly limited herein.
It should be understood that the first target function may be a set of execution results corresponding to a plurality of function points, and thus, the first target tree structure should include at least one execution logic when describing the first target function, and each execution logic is used to implement one function point. For example, the first target tree structure may use an abstract syntax tree, so as to achieve a more concise description of the target function to be updated.
The following describes in detail how the abstract syntax tree is used to describe the target function.
In this embodiment of the present application, any target function includes a plurality of function points, and a plurality of nodes may be defined in each abstract syntax tree, so that in order to enable the abstract syntax tree to better describe the corresponding target function, as a possible implementation manner, the nodes in the abstract syntax tree and the function points included in the target function may be in one-to-one correspondence, that is, one node is used to describe one function point.
Specifically, each node may have a corresponding preset attribute set, where the preset attribute set includes at least a first field, a second field, a third field, and a fourth field, where the first field is used to indicate coding of a current function point (used to distinguish a plurality of function points included in each objective function), the second field is used to indicate a function type of the current function point, the third field is used to indicate an execution result of the current function point, and the fourth field is used to indicate whether the current function point has an association relationship with other function points. It should be understood that the association relationship herein refers to that the execution process of the current function point depends on the execution results of other function points.
In the embodiment of the application, any function point in the project label function is described in the above manner, so that a set of standardized description structure is formed, and the subsequent analysis process is conveniently and smoothly executed.
Considering that the above-mentioned target tree structure characterizes a target function, and each target function has a corresponding target object, for example, the update function is to add a click function to an existing button and play music, where "button" is the target object, and "click and play music" is the target function of the target object. Therefore, in the embodiment of the application, not only the target tree structure for describing the target function needs to be added to the project file, but also the corresponding relation between the target tree structure and the target object needs to be established.
It should be understood that a plurality of target objects, for example, target object 1, target object 2, and target object 3, are predefined in the project file for characterizing the original function, and the number of predefined target objects in the project file is not particularly limited here. Meanwhile, the plurality of target objects can be all target objects of the same type, or target objects of different types, and the types of the target objects predefined in the project file are not particularly limited.
A detailed description is given below of a scheme how the target tree structure is associated with the target object.
The first way is: the target tree structure describing the target function directly establishes an association relationship with the target object.
In this embodiment of the present application, each target object predefined in the project file has its own identity, and before updating the original function, a developer may know the specific content of the update, that is, what target function needs to be added to which target object. Therefore, the target tree structure should include the identity of the target object to be associated with in addition to describing the target function, so that after the target tree structure is added to the project file, the association between the target tree structure and a specific target object in a plurality of target objects predefined in the project file can be established.
The second way is: the target tree structure describing the target function indirectly establishes an association relationship with the target object.
In the embodiment of the application, a plurality of target tree structures (namely function templates) for describing different target functions are pre-established, and each target tree structure is provided with an identity of the target tree structure, namely the described target functions can be distinguished through the identity of the target tree structure. Meanwhile, a reference tree structure for describing the target object to be associated with and invoking which target tree structure (i.e. which function template) is also established, so that after the target tree structure and the reference tree structure are added to the project file, an association relationship can be established between a specific target tree structure (specific function template) and a specific target object of a plurality of target objects predefined in the project file.
It should be understood that in the embodiment of the present application, one of the two modes may be flexibly selected according to a specific upgrade content, for example, when the upgrade content is to add a target function to a target object, or to add different target functions to different target objects, the first mode or the second mode may be selected; when the upgrade content is to add the same target function to different target objects, a second mode can be selected. There is no particular limitation herein.
Step 102: and running the project file, and calling a parser to parse the first target tree structure so as to add the first target function to the software.
In the embodiment of the application, after the first target tree structure for describing the first target function is added to the project file, the project file can be operated, so that the existing software is updated.
As a possible implementation manner, the electronic device may run the project file and call the parser to parse the first target tree structure, so as to add the first target function to the software, that is, complete the update process of the software.
The following describes in detail how to parse a first target abstract syntax tree for describing a first target function.
In this embodiment of the present application, the plurality of nodes defined in the first target abstract syntax tree may be divided into root nodes and leaf nodes, and it should be understood that only one root node may be defined in the first target abstract syntax tree, but a plurality of leaf nodes may be defined. In the parsing, the root node is usually started (i.e. the root node is used as the starting point of the parsing), so that in order to determine the root node in a plurality of child nodes, a preset field is set in the first target abstract syntax tree, and the preset field is used for characterizing the functional code of the functional point corresponding to the root node, so that the starting point of the parsing can be quickly determined in the parsing process. The preset field and the encoding of the root node are not particularly limited herein.
In the actual parsing process, the electronic device may quickly determine the root node from the first target abstract syntax tree based on the preset field, and then traverse all the nodes defined in the first target abstract syntax tree with the root node as a starting point, for example, a preamble traversal manner may be adopted, which is not particularly limited herein. Meanwhile, function points of corresponding types are required to be established according to the root node and a second field in a preset attribute set corresponding to each leaf node, for example, the function points are mainly divided into two types, the first type is a data type function point, and the function point functions of the types can be completed through the node without depending on other nodes; the second type is a functional point, which cannot be completed by the node itself and must depend on the execution results of other nodes.
After determining the function points of the nodes, the electronic device may start executing the function point corresponding to the root node with the root node as a starting point, and determine at least one leaf node associated with the root node according to a fourth field in the preset attribute set corresponding to the root node, so as to execute the function point corresponding to each leaf node in the at least one leaf node. In the process of executing the function point corresponding to each leaf node in the at least one leaf node, if it is determined that each leaf node has no association relationship with other leaf nodes, an execution result of the function point corresponding to each leaf node in the at least one leaf node may be directly obtained. And then, based on the execution result of the function point corresponding to each leaf node in the at least one leaf node, further determining the execution result of the function point corresponding to the root node, thereby completing the analysis process.
It should be understood that if any one of the at least one leaf node has an association relationship with other leaf nodes, the function points corresponding to the other leaf nodes are further executed, and corresponding execution results are obtained.
For example, the first target abstract syntax tree is:
referring to fig. 2, the first target abstract syntax tree is used to describe s=2, i.e. obtain a constant 2, and then assign a value to the variable s. Three nodes are used in implementing the above functions to describe: the first one to describe the assignment operation (i.e., "="), the second one to describe the variable s, and the third one to describe the constant 2. The preset field root is 1, it can be determined that the first node is a root node, and then the function point corresponding to the first node is executed. In the process of executing the function point corresponding to the first node, the function point of the first node is found not to be an independent function, and the function point of the first node needs to depend on the execution results of the second node and the third node. At this time, the function points corresponding to the second node and the third node may be executed, and no associated node exists between the second node and the third node, and it should be understood that the function points corresponding to the second node and the function points corresponding to the third node are independent from each other, so that the two function points may be considered to be executed in parallel. After the execution result of the function point corresponding to the second node and the execution result of the function point corresponding to the third node are obtained, the execution result of the first node may be further determined.
For another example, the first target abstract syntax tree is:
/>
referring to fig. 3, the first target abstract syntax tree is used to describe s=2+3, that is, constants 2 and 3 are obtained, then the constants 3 and 2 are added, and then the result after the addition is performed is assigned to the variable s. Five nodes are used in the process of implementing the above functions to describe: the first one describes the assignment operation ("="), the second one describes the variable s, the third one describes the addition operation ("+"), the fourth one describes the constant 2, and the fifth one describes the constant 3. The preset field root is 1, it can be determined that the first node is a root node, and then the function point corresponding to the first node is executed. In the process of executing the function point corresponding to the first node, the function point of the first node is found not to be an independent function, and the function point of the first node needs to depend on the execution results of the second node and the third node. In this case, the functional points corresponding to the second node and the third node may be executed, and it should be understood that the functional point corresponding to the second node and the functional point corresponding to the third node are independent from each other, so that the two functional points may be considered to be executed in parallel. The execution process of the function point corresponding to the second node does not need to depend on the execution results of other nodes, so that the execution result (variable s) of the function point corresponding to the second node can be directly obtained. However, the execution process of the function point corresponding to the third node needs to depend on the execution results of the fourth node and the fifth node, at this time, the function point corresponding to the fourth node and the function point corresponding to the fifth node may be executed first, and since the execution processes of the function point corresponding to the fourth node and the function point corresponding to the fifth node do not depend on the execution results of other function points, the constant 2 (the execution result of the function point corresponding to the fourth node) and the constant 3 (the execution result of the function point corresponding to the fifth node) may be directly obtained. On this basis, the execution result of the function point corresponding to the third node (i.e., 2+3 is 5) can be determined. After determining the execution result of the function point corresponding to the third node, the execution result of the function point corresponding to the first node may be determined (i.e. constant 5 is assigned to variable s).
In some embodiments, it is contemplated that the present software update does not add a new target function for a particular target object, but rather makes a slight adjustment to a certain target function of the same target object. For example, the background rendering color of a certain target object is changed from red to blue, and in this case, in the embodiment of the present application, the modification is directly performed on the basis of the existing target tree structure, without regenerating the whole target tree structure for implementing the new function, thereby improving the efficiency of software update.
As a possible implementation manner, the project file further includes a second target tree structure for implementing a second target function, where the second target tree structure includes at least one execution logic, and each execution logic is used to implement a function point. When the electronic device detects a modification instruction for the project file, the second target tree structure may be changed to a third target tree structure for implementing a third target function. Then the project file can be operated, and then the analysis program is called to analyze the third target tree structure, so that the second target function in the software is modified into the third target function. The specific analysis process is referred to above, and will not be described herein.
It should be appreciated that the third target tree structure includes at least one execution logic, each execution logic is configured to implement a function point, and the number of identical function points in the third target tree structure and the second target tree structure exceeds a set threshold. Meanwhile, the second target tree structure and the second target tree structure may be abstract syntax trees.
In some embodiments, it is contemplated that the present software update does not add a new target function for a particular target object, but rather makes a substantial adjustment to a certain target function of the same target object. At this time, in the embodiment of the present application, the existing target tree structure may be replaced by the new target tree structure, so that errors caused by more modification to the existing target tree structure are avoided, and thus the efficiency of software update is improved.
As a possible implementation manner, the project file further includes a second target tree structure for implementing a second target function, where the second target tree structure includes at least one execution logic, and each execution logic is used to implement a function point. When the electronic device detects a replacement command for the project file, the second target tree structure may be replaced with a third target tree structure for implementing a third target function. Then the project file can be operated, and then the analysis program is called to analyze the third target tree structure, so that the second target function in the software is deleted and the third target function is added into the software. The specific analysis process is referred to above, and will not be described herein.
It should be appreciated that the third target tree structure includes at least one execution logic, each execution logic is configured to implement a function point, and the number of identical function points in the third target tree structure and the second target tree structure does not exceed a set threshold. Meanwhile, the second target tree structure and the second target tree structure may be abstract syntax trees.
In some embodiments, it is contemplated that the present software update does not add a new target function for a particular target object, but rather removes a certain target function for a certain target object. At this time, in the embodiment of the present application, the specific target tree structure corresponding to the target object is deleted, so as to implement software update.
As a possible implementation manner, the project file further includes a second target tree structure for implementing a second target function, where the second target tree structure includes at least one execution logic, and each execution logic is used to implement a function point. When the electronic device detects a delete command for the project file, the above-described second target tree structure may be deleted from the project file. The project file may then be run to effect deletion of the second target function in the software. It should be appreciated that the second target tree structure may be an abstract syntax tree.
Referring to fig. 4, based on the same inventive concept, an embodiment of the present application further provides a software updating apparatus, where an item file is stored, the item file includes an parsing program, and the apparatus includes: an adding unit 201 and an updating unit 202.
An adding unit 201 for adding a first target tree structure for realizing a first target function to the project file when an addition command for the project file is detected; wherein the first target tree structure comprises at least one execution logic, each execution logic being configured to implement a functional point;
and the updating unit 202 is configured to run the project file, and call the parsing program to parse the first target tree structure, so as to add the first target function to the software.
Optionally, the project file further includes a second target tree structure for implementing a second target function, the second target tree structure including at least one piece of execution logic, each piece of execution logic for implementing a function point, the apparatus further including:
the modification unit is used for modifying the second target tree structure into a third target tree structure when a modification command for the project file is detected, wherein the third target tree structure is used for realizing a third target function and comprises at least one execution logic, each execution logic is used for realizing one functional point, and the number of the same functional points in the third target tree structure and the second target tree structure exceeds a set threshold;
The updating unit 202 is further configured to: and operating the project file, and calling a parser to parse the third target tree structure so as to modify the second target function in the software into the third target function.
Optionally, the apparatus further comprises:
the replacing unit is used for replacing the second target tree structure with a third target tree structure when a modification instruction for the project file is detected, wherein the third target tree structure is used for realizing a third target function and comprises at least one execution logic, each execution logic is used for realizing one functional point, and the number of the same functional points in the third target tree structure and the second target tree structure does not exceed a set threshold value;
the updating unit 202 is further configured to run the project file, and call the parsing program to parse the third target tree structure, so as to delete the second target function in the software and add the third target function to the software.
Optionally, any of the target tree structures is an abstract syntax tree.
Optionally, any target function includes a plurality of function points, and each abstract syntax tree is defined with a plurality of nodes, and the function points are in one-to-one correspondence with the nodes.
Optionally, each node has a corresponding preset attribute set, where the preset attribute set includes at least a first field, a second field, a third field and a fourth field, where the first field is used to indicate a function code of the current function point, the second field is used to indicate a function type of the current function point, the third field is used to indicate a function value of the current function point, and the fourth field is used to indicate whether the current function point has an association relationship with other function points, and the association relationship is used to indicate that the current function point depends on an execution result of the other function points.
Optionally, the plurality of nodes are divided into root nodes and leaf nodes, a preset field is set in the first target abstract syntax tree, the preset field is used for representing a functional code of a functional point corresponding to the root node, and the updating unit 202 is specifically configured to:
determining a root node from the first target abstract syntax tree based on the preset field;
traversing all nodes included in the first target abstract syntax tree by taking the root node as a starting point, and creating corresponding types of function points according to the root node and a second field in a preset attribute set corresponding to each leaf node;
executing corresponding function points from the root node as a starting point, determining at least one leaf node associated with the root node based on a fourth field in a preset attribute set corresponding to the root node, and executing the function point corresponding to each leaf node in the at least one leaf node;
if the fact that the at least one leaf node has no association relation with other leaf nodes is determined, acquiring an execution result of a function point corresponding to each leaf node in the at least one leaf node;
and determining the execution result of the function point corresponding to the root node based on the execution result of the function point corresponding to each leaf node in the at least one leaf node.
Referring to fig. 5, based on the same inventive concept, the embodiment of the present application further provides an electronic device, where the electronic device includes at least one processor 301, and the processor 301 is configured to execute a computer program stored in a memory, to implement the steps of the software updating method shown in fig. 1 provided by the embodiment of the present invention.
Alternatively, the processor 301 may be a central processing unit, a specific ASIC, or one or more integrated circuits for controlling the execution of programs.
Optionally, the electronic device may further comprise a memory 302 coupled to the at least one processor 301, the memory 302 may comprise ROM, RAM and disk memory. The memory 302 is used for storing data required for the operation of the processor 301, i.e. instructions executable by the at least one processor 301, the at least one processor 301 performing the method as shown in fig. 1 by executing the instructions stored by the memory 302. Wherein the number of memories 302 is one or more. The memory 302 is shown in fig. 5, but it should be noted that the memory 302 is not an essential functional block, and is therefore shown in fig. 5 by a broken line.
The physical devices corresponding to the adding unit 201 and the updating unit 202 may be the aforementioned processor 301. The electronic device may be used to perform the method provided by the embodiment shown in fig. 1. Therefore, for the functions that can be implemented by each functional module in the electronic device, reference may be made to the corresponding description in the embodiment shown in fig. 1, which is not repeated.
Embodiments of the present invention also provide a computer storage medium storing computer instructions that, when executed on a computer, cause the computer to perform a method as described in fig. 1.
It will be apparent to those skilled in the art that various modifications and variations can be made in the present application without departing from the spirit or scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims and the equivalents thereof, the present application is intended to cover such modifications and variations.

Claims (6)

1. A software updating method, which is applied to an electronic device, wherein a project file is stored in the electronic device, the project file includes a parsing program, and the method includes:
adding a first target tree structure for realizing a first target function to the project file when an add command for the project file is detected; wherein the first target tree structure comprises at least one execution logic, each execution logic being configured to implement a functional point;
operating the project file, and calling the analysis program to analyze the first target tree structure so as to add the first target function to the software;
Wherein, any target tree structure is an abstract syntax tree;
any target function comprises a plurality of function points, a plurality of nodes are defined in each abstract syntax tree, and the function points correspond to the nodes one by one;
each node is provided with a corresponding preset attribute set, wherein the preset attribute set at least comprises a first field, a second field, a third field and a fourth field, the first field is used for indicating the function code of the current function point, the second field is used for indicating the function type of the current function point, the third field is used for indicating the function value of the current function point, the fourth field is used for indicating whether the current function point has an association relation with other function points, and the association relation is used for indicating that the current function point depends on the execution result of the other function points;
the plurality of nodes are divided into root nodes and leaf nodes, a preset field is arranged in a first target abstract syntax tree, the preset field is used for representing functional codes of functional points corresponding to the root nodes, and the calling of the parsing program to parse the first target tree structure comprises the following steps:
determining a root node from the first target abstract syntax tree based on the preset field;
Traversing all nodes included in the first target abstract syntax tree by taking the root node as a starting point, and creating corresponding types of function points according to the root node and a second field in a preset attribute set corresponding to each leaf node;
executing corresponding function points from the root node as a starting point, determining at least one leaf node associated with the root node based on a fourth field in a preset attribute set corresponding to the root node, and executing the function point corresponding to each leaf node in the at least one leaf node;
if the fact that the at least one leaf node has no association relation with other leaf nodes is determined, acquiring an execution result of a function point corresponding to each leaf node in the at least one leaf node;
and determining the execution result of the function point corresponding to the root node based on the execution result of the function point corresponding to each leaf node in the at least one leaf node.
2. The method of claim 1, wherein the project file further comprises a second target tree structure for implementing a second target function, the second target tree structure comprising at least one execution logic, each execution logic for implementing a function point, the method further comprising:
When a modification command for the project file is detected, modifying the second target tree structure into a third target tree structure, wherein the third target tree structure is used for realizing a third target function, the third target tree structure comprises at least one execution logic, each execution logic is used for realizing one function point, and the number of the same function points in the third target tree structure and the second target tree structure exceeds a set threshold;
and operating the project file, and calling the analysis program to analyze the third target tree structure so as to modify the second target function in the software into the third target function.
3. The method of claim 1, wherein the project file further comprises a second target tree structure for implementing a second target function, the second target tree structure comprising at least one execution logic, each execution logic for implementing a function point, the method further comprising:
when a replacement command for the project file is detected, replacing the second target tree structure with a third target tree structure, wherein the third target tree structure is used for realizing a third target function, the third target tree structure comprises at least one execution logic, each execution logic is used for realizing one function point, and the number of the same function points in the third target tree structure and the second target tree structure does not exceed a set threshold value;
And operating the project file, and calling the parsing program to parse the third target tree structure so as to delete the second target function in the software and add the third target function to the software.
4. A software updating apparatus, wherein an item file is stored in the apparatus, the item file including a parser therein, the apparatus comprising:
an adding unit configured to add a first target tree structure for realizing a first target function to the project file when an addition command for the project file is detected; wherein the first target tree structure comprises at least one execution logic, each execution logic being configured to implement a functional point;
the updating unit is used for running the project file, calling the analysis program to analyze the first target tree structure so as to add the first target function to the software;
wherein, any target tree structure is an abstract syntax tree;
any target function comprises a plurality of function points, a plurality of nodes are defined in each abstract syntax tree, and the function points correspond to the nodes one by one;
each node is provided with a corresponding preset attribute set, wherein the preset attribute set at least comprises a first field, a second field, a third field and a fourth field, the first field is used for indicating the function code of the current function point, the second field is used for indicating the function type of the current function point, the third field is used for indicating the function value of the current function point, the fourth field is used for indicating whether the current function point has an association relation with other function points, and the association relation is used for indicating that the current function point depends on the execution result of the other function points;
The plurality of nodes are divided into root nodes and leaf nodes, a preset field is arranged in the first target abstract syntax tree, the preset field is used for representing functional codes of corresponding functional points of the root nodes, and the updating unit is specifically used for:
determining a root node from the first target abstract syntax tree based on the preset field;
traversing all nodes included in the first target abstract syntax tree by taking the root node as a starting point, and creating corresponding types of function points according to the root node and a second field in a preset attribute set corresponding to each leaf node;
executing corresponding function points from the root node as a starting point, determining at least one leaf node associated with the root node based on a fourth field in a preset attribute set corresponding to the root node, and executing the function point corresponding to each leaf node in the at least one leaf node;
if the fact that the at least one leaf node has no association relation with other leaf nodes is determined, acquiring an execution result of a function point corresponding to each leaf node in the at least one leaf node;
and determining the execution result of the function point corresponding to the root node based on the execution result of the function point corresponding to each leaf node in the at least one leaf node.
5. An electronic device comprising at least one processor and a memory connected to the at least one processor, the at least one processor being configured to implement the steps of the method of any of claims 1-3 when executing a computer program stored in the memory.
6. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program is executed by a processor to implement the steps of the method according to any one of claims 1-3.
CN202110728350.XA 2021-06-29 2021-06-29 Software updating method and device, electronic equipment and storage medium Active CN113448605B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110728350.XA CN113448605B (en) 2021-06-29 2021-06-29 Software updating method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110728350.XA CN113448605B (en) 2021-06-29 2021-06-29 Software updating method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113448605A CN113448605A (en) 2021-09-28
CN113448605B true CN113448605B (en) 2024-02-09

Family

ID=77814045

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110728350.XA Active CN113448605B (en) 2021-06-29 2021-06-29 Software updating method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113448605B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105159715A (en) * 2015-09-01 2015-12-16 南京大学 Python code change reminding method on basis of abstract syntax tree node change extraction
CN108089871A (en) * 2017-12-04 2018-05-29 广州华旻信息科技有限公司 Automatic updating method of software, device, equipment and storage medium
CN108694049A (en) * 2017-02-23 2018-10-23 阿里巴巴集团控股有限公司 A kind of method and apparatus of update software
CN111324892A (en) * 2020-01-19 2020-06-23 上海戎磐网络科技有限公司 Software gene for generating script file and script detection method, device and medium
WO2020140940A1 (en) * 2019-01-06 2020-07-09 阿里巴巴集团控股有限公司 Code generation method and apparatus, and device and storage medium
CN111666206A (en) * 2020-04-30 2020-09-15 北京百度网讯科技有限公司 Method, device, equipment and storage medium for acquiring influence range of change code
CN111752571A (en) * 2020-06-29 2020-10-09 广州华多网络科技有限公司 Program upgrading method, device, equipment and storage medium
CN111797351A (en) * 2020-06-29 2020-10-20 平安普惠企业管理有限公司 Page data management method and device, electronic equipment and medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105159715A (en) * 2015-09-01 2015-12-16 南京大学 Python code change reminding method on basis of abstract syntax tree node change extraction
CN108694049A (en) * 2017-02-23 2018-10-23 阿里巴巴集团控股有限公司 A kind of method and apparatus of update software
CN108089871A (en) * 2017-12-04 2018-05-29 广州华旻信息科技有限公司 Automatic updating method of software, device, equipment and storage medium
WO2020140940A1 (en) * 2019-01-06 2020-07-09 阿里巴巴集团控股有限公司 Code generation method and apparatus, and device and storage medium
CN111324892A (en) * 2020-01-19 2020-06-23 上海戎磐网络科技有限公司 Software gene for generating script file and script detection method, device and medium
CN111666206A (en) * 2020-04-30 2020-09-15 北京百度网讯科技有限公司 Method, device, equipment and storage medium for acquiring influence range of change code
CN111752571A (en) * 2020-06-29 2020-10-09 广州华多网络科技有限公司 Program upgrading method, device, equipment and storage medium
CN111797351A (en) * 2020-06-29 2020-10-20 平安普惠企业管理有限公司 Page data management method and device, electronic equipment and medium

Also Published As

Publication number Publication date
CN113448605A (en) 2021-09-28

Similar Documents

Publication Publication Date Title
CN112394942B (en) Distributed software development compiling method and software development platform based on cloud computing
CN104484269A (en) Method for automatically generating testing script
CN110543427B (en) Test case storage method and device, electronic equipment and storage medium
US20210365258A1 (en) Method and system for updating legacy software
CN111026404A (en) Method and device for generating parameter configuration code, electronic product and storage medium
CN111324540B (en) Interface testing method and device
CN113296786A (en) Data processing method and device, electronic equipment and storage medium
CN116088846A (en) Processing method, related device and equipment for continuous integrated code format
CN113448605B (en) Software updating method and device, electronic equipment and storage medium
CN115525534A (en) Test case generation method and platform based on swagger interface test
CN109582318B (en) Processing method and device for Portobuf localization, terminal and storage medium
CN111679852A (en) Detection method and device for conflict dependency library
CN111352610A (en) Interface return value modification method and device, electronic equipment and storage medium
CN111444208A (en) Data updating method and related equipment
CN111400128A (en) Log management method and device, computer equipment and storage medium
US10474443B2 (en) Code lineage tool
CN113821195A (en) Method, device and equipment for generating executable program of target language
CN107612919B (en) Protocol configuration method and device
CN112699279A (en) Method, device and equipment for automatically processing components and storage medium
CN112799697A (en) Configuration file version migration method based on standard framework
CN114385271B (en) Command execution system based on plug-in
CN114756217B (en) Plug-in based script generation system
CN117221162A (en) Switch configuration detection method, device, equipment and medium
CN117952069A (en) ARXML file processing method, ARXML file processing device, ARXML file processing equipment and medium
CN113885891A (en) Tomcat application deployment method and system based on ant technology

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant