[go: up one dir, main page]

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

Application program repairing method, related device and equipment Download PDF

Info

Publication number
CN113467803A
CN113467803A CN202110722068.0A CN202110722068A CN113467803A CN 113467803 A CN113467803 A CN 113467803A CN 202110722068 A CN202110722068 A CN 202110722068A CN 113467803 A CN113467803 A CN 113467803A
Authority
CN
China
Prior art keywords
script
modified
application program
repairing
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110722068.0A
Other languages
Chinese (zh)
Other versions
CN113467803B (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

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 method for repairing an application program, a related device and equipment, wherein the method for repairing the application program comprises the following steps: the server acquires the modified script code; compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, wherein the script file corresponds to the plurality of modified methods one to one; and packaging the script files corresponding to the plurality of 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 plurality of modified methods. By the aid of the scheme, the user can be prevented from manually downloading and updating the application program, user operation steps are reduced, and restoration experience and efficiency of the application program are improved.

Description

Application program repairing method, related device and equipment
Technical Field
The present application relates to the technical field of application program repair, and in particular, to a method for repairing an application program, and a related apparatus and device.
Background
With the rapid development of the internet technology, the functions of the internet technology are more and more diversified and efficient. Among them, the user has an increasing demand for the convenience of the application program in the process of using the application program.
In the application process of the application program, some program errors or program iterations often occur, and at this time, a programmer is required to repair and update the application program. At present, a common repair update method is to make a user download and install again by constructing a repaired installation package to replace an original application program that needs to be repaired and updated.
However, the above method often requires a user to perform a more complicated operation, which is easy to cause inconvenience to the user and leads to easy loss of the user.
Disclosure of Invention
The application provides a method for repairing an application program, a related device and equipment, and solves the problem that repair and update of the application program in the prior art bring more complicated operations to a user.
The application provides an application program repairing method, which comprises the following steps: the server acquires the modified script code; compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, wherein the script file corresponds to the plurality of modified methods one to one; and packaging the script files corresponding to the plurality of 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 plurality of modified methods.
The method comprises the following steps of compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, wherein the steps of compiling the modified script codes by using the multi-platform compiler comprise: and compiling the modified script code by using a KotlinJs compiler to generate a script file in a Javascript format.
Compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, wherein the steps of the script file corresponding to the plurality of modified methods comprise: compiling the modified script codes through a KotlinJs compiler based on the dimension of each Kotlin module to obtain a plurality of compiled scripts; splitting the compiling script based on the method contained in each compiling script to obtain script files corresponding to each modified method; wherein each modified method corresponds to a script file.
The method comprises the following steps of modifying a plurality of methods, wherein the script files corresponding to the methods are packaged to obtain a latest patch package, and the method 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 splicing of the class name and the method signature of the original method corresponding to the newly added method and the changed method; and packaging the named script files to obtain the latest patch package.
The steps of compiling the modified script code by using a multi-platform compiler and generating the script file with the set format further comprise: 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 the 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 method for repairing the application program further comprises the following steps: the script code of the application is built by 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 a latest patch package from the server; in response to the latest patch package including the script files corresponding to the plurality of modified methods, repairing the application program based on the script files; the latest patch package is a script code obtained by the server after modification; compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, and packaging the script files corresponding to the plurality of modified methods to obtain the script file, wherein the script file corresponds to the plurality of modified methods one to one.
Wherein, in response to the latest patch package including the script files corresponding to the plurality of modified methods, the step of repairing the application program based on the script files includes: executing the task corresponding to the original method of the application program by executing the preset transfer logic at the inlet of the original method of the application program, so as to judge whether the task is executed by executing the original method.
Wherein, in response to the latest patch package including the script files corresponding to the plurality of modified methods, the step of repairing the application program based on the script files includes: in response to the latest patch package including the modified script file, unpacking the latest patch package to obtain the script files corresponding to the modified methods; and recording the file path of each script file based on the name of the script file to obtain a recording table. Judging whether a record table contains a class name corresponding to the original method and a spliced record of the method signature by executing a preset transit logic; and if the record table has the record with the same splicing of the class name and the method signature corresponding to the original method, 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 modified script file 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.
The present application also provides an apparatus for restoring an application, including: the acquisition module is used for acquiring the modified script codes; the compiling module is used for compiling the modified script codes by utilizing a multi-platform compiler to generate a script file with a set format, wherein the script file corresponds to the plurality of modified methods one by one; and the packaging module is used for packaging the script files corresponding to the plurality of 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 plurality of modified methods.
The present application also provides an apparatus for restoring an application, including: 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 the latest patch package which comprises the script files corresponding to the plurality of modified methods and repairing the application program based on the script files; the latest patch package is a script code obtained by the server after modification; compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, and packaging the script files corresponding to the plurality of modified methods to obtain the script file, wherein the script file corresponds to the plurality of modified methods one to one.
The application also provides an electronic device, which comprises a memory and a processor which are coupled with each other, wherein the processor is used for executing the program instructions stored in the memory so as to realize the method for repairing any application program.
The present application also provides a computer readable storage medium having stored thereon program instructions, which when executed by a processor, implement the method of repairing any of the above-mentioned applications.
According to the scheme, the modified script codes are obtained; and compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, wherein the script file corresponds to the plurality of modified methods one to one, so that the repairing method of the embodiment can be applied to repairing of the application programs of the plurality of platforms, developers are prevented from independently compiling and repairing for each platform, the repairing workload of the developers is reduced, the repairing efficiency of the application programs of each platform is improved, and the project maintenance cost is reduced. The method and the device also pack the script files corresponding to the plurality of 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 including the script files corresponding to the plurality of modified methods, so that the user is prevented from manually downloading and updating the application program, the operation steps of the user are reduced, and the repairing experience and efficiency are improved.
Drawings
FIG. 1 is a flowchart illustrating a first embodiment of a method for repairing an application according to the present application;
FIG. 2 is a flowchart illustrating a second embodiment of a method for repairing an application according to the present application;
FIG. 3 is a schematic diagram of a transport network of an application scenario of 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 flowchart illustrating a third embodiment of a method for repairing an application according to the present application;
FIG. 6 is a flowchart illustrating a fourth embodiment of a method for repairing an application according to the present application;
FIG. 7 is a block diagram of an embodiment of a repair apparatus for an application;
FIG. 8 is a block diagram of another embodiment of a repair facility according to the present application;
FIG. 9 is a block diagram of an embodiment of an electronic device of the present application;
FIG. 10 is a block diagram of an embodiment of a computer-readable storage medium of the present application.
Detailed Description
The following describes in detail the embodiments of the present application with reference to the drawings attached hereto.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular system structures, 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" herein is merely an association describing an associated object, and there may be three relationships, e.g., a and/or B, and: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in this document, the character "/", generally, the former and latter related objects are in an "or" relationship. Further, herein, "more" than two or more than two.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a repair method for an application according to a first embodiment of the present application.
Step S11: and acquiring the modified script code.
The present embodiment is applied to an application scenario after an application has been installed on a client terminal. And the server acquires the modified script code. The script codes are used for constructing the application program, and the current application program is repaired or updated by acquiring and applying the modified script codes.
The application program of this embodiment includes an application program set on a mobile terminal, a PC terminal, or another intelligent terminal, for example, an APP on the mobile terminal, and the specific type is not limited herein.
Step S12: and compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, wherein the script file corresponds to the plurality of modified methods one to one.
And compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format. The multi-platform compiler refers to a compiler that can compile a plurality of application formats or a compiler that can apply a compiled script code 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 KotlinJs Compiler, or other multi-platform Compiler.
The Script file of the set format may include a Script file of a Javascript format, a Script file of a vbs (microsoft Visual Basic Script edition) format, a Script file of a bat format, or a Script file of another format. The specific setting format may be set based on the type of the multi-platform compiler and/or the platform to be applied.
The method of this embodiment is that the running of the script code needs to execute the code content corresponding to each functional task, for example: in the case of script code in JAVA, the methods may be main methods or other callable program methods, each of which performs at least one functional task.
The obtained script file with the set format corresponds to the plurality of modified methods one by one, namely, each script file with the set format is used for realizing one modified method.
Step S13: and packaging the script files corresponding to the plurality of 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 plurality of modified methods.
And after the script files with the plurality of set formats corresponding to the plurality of modified methods one to one are obtained, the script files corresponding to the plurality of modified methods are packaged to obtain the latest patch package, so that when the client terminal starts the 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 plurality of modified methods.
In a specific application scenario, a plurality of script files with set formats can be packaged into a latest patch package by using a Zip compression method. In another specific application scenario, a plurality of script files with set formats can be packaged into a latest patch package by using the win10 compression method. The packing mode of this step can adopt different compression software to compress and pack.
When the application program is started, the client terminal automatically acquires the latest patch package from the server to update and repair the application program, so that the user can complete the repair of the application program when the application program is started, the user is prevented from manually downloading and updating the application program, the operation steps of the user are reduced, and the repair experience and efficiency are improved.
By the method, the application program repairing method of the embodiment obtains the modified script code; and compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, wherein the script file corresponds to the plurality of modified methods one to one, so that the repairing method of the embodiment can be applied to repairing of the application programs of the plurality of platforms, developers are prevented from independently compiling and repairing for each platform, the repairing workload of the developers is reduced, the repairing efficiency of the application programs of each platform is improved, and the project maintenance cost is reduced. In this embodiment, the script files corresponding to the plurality of modified methods are packaged 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 including the script files corresponding to the plurality of modified methods, thereby avoiding the user from manually downloading and updating the application program, reducing the user operation steps, and improving the repair experience and efficiency.
Referring to fig. 2, fig. 2 is a flowchart illustrating a repairing method for an application according to a second embodiment of the present application.
Step S21: 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.
When the script code of the application program is constructed, a section of preset transit logic is inserted in advance at an entrance of each original method in the script code of the application program. The preset relay logic is located at the entrance of each method, so that when an application program is run, the preset relay logic at the entrance of the method is executed before a task corresponding to a certain method is run, and therefore whether the next executed task is executed 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 relay logic.
When the script code of the application program is constructed, the script code of the application program can be constructed through the Kotlin, so that the multi-platform applicability of the Kotlin is utilized to be suitable for multiple platforms.
Step S22: and receiving manual modification of the script codes of the application program to obtain the modified script codes.
After the application program is constructed, the application program is installed on the client terminal. The server receives script code modified by a developer/human by a method of the script code of the application program. 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 manual operation finds that a program error occurs in the currently installed application program or the currently installed application program needs to be updated, 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 modified code of 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 may also be modified through the trained neural network, so that the server acquires the modified script code. And the modification of the script code can also be made based on Kotlin.
Step S23: compiling the modified script codes through a KotlinJs compiler based on the dimensionality of each Kotlin module to obtain a plurality of compiling scripts, splitting the compiling scripts based on the methods contained in each compiling script to obtain script files corresponding to the modified methods.
And compiling the modified whole script code to generate a script file. Specifically, the modified script code may be compiled by a KotlinJs compiler to obtain a plurality of compiled scripts. And splitting the compiling script based on the method contained in each compiling 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 and JVM. Kotlin is a cross-platform language, and can be compiled into bytecodes or codes executable by other platforms through a compiler, such as Java bytecodes, c executable files, JavaScript codes, and the like, thereby having multi-platform applicability. The KotlinJs compiler is used to compile the Kotlin language.
And compiling the modified script code by the Kotlinjs compiler based on the dimension of each Kotlin module to obtain a compiling script corresponding to each Kotlin module. The developer divides the script codes of the application program based on different functions of the product service to obtain a plurality of divided files, and each divided file corresponds to one Kotlin module, namely each compiling 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 salute function file, the KotlinJs compiler compiles the modified script code according to the division of the barrage function file, the comment function file, and the salute function file to obtain 3 compiling scripts corresponding to the modified barrage function file, the comment function file, and the salute function file. In this embodiment, the file type of the compiled script may be a Javascript script file (js file for short), and in other embodiments, the file types of the compiled script and the script file may also be adjusted based on the type of the application platform, so that the compiled script and the script file are applicable to the corresponding platform, thereby improving the multi-platform applicability of the repair of the application program.
Compiling the modified script codes to obtain a plurality of compiled scripts, and splitting each compiled script based on the number of methods contained in each compiled script to obtain a plurality of script files, wherein each modified method corresponds to one script file. And the file type of the script file can also be a Javascript script file. Specifically, the js code of each method may be copied to a separate file for storage, thereby obtaining a Javascript script file corresponding to each modified method.
In a specific application scenario, when a compiled script includes 100 methods, the compiled script is split into 100 script files based on the methods.
Step S24: comparing the current script code with the modified script code to obtain a new method and a changed method in the modified script code, naming script files corresponding to the new method and the changed method according to the class name of the original method and the splicing of the method signature corresponding to the new method and the changed method, and packaging the named script files to obtain the latest patch package.
And comparing the current script code with the modified script code to obtain the repaired code change, and obtaining a newly added method, a changed method and a removed method in the modification based on the changed code. And finding out all script files corresponding to the newly added method and the changed method according to the splicing of the class name and the method signature, and packaging the script files into the latest patch package. Because the methods have a mutual calling relationship, the removed method itself cannot be executed after the execution is performed according to the added method and the changed method, and therefore, the removed method can be ignored in the step.
In a specific application scenario, the current script code may be compared with the modified script code through a version control tool, and the repaired code change may be obtained. The version control tools comprise git, svn and other version tools.
In a specific application scenario, all script files corresponding to the newly added method and the changed method can be packaged into the latest patch package by adopting a Zip compression mode. In another specific application scenario, a win10 compression mode may also be adopted to pack all script files corresponding to the newly added method and the changed method into the latest patch package. The packing mode of this step can adopt different compression software and/or packing software to compress and/or pack.
And naming script files corresponding to the newly added method and the changed method according to the class name of the original method corresponding to the newly added method and the changed method and the splicing of the method signature, and packaging the named script files to obtain the latest patch package. The name of the class where the method in the Kotlin is located is unique, the signature of the method in the class is also unique, the name formed by splicing the method and the signature can ensure that the name of the modified method is unique and not repeated, and the modified methods cannot have homonymy conflict. The original method of the embodiment refers to a method of installing an application program in an initial script code on a client terminal for the first time after the application program is constructed. In the method, the application program is repaired for many times in practical application, and except for the name of the original method of the original application program, the names of all subsequent repairs are the concatenation of the class name and the method signature of the original method.
In other embodiments, the script file of each method may be named based on the concatenation of the class name and the method signature of the original method corresponding to each method in the modified script code, and then the current script code is compared with the modified script code to obtain the new method, the modified method, and the removal method.
Through 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 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.
The transmission network 30 of the present embodiment includes a server 31 and a plurality of client terminals 32, wherein each of the client terminals 32 is communicatively connected to the server 31.
When the server 31 constructs the script code of the application program, a preset transit logic is inserted into each original method entry. After the construction is completed, 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 then installs the application program based on the script code.
The server 31 gets the modified script code. The server 31 compiles the modified entire script code to generate a compiled script. And the server 31 splits the compiled script to obtain script files corresponding to the modified methods. Specifically, the modified script code can be compiled through a KotlinJs compiler based on the dimension of each Kotlin module to obtain a plurality of compiling scripts, and the compiling scripts are split based on the methods included in each compiling script to obtain script files corresponding to the modified methods.
Subsequently, the server 31 acquires and names the newly added method and the changed method in the modified script code. Specifically, the server 31 compares the script code before modification with the script code after modification, and obtains a new method and a changed method in the script code after modification. And naming the script file corresponding to the new method and the changed method according to the splicing of the class name and the method signature of the original method corresponding to the new method and the changed method.
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 the application program, acquires the received 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, to obtain the 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 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 the record table is judged by executing a preset transit logic, and if the record of splicing 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.
Through the method, when the script code of the application program is constructed, the preset relay logic is inserted into each original method entry of the script code, and the preset relay logic at the method entry can be executed before each task corresponding to a certain method is run, so that whether the next executed task is executed 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 relay logic. In this embodiment, modified script codes are obtained, the modified script codes are compiled through a KotlinJs compiler based on the dimension of each Kotlin module to obtain a plurality of compiling scripts, the compiling scripts are split based on the method included in each compiling script to obtain script files corresponding to each modified method, and therefore, the multi-platform adaptability of the KotlinJs compiler can be utilized to enable unified repair to application programs of multiple platforms, and repair efficiency is improved. The method and the system avoid independent compiling and repairing of developers aiming at each platform, reduce repairing workload of the developers, further improve repairing efficiency of each platform application program and reduce project maintenance cost.
Referring to fig. 5, fig. 5 is a flowchart illustrating a repairing method for an application according to a third embodiment of the present application.
Step S51: and starting the 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 every time to judge whether the application program needs to be repaired, so that the relevant operation that a user downloads and updates the application program manually by himself can be avoided, the operation steps of the user are reduced, and the repair experience and efficiency of the application program are improved.
After the client terminal obtains the latest patch package, unpacking can be performed in a packing mode based on a server, for example: and when the server generates the latest patch package in a compression mode, the client terminal unpacks the patch package in a decompression mode.
Step S52: responding to the latest patch package including the script files corresponding to the plurality of modified methods, and repairing the application program based on the script files, wherein the latest patch package is obtained by the server and is the modified script code; compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, and packaging the script files corresponding to the plurality of modified methods to obtain the script file, wherein the script file corresponds to the plurality of modified methods one to one.
And after unpacking the latest patch package, the server judges whether the latest patch package comprises the script files corresponding to the plurality of modified methods, and if so, the server repairs the application program based on the script files in the latest patch package. And if the latest patch package is blank, the application program is started without repairing the script code, and no response is performed. In other embodiments, it may also be determined whether the latest patch package before unpacking includes the script files corresponding to the modified multiple methods by determining whether the latest patch package is blank.
The latest patch package of the embodiment is obtained by compiling the modified script code by using a multi-platform compiler after the server acquires the modified script code, generating a script file with a set format, and packaging the script files corresponding to the modified methods, wherein the script file corresponds to the modified methods one to one. The specific steps of the server generating the latest patch package can refer to the embodiment in fig. 1, and are not described herein again.
Through the above manner, the method for repairing the application program of the embodiment obtains the latest patch package from the server when the application program is started; responding to the latest patch package including the script files corresponding to the plurality of modified methods, and repairing the application program based on the script files; therefore, the method and the device can avoid the relevant operation that the user downloads and updates the application program manually, reduce the operation steps of the user and improve the repair experience and efficiency. The latest patch package is the script code obtained by the server after modification; and compiling the modified script codes by using a multi-platform compiler to generate script files with set formats, and packaging the script files corresponding to the modified methods to obtain the script files. Therefore, the repairing method of the embodiment can be applied to repairing of the application programs of multiple platforms, a developer is prevented from independently compiling and repairing each platform, the repairing workload of the developer is reduced, the repairing efficiency of the application programs of each platform is improved, and the project maintenance cost is reduced.
Referring to fig. 6, fig. 6 is a flowchart illustrating a repairing method for an application according to a fourth embodiment 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 relay logic is located at the entrance of each method, so that when an application program is run, the preset relay logic at the entrance of the method is executed before a task corresponding to a certain method is run, and therefore whether the next executed task is executed 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 relay logic.
Step S61: and starting the 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 every time to judge whether the application program needs to be repaired, so that the relevant operation that a user downloads and updates the application program manually by himself can be avoided, the operation steps of the user are reduced, and the repair experience and efficiency of the application program are improved.
Please refer to any of the foregoing embodiments, and details are not repeated herein.
Step S62: and in response to the latest patch package including the modified script files, unpacking the latest patch package to obtain the script files corresponding to the modified methods, and recording the file paths of the script files based on the names of the script files to obtain a recording list.
And judging whether the latest patch package comprises the modified script file, if so, indicating that a program error exists in the application program and the repair is needed. If the latest patch package is a blank patch package or does not include the modified script file, the result shows that no program error exists in the current application program, and the repair is not needed.
And in response to the latest patch package including the modified script file, unpacking the latest patch package to obtain the script files corresponding to the modified methods. In a specific application scenario, when the server performs compression and packaging in a Zip compression manner to obtain the latest patch package, the embodiment may also perform decompression and unpacking on the latest patch package in a Zip decompression manner. 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.
And after the script files corresponding to the plurality of modified methods are obtained, recording the file path of each script file based on the naming of the script file to obtain a recording list. Specifically, the script files corresponding to the plurality of modified methods are stored in the storage device of the client terminal, and are recorded into a recording table according to the name 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 the key is a class name of an original method and a name of a concatenation of method signatures, and the value is a file path of the 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: and judging whether a record of splicing of the class name and the method signature corresponding to the original method exists in the record table or not by executing preset transit logic, and executing the task corresponding to the original method by executing the modified script file if the record of splicing 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 plurality of modified methods are recorded, and when the application program is specifically operated, the corresponding method is executed to execute the relevant function task. Since a preset relay logic is inserted into the entry of each method when the script code is constructed, the preset relay logic is executed first before the corresponding method is executed. Specifically, the preset transit logic is as follows: according to the concatenation of the class name of the original method corresponding to the current method and the original method signature, it is queried whether the record table in step S62 contains a record with the same name as the concatenation name. If not, indicating that the current method does not need to be repaired, then the original logic of the current method is continuously executed. If the hash record table contains names, which indicate that the current method needs to be replaced, the logic of the current method is abandoned, and the modified script file is jumped to execute the functional task.
The specific steps of jumping to the modified script file to execute the functional task are as follows: acquiring a file path of the modified script file 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.
In a specific application scenario, a class name of an original method corresponding to a current method and a file path of a script file corresponding to splicing of an original method signature are obtained from a record table, the script file is read from a storage device of a 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 concatenation of the class name of the original method and the original signature corresponding to the current method is obtained from the hash record table, so that the script file stored in the device is read through the file path, and the JS file is executed through a general JavaScript engine (such as a JavaScript core or other JS engine) and other engines, so as to complete the execution of the corresponding functional task.
In this embodiment, the transmission network between the server and the client terminal and the data flow direction of data transmission are the same as those in the embodiment of fig. 2, please refer to the foregoing, and details are not described herein again.
Through the steps, the method for repairing the application program of the embodiment can realize automatic repair of the business program by starting the application program and acquiring the latest patch package from the server, so that the user can be prevented from manually downloading and updating the application program, the operation steps of the user are reduced, and the repair experience and efficiency are improved. And then responding to the latest patch package including the modified script files, unpacking the latest patch package to obtain the modified script files corresponding to a plurality of methods, recording the file path of each script file based on the naming of the script file to obtain a recording table, judging whether the recording table has the class name corresponding to the original method and the splicing record of the method signature by executing preset transfer logic, and if the recording table has the record with the same splicing of the class name corresponding to the original method and the method signature, executing the task corresponding to the original method by executing the modified script file to realize the restoration of the application program based on the preset transfer logic. The latest patch package of the embodiment is obtained through a KotlinJs compiler, so that the multi-platform applicability of the KotlinJs compiler can be utilized to uniformly repair the multi-platform application program, and the repair efficiency is improved. The method and the system avoid independent compiling and repairing of developers aiming at each platform, reduce repairing workload of the developers, further improve repairing efficiency of each platform application program and reduce project maintenance cost.
Referring to fig. 7, fig. 7 is a schematic diagram of a framework of an embodiment of a repair apparatus for an application program according to the present application. The device 70 for restoring the application program comprises an acquisition module 71, a compiling module 72 and a packaging module 73. An obtaining module 71, configured to obtain 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 plurality of modified methods one to one; and the packaging module 73 is configured to package the script files corresponding to the plurality of 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 plurality of modified methods.
The compiling module 72 is further configured to compile the modified script code with a KotlinJs compiler to generate a script file in a Javascript format.
The compiling module 72 is further configured to compile the modified script code based on the dimension of each Kotlin module through a KotlinJs compiler to obtain a plurality of compiled scripts; splitting the compiling script based on the method contained in each compiling script to obtain script files 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 codes before modification with the script codes after modification, and obtain a new method and a changed method in the script codes after modification; naming script files corresponding to the newly added method and the changed method according to the splicing of the class name and the method signature of the original method corresponding to the newly added method and the changed method; and packaging the named script files to obtain the latest patch package.
The obtaining module 71 is further configured to insert a preset relay logic into each original method entry of the script code when constructing the script code of the application program, so that when executing the task corresponding to the original method of the application program, whether to execute the task by executing the original method is determined by first executing the preset relay logic in the original method.
The acquisition module 71 is also used to build script code for the application by Kotlin.
By the aid of the scheme, the user can be prevented from manually downloading and updating the application program, user operation steps are reduced, and restoration experience and efficiency of the application program are improved.
Referring to fig. 8, fig. 8 is a schematic diagram of a framework of another embodiment of a repair apparatus for an application program according to the present application.
The application program recovery device 80 includes an activation module 81 and a recovery module 82. The starting module 81 is used for starting an application program and acquiring a latest patch package from a server; the repairing module 82 is configured to, in response to that the latest patch package includes script files corresponding to the modified multiple methods, repair the application program based on the script files; the latest patch package is a script code obtained by the server after modification; compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, and packaging the script files corresponding to the plurality of modified methods to obtain the script file, wherein the script file corresponds to the plurality of modified methods one to one.
The repairing module 82 is further configured to execute a task corresponding to the original method of the application by first executing a preset relay logic at an entry of the original method of the application, so as to determine whether to execute the task by executing the original method.
The repairing module 82 is further configured to, in response to the latest patch package including the modified script file, unpack the latest patch package to obtain script files corresponding to the modified methods; and recording the file path of each script file based on the name of the script file to obtain a recording table. Judging whether a record table contains a class name corresponding to the original method and a spliced record of the method signature by executing a preset transit logic; and if the record table has the record with the same splicing of the class name and the method signature corresponding to the original method, executing the task corresponding to the original method by executing the modified script file.
The repairing module 82 is further configured to obtain a file path of the modified script file 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.
By the aid of the scheme, the user can be prevented from manually downloading and updating the application program, user operation steps are reduced, and restoration experience and efficiency of the application program are improved.
Referring to fig. 9, fig. 9 is a schematic diagram of a frame of an embodiment of an electronic device according to the present application. The electronic device 90 includes a memory 91 and a processor 92 coupled to each other, and the processor 92 is configured to execute program instructions stored in the memory 91 to implement the steps of the method for repairing an application program according to any of the first, second, third, and fourth embodiments. In one particular implementation scenario, the electronic device 90 may include, but is not limited to: a microcomputer, a server, and the electronic device 90 may also include a mobile device such as a notebook computer, a tablet computer, and the like, which is not limited herein.
In particular, the processor 92 is configured to control itself and the memory 91 to implement the steps of any of the above-described embodiments of the application repair method. The processor 92 may also be referred to as a CPU (Central Processing Unit). The processor 92 may be an integrated circuit chip having signal processing capabilities. The Processor 92 may also be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, 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 collectively implemented by an integrated circuit chip.
By the aid of the scheme, the user can be prevented from manually downloading and updating the application program, user operation steps are reduced, and restoration experience and efficiency of the application program are improved.
Referring to fig. 10, fig. 10 is a block diagram illustrating an embodiment of a computer-readable storage medium according to the present application. The computer-readable storage medium 100 stores program instructions 1001 capable of being executed by a processor, and the program instructions 1001 are used for implementing the steps of the method for restoring an application program according to any one of the first, second, third, and fourth embodiments described above.
By the aid of the scheme, the user can be prevented from manually downloading and updating the application program, user operation steps are reduced, and restoration 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 method and apparatus may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is merely one type of logical division, and an actual implementation may have another division, for example, a unit or a component may be combined or integrated with another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some interfaces, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on network elements. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to 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), a magnetic disk or an optical disk, and other various media capable of storing program codes.

