CN113467803B - Application program repairing method, related device and equipment - Google Patents

Application program repairing method, related device and equipment Download PDF

Info

Publication number
CN113467803B
CN113467803B CN202110722068.0A CN202110722068A CN113467803B CN 113467803 B CN113467803 B CN 113467803B CN 202110722068 A CN202110722068 A CN 202110722068A CN 113467803 B CN113467803 B CN 113467803B
Authority
CN
China
Prior art keywords
script
modified
application program
patch package
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110722068.0A
Other languages
Chinese (zh)
Other versions
CN113467803A (en
Inventor
张宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202110722068.0A priority Critical patent/CN113467803B/en
Publication of CN113467803A publication Critical patent/CN113467803A/en
Application granted granted Critical
Publication of CN113467803B publication Critical patent/CN113467803B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

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

Landscapes

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

Abstract

The application discloses a repair method of an application program, and a related device and equipment, wherein the repair method of the application program comprises the following steps: the server acquires the modified script code; compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, wherein the script files correspond to the modified methods one by one; and packaging script files corresponding to the modified methods to obtain a latest patch package, so that when the client terminal starts the application program, the latest patch package is obtained from the server, and the application program is repaired based on the script files in response to the fact that the latest patch package comprises the script files corresponding to the modified methods. According to the scheme, the user can be prevented from manually downloading and updating the application program, the operation steps of the user are reduced, and the repairing experience and efficiency of the application program are improved.

Description

Application program repairing method, related device and equipment
Technical Field
The present invention relates to the technical field of application program repair, and in particular, to an application program repair method, and related devices and equipment.
Background
With the rapid development of internet technology, the functions of internet technology are more and more diversified and efficient. In the process of using the application program, the user needs to increase the convenience degree of the application program.
In the application process, some program errors or program iterations often occur in the application program, and at this time, a programmer is required to repair and update the application program. At present, a common repairing and updating mode is to make a user download and install again to replace an application program which is originally required to be repaired and updated by constructing a repaired installation package.
However, the above method often requires the user to perform complicated operation, which is easy to bring inconvenience to the user and leads to easy loss of the user.
Disclosure of Invention
The application program repairing method, the related device and the equipment are provided, and the problem that more complicated operations are brought to a user by repairing and updating the application program in the prior art is solved.
The application provides a method for repairing an application program, which comprises the following steps: the server acquires the modified script code; compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, wherein the script files correspond to the modified methods one by one; and packaging script files corresponding to the modified methods to obtain a latest patch package, so that when the client terminal starts the application program, the latest patch package is obtained from the server, and the application program is repaired based on the script files in response to the fact that the latest patch package comprises the script files corresponding to the modified methods.
The step of compiling the modified script code by utilizing a multi-platform compiler to generate a script file with a set format comprises the following steps: and compiling the modified script codes by using a KotlenJs compiler to generate a script file in a Javascript format.
The method comprises the steps of compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, wherein the steps of the script files corresponding to the modified methods comprise: compiling the modified script codes based on the dimension of each Kotlen module by a Kotlen js compiler to obtain a plurality of compiling scripts; splitting the compiling script based on the method contained in each compiling script to obtain a script file corresponding to each modified method; wherein each modified method corresponds to a script file.
The step of packing script files corresponding to the modified methods to obtain the latest patch package comprises the following steps: comparing the script code before modification with the script code after modification to obtain a new method and a changed method in the script code after modification; naming script files corresponding to the newly added method and the changed method according to the class names of the original method corresponding to the newly added method and the changed method and the concatenation of the method signatures; and packaging the named script file to obtain the latest patch package.
The method comprises the steps of compiling the modified script codes by utilizing a multi-platform compiler, and generating script files with set formats, wherein the method further comprises the following steps: when the script code of the application program is constructed, a preset transfer logic is inserted into each original method entry of the script code, so that when a task corresponding to the original method of the application program is executed, whether the task is executed by executing the original method is judged by executing the preset transfer logic in the original method.
The application program repairing method further comprises the following steps: script code of the application is built through Kotlin.
The application also provides a method for repairing the application program, which comprises the following steps: the client terminal starts an application program and acquires the latest patch package from the server; responding to the latest patch package which comprises script files corresponding to the modified methods, and repairing the application program based on the script files; wherein, the latest patch package is script codes after the server acquires the modification; compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, and packaging the script files corresponding to the modified methods, wherein the script files correspond to the modified methods one by one.
The method for repairing the application program based on the script files comprises the following steps of: the task corresponding to the original method of the application program is executed by executing preset transfer logic at the original method entrance of the application program, so as to judge whether the task is executed by executing the original method.
The method for repairing the application program based on the script files comprises the following steps of: unpacking the latest patch package to obtain script files corresponding to the modified methods in response to the fact that the latest patch package comprises the modified script files; and recording the file path of each script file based on the naming of the script file to obtain a record table. Judging whether a spliced record of a class name and a method signature corresponding to the original method exists in a record table or not by executing preset transfer logic; and if the record table has the same record of the class name corresponding to the original method and the concatenation of the method signature, executing the task corresponding to the original method by executing the modified script file.
The step of executing the task corresponding to the original method by executing the modified script file comprises the following steps: acquiring a file path of the script file after modification corresponding to the original method from a record table; acquiring a modified script file based on the file path; and executing the modified script file.
The application also provides a repairing device of the application program, which comprises: the acquisition module is used for acquiring the modified script code; the compiling module is used for compiling the modified script codes by utilizing the multi-platform compiler to generate script files with set formats, wherein the script files correspond to the modified methods one by one; and the packaging module is used for packaging the script files corresponding to the modified methods to obtain the latest patch package, so that when the client terminal starts the application program, the latest patch package is obtained from the server, and the application program is repaired based on the script files in response to the fact that the latest patch package comprises the script files corresponding to the modified methods.
The application also provides a repairing device of the application program, which comprises: the starting module is used for starting the application program and acquiring the latest patch package from the server; the repair module is used for responding to the script files corresponding to the modified methods included in the latest patch package and repairing the application program based on the script files; wherein, the latest patch package is script codes after the server acquires the modification; compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, and packaging the script files corresponding to the modified methods, wherein the script files correspond to the modified methods one by one.
The application also provides an electronic device, which comprises a memory and a processor which are mutually coupled, wherein the processor is used for executing program instructions stored in the memory so as to realize the repairing method of any application program.
The application also provides a computer readable storage medium having program instructions stored thereon, which when executed by a processor implement a repair method for any one of the above-mentioned applications.
According to the scheme, the modified script code is obtained; and compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, wherein the script files correspond to the modified methods one by one, so that the repairing method of the embodiment can be applied to repairing the application programs of multiple platforms, the situation that developers independently compile and repair the platforms is avoided, the repairing workload of the developers is reduced, the repairing efficiency of the application programs of the platforms is improved, and the project maintenance cost is reduced. The method and the system also package script files corresponding to the modified methods to obtain the latest patch package, so that when the client terminal starts the application program, the latest patch package is obtained from the server, and the application program is repaired based on the script files in response to the latest patch package comprising the script files corresponding to the modified methods, thereby avoiding related operations of downloading and updating the application program by a user, reducing user operation steps and improving repair experience and efficiency.
Drawings
FIG. 1 is a flow chart of a first embodiment of a repair method for an application of the present application;
FIG. 2 is a flow chart of a second embodiment of a repair method for an application of the present application;
FIG. 3 is a schematic diagram of a transmission network of an application scenario in FIG. 2;
fig. 4 is a data flow diagram of data transmission performed by each terminal in the transmission network in the application scenario of fig. 3;
FIG. 5 is a flow chart of a third embodiment of a repair method for an application of the present application;
FIG. 6 is a flow chart of a fourth embodiment of a repair method for an application of the present application;
FIG. 7 is a schematic diagram of a framework of one embodiment of a prosthetic device of the application;
FIG. 8 is a schematic diagram of a framework of another embodiment of a prosthetic device of the application;
FIG. 9 is a schematic diagram of a frame of an embodiment of an electronic device of the present application;
FIG. 10 is a schematic diagram of a framework of one embodiment of a computer-readable storage medium of the present application.
Detailed Description
The following describes the embodiments of the present application in detail with reference to the drawings.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, interfaces, techniques, etc., in order to provide a thorough understanding of the present application.
The terms "system" and "network" are often used interchangeably herein. The term "and/or" is merely one association relationship describing the associated object, and three relationships may exist, for example, a and/or B may: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein is generally an or relationship between the front and rear related objects. Further, "more" than two or more than two herein.
Referring to fig. 1, fig. 1 is a flowchart of a first embodiment of a repairing method for an application program of the present application.
Step S11: and acquiring the modified script code.
The embodiment is applied to an application scene after an application program has been installed on a client terminal. The server obtains the modified script code. The script code is used for constructing the application program, and the current application program is repaired or updated by acquiring and applying the modified script code.
The application programs of the present embodiment include application programs provided on a mobile terminal, a PC terminal or other intelligent terminals, such as APP on a mobile terminal, and the specific type is not limited herein.
Step S12: and compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, wherein the script files are in one-to-one correspondence with the modified methods.
And compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats. Wherein, the multi-platform compiler refers to a compiler which can compile a plurality of application formats or can apply compiled script codes to a plurality of platforms, for example: android platform, ios platform, nodeJs desktop/server application platform, java desktop/server application platform or other platforms, etc. While the multi-platform compiler may include a GCC (GNU Compiler Collection) compiler, a kotlenjs compiler, or other multi-platform compiler.
The script files in the set format may include script files in Javascript format, script files in VBS (Microsoft Visual Basic Script Edition) format, script files in bat format, or script files in other formats. The specific setting format can be set based on the type of the multi-platform compiler and/or the platform needing to be applied.
The method of the present embodiment is code content corresponding to each functional task that needs to be executed in the running of script code, for example: in script code in the form of JAVA, the methods may be main methods or other callable program methods, each of which implements at least one functional task.
The obtained script files with the set formats are in one-to-one correspondence with the modified methods, that is, each script file with the set formats is used for realizing one modified method.
Step S13: and packaging script files corresponding to the modified methods to obtain a latest patch package, so that when the client terminal starts the application program, the latest patch package is obtained from the server, and the application program is repaired based on the script files in response to the fact that the latest patch package comprises the script files corresponding to the modified methods.
After script files in a plurality of set formats corresponding to the modified methods one by one are obtained, the script files corresponding to the modified methods are packaged to obtain the latest patch package, so that when the client terminal starts an application program, the latest patch package can be obtained from the server, and the application program is repaired based on the script files in response to the fact that the latest patch package comprises the script files corresponding to the modified methods.
In a specific application scenario, a plurality of script files in a set format may be packaged into a latest patch package in a Zip compression manner. In another specific application scenario, a win10 compression manner may also be used to package a plurality of script files in a set format into a latest patch package. The packing mode of the step can adopt different compression software to carry out compression packing.
When the client terminal starts the application program, the latest patch package is automatically acquired from the server to update and repair, so that a user can finish repairing the application program when starting the application program, related operations of downloading and updating the application program by the user are avoided, user operation steps are reduced, and repairing experience and efficiency are improved.
By the method, the repairing method of the application program of the embodiment obtains the modified script code; and compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, wherein the script files correspond to the modified methods one by one, so that the repairing method of the embodiment can be applied to repairing the application programs of multiple platforms, the situation that developers independently compile and repair the platforms is avoided, the repairing workload of the developers is reduced, the repairing efficiency of the application programs of the platforms is improved, and the project maintenance cost is reduced. The method also packages the script files corresponding to the modified methods to obtain the latest patch package, so that when the client terminal starts the application program, the latest patch package is obtained from the server, and the application program is repaired based on the script files in response to the latest patch package comprising the script files corresponding to the modified methods, thereby avoiding related operations of downloading and updating the application program by a user, reducing user operation steps and improving repair experience and efficiency.
Referring to fig. 2, fig. 2 is a flowchart of a second embodiment of a repairing method of an application program of the present application.
Step S21: when the script code of the application program is constructed, preset transfer logic is inserted into each original method entry of the script code.
When the script code of the application program is constructed, a section of preset transit logic is inserted in advance at the entrance of each original method in the script code of the application program. The preset transfer logic is located at the entrance of each method, so that when an application program is run, the preset transfer logic at the entrance of the method can be executed first before each task corresponding to a certain method is run, and therefore whether the task to be executed next is based on the script file corresponding to the existing method or the script file corresponding to the modified method can be determined to be executed based on the preset transfer logic.
When the script code of the application program is constructed, the script code of the application program can be constructed through the Kotlen, so that the multi-platform applicability of the Kotlen is applicable to multiple platforms.
Step S22: and receiving manual modification of the script code of the application program to obtain the modified script code.
After the application program is built, the application program is installed on the client terminal. The server receives the script code modified by the developer/human method of the script code of the application. In a specific application scenario, the modified script code may be generated by modifying the script code of the currently installed application program after a program error of the currently installed application program or the current application program needs to be updated is found manually, and the modified script code is transmitted to the server, so that the server obtains the modified script code.
The modified script code is the code modified by the whole application program, and comprises all modified methods and unmodified methods. In other embodiments, the method of the script code of the application program can be modified through the trained neural network, so that the server obtains the modified script code. Whereas the modification of the script code can also be based on kotlen.
Step S23: and compiling the modified script codes based on the dimension of each Kotlen module through a Kotlen Js compiler to obtain a plurality of compiling scripts, and splitting the compiling scripts based on the methods contained in each compiling script to obtain script files corresponding to each modified method.
Compiling the whole modified script code to generate a script file. Specifically, the modified script code may be compiled by a kotlenjs compiler to obtain a plurality of compiled scripts. And splitting the compiled scripts based on the methods contained in each compiled script to obtain script files corresponding to the modified methods. Kotlin is a programming language and can be used for developing application programs such as Android, JVM and the like. Kotlin is a cross-platform language, and can be compiled into byte codes or codes which can be run by other platforms through a compiler, such as Java byte codes, c executable files, javaScript codes and the like, so that the multi-platform application is realized. The KotlenJs compiler is used to compile the Kotlen language.
The kotlenjs compiler compiles the modified script code based on the dimension of each kotlen module to obtain a compiling script corresponding to each kotlen module. The developer divides script codes of the application program based on different functions of the product service to obtain a plurality of divided files, wherein each divided file corresponds to one Kotlen module, namely, each compiled script corresponds to one divided file.
In a specific application scenario, when the script code of the application program is divided into a barrage function file, a comment function file and a gift function file, the kotlenjs compiler compiles the modified script code according to the division of the barrage function file, the comment function file and the gift function file to obtain 3 compiled scripts corresponding to the modified barrage function file, the comment function file and the gift function file. In this embodiment, the file type of the compiled script may be a Javascript script file (abbreviated as a js file), and in other embodiments, the file types of the compiled script and the script file may be adjusted based on the type of the application platform, so that the compiled script and the script file are suitable for the corresponding platform, thereby improving the multi-platform applicability of repairing the application program.
After compiling the modified script codes to obtain a plurality of compiling scripts, splitting each compiling script based on the number of methods contained in each compiling script to obtain a plurality of script files, wherein each modified method corresponds to one script file. The script file may be a Javascript file. Specifically, js codes of each method can be copied to a separate file for storage, so that a Javascript script file corresponding to each modified method is obtained.
In a specific application scenario, when 100 methods are included in one compiled script, the compiled script is split into 100 script files based on each method.
Step S24: comparing the current script code with the modified script code to obtain a newly added method and a modified method in the modified script code, naming script files corresponding to the newly added method and the modified method according to the class names of the original method corresponding to the newly added method and the modified method and the concatenation of the method signatures, and packaging the named script files to obtain the latest patch package.
Comparing the current script code with the modified script code, the repaired code change can be obtained, and a newly added method, a changed method and a removed method in the modification can be obtained based on the changed code. And finding out all script files corresponding to the newly added method and the changed method according to the class name and the concatenation of the method signature, and packaging the script files into the latest patch package. Because of the calling relationship between the methods, the removed method is not executed after executing according to the newly added method and the changed method, so that the removed method can be ignored in the step.
In a specific application scenario, the current script code and the modified script code can be compared through a version control tool, and the repaired code change can be obtained. The version control tools comprise versions of git, svn and the like.
In a specific application scenario, a Zip compression mode may be adopted to package all script files corresponding to the newly added method and the changed method into the latest patch package. In another specific application scenario, a win10 compression mode may also be used to package all script files corresponding to the newly added method and the changed method into the latest patch package. The packing manner of the step can adopt different compression software and/or packing software for compression and/or packing.
Naming script files corresponding to the newly added method and the changed method according to the class names of the original method corresponding to the newly added method and the changed method and the splicing of the method signatures, and packaging the named script files to obtain the latest patch package. The class name of the method in Kotlin is unique, the method signature in the class is also unique, and the concatenation of the class name and the method signature can be used as the name to ensure that the naming of the modified method is not repeated, and the modified methods do not have homonymous conflicts. The original method of this embodiment refers to a method of initial script code that is installed on a client terminal for the first time after an application program is constructed. The application program can be repaired for many times in practical application, and besides the original method of the original application program is named as an original method signature, all names in the follow-up repair process are the class names of the original method and the splice of the method signatures.
In other embodiments, the script file of each method may be named based on the class name of the original method corresponding to each method and the concatenation of the method signature in the modified script code, then the current script code is compared with the modified script code to obtain a new method, a modified method and a removed method, and the class name of the original method corresponding to the modified method and the concatenation of the method signature are used to obtain the corresponding named script file based on the new method, so as to obtain the new method and the modified script file corresponding to the modified method.
By the method, the client terminal can update the application program when the application program is started. Referring to fig. 3-4, fig. 3 is a schematic structural diagram of a transmission network of an application scenario in fig. 2; fig. 4 is a data flow diagram of data transmission by each terminal in the transmission network in the application scenario of fig. 3.
The transmission network 30 of the present embodiment includes a server 31 and a plurality of client terminals 32, wherein each client terminal 32 is communicatively connected to the server 31.
The server 31 inserts preset relay logic at each of the original method portals when constructing script codes of the application programs. After completion of the construction, the server 31 transmits the script code of the application program to the plurality of client terminals 32, and each client terminal 32 receives the script code of the application program and installs the application program based on the script code.
The server 31 obtains the modified script code. The server 31 then compiles the modified entire script code to generate a compiled script. The server 31 splits the compiled script to obtain script files corresponding to the modified methods. Specifically, the modified script codes can be compiled by a kotlenjs compiler based on the dimension of each kotlen module to obtain a plurality of compiling scripts, and the compiling scripts are split based on the methods contained in each compiling script to obtain script files corresponding to each modified method.
Subsequently, the server 31 acquires and names a method newly added and a method changed in the modified script code. Specifically, the server 31 compares the script code before modification with the script code after modification, and acquires a method newly added and a method changed in the script code after modification. And naming script files corresponding to the newly added method and the changed method according to the class names of the original method corresponding to the newly added method and the changed method and the concatenation of the method signatures.
The server 31 packages the named script file to obtain the latest patch package. The server 31 then transmits the latest patch package to the client terminal 32.
The client terminal 32 starts an application program, obtains the latest patch package from the server 31, and unpacks the latest patch package in response to the latest patch package including the modified script file, thereby obtaining script files corresponding to the modified methods.
The client terminal 32 records the file path of each script file based on the name of the script file, and obtains a record table. And executing the task corresponding to the original method of the application program by executing the preset transfer logic first so as to judge whether the task is executed by executing the original method. Specifically, whether a record of splicing of the class name and the method signature corresponding to the original method exists in a record table is judged by executing preset transfer logic, and if the record of splicing of the class name and the method signature corresponding to the original method exists in the record table, a task corresponding to the original method is executed by executing the modified script file. Thereby completing the repair of the application.
By the method, when the script code of the application program is constructed, the preset transfer logic is inserted into each original method entry of the script code, and the preset transfer logic at the method entry can be executed first before each task corresponding to a certain method is executed, so that whether the task to be executed next is based on the script file corresponding to the existing method or the script file corresponding to the modified method can be determined based on the preset transfer logic. According to the method, the modified script codes are obtained, the modified script codes are compiled by the KotlenJs compiler based on the dimension of each Kotlen module, a plurality of compiling scripts are obtained, the compiling scripts are split based on the method contained in each compiling script, and script files corresponding to each modified method are obtained, so that the multi-platform adaptability of the KotlenJs compiler can be utilized to enable unified restoration of multi-platform application programs, and restoration efficiency is improved. The method and the device avoid the independent compiling and repairing of the developer aiming at each platform, reduce the repairing workload of the developer, further improve the repairing efficiency of the application programs of each platform and reduce the project maintenance cost.
Referring to fig. 5, fig. 5 is a flowchart of a third embodiment of a repairing method of an application program of the present application.
Step S51: and starting an application program, and acquiring the latest patch package from the server.
The client terminal starts the application program and acquires the latest patch package from the server, wherein the latest patch package is automatically acquired from the server when the application program on the client terminal is started each time so as to judge whether the application program needs to be repaired or not, thereby avoiding the related operation of downloading and updating the application program by a user by the user, reducing the operation steps of the user and improving the repairing experience and efficiency of the application program.
After the client terminal obtains the latest patch package, the client terminal may unpack the latest patch package based on a packing mode of the server, for example: when the server generates the latest patch package in a compressed mode, the client terminal unpacks in an decompressing mode.
Step S52: responding to the latest patch package which comprises script files corresponding to the modified methods, and repairing the application program based on the script files, wherein the latest patch package is obtained by the server through the modified script codes; compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, and packaging the script files corresponding to the modified methods, wherein the script files correspond to the modified methods one by one.
After unpacking the latest patch package, the server judges whether the latest patch package comprises script files corresponding to the modified methods, and if so, the server repairs the application program based on the script files in the latest patch package. If the latest patch package is blank, the starting of the application program does not relate to the restoration of the script code, and the application program does not respond. In other embodiments, whether the latest patch package includes script files corresponding to the modified methods may also be determined by determining whether the latest patch package before unpacking is blank.
The latest patch package in this embodiment is obtained by compiling the modified script code by using a multi-platform compiler after the server obtains the modified script code, generating a script file in a set format, and packaging the script files corresponding to the modified methods, where the script file corresponds to the modified methods one by one. The specific steps of generating the latest patch package by the server may refer to the embodiment of fig. 1, and will not be described herein.
By the method, when the application program is started, the latest patch package is obtained from the server; responding to the latest patch package to include script files corresponding to the modified methods, and repairing the application program based on the script files; therefore, related operations of downloading and updating the application program manually by a user can be avoided, the operation steps of the user are reduced, and the repairing experience and efficiency are improved. The latest patch package is the script code after the server acquires the modification; and compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, and packaging the script files corresponding to the modified methods. Therefore, the repairing method of the embodiment can be applied to repairing application programs of multiple platforms, the situation that developers independently compile and repair each platform is avoided, repairing workload of the developers is reduced, repairing efficiency of the application programs of each platform is improved, and project maintenance cost is reduced.
Referring to fig. 6, fig. 6 is a flowchart of a fourth embodiment of a repairing method of an application program of the present application.
The client terminal downloads the original script code of the application program and installs the original script code so as to set the application program on the client terminal. And when the script code of the application program is constructed, a section of preset transit logic is inserted in advance at the entrance of each method in the script code of the application program. The preset transfer logic is located at the entrance of each method, so that when an application program is run, the preset transfer logic at the entrance of the method can be executed first before each task corresponding to a certain method is run, and therefore whether the task to be executed next is based on the script file corresponding to the existing method or the script file corresponding to the modified method can be determined to be executed based on the preset transfer logic.
Step S61: and starting an application program, and acquiring the latest patch package from the server.
The client terminal starts the application program and acquires the latest patch package from the server, wherein the latest patch package is automatically acquired from the server when the application program on the client terminal is started each time so as to judge whether the application program needs to be repaired or not, thereby avoiding the related operation of downloading and updating the application program by a user by the user, reducing the operation steps of the user and improving the repairing experience and efficiency of the application program.
The step of generating the latest patch package by the server is referred to any of the foregoing embodiments, and will not be described herein.
Step S62: and unpacking the latest patch package in response to the fact that the latest patch package comprises the modified script files, obtaining script files corresponding to the modified methods, and recording file paths of the script files based on naming of the script files to obtain a record table.
Judging whether the latest patch package comprises a modified script file or not, and if the latest patch package comprises the modified script file, indicating that a program error exists in the application program and that the application program needs to be repaired. If the latest patch package is a blank patch package or does not comprise a modified script file, the method indicates that no program error exists in the current application program and repair is not needed.
And unpacking the latest patch package to obtain script files corresponding to the modified methods in response to the fact that the latest patch package comprises the modified script files. In a specific application scenario, when the server compresses and packages by adopting a Zip compression mode to obtain the latest patch package, the embodiment may also decompress and unpack the latest patch package by adopting a Zip decompression mode. In other embodiments, in this document, unpacking the latest patch package may be performed before the step of determining whether the latest patch package includes the modified script file, so as to determine whether the latest patch package includes the modified script file.
After the script files corresponding to the multiple modified methods are obtained, the file paths of the script files are recorded based on the naming of the script files, and a record table is obtained. Specifically, script files corresponding to the modified methods are stored in a storage device of the client terminal, and are recorded into a record table according to the naming of each script file.
In a specific application scenario, the record table may be a hash record table, where the hash table is a key-value pair, where a key is a class name of an original method and a spliced name of a method signature, and a value is a file path of a script file, so that the file path of each script file is recorded through the hash record table based on the naming of the script file.
Step S63: judging whether a record of splicing of the class name and the method signature corresponding to the original method exists in the record table by executing preset transfer logic, and executing a task corresponding to the original method by executing the modified script file if the record of splicing of the class name and the method signature corresponding to the original method exists in the record table.
When the application program of the client terminal is started, the script files corresponding to the modified methods are recorded, and when the application program specifically runs, the corresponding methods are executed to execute related functional tasks. When the script code is constructed, a section of preset transfer logic is inserted in advance at the entrance of each method, and then the preset transfer logic is executed first before the corresponding method is executed. Specifically, the preset transfer logic is: and inquiring whether the record table in the step S62 contains records with the same splicing name or not according to the class name of the original method corresponding to the current method and the splicing of the original method signature. If not, the original logic of the current method is continued to be executed, which indicates that the current method does not need to be repaired. If the hash record table contains a name, which indicates that the current method needs to be replaced, logic of the current method is abandoned, and the modified script file is skipped to execute the functional task.
The specific steps of executing the functional task by jumping the modified script file are as follows: acquiring a file path of the script file after modification corresponding to the original method from a record table; acquiring a modified script file based on the file path; and executing the modified script file.
In a specific application scenario, a file path of a script file corresponding to the splicing of the class name of the original method corresponding to the current method and the original method signature is obtained from a record table, the script file is read from a storage device of the client terminal based on the file path, and the script file is executed through a general engine, so that the functional task is executed. The current method logic is not being executed.
In a specific application scenario, a file path of a JS file corresponding to the class name of the original method corresponding to the current method and the concatenation of the original method signature is obtained from a hash record table, so that the script file stored in the equipment is read through the file path, and then the JS file is executed through engines such as a general JavaScript engine (such as a JavaScript core or other JS engine) and the like, so that the execution of the corresponding functional task is completed.
In this embodiment, the transmission network between the server and the client terminal and the data flow of the data transmission are the same as those of the embodiment of fig. 2, please refer to the foregoing, and the description is omitted here.
Through the steps, the method for repairing the application program in the embodiment obtains the latest patch package from the server by starting the application program, and can realize automatic repair of the business program, thereby avoiding related operations of downloading and updating the application program by a user, reducing operation steps of the user, and improving repair experience and efficiency. And unpacking the latest patch package to obtain script files corresponding to the modified methods in response to the fact that the latest patch package comprises the modified script files, recording file paths of the script files based on the names of the script files to obtain a record table, judging whether spliced records of class names and method signatures corresponding to the original methods exist in the record table through executing preset transfer logic, and if the record table contains the same record as the spliced records of the class names and the method signatures corresponding to the original methods, executing tasks corresponding to the original methods through executing the modified script files to realize the restoration of the application program based on the preset transfer logic. The latest patch package in the embodiment is obtained through a KotlenJs compiler, and the multi-platform applicability of the KotlenJs compiler can be utilized to uniformly repair the multi-platform application programs, so that the repair efficiency is improved. The method and the device avoid the independent compiling and repairing of the developer aiming at each platform, reduce the repairing workload of the developer, further improve the repairing efficiency of the application programs of each platform and reduce the project maintenance cost.
Referring to fig. 7, fig. 7 is a schematic diagram of a repairing apparatus according to an embodiment of the application program. The application repairing apparatus 70 includes an acquisition module 71, a compiling module 72, and a packaging module 73. An acquisition module 71 for acquiring the modified script code; the compiling module 72 is configured to compile the modified script code by using a multi-platform compiler, and generate a script file with a set format, where the script file corresponds to the modified methods one by one; and the packaging module 73 is configured to package the script files corresponding to the modified methods to obtain a latest patch package, so that when the client terminal starts the application program, the latest patch package is obtained from the server, and the application program is repaired based on the script files in response to the latest patch package including the script files corresponding to the modified methods.
The compiling module 72 is further configured to compile the modified script code by using a kotlenjs compiler to generate a script file in Javascript format.
The compiling module 72 is further configured to compile the modified script code based on the dimension of each kotlen module by using a kotlenjs compiler, so as to obtain a plurality of compiling scripts; splitting the compiling script based on the method contained in each compiling script to obtain a script file corresponding to each modified method; wherein each modified method corresponds to a script file.
The packaging module 73 is further configured to compare the script code before modification with the script code after modification, and obtain a method newly added and a method changed in the script code after modification; naming script files corresponding to the newly added method and the changed method according to the class names of the original method corresponding to the newly added method and the changed method and the concatenation of the method signatures; and packaging the named script file to obtain the latest patch package.
The obtaining module 71 is further configured to insert preset transfer logic into each original method entry of the script code when the script code of the application program is constructed, so that when executing a task corresponding to the original method of the application program, it is determined whether to execute the task by executing the original method by executing the preset transfer logic in the original method.
The acquisition module 71 is also used to construct script code for the application by Kotlin.
According to the scheme, the user can be prevented from manually downloading and updating the application program, the operation steps of the user are reduced, and the repairing experience and efficiency of the application program are improved.
Referring to fig. 8, fig. 8 is a schematic diagram of a repairing apparatus according to another embodiment of the application program.
The repairing device 80 of the application program comprises a starting module 81 and a repairing module 82. The starting module 81 is used for starting an application program and acquiring the latest patch package from a server; the repair module 82 is configured to repair the application program based on the script file in response to the latest patch package including the script files corresponding to the modified methods; wherein, the latest patch package is script codes after the server acquires the modification; compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, and packaging the script files corresponding to the modified methods, wherein the script files correspond to the modified methods one by one.
The repair module 82 is further configured to execute a task corresponding to the original method of the application program by executing preset relay logic at an entry of the original method of the application program, so as to determine whether to execute the task by executing the original method.
The repair module 82 is further configured to unpack the latest patch package in response to the latest patch package including the modified script file, to obtain script files corresponding to the modified methods; and recording the file path of each script file based on the naming of the script file to obtain a record table. Judging whether a spliced record of a class name and a method signature corresponding to the original method exists in a record table or not by executing preset transfer logic; and if the record table has the same record of the class name corresponding to the original method and the concatenation of the method signature, executing the task corresponding to the original method by executing the modified script file.
The repair module 82 is further configured to obtain a file path of the script file after modification corresponding to the original method from the record table; acquiring a modified script file based on the file path; and executing the modified script file.
According to the scheme, the user can be prevented from manually downloading and updating the application program, the operation steps of the user are reduced, and the repairing experience and efficiency of the application program are improved.
Referring to fig. 9, fig. 9 is a schematic frame diagram of an embodiment of an electronic device of the present application. The electronic device 90 comprises a memory 91 and a processor 92 coupled to each other, the processor 92 being adapted to execute program instructions stored in the memory 91 for implementing the steps of the method for repairing an application of any of the first, second, third and fourth embodiments described above. In one particular implementation scenario, electronic device 90 may include, but is not limited to: the microcomputer and the server, and the electronic device 90 may also include a mobile device such as a notebook computer and a tablet computer, which is not limited herein.
In particular, the processor 92 is operative to control itself and the memory 91 to implement the steps of the repair method embodiment of any of the application programs described above. The processor 92 may also be referred to as a CPU (Central Processing Unit ). The processor 92 may be an integrated circuit chip with signal processing capabilities. The processor 92 may also be a general purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a Field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 92 may be commonly implemented by an integrated circuit chip.
According to the scheme, the user can be prevented from manually downloading and updating the application program, the operation steps of the user are reduced, and the repairing experience and efficiency of the application program are improved.
Referring to fig. 10, fig. 10 is a schematic diagram illustrating a framework of an embodiment of a computer readable storage medium according to the present application. The computer-readable storage medium 100 stores program instructions 1001 executable by a processor, the program instructions 1001 being for implementing the steps of the method for repairing an application of any of the first, second, third and fourth embodiments described above.
According to the scheme, the user can be prevented from manually downloading and updating the application program, the operation steps of the user are reduced, and the repairing experience and efficiency of the application program are improved.
In the several embodiments provided in the present application, it should be understood that the disclosed methods and apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical, or other forms.
The elements illustrated as separate elements may or may not be physically separate, and elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over network elements. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all or part of the technical solution contributing to the prior art or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (11)

1. A method for repairing an application program, the method comprising:
the server acquires the modified script code;
compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, wherein the script files are in one-to-one correspondence with the modified methods;
packaging the script files corresponding to the modified methods to obtain a latest patch package, so that when the client terminal starts the application program, the latest patch package is obtained from a server, and the application program is repaired based on the script files in response to the latest patch package comprising the script files corresponding to the modified methods;
the step of packing the script files corresponding to the modified methods to obtain the latest patch package comprises the following steps:
comparing the current script code with the modified script code to obtain a new method and a new changing method in the modified script code; naming script files corresponding to the new method and the changed method according to the class names of the original methods corresponding to the new method and the changed method and the concatenation of the method signatures; packaging the named script file to obtain the latest patch package;
The step of compiling the modified script code by using a multi-platform compiler to generate a script file with a set format further comprises the following steps:
when the script code of the application program is constructed, a preset transfer logic is inserted into each original method entry of the script code, so that when a task corresponding to an original method of the application program is executed, whether the task is executed by executing the original method is judged by executing the preset transfer logic in the original method.
2. The method for repairing an application program according to claim 1, wherein the step of compiling the modified script code using a multi-platform compiler to generate a script file in a set format comprises:
and compiling the modified script codes by using a KotlenJs compiler to generate a script file in a Javascript format.
3. The method for repairing an application program according to claim 1, wherein the step of compiling the modified script code with a multi-platform compiler to generate a script file in a set format, wherein the script file corresponds to the modified methods comprises:
Compiling the modified script codes based on the dimension of each Kotlen module by a Kotlen js compiler to obtain a plurality of compiling scripts;
splitting the compiling script based on the method contained in each compiling script to obtain a script file corresponding to each modified method;
wherein each modified method corresponds to a script file.
4. A method of repairing an application according to any one of claims 1-3, further comprising:
script code of the application is constructed through Kotlin.
5. A method for repairing an application program, the method comprising:
the client terminal starts the application program and acquires the latest patch package from the server;
responding to the latest patch package which comprises script files corresponding to a plurality of modified methods, and repairing the application program based on the script files;
the latest patch package is used for comparing the current script code with the modified script code to obtain a new method and a new changing method in the modified script code; naming script files corresponding to the new method and the changed method according to the class names of the original methods corresponding to the new method and the changed method and the concatenation of the method signatures; packaging the named script files, wherein the script files correspond to the modified methods one by one;
The step of repairing the application program based on the script file comprises the following steps of:
executing tasks corresponding to the original methods of the application program by executing preset transfer logic at the original method entrance of the application program, so as to judge whether the tasks are executed by executing the original methods.
6. The method for repairing an application program according to claim 5, wherein the step of repairing the application program based on the script file in response to the latest patch package including the script file corresponding to the modified methods includes:
unpacking the latest patch package to obtain script files corresponding to the modified methods in response to the fact that the latest patch package comprises the modified script files;
recording the file path of each script file based on the naming of the script file to obtain a record table;
judging whether a spliced record of a class name and a method signature corresponding to the original method exists in the record table or not by executing the preset transfer logic;
And if the record table has the record with the same class name and method signature corresponding to the original method, executing the task corresponding to the original method by executing the modified script file.
7. The method for repairing an application program according to claim 6, wherein the step of executing the task corresponding to the original method by executing the modified script file comprises:
acquiring a file path of the modified script file corresponding to the original method from the record table;
acquiring the modified script file based on the file path;
and executing the modified script file.
8. An application repair device, the application repair device comprising:
the acquisition module is used for acquiring the modified script code;
the compiling module is used for compiling the modified script codes by utilizing a multi-platform compiler to generate script files with set formats, wherein the script files are in one-to-one correspondence with the modified methods;
the packaging module is used for packaging the script files corresponding to the modified methods to obtain a latest patch package, so that when the client terminal starts the application program, the latest patch package is obtained from a server, and the application program is repaired based on the script files in response to the fact that the latest patch package comprises the script files corresponding to the modified methods;
The step of packing the script files corresponding to the modified methods to obtain the latest patch package comprises the following steps:
comparing the current script code with the modified script code to obtain a new method and a new changing method in the modified script code; naming script files corresponding to the new method and the changed method according to the class names of the original methods corresponding to the new method and the changed method and the concatenation of the method signatures; packaging the named script file to obtain the latest patch package;
the step of compiling the modified script code by using a multi-platform compiler to generate a script file with a set format further comprises the following steps:
when the script code of the application program is constructed, a preset transfer logic is inserted into each original method entry of the script code, so that when a task corresponding to an original method of the application program is executed, whether the task is executed by executing the original method is judged by executing the preset transfer logic in the original method.
9. An application repair device, the application repair device comprising:
The starting module is used for starting the application program and acquiring the latest patch package from the server;
the repairing module is used for responding to script files corresponding to the modified methods included in the latest patch package and repairing the application program based on the script files; the latest patch package is used for comparing the current script code with the modified script code to obtain a new method and a new changing method in the modified script code; naming script files corresponding to the new method and the changed method according to the class names of the original methods corresponding to the new method and the changed method and the concatenation of the method signatures; packaging the named script files, wherein the script files correspond to the modified methods one by one;
the step of repairing the application program based on the script file comprises the following steps of:
executing tasks corresponding to the original methods of the application program by executing preset transfer logic at the original method entrance of the application program, so as to judge whether the tasks are executed by executing the original methods.
10. An electronic device comprising a memory and a processor coupled to each other, the processor being configured to execute program instructions stored in the memory to implement the method of repairing an application according to any one of claims 1 to 4 or the method of repairing an application according to any one of claims 5 to 7.
11. A computer readable storage medium having stored thereon program instructions, which when executed by a processor, implement the method of repairing an application according to any of claims 1 to 4 or the method of repairing an application according to any of claims 5 to 7.
CN202110722068.0A 2021-06-28 2021-06-28 Application program repairing method, related device and equipment Active CN113467803B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110722068.0A CN113467803B (en) 2021-06-28 2021-06-28 Application program repairing method, related device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110722068.0A CN113467803B (en) 2021-06-28 2021-06-28 Application program repairing method, related device and equipment

Publications (2)

Publication Number Publication Date
CN113467803A CN113467803A (en) 2021-10-01
CN113467803B true CN113467803B (en) 2024-03-01

Family

ID=77873420

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110722068.0A Active CN113467803B (en) 2021-06-28 2021-06-28 Application program repairing method, related device and equipment

Country Status (1)

Country Link
CN (1) CN113467803B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2246782A1 (en) * 2009-04-30 2010-11-03 Sap Ag Application modification framework
CN103853589A (en) * 2014-02-26 2014-06-11 上海爱数软件有限公司 Cross-platform system compiling and building method
CN111488169A (en) * 2020-04-07 2020-08-04 网易(杭州)网络有限公司 Method and device for hot updating of application program, storage medium and electronic equipment
CN111666096A (en) * 2020-07-02 2020-09-15 腾讯科技(深圳)有限公司 Hot updating method and device for target application, storage medium and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2246782A1 (en) * 2009-04-30 2010-11-03 Sap Ag Application modification framework
CN103853589A (en) * 2014-02-26 2014-06-11 上海爱数软件有限公司 Cross-platform system compiling and building method
CN111488169A (en) * 2020-04-07 2020-08-04 网易(杭州)网络有限公司 Method and device for hot updating of application program, storage medium and electronic equipment
CN111666096A (en) * 2020-07-02 2020-09-15 腾讯科技(深圳)有限公司 Hot updating method and device for target application, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN113467803A (en) 2021-10-01

Similar Documents

Publication Publication Date Title
US10296323B2 (en) System and method for fast initial and incremental deployment of apps
CN111367510B (en) Android function module development method and device
US8612947B2 (en) System and method for remotely compiling multi-platform native applications for mobile devices
EP3410296A1 (en) Starting method and device for embedded device
US20020169591A1 (en) Module for developing wireless device applications using an integrated emulator
CN104991793A (en) Method, device and system used for application program subpackage
CN109032638A (en) Hot update method, server and the mobile terminal of mobile application software
US10866803B2 (en) Generating interaction libraries
CN112631622A (en) Application installation method and device, server and computer readable medium
CN105159732A (en) Method for installing or updating application program in mobile terminal and mobile terminal
CN108132808B (en) Channel package generation method and device
CN112148297A (en) Intelligent server encryption and packaging method and device
CN111061486B (en) Android application program increment method
CN116009959B (en) Flash item transplanting method, device and system and storage medium
CN113467803B (en) Application program repairing method, related device and equipment
CN113641389B (en) Software upgrading method, device and equipment based on OpenCPU
CN112685048B (en) Application program packaging method, electronic device and storage medium
CN113157329A (en) Method, system, server and storage medium for starting application
CN114529066A (en) Updating method, device and equipment of Flutter application and storage medium
CN112596751A (en) Compiling method, terminal, server and storage medium of application program installation package
CN112506519A (en) Compiling method of application program, mobile terminal and server
CN110362320B (en) Command implementation method and device of application development platform
CN115168175A (en) Program error solving method, device, electronic equipment and storage medium
CN113849202A (en) Drive adaptation method and device for kernel upgrading of operating system and electronic equipment
CN113849181A (en) Cross compiling tool chain construction method and device, electronic equipment and 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
GR01 Patent grant
GR01 Patent grant