CN112799703A - Resource file processing method and device, client and storage medium - Google Patents

Resource file processing method and device, client and storage medium Download PDF

Info

Publication number
CN112799703A
CN112799703A CN202110140755.1A CN202110140755A CN112799703A CN 112799703 A CN112799703 A CN 112799703A CN 202110140755 A CN202110140755 A CN 202110140755A CN 112799703 A CN112799703 A CN 112799703A
Authority
CN
China
Prior art keywords
resource file
abstract syntax
program
code
syntax tree
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.)
Pending
Application number
CN202110140755.1A
Other languages
Chinese (zh)
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.)
Weimin Insurance Agency Co Ltd
Original Assignee
Weimin Insurance Agency 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 Weimin Insurance Agency Co Ltd filed Critical Weimin Insurance Agency Co Ltd
Priority to CN202110140755.1A priority Critical patent/CN112799703A/en
Publication of CN112799703A publication Critical patent/CN112799703A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration 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 embodiment of the invention relates to a method, a device, a client and a storage medium for processing resource files, wherein the method comprises the following steps: when detecting that a hot updated resource file exists in a program, acquiring the resource file from a server; converting the resource file into a plurality of different types of grammar structures; the hot updating operation is executed on the program based on the plurality of grammar structures, the resource file is stored in the server instead of the program official release platform, the condition that the program cannot be used due to the fact that the auditing period is too long can be effectively avoided, the resource file is converted into the grammar structures, and the code data corresponding to the grammar structures are sequentially operated to achieve the effect of directly operating the resource file, so that the hot updating of the program is achieved.

Description