Claims (14)

1. A method for repairing an application program, the method comprising:
the server acquires the modified script code;
compiling the modified script codes by using a multi-platform compiler to generate a script file with a set format, wherein the script file corresponds to the plurality of modified methods one to one;
and packaging the script files corresponding to the plurality of 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 plurality of modified methods.
2. The method for repairing an application according to claim 1, wherein the step of compiling the modified script code by using a multi-platform compiler to generate a script file with a set format comprises:
compiling the modified script code by using a KotlinJs compiler to generate a script file in a Javascript format.
3. The method for repairing an application according to claim 1 or 2, wherein the step of compiling the modified script code by using a multi-platform compiler to generate a script file with a set format, wherein the step of the script file corresponding to the plurality of modified methods comprises:
compiling the modified script code through a KotlinJs compiler based on the dimension of each Kotlin module to obtain a plurality of compiled scripts;
splitting the compiling script based on the method contained in each compiling script to obtain script files corresponding to the modified methods;
wherein each modified method corresponds to a script file.
4. The method for repairing an application according to claim 1, wherein the step of packaging the script files corresponding to the plurality of modified methods to obtain a latest patch package comprises:
comparing the current script code with the modified script code to obtain a new method and a changed method in the modified script code;
naming script files corresponding to the newly added method and the changed method according to the splicing of the class name and the method signature of the original method corresponding to the newly added method and the changed method;
and packaging the named script files to obtain the latest patch package.
5. The method for repairing an application according to claim 1, wherein 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:
when a script code of an 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 first.
6. The method for repairing an application according to any one of claims 1 to 5, further comprising:
the script code of the application is constructed by Kotlin.
7. 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 including script files corresponding to the plurality of modified methods, and repairing the application program based on the script files;
the latest patch package is a script code obtained by the server after modification; compiling the modified script code by using a multi-platform compiler to generate a script file with a set format, and packaging the script file corresponding to the plurality of modified methods to obtain the script file, wherein the script file corresponds to the plurality of modified methods one to one.
8. A method for repairing an application according to claim 7, wherein in response to the latest patch package including a script file corresponding to the plurality of modified methods, the step of repairing the application based on the script file includes:
executing a task corresponding to an original method of the application program by executing a preset transfer logic at an original method entrance of the application program, so as to judge whether the task is executed by executing the original method.
9. A method for repairing an application according to claim 8, wherein in response to the latest patch package including a script file corresponding to the plurality of modified methods, the step of repairing the application based on the script file includes:
in response to the latest patch package including the modified script file, unpacking the latest patch package to obtain the script files corresponding to the modified methods;
recording the file path of each script file based on the name of the script file to obtain the record table;
judging whether a record of splicing the class name and the method signature corresponding to the original method exists in the record table or not by executing the preset transit logic;
and if the record table has the record with the same splicing of the class name and the method signature corresponding to the original method, executing the task corresponding to the original method by executing the modified script file.
10. The method for repairing an application according to claim 9, 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.
11. An apparatus for restoring an application, comprising:
the acquisition module is used for acquiring the modified script codes;
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 correspond to the plurality of modified methods one to one;
and the packaging module is used for packaging the script files corresponding to the plurality of 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 plurality of modified methods.
12. An apparatus for restoring an application, 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 the latest patch package which comprises the script files corresponding to the plurality of modified methods, and repairing the application program based on the script files; the latest patch package is a script code obtained by the server after modification; compiling the modified script code by using a multi-platform compiler to generate a script file with a set format, and packaging the script file corresponding to the plurality of modified methods to obtain the script file, wherein the script file corresponds to the plurality of modified methods one to one.
13. An electronic device, comprising a memory and a processor coupled to each other, wherein the processor is configured to execute program instructions stored in the memory to implement the method for repairing an application program according to any one of claims 1 to 6 or the method for repairing an application program according to any one of claims 7 to 10.
14. A computer-readable storage medium on which program instructions are stored, which program instructions, when executed by a processor, implement a method of repairing an application program according to any one of claims 1 to 6 or a method of repairing an application program according to any one of claims 7 to 10.
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 true CN113467803A (en) 2021-10-01
CN113467803B 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
CN113467803B (en) 2024-03-01

