Application Update Method, Device, Equipment and Storage Medium
By obtaining and executable objects in AST data, the cross-platform applicability problem of dynamic updates of flutter applications is solved, online version updates and bug fixes are realized, and update efficiency is improved.
Patent Information
- Application Number
- CN202111075718.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-14
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2041-09-14
AI Technical Summary
The existing technology lacks mature solutions to support dynamic update of flutter applications, especially the inability to achieve dynamic update of business logic and lack of cross-platform applicability.
By obtaining abstract syntax tree (AST) data, executable objects are obtained based on AST data, and executable objects are executed using dart virtual machine (VM) to update flutter applications, realizing dynamic updates.
It realizes dynamic updates of flutter applications, does not need to re-download the installation package, supports cross-platform online version updates and bug fixes, improving update efficiency and applicability.
Smart Images

Figure CN113961215B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, specifically to technical fields such as application development and front-end technologies, and particularly to an application update method, apparatus, device, and storage medium. Background Art
[0002] With the development of Flutter technology, more and more applications (APPs) are developed using Flutter technology.
[0003] In order to improve the application update speed and enhance the user experience, APPs need to support dynamic updates. However, there is currently a lack of a mature solution for supporting dynamic updates of Flutter applications. Summary of the Invention
[0004] The present disclosure provides an application update method, apparatus, device, and storage medium.
[0005] According to one aspect of the present disclosure, there is provided an application update method, including: obtaining AST data, where the AST data is used to describe the AST corresponding to the updated source code of the application to be updated; obtaining an executable object based on the AST data, where the executable object can be executed by the application to be updated; and executing the executable object to update the application to be updated.
[0006] According to another aspect of the present disclosure, there is provided an application update apparatus, including: an obtaining module for obtaining AST data, where the AST data is used to describe the AST corresponding to the updated source code of the application to be updated; a parsing module for obtaining an executable object based on the AST data, where the executable object can be executed by the application to be updated; and an execution module for executing the executable object to update the application to be updated.
[0007] According to another aspect of the present disclosure, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of the above aspects.
[0008] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to cause a computer to execute the method according to any one of the above aspects.
[0009] According to another aspect of the present disclosure, there is provided a computer program product including a computer program which, when executed by a processor, implements the method according to any one of the above aspects.
[0010] According to the technical solution of the present disclosure, dynamic update of an application can be supported.
[0011] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. Description of the Drawings
[0012] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0013] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure;
[0014] Figure 2 is a schematic diagram according to the second embodiment of the present disclosure;
[0015] Figure 3 is a schematic diagram according to the third embodiment of the present disclosure;
[0016] Figure 4 is a schematic diagram according to the fourth embodiment of the present disclosure;
[0017] Figure 5 is a schematic diagram according to the fifth embodiment of the present disclosure;
[0018] Figure 6 is a schematic diagram of an electronic device for implementing any one of the application update methods in the embodiments of the present disclosure. Detailed Embodiments
[0019] The following makes an illustration of the exemplary embodiments of the present disclosure in conjunction with the drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted below.
[0020] In the related art, there are some solutions for supporting dynamic update of flutter applications. For example, methods based on static generation of domain-specific language (DSL) products, dynamic open-source frameworks based on JavaScript, and product replacement supporting the android side, etc.
[0021] However, all of these solutions have certain limitations. For example, the method based on statically generating DSL products only supports the dynamic update of the user interface (UI), and does not support the dynamic update of business logic; for the dynamic open-source framework based on JavaScript, the flutter application needs to be encoded as JavaScript code; the product replacement that supports the android side is only applicable to the android system and not applicable to the ios system.
[0022] To achieve the generality of the dynamic update of the application, the present disclosure provides the following embodiments.
[0023] Figure 1 FIG. is a schematic diagram according to the first embodiment of the present disclosure. This embodiment provides an application update method, including:
[0024] 101. Obtain Abstract Syntax Tree (AST) data, where the AST data is used to describe the AST corresponding to the updated source code of the application to be updated.
[0025] 102. Based on the AST data, obtain an executable object that can be executed by the application to be updated.
[0026] 103. Execute the executable object to update the application to be updated.
[0027] Wherein, the execution subject of this embodiment can be an application update device, and this device can be located on an electronic device. The electronic device can be a user terminal, and the user terminal can include: mobile devices (such as mobile phones, tablets), wearable devices (such as smart watches, smart bracelets), smart home devices (such as smart TVs, smart speakers), vehicle-mounted terminals (such as car machines), etc.
[0028] In this embodiment, by processing based on AST data, when there is an update to the application, it is not necessary to download a new installation package, thereby realizing the dynamic update of the application. Further, the processing solution based on the dynamic parsing object is not limited to UI, JavaScript code, and the android system, and has strong generality.
[0029] Source code, also known as source code, refers to an uncompiled text file written according to certain programming language specifications, which is a series of human-readable computer language instructions.
[0030] Applications of different technologies can be written in different programming languages, and the corresponding source code can be source code in different programming languages.
[0031] For example, if the application is a Flutter application, since the programming language corresponding to the Flutter application is Dart, the source code can specifically be Dart source code.
[0032] Flutter is an open-source toolkit by Google that helps developers efficiently build beautiful multi-platform applications through a set of code libraries, supporting mobile, web, desktop, and embedded platforms.
[0033] In computer science, an Abstract Syntax Tree (AST), or simply a syntax tree, is an abstract representation of the syntactic structure of source code. It presents the syntactic structure of a programming language in a tree-like form, and each node in the tree represents a structure in the source code.
[0034] AST data is used to describe the AST corresponding to the source code. For example, it can be described from dimensions such as lexical and semantic. AST data can also be called AST products.
[0035] Specifically, AST data can include: library, declaration, statement, expression. Generally speaking, for each Dart source code corresponding to a Flutter application, it is a library. A library contains classes, enums, top-level functions, top-level variables, or constants. A declaration is an executable carrier that contains class declarations, function declarations, etc. A class declaration consists of member variables and function declarations. A function declaration consists of a statement block and a return expression. A statement consists of statements or / or expressions. An expression is the smallest unit of the abstract syntax tree.
[0036] The application to be updated can be a Flutter application, that is, a certain Flutter application needs to be updated.
[0037] When the developer of a Flutter application needs to update the Flutter application, they can update its source code to obtain the updated source code.
[0038] Specifically, the server can obtain the updated source code written by the developer and then obtain the AST data based on the source code.
[0039] The AST data obtained based on the updated source code can be called the updated AST data. The server can actively send the updated AST data to the Flutter applications installed on each user terminal; or, the Flutter applications installed on each user terminal can periodically query the server to check if there is updated AST data. When the server receives the query and there is updated AST data, it will feedback the updated AST data as a response to the Flutter application.
[0040] In some embodiments, the Flutter application can obtain the AST data from the server. The server compiles the Dart source code based on the analyze component of the Dart architecture to obtain the AST data.
[0041] Among them, the analyze component is provided by Dart official. Based on this analyze component, an AST object, that is, AST data, can be generated based on the Dart source code, and code inspection of the Dart source code can also be performed.
[0042] The analyze component can provide the CompilationUnit class. Based on this class, the Dart source code can be compiled to obtain an AST object. The specific compilation process can refer to the related technology and will not be elaborated here.
[0043] By using the analyze component to obtain the AST data, the AST data can be obtained simply and effectively.
[0044] As Figure 2 shown, the Flutter application can include: a dynamic parser. The dynamic parser obtains an executable object based on the obtained AST data, and then realizes the dynamic update of the Flutter application. Based on the dynamic update, it can support the online update of the version or online bug fixing of the Flutter application.
[0045] Under the Flutter architecture, as Figure 2 shown, the Flutter application can also include: a Dart virtual machine (VirtualMachine, VM). The Dart VM executes the executable object to run the corresponding Flutter application.
[0046] The executable object refers to an object executable by the Dart VM, and can include classes, methods, application programming interfaces (APIs), templates, etc.
[0047] Further, executable objects can be divided into non-customizable executable objects and customizable executable objects. Non-customizable executable objects refer to general executable objects, such as objects provided by the system where the Flutter application is located, or objects provided by a third party. Specifically, for example, APIs provided by the system or a third party. Customizable executable objects refer to executable objects corresponding to functions or UIs customized by the developer of the Flutter application.
[0048] As Figure 2 shown, after the dynamic parser parses the dynamic parsing object, non-customizable executable objects and / or customizable executable objects can be obtained. Subsequently, the non-customizable executable objects and / or customizable executable objects can be executed by the Dart VM, thereby rendering the UI of the Flutter application and / or running the business functions of the Flutter application.
[0049] Taking the executable objects including non-customizable executable objects and customizable executable objects as an example, different executable objects can be obtained in different ways.
[0050] In some embodiments, obtaining the executable object based on the AST data includes:
[0051] Parsing the AST data to obtain a parsing object; and obtaining the executable object based on the parsing object.
[0052] Further, the parsing object includes: a first parsing object and a second parsing object. The executable object includes non-customizable executable objects and / or customizable executable objects. Obtaining the executable object based on the parsing object includes: mapping the first parsing object to the non-customizable executable object based on a syntax mapping; and / or converting the second parsing object to the customizable executable object based on a custom template.
[0053] Among them, the first parsing object refers to a dynamic parsing object that can be parsed into a non-customizable executable object, and the second parsing object refers to a dynamic parsing object that can be parsed into a customizable executable object.
[0054] As Figure 3 shown, the dynamic parser can parse the AST data to obtain a parsing object. The parsing object includes a first parsing object and a second parsing object. Based on the syntax mapping, the first parsing object is mapped to the non-customizable executable object, and based on the custom template, the second parsing object is converted to the customizable executable object.
[0055] Developers of Flutter applications can complete the coding of the source code of Flutter applications according to their own needs. The source code can include multiple classes, and the multiple classes can include existing classes and / or custom classes, so as to obtain a first parsing object and a second parsing object. That is, the first parsing object is the dynamic parsing object of the existing class object, and the second parsing object is the dynamic parsing object corresponding to the custom class.
[0056] For the first parsing object, a corresponding non-custom executable object can be obtained based on the syntax mapping method. For example, the Function.apply() method in the system or third-party syntax mapping is used to implement the mapping from the first parsing object to the non-custom executable object.
[0057] For the second parsing object, metadata can be pre-configured in the dynamic parser. Based on the second parsing object, an instance of the metadata can be created, and then the metadata can be matched to the custom template based on the uri, class name, method name, etc., and the instance corresponding to the metadata is passed into the custom template to implement the instantiation of the custom template. The instantiated custom template can be called a custom executable object, so that the Dart VM can execute the custom executable object.
[0058] The parsing object can be obtained through the AST data, and then the executable object can be obtained.
[0059] By obtaining the non-custom executable object based on the syntax mapping and the custom executable object based on the custom template, the Flutter application can run smoothly when it includes existing classes and custom classes.
[0060] In some embodiments, parsing the AST data to obtain a parsing object includes: constructing an abstract syntax tree based on the AST data, and the abstract syntax tree includes nodes; if variables are included in the nodes, based on the scope chain of the variables, obtaining the expressions in the AST corresponding to the variables; executing the expressions to obtain an execution result, and using the execution result as the parsing object corresponding to the variables.
[0061] Among them, the AST can include multiple nodes, and each node of the AST can be traversed in a recursive traversal manner.
[0062] Variables can be included in the nodes, and the variables can be used to store and convert data.
[0063] The scope chain refers to the effective range of variables. For each scope on the scope chain, the variables within the scope are managed. By concatenating the parent node scope or the child node scope, the public variables of the parent node can be accessed, and at the same time, the child node can access its public variables.
[0064] For a certain variable, based on the scope chain, the scope of the variable can be obtained. Based on this scope, the expressions in the AST within this scope can be obtained. An expression is the smallest executable unit of the AST. Subsequently, the expressions within this scope can be executed to obtain the execution result, and the execution result is used as the parsing object corresponding to the variable.
[0065] By constructing an AST based on AST data and based on the scope chain, a parsing object can be obtained.
[0066] In some embodiments, the application is a Flutter application, and the executable object is the executable object of the Dart VM corresponding to the Flutter application. Executing the executable object includes:
[0067] Using the Dart VM to execute the executable object.
[0068] Among them, in the Flutter architecture, the Dart VM executes the executable object, as Figure 2 or Figure 3 shown. Subsequently, the update of the Flutter application can be realized.
[0069] By executing the executable object through the Dart VM, the running of the Flutter application can be realized.
[0070] In the embodiments of the present disclosure, when there is an update for the Flutter application, instead of adopting the method of re-downloading and installing the installation package of the Flutter application, the update of the Flutter application is realized based on the AST data, thereby realizing the dynamic update of the Flutter application, and further supporting the online version update or online bug fixing of the Flutter application, etc.
[0071] Figure 4 It is a schematic diagram according to the fourth embodiment of the present disclosure. This embodiment provides an application update method, and the method includes:
[0072] 401. The server uses the analyze component to compile the Dart source code of the Flutter application to obtain AST data.
[0073] Among them, if it is used for the application update process, then the above-mentioned Flutter application is the application to be updated, and the Dart source code is the updated source code.
[0074] 402. The server sends the AST data to the Flutter application.
[0075] 403. The flutter application obtains a parsing object based on the AST data, and the parsing object includes a first parsing object and a second parsing object.
[0076] 404. The flutter application uses grammar mapping to map the first parsing object to a non-custom executable object; and based on a custom template, converts the second parsing object into a custom executable object.
[0077] 405. The flutter application uses the dart VM to execute the non-custom executable object and the custom executable object to update the flutter application.
[0078] It can be understood that for the content not detailed in this embodiment, reference can be made to the relevant descriptions of other embodiments.
[0079] In this embodiment, when there is an update for the flutter application, instead of re-downloading and installing the installation package of the flutter application, the update of the flutter application is realized based on the AST data, thereby realizing the dynamic update of the flutter application, and further supporting the online version update or online bug repair of the flutter application, etc.
[0080] Figure 5 This is a schematic diagram according to the fifth embodiment of the present disclosure. This embodiment provides an application update device. As Figure 5 shown, the device 500 includes: an acquisition module 501, a parsing module 502, and an execution module 503.
[0081] The acquisition module 501 is used to acquire AST data, and the AST data is used to describe the AST corresponding to the updated source code of the application to be updated;
[0082] The parsing module 502 is used to obtain an executable object based on the AST data, and the executable object can be executed by the application to be updated;
[0083] The execution module 503 is used to execute the executable object to update the application to be updated.
[0084] In this embodiment, by processing based on the AST data, when there is an update for the application, it is not necessary to download a new installation package, thereby realizing the dynamic update of the application. Further, the processing solution based on the dynamic parsing object is not limited to UI, JavaScript code, and the android system, and has strong versatility.
[0085] In some embodiments, the updated source code is Dart source code, and the obtaining module 501 is specifically configured to: obtain the AST data from a server, where the server compiles the Dart source code based on the analyze component of the Dart architecture to obtain the AST data.
[0086] In some embodiments, the parsing module 502 is specifically configured to: parse the AST data to obtain a parsing object; and obtain the executable object based on the parsing object.
[0087] In some embodiments, the parsing object includes: a first parsing object and / or a second parsing object, and the executable object includes a non-customizable executable object and a customizable executable object. The parsing module 502 is further specifically configured to: map the first parsing object to the non-customizable executable object based on a syntax mapping; and / or convert the second parsing object to the customizable executable object based on a custom template.
[0088] In some embodiments, the parsing module 502 is further specifically configured to: construct an abstract syntax tree based on the AST data, where the abstract syntax tree includes nodes; if the nodes include variables, obtain the expressions in the AST corresponding to the variables based on the scope chain of the variables; execute the expressions to obtain an execution result, and use the execution result as the parsing object corresponding to the variables.
[0089] In some embodiments, the application is a Flutter application, and the executable object is an executable object of the Dart VM corresponding to the Flutter application. The execution module 503 is specifically configured to: use the Dart VM to execute the executable object.
[0090] In the embodiments of the present disclosure, when there is an update to a Flutter application, instead of redownloading and installing the installation package of the Flutter application, the update of the Flutter application is implemented based on the AST data, thereby realizing the dynamic update of the Flutter application, and further supporting online version updates or online bug fixes, etc., of the Flutter application.
[0091] It can be understood that in the embodiments of the present disclosure, the same or similar content in different embodiments can be referred to each other.
[0092] It can be understood that the "first", "second", etc. in the embodiments of the present disclosure are only used for distinction and do not represent high or low importance, chronological order, etc.
[0093] According to the embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0094] Figure 6 FIG. shows a schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, for example, laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, personal digital assistants, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementations of the present disclosure described and / or claimed herein.
[0095] As Figure 6 shown, the electronic device 600 includes a computing unit 601 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0096] A plurality of components in the electronic device 600 are connected to the I / O interface 605, including: an input unit 606, such as, for example, a keyboard, a mouse, etc.; an output unit 607, such as, for example, various types of displays, speakers, etc.; a storage unit 608, such as, for example, a magnetic disk, an optical disk, etc.; and a communication unit 609, such as, for example, a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the electronic device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0097] The computing unit 601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 executes the various methods and processes described above, such as the application update method. For example, in some embodiments, the application update method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the application update method described above can be executed. Alternatively, in other embodiments, the computing unit 601 can be configured to execute the application update method in any other suitable manner (e.g., by means of firmware).
[0098] Various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field-programmable gate arrays (FPGA), application-specific integrated circuits (ASIC), application-specific standard products (ASSP), system-on-a-chip systems (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special or general-purpose programmable processor, receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0099] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program codes can be executed entirely on the machine, partially on the machine, executed partially on the machine as an independent software package and partially on a remote machine, or executed entirely on a remote machine or server.
[0100] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0101] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).
[0102] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0103] A computer system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is created by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0104] It should be understood that various forms of the processes shown above can be used, steps can be reordered, added or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitations are imposed herein.
[0105] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.
Claims
1. An application update method, comprising: Obtaining Abstract Syntax Tree (AST) data, where the AST data is used to describe the AST corresponding to the updated source code of the application to be updated; The application is a Flutter application, and the updated source code is Dart source code; the AST data is obtained from a server, and the server is obtained after compiling the Dart source code based on the analyze component of the Dart architecture; Using the dynamic parser in the Flutter application, based on the AST data, obtaining an executable object that can be executed by the application to be updated; the executable object is an executable object of the Dart VM corresponding to the Flutter application; Using the Dart VM to execute the executable object to update the application to be updated.
2. The method according to claim 1, wherein The obtaining the executable object based on the AST data includes: Parsing the AST data to obtain a parsed object; Based on the parsed object, obtaining the executable object.
3. The method according to claim 2, wherein, The parsed object includes: a first parsed object and / or a second parsed object, and the executable object includes a non-customizable executable object and a customizable executable object. The obtaining the executable object based on the parsed object includes: Based on a syntax mapping, mapping the first parsed object to the non-customizable executable object; And / or, Based on a custom template, converting the second parsed object into the customizable executable object.
4. The method according to claim 2, wherein The parsing the AST data to obtain a parsed object includes: Constructing an abstract syntax tree based on the AST data, where the abstract syntax tree includes nodes; If the nodes include variables, based on the scope chain of the variables, obtaining the expressions in the AST corresponding to the variables; Executing the expressions to obtain an execution result, and using the execution result as the parsed object corresponding to the variables.
5. An application update device, comprising: An obtaining module, configured to obtain AST data, where the AST data is used to describe the AST corresponding to the updated source code of the application to be updated; The application is a Flutter application, and the updated source code is Dart source code; the AST data is obtained from a server, and the server is obtained after compiling the Dart source code based on the analyze component of the Dart architecture; A parsing module, configured to use the dynamic parser in the Flutter application, based on the AST data, obtain an executable object that can be executed by the application to be updated; the executable object is an executable object of the Dart VM corresponding to the Flutter application; An execution module, configured to use the Dart VM to execute the executable object to update the application to be updated.
6. The apparatus according to claim 5, wherein The parsing module is specifically configured to: Parse the AST data to obtain a parsed object; Based on the parsed object, obtain the executable object.
7. The apparatus according to claim 6, wherein The parsing object includes: a first parsing object and / or a second parsing object, and the executable object includes a non-custom executable object and a custom executable object. The parsing module is further specifically configured to: Based on a syntax mapping, map the first parsing object to the non-custom executable object; and / or Based on a custom template, convert the second parsing object into the custom executable object.
8. The apparatus according to claim 6, wherein, The parsing module is further specifically configured to: Construct an abstract syntax tree based on the AST data, and the abstract syntax tree includes nodes; If the nodes include variables, obtain the expressions in the AST corresponding to the variables based on the scope chain of the variables; Execute the expressions to obtain an execution result, and use the execution result as the parsing object corresponding to the variables.
9. An electronic device, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1-4.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-4.
11. A computer program product, comprising a computer program, and the computer program implements the method according to any one of claims 1-4 when executed by a processor.
Citation Information
Patent Citations
Application program hot update method and device, storage medium and computer equipment
CN110659057A