Resource file processing method and device, client and storage medium
Technical Field
The embodiment of the invention relates to the field of software, in particular to a resource file processing method, a resource file processing device, a resource file processing client and a storage medium.
Background
The applet is an application program which can be used without downloading and installing, and has the advantages of light weight, being used and taken immediately and the like. With the continued development of the ecology of applets, more and more products are serving users in the form of applets.
The development of the small program to the online is usually performed through the steps of development testing- > uploading codes- > submitting audit- > issuing and the like, after the small program meets BUG, a developer needs to send the updated small program to the official audit of the small program, after the official audit of the small program passes, the developer can issue the updated small program to the outside, and the small program is exposed to the outside after the official audit passes because the time of the official audit is not fixed and the updated small program is not exposed to the outside after the audit passes, so when the small program has BUG, the user cannot obtain the updated small program at the first time, and the small program cannot be used by the user.
Disclosure of Invention
In view of this, to solve the technical problems or some technical problems, embodiments of the present invention provide a method, an apparatus, a client and a storage medium for processing a resource file.
The embodiment of the invention provides a method for processing a resource file, which comprises the following steps:
when detecting that a hot updated resource file exists in a program, acquiring the resource file from a server;
converting the resource file into a plurality of different types of grammar structures;
performing a hot update operation on the program based on a plurality of the syntax structures.
An embodiment of the present invention provides a processing apparatus for a resource file, including:
the acquisition module is used for acquiring the resource file from the server when detecting that the hot updated resource file exists in the program;
the conversion module is used for converting the resource file into a plurality of different types of grammar structures;
a processing module to perform a hot update operation on the program based on a plurality of the syntax structures.
An embodiment of the present invention provides a client, including: the processor is used for executing the processing program of the resource file stored in the memory, and the processing method of the resource file is used.
An embodiment of the present invention provides a storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors, and are used in the method for processing a resource file.
An embodiment of the present invention provides a computer program product or a computer program, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium; the processor of the client reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the client executes the method provided in the above-mentioned various alternative implementations.
According to the processing scheme of the resource file provided by the embodiment of the invention, when the resource file with hot update of the program is detected, the resource file is obtained from the server; converting the resource file into a plurality of different types of grammar structures; the hot updating operation is executed on the program based on the plurality of grammar structures, the resource file is stored in the server instead of the program official release platform, the condition that the program cannot be used due to the fact that the auditing period is too long can be effectively avoided, the resource file is converted into the grammar structures, and the code data corresponding to the grammar structures are sequentially operated to achieve the effect of directly operating the resource file, so that the hot updating of the program is achieved.
Drawings
Fig. 1 is an application scenario diagram of a resource file processing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a resource file processing method according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a process for obtaining the resource file from the server according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of another resource file processing method according to an embodiment of the present invention;
fig. 5 is a schematic flowchart of another resource file processing method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a resource file processing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a client according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For the convenience of understanding of the embodiments of the present invention, the following description will be further explained with reference to specific embodiments, which are not to be construed as limiting the embodiments of the present invention.
Fig. 1 is an application scenario diagram of a resource file processing method according to an embodiment of the present invention, as shown in fig. 1, a server 200 is used to provide a backend service for a client 300 of an application installed in a terminal device 100, where the server 200 may also be referred to as a backend server of the application, and the server 200 may include, but is not limited to, a backend server, a component server, a data server, and the like. Server 200 may store resource files for performing hot updates. The server 200 may be one server, a server cluster composed of a plurality of servers, or a cloud computing service center.
The terminal device 100 is provided with a client 300 for installing an application program, and the client 300 refers to a program corresponding to a server and providing a local service for a client. Here, the local service may include, but is not limited to: human-computer interaction services, local data collection and maintenance services, communication services between local and server, etc. The terminal Device 100 may include a Mobile phone, a tablet computer, a notebook computer, a palm computer, a Mobile Internet Device (MID), a wearable Device (e.g., a smart watch, a smart bracelet, etc.).
The client 300 may include: the application program can be an applet (such as WeChat) embedded in client software (such as WeChat) for instant messaging, a function (also called WebApp) running on a web browser, an applet embedded in an email, and the like.
When a user opens an applet in a client 300 of an application program through a terminal device 100, and a server 200 can detect that a BUG in the applet installed in the client 300 on the terminal device 100 needs to be repaired or a new function is on line, the client 300 obtains a resource file from the server 200, and the client on the terminal device 100 can perform hot update according to the resource file.
Fig. 2 is a schematic flowchart of a method for processing a resource file according to an embodiment of the present invention, and as shown in fig. 2, the method specifically includes:
and S21, when detecting that the hot updated resource file exists in the program, acquiring the resource file from the server.
The program related to this embodiment may be a program (e.g., WeChat) embedded in client software of instant messaging (e.g., WeChat), a function (also referred to as WebApp) running on a web browser, and an applet embedded in an email, where when a BUG occurs in the program, a developer debugs the BUG, generates a resource file for solving the BUG, and stores the resource file in a server, where the resource file may be used for hot update of the program, that is, the resource file stored in the server is a file that is not submitted to an official audit of the program.
Further, before the program is started, a request is sent to the server to detect whether a resource file used by the program for executing hot update exists in the server, and when the resource file used by the program for executing hot update exists in the program, the resource file is acquired from the server.
And S22, converting the resource file into a plurality of different types of grammar structures.
In this embodiment, the parser is used to parse the resource file obtained by the server from the server, and convert the resource file into a plurality of different types of syntax structures, where the conversion rule may be a syntax structure in a preset format obtained by converting according to the type of each code segment in the resource file, and the syntax structure stores corresponding code data,
the syntax structure tree of the preset format may be: an Abstract Syntax Tree (AST) of JSON format stores relevant code data on nodes in the Abstract Syntax Tree.
S23, executing hot updating operation on the program based on a plurality of the grammar structures.
And according to the running sequence of the codes in the resource file, reading corresponding code data from the plurality of grammar structures in sequence so as to achieve the effect of running the whole section of codes corresponding to the resource data and fulfill the aim of executing hot update on the program.
In an alternative of the embodiment of the present invention, the resource file may be a complete code segment of the program, and may also be a patch code corresponding to a code segment in which a BUG exists.
Further, when the resource file is a complete code segment of the program, determining an execution sequence of the corresponding syntax structure according to the execution sequence of the complete code segment, and executing a hot update operation of the program according to the execution sequence of the syntax structure.
When the resource file is a patch code, determining identification information corresponding to a code segment of a BUG of the current program, setting the identification information on the code segment and setting the identification information on the patch code, correspondingly, when the patch code is converted into a plurality of grammatical structures, setting the identification information on each grammatical structure, and accurately determining the position information of the patch code in the whole code segment of the program through the identification information.
By converting the resource file into a form of a plurality of syntactic structures, the problem that the resource file cannot be directly loaded and replaced in the hot updating stage of the program can be avoided, and the purpose of directly running the resource file to realize hot updating can be realized by sequentially reading code data in the syntactic structures.
According to the resource file processing method provided by the embodiment of the invention, when the resource file with hot update of a program is detected, the resource file is obtained from a server; converting the resource file into a plurality of different types of grammar structures; the hot updating operation is executed on the program based on the plurality of grammar structures, the resource file is stored in the server instead of the program official release platform, the condition that the program cannot be used due to the fact that the auditing period is too long can be effectively avoided, the resource file is converted into the grammar structures, and the code data corresponding to the grammar structures are sequentially operated to achieve the effect of directly operating the resource file, so that the hot updating of the program is achieved.
Fig. 3 is a schematic flowchart of a process of acquiring the resource file from the server according to the embodiment of the present invention, and as shown in fig. 3, the process specifically includes:
and S31, when the program is started, sending the local version information of the program to a server.
And performing version detection on the program when the program is started to judge whether a resource file corresponding to hot update exists in the program, wherein the resource file can be understood as patch code aiming at solving one or more BUGs of the program.
Further, the version detection of the program before the program is run may be that when the program is triggered by a user to enter the start interface, the local version information of the current program is sent to the server when the start interface is run.
And S32, receiving a version comparison result returned by the server in response to the local version information.
After receiving the sent local version information, the server queries the current version information of the program stored at the server side, and the current version information can be understood as the version information corresponding to the latest version of the program.
And the server compares the current version information with the local version information to obtain a version comparison result, and sends the comparison result to the client carried by the program.
Further, the version alignment result may be: the same, that is, the version of the program carried in the client is the latest version, and the hot update operation is not required to be executed; the version alignment result may also be: in contrast, the version of the program carried in the client is not the latest version, and the hot-update operation needs to be performed.
It should be noted that, when the version comparison results are the same, the program directly jumps to the main interface from the starting interface of the program; and when the version comparison results are different, sending the comparison result to the client carried by the program, wherein the comparison result also carries the current version information of the program stored by the server, so that the client can obtain the corresponding resource file from the server.
And S33, if the version comparison results are the same, determining that the hot updated resource file does not exist in the program.
And S34, if the version comparison results are different, determining that the hot updated resource file exists in the program.
And the client determines whether the program needs to execute hot update according to the version comparison result returned by the server, and requests the server for a corresponding resource file when the hot update needs to be executed.
And S35, sending the acquisition request of the resource file to a server.
S36, receiving the resource file corresponding to the current version information returned by the server in response to the acquisition request.
The client generates an acquisition request of the resource file according to the current version information carried in the version comparison result, sends the acquisition request to the server, the server analyzes the acquisition request to obtain the current version information after receiving the acquisition request, queries the resource file corresponding to the current version information, returns the resource file to the client, and stores the resource file in a cache corresponding to a program when the client receives the resource file.
In this embodiment, the resource file may be a log file in Object Notation (JSON) format, or a target abstract syntax tree in JSON format; and when the resource file is a log file in a JSON format, storing the log file in a cache corresponding to the program in a character string mode.
When the resource file is a target Abstract Syntax Tree in the JSON format, the server converts the log file in the JSON format into the target Abstract Syntax Tree in the JSON format in advance, where the target Abstract Syntax Tree may be (Abstract Syntax Tree, AST), and the conversion of the resource file may be performed by using Acorn, which is a JS parser.
Fig. 4 is a schematic flowchart of another resource file processing method according to an embodiment of the present invention, and as shown in fig. 4, the method specifically includes:
and S41, acquiring the log file in the JSON format from the server when detecting that the hot updated resource file exists in the program.
In this embodiment, the resource file is a log file in JSON format, the log file is a code for solving the BUG provided by the developer, and the log file is stored in a character string format, and the data format is JSON.
Detecting whether the program has the resource file with the hot update through the version number detection, when the program has the resource file with the hot update, requesting the server to acquire the log file with the JSON format, and the step of acquiring the log file with the JSON format may refer to the relevant steps from S31 to S36 in fig. 3, which is not described herein for brevity.
And S42, inputting the log file into a parser so that the parser outputs a target abstract syntax tree corresponding to the log file.
The parser may be a JS parser, for example, Acorn, and the target abstract syntax tree may be AST, and the log file is parsed by Acorn and converted into AST, that is, converted into a tree data structure, and the AST may include a parent node, a child node, a sibling node, and the like.
And S43, splitting the target abstract syntax tree into a plurality of sub abstract syntax trees according to the types of codes in the target abstract syntax tree.
The division of the target AST is performed by using the Acorn library, and the returned AST object conforming to the ESTree spec corresponding to the AST is returned by using an interface (input, options) of the target AST, which can be understood as that the target AST is divided into a plurality of different types of sub-AST according to the type of codes in the AST by using the Acorn library.
The process of performing the splitting of the AST with the Acorn library may be: traversing all nodes in the target abstract syntax tree to obtain a plurality of code types contained in the target abstract syntax tree; and extracting a code part related to each code type from the target abstract syntax tree to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
Further, inputting the target AST into an Acorn repository, and traversing all nodes in the target AST sequentially from a parent node by using a JS parser in the Acorn repository to obtain a plurality of code types contained in the target AST, where the code types may be: ForStation type (for loop), CallExpression type (function call), IfStation type (judgment), etc., and then returns the sub AST conforming to the ESTree spec by using an interface (input, options).
In an alternative of the embodiment of the present invention, an operation sequence of a plurality of codes corresponding to the code type in the target abstract syntax tree is determined; and extracting a code part corresponding to each code type from the target abstract syntax tree according to the running sequence to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
The running sequence of the codes corresponding to the multiple code types can be understood as the running sequence of the codes corresponding to each code type in the resource file, and the purpose of obtaining the running sequence of the codes is to facilitate the subsequent hot updating of the program according to the sub-abstract syntax tree.
And S44, reading corresponding code information from the plurality of sub abstract syntax trees in sequence according to the running sequence, and executing hot updating operation on the program based on the code information.
And obtaining an operation sequence according to different code types in the obtained resource file, sequencing the plurality of sub-ASTs, sequentially reading code information corresponding to each sub-AST according to the sequenced sub-ASTs, and operating the code information to achieve the effect of operating the whole resource file, thereby realizing the hot update operation of the program.
In an alternative scheme of the embodiment of the present invention, a plurality of sub-abstract syntax trees are sent to a compiler, so that the compiler compiles each sub-abstract syntax tree to obtain code information corresponding to each sub-abstract syntax tree; receiving a plurality of code information returned by the compiler; and sequentially adopting a plurality of code information to perform hot updating operation on the program according to the running sequence.
By means of the compiling capability of an external compiler, the plurality of sub-abstract syntax trees are compiled simultaneously, the reading time of the sub-abstract syntax trees can be shortened, and the hot updating efficiency is improved.
It should be noted that: in addition to the compiler, any other program, thread, process, or the like that can read the sub-abstract syntax can be used to perform the reading step of the code information, and this embodiment is not particularly limited.
Fig. 5 is a schematic flowchart of a processing method for a resource file according to another embodiment of the present invention, and as shown in fig. 5, the method specifically includes:
and S51, when detecting that the hot updated resource file exists in the program, acquiring the target abstract syntax tree in the JSON format from the server.
In this embodiment, the resource file is a target abstract syntax tree in JSON format, the target abstract syntax tree in JSON format is obtained by converting a log file in JSON format, the log file is a code for solving program BUG provided by a developer, and the code is stored in a character string form, and the data format is JSON.
The server calls Acorn, converts the log file to a target abstract syntax tree, which may be AST, using a JS parser.
And S52, splitting the target abstract syntax tree into a plurality of sub abstract syntax trees according to the types of codes in the target abstract syntax tree.
The division of the AST is performed by using the Acorn library, and the returned AST object conforming to the ESTree spec corresponding to the AST is returned by using an interface (input, options) of the AST, which can be understood as that the AST is divided into a plurality of sub-ASTs of different types according to the type of codes in the AST by using the Acorn library.
The process of performing the splitting of the AST with the Acorn library may be: traversing all nodes in the target abstract syntax tree to obtain a plurality of code types contained in the target abstract syntax tree; and extracting a code part related to each code type from the target abstract syntax tree to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
Further, inputting the target AST into an Acorn repository, and traversing all nodes in the target AST sequentially from a parent node by using a JS parser in the Acorn repository to obtain a plurality of code types contained in the target AST, where the code types may be: ForStation type (for loop), CallExpression type (function call), IfStation type (judgment), etc., and then returns the sub AST conforming to the ESTree spec by using an interface (input, options).
In an alternative of the embodiment of the present invention, an operation sequence of a plurality of codes corresponding to the code type in the target abstract syntax tree is determined; and extracting a code part corresponding to each code type from the target abstract syntax tree according to the running sequence to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
The running sequence of the codes corresponding to the multiple code types can be understood as the running sequence of the codes corresponding to each code type in the resource file, and the purpose of obtaining the running sequence of the codes is to facilitate the subsequent hot updating of the program according to the sub-abstract syntax tree.
And S53, reading corresponding code information from the plurality of sub abstract syntax trees in sequence according to the running sequence, and executing hot updating operation on the program based on the code information.
And obtaining an operation sequence according to different code types in the obtained resource file, sequencing the plurality of sub-ASTs, sequentially reading code information corresponding to each sub-AST according to the sequenced sub-ASTs, and operating the code information to achieve the effect of operating the whole resource file, thereby realizing the hot update operation of the program.
According to the resource file processing method provided by the embodiment of the invention, when the resource file with hot update of a program is detected, the resource file is obtained from a server; converting the resource file into a plurality of different types of grammar structures; the method comprises the steps of executing hot updating operation on a program based on a plurality of syntactic structures, storing a resource file in a server instead of a program official release platform, effectively avoiding the condition that the program cannot be used due to an overlong auditing period, splitting the resource file into a plurality of different types of sub-ASTs, and sequentially operating the sub-ASTs according to the code operation sequence to achieve the effect of directly operating the resource file, thereby realizing hot updating of the program, facilitating timely repair when the program has BUG, and improving the experience of a user in using the program.
Fig. 6 is a schematic structural diagram of a resource file processing apparatus according to an embodiment of the present invention, and as shown in fig. 6, the apparatus specifically includes:
an obtaining module 61, configured to obtain a resource file of a hot update from a server when detecting that the resource file exists in a program;
a conversion module 62 for converting the resource file into a plurality of different types of grammar structures;
a processing module 63, configured to perform a hot update operation on the program based on a plurality of the syntax structures.
When detecting that a hot updated resource file exists in a program, acquiring the resource file from a server;
converting the resource file into a plurality of different types of grammar structures;
performing a hot update operation on the program based on a plurality of the syntax structures.
In one possible embodiment, the resource file includes: a log file in an object numbered musical notation format;
the conversion module 62 is specifically configured to input the log file into a parser, so that the parser outputs a target abstract syntax tree corresponding to the log file; and splitting the target abstract syntax tree into a plurality of sub abstract syntax trees according to the type of codes in the target abstract syntax tree.
In one possible embodiment, the resource file includes: a target abstract syntax tree in object notation format;
the conversion module 62 is specifically configured to split the target abstract syntax tree into a plurality of sub abstract syntax trees according to the type of the code in the target abstract syntax tree.
In a possible implementation manner, the conversion module 62 is specifically configured to traverse all nodes in the target abstract syntax tree to obtain a plurality of code types included in the target abstract syntax tree; and extracting a code part related to each code type from the target abstract syntax tree to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
In a possible embodiment, the conversion module 62 is specifically configured to determine an operation order of a plurality of codes corresponding to the code types in the target abstract syntax tree; and extracting a code part corresponding to each code type from the target abstract syntax tree according to the running sequence to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
In a possible implementation manner, the processing module 63 is specifically configured to read corresponding code information from a plurality of the sub-abstract syntax trees in sequence according to the running order, and perform a hot update operation on the program based on the code information.
In a possible implementation manner, the processing module 63 is specifically configured to send the plurality of sub-abstract syntax trees to a compiler, so that the compiler compiles each sub-abstract syntax tree to obtain code information corresponding to each sub-abstract syntax tree; receiving a plurality of code information returned by the compiler; and sequentially adopting a plurality of code information to perform hot updating operation on the program according to the running sequence.
In one possible embodiment, the apparatus further comprises: a detection module 604, configured to send local version information of the program to a server when the program is started; receiving a version comparison result returned by the server in response to the local version information; if the version comparison results are the same, determining that the hot updated resource file does not exist in the program; if the version comparison results are different, determining that the hot updated resource file exists in the program; and when the version comparison results are different, the version comparison result also carries the current version information of the resource file stored by the server.
In a possible implementation manner, the obtaining module 61 is specifically configured to send an obtaining request of the resource file to a server, where the obtaining request carries the current version information; and receiving the resource file corresponding to the current version information returned by the server in response to the acquisition request.
The processing apparatus for a resource file provided in this embodiment may be the processing apparatus for a resource file shown in fig. 6, and may perform all the steps of the processing method for a resource file shown in fig. 2 to 5, so as to achieve the technical effect of the processing method for a resource file shown in fig. 2 to 5, which is described with reference to fig. 2 to 5 for brevity, and is not described herein again.
Fig. 7 is a schematic structural diagram of a client according to an embodiment of the present invention, where the client 700 shown in fig. 7 includes: at least one processor 701, memory 702, at least one network interface 704, and other user interfaces 703. The various components in client 700 are coupled together by a bus system 705. It is understood that the bus system 705 is used to enable communications among the components. The bus system 705 includes a power bus, a control bus, and a status signal bus in addition to a data bus. But for clarity of illustration the various busses are labeled in figure 7 as the bus system 705.
The user interface 703 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, trackball, touch pad, or touch screen, among others.
It is to be understood that the memory 702 in embodiments of the present invention may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of illustration and not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (ddr Data Rate SDRAM, ddr SDRAM), Enhanced Synchronous SDRAM (ESDRAM), synchlronous SDRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 702 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some embodiments, memory 702 stores the following elements, executable units or data structures, or a subset thereof, or an expanded set thereof: an operating system 7021 and application programs 7022.
The operating system 7021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, for implementing various basic services and processing hardware-based tasks. The application 7022 includes various applications, such as a Media Player (Media Player), a Browser (Browser), and the like, for implementing various application services. Programs that implement methods in accordance with embodiments of the present invention can be included within application program 7022.
In the embodiment of the present invention, the processor 701 is configured to execute the method steps provided by the method embodiments by calling a program or an instruction stored in the memory 702, specifically, a program or an instruction stored in the application 7022, for example, and includes:
when detecting that a hot updated resource file exists in a program, acquiring the resource file from a server; converting the resource file into a plurality of different types of grammar structures; performing a hot update operation on the program based on a plurality of the syntax structures.
In one possible embodiment, the resource file includes: a log file in an object numbered musical notation format;
inputting the log file into a parser so that the parser outputs a target abstract syntax tree corresponding to the log file; and splitting the target abstract syntax tree into a plurality of sub abstract syntax trees according to the type of codes in the target abstract syntax tree.
In one possible embodiment, the resource file includes: a target abstract syntax tree in object notation format;
and splitting the target abstract syntax tree into a plurality of sub abstract syntax trees according to the type of the codes in the target abstract syntax tree.
In a possible implementation manner, all nodes in the target abstract syntax tree are traversed to obtain a plurality of code types contained in the target abstract syntax tree; and extracting a code part related to each code type from the target abstract syntax tree to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
In one possible implementation, determining an operation sequence of codes corresponding to a plurality of code types in the target abstract syntax tree; and extracting a code part corresponding to each code type from the target abstract syntax tree according to the running sequence to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
In one possible implementation, corresponding code information is sequentially read from a plurality of the sub-abstract syntax trees according to the running order, and a hot update operation on the program is executed based on the code information.
In a possible implementation manner, sending the plurality of sub-abstract syntax trees to a compiler so that the compiler compiles each sub-abstract syntax tree to obtain code information corresponding to each sub-abstract syntax tree; receiving a plurality of code information returned by the compiler; and sequentially adopting a plurality of code information to perform hot updating operation on the program according to the running sequence.
In one possible embodiment, the local version information of the program is sent to a server when the program is started; receiving a version comparison result returned by the server in response to the local version information; if the version comparison results are the same, determining that the hot updated resource file does not exist in the program; if the version comparison results are different, determining that the hot updated resource file exists in the program; and when the version comparison results are different, the version comparison result also carries the current version information of the resource file stored by the server.
In a possible implementation manner, an obtaining request of the resource file is sent to a server, and the obtaining request carries the current version information; and receiving the resource file corresponding to the current version information returned by the server in response to the acquisition request.
The method disclosed in the above embodiments of the present invention may be applied to the processor 701, or implemented by the processor 701. The processor 701 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be implemented by integrated logic circuits of hardware or instructions in the form of software in the processor 701. The Processor 701 may be a general-purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software elements in the decoding processor. The software elements may be located in ram, flash, rom, prom, or eprom, registers, among other storage media that are well known in the art. The storage medium is located in the memory 702, and the processor 701 reads the information in the memory 702 and performs the steps of the above method in combination with the hardware thereof.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the Processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units performing the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The client provided in this embodiment may be the client shown in fig. 7, and may execute all the steps of the method for processing the resource file shown in fig. 2 to 5, so as to achieve the technical effect of the method for processing the resource file shown in fig. 2 to 5, which is described with reference to fig. 2 to 5 for brevity and is not described herein again.
The embodiment of the invention also provides a storage medium (computer readable storage medium). The storage medium herein stores one or more programs. Among others, the storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the storage medium are executable by one or more processors, the method for processing the resource file executed on the processing device side of the resource file is realized.
The processor is used for executing the processing program of the resource file stored in the memory so as to realize the following steps of the processing method of the resource file executed on the processing equipment side of the resource file:
when detecting that a hot updated resource file exists in a program, acquiring the resource file from a server; converting the resource file into a plurality of different types of grammar structures; performing a hot update operation on the program based on a plurality of the syntax structures.
In one possible embodiment, the resource file includes: a log file in an object numbered musical notation format;
inputting the log file into a parser so that the parser outputs a target abstract syntax tree corresponding to the log file; and splitting the target abstract syntax tree into a plurality of sub abstract syntax trees according to the type of codes in the target abstract syntax tree.
In one possible embodiment, the resource file includes: a target abstract syntax tree in object notation format;
and splitting the target abstract syntax tree into a plurality of sub abstract syntax trees according to the type of the codes in the target abstract syntax tree.
In a possible implementation manner, all nodes in the target abstract syntax tree are traversed to obtain a plurality of code types contained in the target abstract syntax tree; and extracting a code part related to each code type from the target abstract syntax tree to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
In one possible implementation, determining an operation sequence of codes corresponding to a plurality of code types in the target abstract syntax tree; and extracting a code part corresponding to each code type from the target abstract syntax tree according to the running sequence to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
In one possible implementation, corresponding code information is sequentially read from a plurality of the sub-abstract syntax trees according to the running order, and a hot update operation on the program is executed based on the code information.
In a possible implementation manner, sending the plurality of sub-abstract syntax trees to a compiler so that the compiler compiles each sub-abstract syntax tree to obtain code information corresponding to each sub-abstract syntax tree; receiving a plurality of code information returned by the compiler; and sequentially adopting a plurality of code information to perform hot updating operation on the program according to the running sequence.
In one possible embodiment, the local version information of the program is sent to a server when the program is started; receiving a version comparison result returned by the server in response to the local version information; if the version comparison results are the same, determining that the hot updated resource file does not exist in the program; if the version comparison results are different, determining that the hot updated resource file exists in the program; and when the version comparison results are different, the version comparison result also carries the current version information of the resource file stored by the server.
In a possible implementation manner, an obtaining request of the resource file is sent to a server, and the obtaining request carries the current version information; and receiving the resource file corresponding to the current version information returned by the server in response to the acquisition request.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (12)

