CN110442347B - Method and device for compiling installation package, electronic equipment and readable storage medium - Google Patents

Method and device for compiling installation package, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN110442347B
CN110442347B CN201910739317.XA CN201910739317A CN110442347B CN 110442347 B CN110442347 B CN 110442347B CN 201910739317 A CN201910739317 A CN 201910739317A CN 110442347 B CN110442347 B CN 110442347B
Authority
CN
China
Prior art keywords
compiling
data
smali
installation package
code
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
CN201910739317.XA
Other languages
Chinese (zh)
Other versions
CN110442347A (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 CN201910739317.XA priority Critical patent/CN110442347B/en
Publication of CN110442347A publication Critical patent/CN110442347A/en
Application granted granted Critical
Publication of CN110442347B publication Critical patent/CN110442347B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/53Decompilation; Disassembly
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • 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

Abstract

The embodiment of the application provides an installation package compiling method, device, electronic equipment and readable storage medium, when non-first compiling operation aiming at any development project is detected, a code dependency source corresponding to code updating data can be obtained according to compiling updating data corresponding to the development project, and further the code updating data is quickly updated into decompiling data of an installation package to be compiled of the development project according to the code dependency source, and/or resource updating data is quickly updated into decompiling data of the installation package to be compiled of the development project. Therefore, a developer does not need to repeatedly conduct various pre-checks during non-first compiling, so that the compiling time cost during non-first compiling is reduced, and the efficiency of non-first compiling is improved.

Description

Method and device for compiling installation package, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for compiling an installation package, an electronic device, and a readable storage medium.
Background
As business development becomes more and more abundant, the code amount of development projects of Android mobile clients becomes more and more, and corresponding codes need to be compiled every time. Therefore, the developer needs to perform various pre-operations during the compiling process, so that the compiling speed is slower and slower. Since the cost of compiling time of each running development project is equivalent to the cost of manpower and time of wasting the developer, especially for non-first compiling, if the compiling efficiency is not improved, the developing efficiency is greatly affected.
Disclosure of Invention
In view of the foregoing, an object of the present application is to provide an installation package compiling method, apparatus, electronic device, and readable storage medium, which do not require a developer to repeatedly perform various pre-checks at the time of non-first compiling, thereby reducing the compiling time cost at the time of non-first compiling and improving the efficiency of non-first compiling.
According to an aspect of an embodiment of the present application, there is provided an installation package compiling method, applied to an electronic device, the method including:
when a compiling operation aiming at any development project is detected, compiling update data corresponding to the development project is obtained, wherein the compiling update data comprises at least one of code update data and resource update data;
judging whether the compiling operation is the first operation or not according to compiling updating data corresponding to the development project;
if the compiling operation is not the first operation, a code dependency source corresponding to the code updating data is obtained, and the code updating data is updated to decompilation data of the to-be-compiled installation package of the development project according to the code dependency source, and/or the resource updating data is updated to decompilation data of the to-be-compiled installation package of the development project.
According to another aspect of the embodiments of the present application, there is provided an installation package compiling apparatus applied to an electronic device, the apparatus including:
the system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring compiling update data corresponding to any development project when compiling operation aiming at the development project is detected, and the compiling update data comprises at least one of code update data and resource update data;
the judging module is used for judging whether the compiling operation is the first operation or not according to compiling update data corresponding to the development project;
and the updating module is used for acquiring a code dependency source corresponding to the code updating data if the compiling operation is not the first operation, updating the code updating data into decompiling data of the to-be-compiled installation package of the development project according to the code dependency source, and/or updating the resource updating data into decompiling data of the to-be-compiled installation package of the development project.
According to another aspect of embodiments of the present application, there is provided an electronic device including a machine-readable storage medium storing machine-executable instructions and a processor that, when executing the machine-executable instructions, implements the aforementioned installation package compilation method.
According to another aspect of the embodiments of the present application, there is provided a readable storage medium having stored therein machine-executable instructions that when executed implement the aforementioned installation package compilation method.
Based on any aspect, when detecting a non-first compiling operation for any development project, the embodiments of the present application can obtain a code dependency source corresponding to the code update data according to the compiling update data corresponding to the development project, and further update the code update data to decompilation data of an installation package to be compiled of the development project according to the code dependency source, and/or update the resource update data to decompilation data of the installation package to be compiled of the development project. Therefore, a developer does not need to repeatedly conduct various pre-checks during non-first compiling, so that the compiling time cost during non-first compiling is reduced, and the efficiency of non-first compiling is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting in scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow diagram of an installation package compiling method according to an embodiment of the present application;
FIG. 2 illustrates a schematic diagram of decompiled data of an exemplary installation package provided by embodiments of the present application;
FIG. 3 is a second flowchart of a method for compiling an installation package according to an embodiment of the present disclosure;
FIG. 4 is a third flow chart of the installation package compiling method according to the embodiment of the application;
FIG. 5 is a schematic diagram of functional modules of an installation package compiling apparatus according to an embodiment of the present application;
fig. 6 is a schematic block diagram of an electronic device for implementing the above-mentioned installation package compiling method according to an embodiment of the application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the accompanying drawings in the present application are only for the purpose of illustration and description, and are not intended to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this application, illustrates operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to the flow diagrams and one or more operations may be removed from the flow diagrams as directed by those skilled in the art.
In addition, the described embodiments are only some, but not all, of the embodiments of the present application. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
Fig. 1 shows a flowchart of the installation package compiling method according to the embodiment of the application, and it should be understood that, in other embodiments, the order of part of the steps in the installation package compiling method according to the embodiment may be interchanged according to actual needs, or part of the steps may be omitted or deleted. The detailed steps of the installation package compiling method are described below.
Step S110, when the compiling operation for any development project is detected, compiling update data corresponding to the development project is obtained.
Step S120, judging whether the compiling operation is the first operation according to the compiling update data corresponding to the development project.
If the compiling operation is not the first operation, step S130 is executed, which is described in detail below.
Step S130, a code dependency source corresponding to the code update data is obtained, and the code update data is updated to decompilation data of an installation package to be compiled of the development project according to the code dependency source, and/or the resource update data is updated to decompilation data of the installation package to be compiled of the development project.
In this embodiment, different development projects may be determined and developed according to different service requirements. For example, for the requirement of online live internet, related live internet software items, such as a live anchor software item, a live audience software item, and the like, can be determined.
In some possible embodiments, the programming language adopted by each development project may be, but is not limited to, java, C/c++, etc., and any other feasible programming language may be adopted, and under different programming languages, a corresponding compiling manner may be adopted to compile the code or resource to generate compiled update data. For example, in this embodiment, taking an internet live software project of a certain Android platform as an example, the compiled update data corresponding to the development project may be compiled update data obtained by developing and compiling based on the Java language.
In order to improve the compiling efficiency of the non-first compiling operation, the embodiment can judge whether the compiling operation is the first operation or not according to the compiling update data, and if not, can determine the specific update data related to the compiling operation according to the compiling update data. For example, if the compiling operation only involves code update data (such as JAVA code data), then a code dependency source corresponding to the code update data is obtained, and the code update data is updated into decompiled data of the installation package to be compiled of the development project according to the code dependency source. For another example, if the compiling operation only involves resource update data (such as software interface picture data, audio/video resource data, etc.), then the resource update data is updated into decompiled data of the installation package to be compiled of the development project. For another example, if the compiling operation involves both the code update data and the resource update data, then a code dependency source corresponding to the code update data is obtained, and the code update data is updated to decompilation data of the installation package to be compiled of the development project according to the code dependency source, and meanwhile, the resource update data is updated to decompilation data of the installation package to be compiled of the development project.
Thus, according to the compiling mechanism, a developer does not need to repeatedly conduct various pre-checks during non-first compiling, so that the compiling time cost during non-first compiling is reduced, and the efficiency of non-first compiling is improved.
In some possible implementations, for step S120, for each development project, there is typically no compiled data that has been generated at the time of the first compilation. Based on this, it can be determined whether or not there is compiled data associated with the compiled update data in the project development data of the development project. For example, if the project development data of the development project includes the compiling data associated with the compiling update data, the compiling operation is determined not to be the first operation, otherwise, the compiling operation may be determined to be the first operation.
In some possible embodiments, for step S130, taking a software development project of the Android system as an example, an installation package file of the Android system is an Apk file, and an inner shell of the Apk file is substantially divided into two parts, wherein one part is resource data and the other part is code data. If the Apk file is decompiled by some decompiling tool (such as Apktool tool), the code data in the Apk file is decompiled and parsed into a smali file, and the resource data is directly restored into a specific resource file. In addition, the Apk file may further include a plurality of Dex files, and then the decompiled smali files are distributed in a plurality of different smali folders, for example, folders named smali_class1, smali_class2, smali_class3 … …, and the like. For example, as shown in fig. 2, which shows a schematic interface diagram of folders obtained after decompilation for a certain Apk file, a plurality of smali folders (e.g., smali_class99, smali_class98, smali_class97, etc.) for storing code data can be seen.
That is, each Dex file may correspond to a smali folder. On the basis, the embodiment can establish a preset hash table for the smali folders and the smali files corresponding to the insides of the smali folders, so that the positions of the corresponding stored smali folders can be quickly searched through the file names of the smali files during subsequent incremental updating.
In addition, before the compiling operation of the development project, the Class file generated by compiling each development project may be stored locally in advance. Still taking the Android system as an example, the Class file may also be called a Java Class file, and may provide a binary service independent of the underlying host platform for a program developed in the Java language. The Class file may be a binary file running on any hardware platform and operating system (e.g., android system) that supports a Java virtual machine.
In one example, for code update data, one implementation of obtaining a code dependent source corresponding to the code update data may be: and acquiring a project catalog corresponding to the code updating data in the development project, acquiring a target Class file associated with the code updating data from the project catalog, and determining the target Class file as a code dependency source corresponding to the code updating data.
Alternatively, the target Class file may be a Class file generated by a first compiling operation associated with the code update data, or a Class file generated by a last compiling operation of the presently detected compiling operation.
Thus, after the code dependency source corresponding to the code update data is acquired, the code update data (Java code data) can be compiled from the code dependency source to generate a Class file. For example, code update data may be converted into Class data according to a java instruction, where/xxx/xxx/xxx/xxxx, where/xxx/xxx indicates an item directory corresponding to a code dependency source corresponding to the code update data.
The Class file is then converted to a Dex file, for example, by a dx-Dex-output=class.
Then decompiling is carried out on the Dex file, and a corresponding first Smali file is obtained. For example, the Dex file may be decompiled via Java-jar base mali-2.2.1.jar d classes.dex to obtain a corresponding first Smali file.
In addition, before or at the same time, decompilation is required to be performed on the installation package to be compiled of the development project, so as to obtain decompilation data of the installation package to be compiled of the development project. For example, decompilation may be performed on the installation package to be compiled for the development project by./ apktool.sh app-debug.apkacdemo, resulting in decompilation data for the installation package to be compiled for the development project, which may include a plurality of Smali folders.
Then, a target Smali folder corresponding to the Dex file may be determined from the plurality of Smali folders. For example, the foregoing predetermined hash table may be obtained, and since the hash table includes the Smali folder corresponding to each Dex file and at least one Smali file corresponding to each Smali folder, the Smali folder corresponding to the Dex file may be searched from the hash table as the target Smali folder.
Through the above procedure, the first Smali file may be updated into the target Smali folder. For example, code data may be newly added or original code data may be modified according to a specific development process. Thus, it may be selected to replace the second SmaLI file from the last compilation operation in the target SmaLI folder with the first SmaLI file or to add the first SmaLI file to the target SmaLI folder as a newly added SmaLI file.
For example, assume that the target Smali folder is smali_class99 shown in fig. 2, three Smali files of Smali991, smali992, smali993 of the software project may be included in smali_class 99. If the first Smali file is a Smali991, a Smali992, a Smali994 other than a Smali993, then the Smali994 may be added to the smali_class99 as a new added Smali file, at which point the smali_class99 may include a Smali991, a Smali992, a Smali993, a Smali991, a Smali992, a Smali994. For another example, if the first Smali file is Smali991 'for replacing the image Smali991, then Smali991 in smali_class99 may be replaced with Smali991'.
In another example, for resource update data, the installation package to be compiled for the development project may be decompiled in advance to obtain decompiled data, which may include a resource data folder. Therefore, according to a specific development process, the resource data can be newly added, and the original resource data can be modified. Accordingly, it is possible to select to replace the last compiled resource file corresponding to the resource update data in the resource data folder with the resource update data or to add the resource update data as newly added resource data to the resource data folder.
For example, assuming that the path of the resource data folder is/Resources,/Resources may include images A1, A2, A3 of the interface a of the software item, e.g., the resource update data is A4 other than images A1, A2, A3, A4 may be added as newly added resource data to the folder under/Resources, and at this time/Resources may include images A1, A2, A3, A4 of the interface a of the software item in the folder under/Resources. For another example, if the resource update data is A1 'for replacing the image A1, the image A1 of the interface a in/Resources may be replaced with A1'.
On the basis of the foregoing description, please further refer to fig. 3, after step S130, the installation package compiling method provided in this embodiment may further include the following steps S140 and S150, which are specifically described below.
And step S140, re-packing the decompiled data after updating to obtain a re-packing installation package.
For example, the repackaging installation package can be obtained by repackaging the decompiled data including the update through a repackaging instruction, such as an apktool b smali/acde-o asde.
And step S150, signing the repackaged installation package to obtain a compiled installation package.
For example, the repackaged installation package may be signed by a re-signing instruction, such as a java-verbose-keyer/Users/v 5/Documents/Nook/signkey-signedjar/Users/v5/power/smali/rep-sign. Apk/Users/v5/power/smali/rep. Apk Nook signing instruction.
Thus, the compiled installation package is the updated installation package, so that a new installation package version can be pushed for relevant users of the development project to increase or improve software functions.
In another case, referring to fig. 4, if the compiling operation is the first operation, the following steps S121 and S122 are executed, which are described in detail below.
Step S121, generating a corresponding compiling installation package according to the compiling update data.
Step S122, adjusting the target code in the packing tool corresponding to the generated compiling and installing package.
In this embodiment, the inventor researches that there is an r.java file in the Apk file, where the r.java file stores unique identification IDs of a plurality of resource data, in the process of compiling a plurality of installation packages, the IDs of the same resource data may change, and the changed IDs may conflict with the IDs of other resource data, which results in errors when a certain resource data is referenced later, thereby resulting in a compilation failure. Based on this, the present embodiment can modify the object code in the packaging tool corresponding to the generated compilation installation package when the compilation operation is performed for the first time, and the object code can be used to determine the identification information for each resource data when executed. Thus, when the packaging tool packages the compiling and installing package, the identification information of each initial resource data in the compiling and installing package is locked, and the identification information of the newly added resource data is not identical with the identification information of each initial resource data. For example, the method can ensure that the IDs of all the resource data are unchanged in the subsequent multiple packaging process, and the IDs of the newly added resource data are sequentially increased on the basis of the original IDs, so that the problem of compiling failure caused by errors when a certain resource data is referenced in the subsequent process is avoided, and the stability in the development process is improved.
Further, based on the same inventive concept, referring to fig. 5, a schematic diagram of functional modules of an installation package compiling apparatus 200 provided in an embodiment of the present application is shown, where the embodiment may divide the functional modules of the installation package compiling apparatus 200 according to the above-mentioned method embodiment. For example, each functional module may be divided corresponding to each function, or two or more functions may be integrated in one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation. For example, in the case where respective functional modules are divided by corresponding respective functions, the installation package compiling apparatus 200 shown in fig. 5 is only one apparatus schematic diagram. The installation package compiling apparatus 200 may include an obtaining module 210, a judging module 220, and an updating module 230, and the functions of each functional module of the installation package compiling apparatus 200 are described in detail below.
The obtaining module 210 is configured to, when a compiling operation for any development project is detected, obtain compiling update data corresponding to the development project, where the compiling update data includes at least one of code update data and resource update data. It is understood that the acquisition module 210 may be used to perform the step S110 described above, and reference may be made to the details of the implementation of the acquisition module 210 regarding the step S110 described above.
The judging module 220 is configured to judge whether the compiling operation is a first operation according to the compiling update data corresponding to the development project. It is understood that the determination module 220 may be used to perform the above step S120, and reference may be made to the details of the implementation of the determination module 220 regarding the above step S120.
The updating module 230 is configured to obtain a code dependency source corresponding to the code update data if the compiling operation is not the first operation, and update the code update data to decompilation data of the installation package to be compiled of the development project according to the code dependency source, and/or update the resource update data to decompilation data of the installation package to be compiled of the development project. It is understood that the update module 230 may be used to perform the step S130 described above, and reference may be made to the details of the implementation of the update module 230 regarding the step S130 described above.
In some possible embodiments, the determining module 220 may specifically be configured to:
judging whether compiling data associated with the compiling updating data exists in project development data of the development project;
if the project development data of the development project contains compiling data related to the compiling update data, judging that the compiling operation is not the first operation, otherwise, judging that the compiling operation is the first operation.
In some possible embodiments, the update module 230 may specifically obtain the code dependency source corresponding to the code update data by:
acquiring a project catalog corresponding to code update data in the development project;
and acquiring a target Class file associated with the code update data from the item catalog, and determining the target Class file as a code dependent source corresponding to the code update data.
In some possible embodiments, the target Class file is a Class file generated by a first compiling operation associated with the code update data, or a Class file generated by a last compiling operation of the presently detected compiling operation.
In some possible embodiments, the updating module 230 may specifically update the code update data into decompiled data of the installation package to be compiled for the development project by:
compiling the code update data according to the code dependency source to generate a Class file;
converting the Class file into a Dex file;
decompiling the Dex file to obtain a corresponding first Smali file;
decompilation is carried out on the installation package to be compiled of the development project to obtain decompilation data of the installation package to be compiled of the development project, wherein the decompilation data comprises a plurality of Smali folders;
determining a target Smali folder corresponding to the Dex file from a plurality of Smali folders;
the first Smali file is updated into the target Smali folder.
In some possible implementations, the update module 230 may specifically determine the target Smali folder to be updated from among the plurality of Smali folders by:
acquiring a predetermined hash table, wherein the hash table comprises Smali folders corresponding to each Dex file and at least one Smali file corresponding to each Smali folder;
the Smali folder corresponding to the Dex file is searched from the hash table as a target Smali folder.
In some possible implementations, the update module 230 may specifically update the first Smali file into the target Smali folder by:
replacing a second Smali file, which is obtained by last compiling in the target Smali folder, with the first Smali file; or alternatively
The first Smali file is added to the target Smali folder as a new added Smali file.
In some possible embodiments, the update module 230 may specifically update the resource update data into decompiled data of the installation package to be compiled for the development project by:
decompiling the installation package to be compiled of the development project to obtain decompiled data, wherein the decompiled data comprises a resource data folder;
replacing the last compiled resource file corresponding to the resource updating data in the resource data folder with the resource updating data; or alternatively
And adding the resource update data into the resource data folder as newly added resource data.
In some possible embodiments, the installation package compiling apparatus 200 may further include a repackaging module and a signing module. The repacking module can be specifically used for repacking the updated decompiled data to obtain a repacking installation package. The signature module can be specifically used for signing the repackaged installation package to obtain a compiled installation package.
In some possible embodiments, the installation package compiling apparatus 200 may further include a code adjustment module, which may specifically be configured to generate a corresponding compiled installation package according to the compiling update data if the compiling operation is the first operation, and then adjust the object code in the packaging tool corresponding to the generated compiled installation package, so that when the packaging tool packages the compiled installation package, the identification information of each initial resource data in the compiled installation package is locked, and the identification information of the newly added resource data is not the same as the identification information of each initial resource data. The object code, when executed, is used to determine identification information for each resource data.
Further, fig. 6 shows a schematic block diagram of an electronic device 100 for implementing the above-mentioned installation package compiling method according to the embodiment of the application, based on the same inventive concept, in which the electronic device 100 may include a machine-readable storage medium 120 and a processor 130.
The processor 130 may be a general-purpose central processing unit (Central Processing Unit, CPU), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of programs that provide the installation package compilation method of the foregoing method embodiments.
The machine-readable storage medium 120 may be, but is not limited to, ROM or other type of static storage device, RAM or other type of dynamic storage device, which may store static information and instructions, as well as electrically erasable programmable Read-Only MEMory (EEPROM), compact Read-Only MEMory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The machine-readable storage medium 120 may reside separately and be coupled to the processor 130 by a communication bus. The machine-readable storage medium 120 may also be integral to the processor. Wherein the machine-readable storage medium 120 is used to store machine-executable instructions for performing aspects of the present application. Processor 130 is configured to execute machine-executable instructions stored in machine-readable storage medium 120 to perform the foregoing method embodiments to provide an installation package compilation method.
The present application also provides a readable storage medium containing computer executable instructions that when executed are operable to perform the installation package compilation method provided by the foregoing method embodiments.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although the present application has been described herein in connection with various embodiments, other variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed application, from a review of the figures, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other elements or steps, and the "a" or "an" does not exclude a plurality. A single processor or other unit may fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.
The foregoing is merely various embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered in the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (11)

1. An installation package compiling method, applied to an electronic device, comprising:
when a compiling operation aiming at any development project is detected, compiling update data corresponding to the development project is obtained, wherein the compiling update data comprises at least one of code update data and resource update data;
judging whether the compiling operation is the first operation or not according to compiling updating data corresponding to the development project;
if the compiling operation is not the first operation, acquiring a code dependency source corresponding to the code updating data, and updating the code updating data into decompiling data of a to-be-compiled installation package of the development project according to the code dependency source, and/or updating the resource updating data into decompiling data of the to-be-compiled installation package of the development project;
the step of updating the code update data into decompilation data of an installation package to be compiled of the development project according to the code dependency source comprises the following steps:
compiling the code update data according to the code dependency source to generate a Class file;
converting the Class file into a Dex file;
decompiling the Dex file to obtain a corresponding first Smali file;
decompilation is carried out on the installation package to be compiled of the development project to obtain decompilation data of the installation package to be compiled of the development project, wherein the decompilation data comprises a plurality of Smali folders;
acquiring a predetermined hash table, wherein the hash table comprises Smali folders corresponding to each Dex file and at least one Smali file corresponding to each Smali folder;
searching a Smali folder corresponding to the Dex file from the hash table as a target Smali folder;
updating the first Smali file into the target Smali folder.
2. The installation package compiling method according to claim 1, wherein the step of judging whether the compiling operation is a first operation according to compiling update data corresponding to the development project comprises:
judging whether compiling data associated with the compiling updating data exists in project development data of the development project;
if the project development data of the development project contains compiling data related to the compiling update data, judging that the compiling operation is not the first operation, otherwise, judging that the compiling operation is the first operation.
3. The installation package compiling method according to claim 1, wherein the step of acquiring the code dependency source corresponding to the code update data comprises:
acquiring a project catalog corresponding to the code update data in the development project;
and acquiring a target Class file associated with the code updating data from the item catalog, and determining the target Class file as a code dependent source corresponding to the code updating data.
4. A method of compiling an installation package according to claim 3, wherein the target Class file is a Class file generated by a first compiling operation associated with the code update data or a Class file generated by a last compiling operation of the presently detected compiling operation.
5. The installation package compilation method of claim 1 wherein said step of updating said first Smali file into said target Smali folder comprises:
replacing a second Smali file obtained by last compiling of the target Smali folder with the first Smali file; or alternatively
The first Smali file is added to the target Smali folder as a new added Smali file.
6. The install package compiling method according to any one of claims 1 to 4, wherein the step of updating the resource update data into decompiled data of the install package to be compiled of the development project comprises:
decompiling the installation package to be compiled of the development project to obtain decompiled data, wherein the decompiled data comprises a resource data folder;
replacing a last compiled resource file corresponding to the resource update data in the resource data folder with the resource update data; or alternatively
And adding the resource update data into the resource data folder as newly added resource data.
7. The installation package compilation method of claim 1, further comprising:
repackaging the updated decompiled data to obtain a repackaged installation package;
and signing the repackaging installation package to obtain a compiled installation package.
8. The installation package compilation method of claim 1, further comprising:
if the compiling operation is the first operation, generating a corresponding compiling installation package according to the compiling update data;
and adjusting target codes in a packaging tool corresponding to the generated compiling and installing package, so that when the packaging tool packages the compiling and installing package, the identification information of each initial resource data in the compiling and installing package is locked, the identification information of the newly added resource data is not identical with the identification information of each initial resource data, and the target codes are used for determining the identification information for each resource data when being executed.
9. An installation package compiling apparatus, applied to an electronic device, comprising:
the system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring compiling update data corresponding to any development project when compiling operation aiming at the development project is detected, and the compiling update data comprises at least one of code update data and resource update data;
the judging module is used for judging whether the compiling operation is the first operation or not according to compiling update data corresponding to the development project;
the updating module is used for acquiring a code dependency source corresponding to the code updating data if the compiling operation is not the first operation, updating the code updating data into decompiling data of the to-be-compiled installation package of the development project according to the code dependency source, and/or updating the resource updating data into decompiling data of the to-be-compiled installation package of the development project;
the updating module is specifically configured to:
compiling the code update data according to the code dependency source to generate a Class file;
converting the Class file into a Dex file;
decompiling the Dex file to obtain a corresponding first Smali file;
decompilation is carried out on the installation package to be compiled of the development project to obtain decompilation data of the installation package to be compiled of the development project, wherein the decompilation data comprises a plurality of Smali folders;
acquiring a predetermined hash table, wherein the hash table comprises Smali folders corresponding to each Dex file and at least one Smali file corresponding to each Smali folder;
searching a Smali folder corresponding to the Dex file from the hash table as a target Smali folder;
updating the first Smali file into the target Smali folder.
10. An electronic device comprising a machine-readable storage medium storing machine-executable instructions and a processor that, when executing the machine-executable instructions, implements the installation package compilation method of any of claims 1-8.
11. A readable storage medium having stored therein machine executable instructions that when executed implement the installation package compilation method of any of claims 1-8.
CN201910739317.XA 2019-08-12 2019-08-12 Method and device for compiling installation package, electronic equipment and readable storage medium Active CN110442347B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910739317.XA CN110442347B (en) 2019-08-12 2019-08-12 Method and device for compiling installation package, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910739317.XA CN110442347B (en) 2019-08-12 2019-08-12 Method and device for compiling installation package, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110442347A CN110442347A (en) 2019-11-12
CN110442347B true CN110442347B (en) 2023-06-30

Family

ID=68434714

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910739317.XA Active CN110442347B (en) 2019-08-12 2019-08-12 Method and device for compiling installation package, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110442347B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111274551B (en) * 2019-12-30 2023-06-27 上海上讯信息技术股份有限公司 Compiler-based java code protection method and device and electronic equipment
CN111240686B (en) * 2020-01-09 2022-10-04 江苏满运软件科技有限公司 Cloud compiling method and system, terminal device, cloud server and storage medium
CN111459822B (en) * 2020-04-01 2023-10-03 抖音视界有限公司 Method, device, equipment and readable medium for extracting system component data
CN112286564A (en) * 2020-10-22 2021-01-29 上海艾拉比智能科技有限公司 Differential upgrade algorithm for binary system files of IOT (input/output) equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5978585A (en) * 1997-03-27 1999-11-02 Inprise Corporation Development system with improved methods for recompiling dependent code modules
US9134975B1 (en) * 2014-08-22 2015-09-15 International Business Machines Corporation Determining which computer programs are candidates to be recompiled after application of updates to a compiler
CN105988854A (en) * 2015-02-12 2016-10-05 龙芯中科技术有限公司 Dynamic compilation method and apparatus
CN108897562A (en) * 2018-06-27 2018-11-27 腾讯科技(深圳)有限公司 Installation kit update method, device, medium and equipment
CN109032631A (en) * 2018-07-12 2018-12-18 腾讯科技(深圳)有限公司 Application program service packs acquisition methods, device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5978585A (en) * 1997-03-27 1999-11-02 Inprise Corporation Development system with improved methods for recompiling dependent code modules
US9134975B1 (en) * 2014-08-22 2015-09-15 International Business Machines Corporation Determining which computer programs are candidates to be recompiled after application of updates to a compiler
CN105988854A (en) * 2015-02-12 2016-10-05 龙芯中科技术有限公司 Dynamic compilation method and apparatus
CN108897562A (en) * 2018-06-27 2018-11-27 腾讯科技(深圳)有限公司 Installation kit update method, device, medium and equipment
CN109032631A (en) * 2018-07-12 2018-12-18 腾讯科技(深圳)有限公司 Application program service packs acquisition methods, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110442347A (en) 2019-11-12

Similar Documents

Publication Publication Date Title
CN110442347B (en) Method and device for compiling installation package, electronic equipment and readable storage medium
CN107168749B (en) Compiling method, device, equipment and computer readable storage medium
US9430224B2 (en) Hot-update method and apparatus
US9043778B2 (en) Method and system for upgrading software
CN106971098B (en) Method and device for preventing repacking
US9134965B2 (en) Method for developing software and system therefor
JP2016519385A (en) Method for loading driver and embedded device
CN109800005B (en) Client hot update method and device
CN112769706B (en) Componentized routing method and system
WO2020177429A1 (en) Method and apparatus for embedding codes in application, and electronic device
CN112947934A (en) Method, device and medium for dynamically transforming business logic
CN113472579A (en) Configuration method, equipment and medium for accessing external network application program interface
CN110888652A (en) Multi-version construction method based on jenkins plug-in and terminal
CN111596951A (en) Method and device for configuring engineering file
CN114879976A (en) Version environment deployment method and device and electronic equipment
CN112230930A (en) Method and device for constructing and packaging hybrid technology stack and machine-readable storage medium
CN105447040A (en) Binary file management and update method and device, and binary file management system
CN116775087A (en) Thermal repair method, device, electronic equipment and storage medium
CN113641389B (en) Software upgrading method, device and equipment based on OpenCPU
CN115576560A (en) Hot reloading method, device, equipment and medium for dynamic loader
KR101863325B1 (en) Method and apparatus for preventing reverse engineering
CN114924772A (en) Updating method and equipment of algorithm package
CN106547519B (en) Information processing method and system
CN112817598A (en) Code injection method in compile time
CN111694730B (en) Method and device for eliminating error reference control resource

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