Similar Documents

Publication Publication Date Title
US8612947B2 (en) System and method for remotely compiling multi-platform native applications for mobile devices
CN100449524C (en) Servicing a component-based software product
CN111367510B (en) Android function module development method and device
CN107451474B (en) Software bug fixing method and device for terminal
CN112631622B (en) Application installation method, device, server and computer readable medium
CN109739523B (en) Application packaging method, device, storage medium and terminal
CN111309451A (en) Method for realizing cross compilation of Docker mirror images
CN113242288B (en) Internet of things equipment firmware upgrading method, system and device and storage medium
CN109032638A (en) Hot update method, server and the mobile terminal of mobile application software
CN106598681A (en) Construction method and device for development environment
CN114610318A (en) Android application packaging method, device, equipment and storage medium
EP3803579A1 (en) Extensibility of unified platform
US10866803B2 (en) Generating interaction libraries
CN111061486B (en) Android application program increment method
CN111625294A (en) Server project execution method, device and related equipment
CN110659022A (en) Method for automatically calling Python script based on Java
CN113467803B (en) Application program repairing method, related device and equipment
US12373178B2 (en) Determining dependencies in workspaces
CN113110842A (en) Software bytecode homology analysis method, device and equipment
CN110362320B (en) Command implementation method and device of application development platform
CN113641389B (en) Software upgrading method, device and equipment based on OpenCPU
CN116795419A (en) Version package grouping method, device, equipment and storage medium
CN117389660A (en) Method and system for detecting jar packet homonymy
CN116775087A (en) Thermal repair method, device, electronic equipment and storage medium
CN115904384A (en) Configuration method, device, equipment and storage medium for application publishing

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