1. A method for processing resource files is characterized by comprising the following steps:
when detecting that a hot updated resource file exists in a program, acquiring the resource file from a server;
converting the resource file into a plurality of different types of grammar structures;
performing a hot update operation on the program based on a plurality of the syntax structures.
2. The method of claim 1, wherein the resource file comprises: a log file in an object numbered musical notation format;
the converting the resource file into a plurality of different types of grammar structures includes:
inputting the log file into a parser so that the parser outputs a target abstract syntax tree corresponding to the log file;
and splitting the target abstract syntax tree into a plurality of sub abstract syntax trees according to the type of the codes in the target abstract syntax tree.
3. The method of claim 1, wherein the resource file comprises: a target abstract syntax tree in object notation format;
the converting the resource file into a plurality of different types of grammar structures includes:
and splitting the target abstract syntax tree into a plurality of sub abstract syntax trees according to the type of the codes in the target abstract syntax tree.
4. The method of claim 2 or 3, wherein splitting the target abstract syntax tree into a plurality of sub-abstract syntax trees according to the type of code in the target abstract syntax tree comprises:
traversing all nodes in the target abstract syntax tree to obtain a plurality of code types contained in the target abstract syntax tree;
and extracting a code part related to each code type from the target abstract syntax tree to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
5. The method of claim 4, wherein the extracting the code portion associated with each code type from the target abstract syntax tree to obtain a plurality of sub-abstract syntax trees corresponding to a plurality of code types comprises:
determining the running sequence of codes corresponding to a plurality of code types in the target abstract syntax tree;
and extracting a code part corresponding to each code type from the target abstract syntax tree according to the running sequence to obtain a plurality of sub abstract syntax trees corresponding to the plurality of code types.
6. The method of claim 5, wherein performing a hot update operation on the program based on the plurality of syntax structures comprises:
and reading corresponding code information from the plurality of sub-abstract syntax trees in sequence according to the running sequence, and executing hot updating operation on the program based on the code information.
7. The method of claim 6, wherein reading corresponding code information from the plurality of sub-abstract syntax trees in sequence according to the running order, and performing a hot update operation on the program based on the code information comprises:
sending the plurality of sub-abstract syntax trees to a compiler so that the compiler compiles each sub-abstract syntax tree to obtain code information corresponding to each sub-abstract syntax tree;
receiving a plurality of code information returned by the compiler;
and sequentially adopting a plurality of code information to perform hot updating operation on the program according to the running sequence.
8. The method of claim 1, wherein determining whether the resource file of the program is hot updated by:
when the program is started, sending local version information of the program to a server;
receiving a version comparison result returned by the server in response to the local version information;
if the version comparison results are the same, determining that the hot updated resource file does not exist in the program;
if the version comparison results are different, determining that the hot updated resource file exists in the program;
and when the version comparison results are different, the version comparison result also carries the current version information of the resource file stored by the server.
9. The method of claim 8, wherein the obtaining the resource file from the server comprises:
sending an acquisition request of the resource file to a server, wherein the acquisition request carries the current version information;
and receiving the resource file corresponding to the current version information returned by the server in response to the acquisition request.
10. An apparatus for processing resource files, comprising:
the acquisition module is used for acquiring the resource file from the server when detecting that the hot updated resource file exists in the program;
the conversion module is used for converting the resource file into a plurality of different types of grammar structures;
a processing module to perform a hot update operation on the program based on a plurality of the syntax structures.
11. A client, comprising: a processor and a memory, wherein the processor is used for executing a processing program of the resource file stored in the memory so as to realize the processing method of the resource file as claimed in any one of claims 1-9.
12. A storage medium storing one or more programs executable by one or more processors to implement the method of processing a resource file according to any one of claims 1 to 9.
CN202110140755.1A 2021-02-01 2021-02-01 Resource file processing method and device, client and storage medium Pending CN112799703A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110140755.1A CN112799703A (en) 2021-02-01 2021-02-01 Resource file processing method and device, client and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110140755.1A CN112799703A (en) 2021-02-01 2021-02-01 Resource file processing method and device, client and storage medium

