CN113448605A - 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
CN113448605A
CN113448605A CN202110728350.XA CN202110728350A CN113448605A CN 113448605 A CN113448605 A CN 113448605A CN 202110728350 A CN202110728350 A CN 202110728350A CN 113448605 A CN113448605 A CN 113448605A
Authority
CN
China
Prior art keywords
target
function
tree structure
target tree
project file
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.)
Granted
Application number
CN202110728350.XA
Other languages
Chinese (zh)
Other versions
CN113448605B (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

Images

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 software updating device, electronic equipment and a storage medium, which can solve the problems that updating failure or retesting is easily caused when software is updated by writing new codes on the basis of original codes in the prior art. The software updating method comprises the following steps: adding a first target tree structure for realizing a first target function to the project file when an adding command for the project file is detected; the first target tree structure comprises at least one execution logic, each execution logic is used for realizing a function point; and operating the project file, and calling an analysis program to analyze the first target tree structure so as to add a first target function to the software.

Description

Software updating method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a software updating method and apparatus, an electronic device, and a storage medium.
Background
In the prior art, when the existing software needs to be updated, new codes are often written in on the basis of original codes, but the newly written codes may affect the original codes, so that updating failure is caused.
Disclosure of Invention
The embodiment of the application provides a software updating method and device, electronic equipment and a storage medium, and can solve the problem that updating failure easily occurs when software is updated 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, which is applied to an electronic device, where an item file is stored in the electronic device, and the item file includes an analysis program, and the method includes:
adding a first target tree structure for implementing 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 for implementing a function 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 the embodiment of the application, a project file is stored in the electronic device, and the project file includes an analysis program. When the software needs to be updated, only the first target tree structure for realizing the first target function needs to be added into the project file, then the project file is operated, and meanwhile, 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 software updating failure is reduced, and the software updating efficiency is improved.
Optionally, 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 configured to implement a function point, and the method further includes:
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 value;
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 the embodiment of the 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 can be directly modified to obtain a third target tree structure. And then operating the project file, and simultaneously calling an analysis program to analyze the third target tree structure, thereby modifying the second target function into a third target function. In the method, if the software updating only involves updating partial function points of the existing functions, the software updating can be directly modified on the basis of the existing target tree structure without regenerating the whole target tree structure for realizing new functions, so that the software updating efficiency is improved.
Optionally, 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 configured to implement a function point, and the method further includes:
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 analysis program to analyze 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 the embodiment of the present application, a second target tree structure for implementing a second target function is stored in the project file, and if a function of the software needs to be updated, the second target tree structure may be replaced with a third target tree structure for implementing a third target function. And then operating the project file, and simultaneously calling an analysis program to analyze the third target tree structure, thereby deleting the second target function and adding the third target function into the software. In the method, if the software updating involves changing the multifunctional points of the existing functions, the existing target tree structure can be replaced by the new target tree structure, errors caused by more changes to the existing target tree structure are avoided, and therefore the software updating efficiency is improved.
Optionally, any target tree structure is an abstract syntax tree.
In the embodiment of the application, the target tree structure for realizing the target function can be an abstract syntax tree, so that the target function can be described more simply.
Optionally, any target function includes a plurality of function points, each abstract syntax tree defines a plurality of nodes, and the function points correspond to the nodes one to one.
In the embodiment of the present application, any target function may be divided into a plurality of function points, and then one function point is described based on one node in the abstract syntax tree, thereby facilitating management of each function point.
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 a 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 execution results of the other function points.
In the embodiment of the application, each node manages one function point through a preset attribute set of the node, so that the abstract syntax tree can be conveniently and uniformly analyzed subsequently.
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 function code of a function point corresponding to the root node, and invoking the parser 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 functional points of corresponding types according to the root node and a second field in a preset attribute set corresponding to each leaf node;
executing a corresponding function point 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 at least one leaf node is determined to have no incidence relation with other leaf nodes, 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 analyzed in a uniform mode, and different analysis programs are not required to be designed separately for different target abstract syntax trees.
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 parser, and the apparatus includes:
an adding unit configured to add, when an addition command for the project file is detected, a first target tree structure for implementing a first target function to the project file; wherein the first target tree structure comprises at least one execution logic, each execution logic for implementing a function point;
and the updating unit is used for 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.
Optionally, 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 configured to implement a function point, and the apparatus further includes:
a modification unit, configured to modify the second target tree structure into a third target tree structure when a modification command for the project file is detected, where the third target tree structure is used to implement a third target function, the third target tree structure includes at least one execution logic, each execution logic is used to implement 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 update 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 comprises:
a replacing unit, configured to replace the second target tree structure with a third target tree structure when a replacement command for the project file is detected, where the third target tree structure is used to implement a third target function, the third target tree structure includes at least one execution logic, each execution logic is used to implement 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;
the updating unit is further configured to run the project file, and invoke the parser 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 target tree structure is an abstract syntax tree.
Optionally, any target function includes a plurality of function points, each abstract syntax tree defines a plurality of nodes, and the function points correspond to the nodes one to one.
Optionally, each node has a corresponding preset attribute set, where the preset attribute set at least includes 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 a 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 result that the current function point depends on other function points is achieved.
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 to represent a function code of a function 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 functional points of corresponding types according to the root node and a second field in a preset attribute set corresponding to each leaf node;
executing a corresponding function point 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 at least one leaf node is determined to have no incidence relation with other leaf nodes, 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, an embodiment of the present application provides an electronic device, where the electronic device includes a processor and a memory, and the processor is configured to implement the steps of the method according to any one of the embodiments of the first aspect when executing a computer program stored in the memory.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the method according to any one of the embodiments of the first aspect.
Drawings
Fig. 1 is a schematic flowchart 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 disclosure;
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 is described in further detail below with reference to the accompanying drawings and embodiments.
In the prior art, when existing software needs to be updated, a plurality of functional modules are usually developed based on an update requirement, each functional module is reserved with an interface, and then a code is input to call each functional module to realize a function to be updated, that is, on the basis of an original code, software update is realized by writing a new code, but the newly written code may affect the original code, thereby causing software update failure.
In view of this, an embodiment of the present application provides a software updating method, in which a target tree structure for implementing a target function is separately added to a project file, and a separate parser is used to parse the target tree structure, so that codes for implementing other functions in the project file are not affected, the possibility of software updating failure is reduced, and the efficiency of software updating is improved.
The technical solutions provided by the embodiments of the present application are described below with reference to the accompanying drawings. Referring to fig. 1, an embodiment of the present application provides a software updating method, where a flow of the method is described as follows:
step 101: adding a first target tree structure for realizing a first target function to the project file when an adding command for the project file is detected; wherein the first target tree structure comprises at least one execution logic, each execution logic for implementing a function point.
In consideration of the comparative embodiment, a developer manually inputs new codes (the new codes are used for realizing target functions) on the basis of original codes, and then runs all the codes (the original codes and the new codes) to update software, so that the newly input codes may conflict with the original codes, software update failure is caused, software update efficiency is low, and the new functions need to be tested three times before being online, and can be formally online after no error is ensured.
In view of this, in the embodiment of the present application, a code that needs to be newly input may be described by using a specific data structure (that is, a target function to be added is described by using a specific data structure), when software needs to be updated, software update may be completed by directly parsing the data structure describing the target function, because a code that implements an original function and a data structure that implements the target function to be added are independent of each other, and a parsing process for the data structure is also independent of an execution process of an original code, no influence is caused on the original code, thereby reducing a probability of software update failure, improving software update efficiency, and a new code is not added, and a comprehensive test is not required, as long as a target tree structure is guaranteed to be correct. Before this, the 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, which can be considered to be used for implementing the existing function of the software, and the project file further includes a parsing program, which can be used for parsing the tree structure, so as to implement the function described by the tree structure. I.e. the parser is designed for parsing the tree structure. When the electronic device detects an add instruction for a 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 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 therefore, the first target tree structure should include at least one execution logic in describing the first target function, and each execution logic is used for implementing one function point. For example, the first target tree structure may adopt an abstract syntax tree, so as to implement more concise description of the target function to be updated.
The following is a detailed description of how the target functionality is described using an abstract syntax tree.
In this embodiment of the present application, any target function includes a plurality of function points, each abstract syntax tree may define a plurality of nodes, and 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 may correspond to the function points included in the target function one to one, 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 an encoding of a current function point (used to distinguish multiple function points included in each entry mark 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 here means 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 a project mark function is described in the above manner, so that a set of standard description structure is formed, and smooth execution of a subsequent analysis process is facilitated.
Considering that the target tree structure represents a project target function, each project target function has a corresponding target object, for example, if the update function is a function of adding a click to an existing button to play music, the "button" is the target object, and the "click and play music" is the target function of the target object. Therefore, in the embodiment of the present application, not only the target tree structure for describing the target function needs to be added to the project file, but also the corresponding relationship 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, the target object 1, the target object 2, and the target object 3, are predefined in the project file for characterizing the original function, and the number of the predefined target objects in the project file is not particularly limited herein. Meanwhile, the plurality of target objects may be all target objects of the same type, or target objects of different types, and the type of the target object predefined in the project file is not particularly limited.
The following is a detailed description of how to associate the target tree structure with the target object.
The first mode is as follows: and the target tree structure describing the target function directly establishes an incidence relation with the target object.
In the embodiment of the application, each target object predefined in the project file has its own identity, and before the original function is updated, a developer can 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, in addition to describing the target function, an identity of a target object to be associated, so that after the target tree structure is added to the project file, the target tree structure can be associated with a specific target object in a plurality of target objects predefined in the project file.
The second mode is as follows: and establishing an incidence relation between a target tree structure describing a target function and a target object indirectly.
In the embodiment of the application, a plurality of target tree structures (i.e., function templates) for describing different target functions are pre-established, and each target tree structure has its own identity, i.e., the target functions described by the target tree structures can be distinguished by their own identities. Meanwhile, a reference tree structure for describing a target object to be associated and calling which target tree structure (i.e., which function template) is to be associated 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 in 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 manners may be flexibly selected according to specific upgrade content, for example, when the upgrade content is to add one target function to one target object, or to add different target functions to different target objects, the first manner or the second manner may be selected; when the upgrading content is to add the same target function to different target objects, the second mode can be selected. And is not particularly limited herein.
Step 102: and operating the project file, and calling an analysis program to analyze 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 can be updated.
As a possible implementation manner, the electronic device may run the project file, and simultaneously invoke 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.
A detailed description is given below of how to parse a first target abstract syntax tree for describing a first target function.
In this embodiment, 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 parsing, usually starting from a root node (that is, the root node is used as a starting point of parsing), so that the root node can be determined at 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 a function code of a function point corresponding to the root node, so that the starting point of parsing can be quickly determined in a parsing process. The preset field and the encoding of the root node are not particularly limited herein.
In an actual parsing process, the electronic device may quickly determine a root node from the first target abstract syntax tree based on the preset field, and then traverse all nodes defined in the first target abstract syntax tree with the root node as a starting point, for example, a front-end traversal manner may be adopted, which is not limited herein. Meanwhile, function points of corresponding types are created according to second fields in a preset attribute set corresponding to the root node and 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 of the type of function point can be completed through the node itself 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 to execute 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 with other leaf nodes, the execution result of the function point corresponding to each leaf node in the at least one leaf node can be directly obtained. And then further 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, thereby completing the analysis process.
It should be understood that if any leaf node in the at least one leaf node has an association relationship with other leaf nodes, the function points corresponding to other leaf nodes are further executed, and corresponding execution results are obtained, and on this basis, the execution results of the function points corresponding to any leaf node can be determined, and finally, the execution results of the function points corresponding to the root node can still be determined.
For example, the first target abstract syntax tree is:
Figure BDA0003139364780000121
Figure BDA0003139364780000131
referring to fig. 2, the first target abstract syntax tree is used to describe s ═ 2, i.e. a constant 2 is obtained and then a value is assigned to the variable s. Three nodes are used in implementing the above functions for description: the first is used to describe the assignment operation (i.e., "), the second node is used to describe the variable s, and the third node is used to describe the constant 2. The preset field "root" is 1, it can be determined that the first node is the 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, it is found that the function point of the first node is not an independent function, and it 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 there is no associated node between the second node and the third node. After obtaining 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, the execution result of the first node may be further determined.
For another example, the first target abstract syntax tree is:
Figure BDA0003139364780000141
Figure BDA0003139364780000151
Figure BDA0003139364780000161
referring to fig. 3, the first target abstract syntax tree is used to describe s as 2+3, that is, constants 2 and 3 are obtained, then constants 3 and 2 are added, and then the result of the addition is assigned to variable s. Five nodes are used in implementing the above functions for description: the first node is used to describe the assignment operation ("═ to"), the second node is used to describe the variable s, the third node is used to describe the addition operation ("+"), the fourth node is used to describe the constant 2, and the fifth node is used to describe the constant 3. The preset field "root" is 1, it can be determined that the first node is the 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, it is found that the function point of the first node is not an independent function, and it 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 it should be understood that the function point corresponding to the second node and the function point corresponding to the third node are independent from each other, and thus, the two function points may be considered to be executed in parallel. Since the execution process of the function point corresponding to the second node does not need to depend on the execution results of other nodes, 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 the execution processes of the function points corresponding to the fourth node and the fifth node do not depend on the execution results of other function points, so that 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 the 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 (i.e., assigning the constant 5 to the variable s) can be determined.
In some embodiments, it is considered that the software update is not to add a new target function to a specific target object, but to slightly adjust 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 at this time, in the embodiment of the present application, modification is performed on the basis of the existing target tree structure directly without regenerating the whole target tree structure for implementing a new function, so that the software updating efficiency 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 for implementing one function point. When the electronic device detects a modification instruction for the project file, the second target tree structure may be modified to a third target tree structure for implementing a third target function. And then, the project file can be operated, and then an 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. For the specific analysis process, please refer to the above, which is not described herein again.
It is to be understood that the third target tree structure comprises at least one execution logic, each execution logic is configured to implement 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. Meanwhile, both the second target tree structure and the second target tree structure may be abstract syntax trees.
In some embodiments, it is considered that the software update is not to add a new target function to a specific target object, but to perform a large adjustment on a certain target function of the same target object. At this moment, in the embodiment of the application, 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 software updating efficiency 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 for implementing one 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. And then, the project file can be operated, and then an 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. For the specific analysis process, please refer to the above, which is not described herein again.
It should be understood that the third target tree structure includes at least one execution logic, each execution logic is used for implementing 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. Meanwhile, both the second target tree structure and the second target tree structure may be abstract syntax trees.
In some embodiments, it is considered that the software update is not to add a new target function to a specific target object, but to remove a certain target function of 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 for implementing one function point. When the electronic device detects a delete command for the item file, the second target tree structure may be deleted from the item file. And then the project file can be operated, so that the second target function in the software is deleted. It is to be understood 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 a project file is stored in the software updating apparatus, and the project file includes a parsing program, and the software updating apparatus includes: an adding unit 201 and an updating unit 202.
An adding unit 201 configured to add a first target tree structure for implementing 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 for implementing a function point;
an updating unit 202, configured to run the project file, and invoke the parser 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, where the second target tree structure includes at least one execution logic, and each execution logic is 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 value;
the updating unit 202 is further configured to: and operating the project file, and calling an analysis program to analyze the third target tree structure so as to modify the second target function in the software into a 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 aiming at the project file is detected, the third target tree structure is used for realizing a third target function, the third target tree structure comprises at least one executing logic, each executing 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;
the updating unit 202 is further configured to run the project file, and invoke a parser 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 target tree structure is an abstract syntax tree.
Optionally, any target function includes a plurality of function points, each abstract syntax tree defines a plurality of nodes, and the function points correspond to the nodes one to one.
Optionally, each node has a corresponding preset attribute set, where the preset attribute set at least includes 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 a 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 result that the current function point depends on other function points is achieved.
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 to represent a function code of a function 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 functional points of corresponding types according to the root node and a second field in a preset attribute set corresponding to each leaf node;
executing a corresponding function point 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 at least one leaf node is determined to have no incidence relation with other leaf nodes, 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, an 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 provided in the embodiment of the present invention and shown in fig. 1.
Alternatively, the processor 301 may be specifically a central processing unit, a specific ASIC, and may be one or more integrated circuits for controlling the execution of programs.
Optionally, the electronic device may further comprise a memory 302 connected 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 by the processor 301 during operation, that is, storing instructions executable by the at least one processor 301, and the at least one processor 301 executes the method shown in fig. 1 by executing the instructions stored in the memory 302. The number of the memories 302 is one or more. The memory 302 is also shown in fig. 5, but it should be understood that the memory 302 is not an optional functional module, and is therefore shown in fig. 5 by a dotted line.
The physical devices corresponding to the adding unit 201 and the updating unit 202 may be the processor 301. The electronic device may be configured to perform the method provided by the embodiment shown in fig. 1. Therefore, regarding the functions that can be realized by the functional modules in the electronic device, reference may be made to the corresponding description in the embodiment shown in fig. 1, which is not repeated herein.
Embodiments of the present invention also provide a computer storage medium, where the computer storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the method as described in fig. 1.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A software updating method is applied to electronic equipment, project files are stored in the electronic equipment, and the project files comprise analysis programs, and the method comprises the following steps:
adding a first target tree structure for implementing 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 for implementing a function 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.
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 value;
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 analysis program to analyze 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 method according to any of claims 1-3, wherein any target tree structure is an abstract syntax tree.
5. The method of claim 4, wherein any target function comprises a plurality of function points, wherein a plurality of nodes are defined in each abstract syntax tree, and wherein the function points are in one-to-one correspondence with the nodes.
6. The method of claim 5, wherein each node has a corresponding preset attribute set, the preset attribute set comprises at least a first field, a second field, a third field and a fourth field, the first field is used for indicating a function code of the current function point, the second field is used for indicating a function type of the current function point, the third field is used for indicating a 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 is dependent on execution results of other function points.
7. The method of claim 6, wherein 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 characterizing a function code of a corresponding function point of the root node, and invoking the parser to parse the first target tree structure comprises:
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 functional points of corresponding types according to the root node and a second field in a preset attribute set corresponding to each leaf node;
executing a corresponding function point 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 at least one leaf node is determined to have no incidence relation with other leaf nodes, 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.
8. A software update apparatus, wherein a project file is stored in the apparatus, and the project file includes a parser, the apparatus comprising:
an adding unit configured to add, when an addition command for the project file is detected, a first target tree structure for implementing a first target function to the project file; wherein the first target tree structure comprises at least one execution logic, each execution logic for implementing a function point;
and the updating unit is used for 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.
9. An electronic device comprising at least one processor and a memory coupled to the at least one processor, the at least one processor being configured to implement the steps of the method according to any one of claims 1-7 when executing a computer program stored in the memory.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the execution of the computer program by a processor is to realize the steps of the method according to any of the claims 1-7.
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 true CN113448605A (en) 2021-09-28
CN113448605B 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
CN113448605B (en) 2024-02-09

Similar Documents

Publication Publication Date Title
CN112394942B (en) Distributed software development compiling method and software development platform based on cloud computing
CN110543427B (en) Test case storage method and device, electronic equipment and storage medium
US20210365258A1 (en) Method and system for updating legacy software
CN112953983A (en) SFTP transmission method and device
CN112463586B (en) Method and medium for automatically generating application program interface test case
CN112685308A (en) Front-end code debugging method and device, computer equipment and computer storage medium
CN110727429B (en) Front-end page generation method, device and equipment
CN115525534A (en) Test case generation method and platform based on swagger interface test
CN112597023A (en) Case management method and device based on guide picture, computer equipment and storage medium
CN113448605B (en) Software updating method and device, electronic equipment and storage medium
US20220092476A1 (en) Dependence relationship detection device and dependence relationship detection method
JP2008165342A (en) Source code creating method, device and program
CN110825433A (en) Design method of edge control equipment
CN115437639A (en) Automatic generation method and device of compiling configuration file, electronic equipment and storage medium
CN110569187B (en) Automatic testing method, device and equipment for multi-platform system application
CN113821195A (en) Method, device and equipment for generating executable program of target language
CN107506299B (en) Code analysis method and terminal equipment
CN114385271B (en) Command execution system based on plug-in
CN114756217B (en) Plug-in based script generation system
WO2024109167A1 (en) Program code processing method and apparatus
US20210311843A1 (en) System verification program generation device, system verification program generation method, and recording medium storing system verification program generation program
CN111736847B (en) Script language mapping method, electronic device and readable storage medium
WO2015198473A1 (en) Test program, test device, and test method
CN113885891A (en) Tomcat application deployment method and system based on ant technology
CN116069582A (en) Application program generation method and device

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