Publications (1)

Publication Number Publication Date
CN112799703A true CN112799703A (en) 2021-05-14

Family

ID=75813644

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110140755.1A Pending CN112799703A (en) 2021-02-01 2021-02-01 Resource file processing method and device, client and storage medium

Country Status (1)

Country Link
CN (1) CN112799703A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113448611A (en) * 2021-08-31 2021-09-28 中邮消费金融有限公司 Method and system for quickly and thermally updating application program

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113448611A (en) * 2021-08-31 2021-09-28 中邮消费金融有限公司 Method and system for quickly and thermally updating application program
CN113448611B (en) * 2021-08-31 2021-11-30 中邮消费金融有限公司 Method and system for quickly and thermally updating application program

Similar Documents

Publication Publication Date Title
US9852015B2 (en) Automatic discovery of a JavaScript API
CN111666206B (en) Method, device, equipment and storage medium for acquiring influence range of change code
US10481964B2 (en) Monitoring activity of software development kits using stack trace analysis
US8402319B2 (en) Method and system to extract a navigation model for analysis of a web application
CN110659057B (en) Application program hot updating method and device, storage medium and computer equipment
US10175975B2 (en) Self-mending software builder
US20180146072A1 (en) Creation of a binding based on a description associated with a server
US11934287B2 (en) Method, electronic device and computer program product for processing data
US11836072B2 (en) Risk-based root cause identification methods and related autobuild systems
US11789752B1 (en) Dynamically-updatable deep transactional monitoring systems and methods
US11314491B1 (en) Generating asynchronous runtime compatibility in JavaScript applications
US10169213B2 (en) Processing of an application and a corresponding test file in a content repository
US20160055074A1 (en) Program analysis device, program analysis method, and program analysis program
Hughes et al. Building Resource Adaptive Software Systems (BRASS) Objectives and System Evaluation
US8914815B2 (en) Automated framework for tracking and maintaining kernel symbol list types
US11977872B2 (en) Method and system for code maintenance
US20120084608A1 (en) Mechanism for Performing Verification of Template Integrity of Monitoring Templates Used for Customized Monitoring of System Activities
CN112799703A (en) Resource file processing method and device, client and storage medium
US9185513B1 (en) Method and system for compilation with profiling feedback from client
CN106502707B (en) Code generation method and device
CN113360156B (en) IOS compiling method and related equipment
CN114115884A (en) Management method and related device for programming service
EP2721494B1 (en) System and method to in-line script dependencies
CN111151008B (en) Verification method and device for game operation data, configuration background and medium
US11689630B2 (en) Request processing method and apparatus, electronic device, and computer storage medium

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