Program compiling method and device, equipment and storage medium
By compiling plugins independently and merging manifest files, the problem of compiling plugins and the host in the same repository is solved, realizing the decoupling of plugins and the host and plugin sharing, supporting applications on different hosts.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-28
- Publication Date
- 2026-03-27
AI Technical Summary
In existing technologies, plug-in framework applications require plug-ins and the host to be placed in the same repository during compilation, which makes it impossible for plug-ins and the host to be developed independently and decoupled, and the plug-ins cannot be used by other hosts.
A program compilation method is provided, which generates a plugin package by compiling plugins independently. After the host compiles, the target plugin is selected according to the requirements and the manifest file is merged. The plugin information is integrated into the host package, thereby decoupling the plugin and the host.
It enables independent development and compilation of plugins and hosts, allowing plugins to be used by any host, decoupling them, supporting plugin sharing, and avoiding the duplication of developing plugins with the same functions.
Smart Images

Figure CN119440533B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, and more particularly, to a program compiling method and device, equipment and storage medium. BACKGROUND
[0002] Before deployment, an application needs to be compiled into an executable file and packaged.
[0003] For the current application program of the plug-in framework, the compiling scheme is to write the plug-in and the host in the same warehouse and perform joint compiling to generate the host and the plug-in apk, and to perform manifest merging and plug-in information integration at the same time. The host and the plug-in need to be placed in the same warehouse for compiling. Thus, the host and the plug-in cannot be developed based on independent warehouses respectively, the plug-in and the host cannot be decoupled, and the plug-in cannot be applied by other hosts. SUMMARY
[0004] The present application provides a program compiling method and device, equipment and storage medium, which can realize independent development and compiling of the plug-in and the host, decouple the plug-in and the host, and enable the plug-in to be applied by any host.
[0005] In a first aspect, the present application provides a program compiling method, which includes: compiling a host to generate a host program package, the host program package including a manifest file of the host; obtaining a manifest file and plug-in information of a target plug-in, the target plug-in being a plug-in obtained after compiling; according to the plug-in information, checking the host and the target plug-in according to a preset condition to determine whether the host and the target plug-in conflict, the plug-in information satisfying the preset condition indicating that the host and the target plug-in do not conflict; if the host and the target plug-in do not conflict, merging the manifest files of the host and the target plug-in to generate a total manifest file, and replacing the manifest file in the host program package with the total manifest file; and integrating the plug-in information into the host program package.
[0006] In a second aspect, the present application provides a program compiling device, which includes: an obtaining module, configured to obtain a manifest file and plug-in information of a target plug-in, the target plug-in being a plug-in obtained after compiling; a compiling module, configured to compile a host to generate a host program package, the host program package including a manifest file of the host; according to the plug-in information, check the host and the target plug-in according to a preset condition to determine whether the host and the target plug-in conflict, the plug-in information satisfying the preset condition indicating that the host and the target plug-in do not conflict; if the host and the target plug-in do not conflict, merge the manifest files of the host and the target plug-in to generate a total manifest file, and replace the manifest file in the host program package with the total manifest file; and integrate the plug-in information into the host program package.
[0007] In a third aspect, the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method provided in the first aspect.
[0008] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, which, when executed, implements the method provided in the first aspect.
[0009] The program compiling method, device, equipment and storage medium provided by the present application can compile the plug-in independently to obtain the program package of the plug-in after the plug-in is developed. Thus, after the host is compiled to obtain the host program package, the host can obtain the plug-in information and the manifest file of the target plug-in according to actual needs, and then merge the manifest files of the host and the plug-in after the plug-in is verified according to the plug-in information. The plug-in information and the merged manifest file are integrated into the host program package, so as to obtain the host program capable of calling the target plug-in. The host and the plug-in in the plug-in framework are developed and compiled independently, the coupling relationship between the host and the plug-in is released, the plug-in can be developed independently, different hosts can select corresponding plug-ins for application according to needs, plug-in sharing is realized, and the same function plug-in no longer needs to be developed repeatedly for different program projects. BRIEF DESCRIPTION OF DRAWINGS
[0010] Figure 1 is a flowchart of a program compiling method provided by an embodiment of the present application;
[0011] Figure 2 is a flowchart of a plug-in compiling method provided by an embodiment of the present application;
[0012] Figure 3 is a flowchart of a host compiling method provided by an embodiment of the present application;
[0013] Figure 4 is a component diagram of a program compiling device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0014] Exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to assist in understanding, and should be considered as merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Also, in order to be clear and concise, the description below omits the description of well-known functions and structures.
[0015] Before deployment, the application needs to be compiled into an executable file and packaged.
[0016] Currently, for applications built on plug-in frameworks, the compilation scheme involves writing the plug-in and the host application in the same repository, performing joint compilation to generate both the host and plug-in APKs, and simultaneously merging manifests and integrating plug-in information. This requires the host and plug-ins to be compiled in the same repository. Consequently, the host and plug-ins cannot be developed independently based on separate repositories, the plug-ins and host are not decoupled, and the plug-ins cannot be used by other hosts.
[0017] To address this issue, this application provides a program compilation method. Independently developed plugins can be pre-compiled to obtain plugin packages. After developing the host program, the host program is compiled to obtain a host package. Based on the host's requirements, a corresponding target plugin can be selected. Then, after determining that the plugin does not conflict with the host based on its plugin information, the host's manifest file and the plugin's manifest file are merged. Finally, the merged manifest file and the target plugin's plugin information are integrated into the host package, resulting in a host program capable of calling the target plugin.
[0018] In this way, plugins and the host can be developed and compiled independently, decoupling the plugins from the host, and allowing plugins to be used by any host.
[0019] The program compilation method provided in the embodiments of this application will be described below with reference to the accompanying drawings.
[0020] In this application embodiment, the above-described program compilation method can be applied to electronic devices capable of program compilation. For example, it can be a server, PC, etc. This application embodiment does not impose any special limitations on the specific device form of the electronic device.
[0021] Figure 1 This is a flowchart illustrating a program compilation method provided in an embodiment of this application, as shown below. Figure 1 As shown, the method may include the following S101-S105.
[0022] S101. Compile the host and generate the host program package.
[0023] The host package includes the host's manifest file.
[0024] When compiling the host, the program compilation method in related technologies can be used, and there are no restrictions here.
[0025] The host application package is the application package (Android Application Package, APK) obtained after the host is compiled. The specific components of this application package typically include static resource files (assets), library files (lib), signing file (META-INF), compilation resource files (res), manifest file, core code file (classes.dex), and resource mapping file (resources.arsc), etc.
[0026] S102. Obtain the manifest file and plugin information of the target plugin.
[0027] The target plugin is the plugin that, after compilation, becomes a program package. That is, after the plugin development is completed, it can be compiled independently to obtain the plugin program package.
[0028] Therefore, the manifest file of the target plugin can be obtained directly from the target plugin's package. Plugin information, on the other hand, can be obtained from the manifest file or information in each file within the package.
[0029] For example, plugin information may include at least one of the following: the plugin's package identifier, the filenames of static resource files contained in the plugin's package (assets filenames), dependency library information of the libraries used by the plugin, and plugin compilation signature information. The dependency library information may include dependency library identifiers used to identify the dependencies and version identifiers used to indicate the versions of the dependencies.
[0030] Optionally, in this embodiment, the various pre-developed plugins can be compiled independently to obtain program packages corresponding to each plugin. This allows the compiler to select the plugins that the host needs to use from among the pre-compiled plugins as target plugins, based on the host's requirements.
[0031] For example, to facilitate the host's compilation process in obtaining the target plugin's manifest file and plugin information, after compiling the plugin, the plugin information can be obtained first from the plugin's manifest file and the information in each file. Then, the plugin information and the plugin's manifest file can be stored. Subsequently, during the host's compilation, the manifest file and plugin information corresponding to the target plugin can be directly retrieved from the storage location.
[0032] For example, plugin information includes the plugin's package identifier (package id), the filenames of static resource files contained in the plugin's package (assets filenames), the dependency information of the libraries used by the plugin, and the plugin's compilation signature information. Figure 2 As shown, after compiling the plugin, the following steps S201-S206 can be executed.
[0033] S201. Obtain the package identifier (package ID) of the plugin's application package (APK). S202. Obtain the plugin's signature information. S203. Obtain the dependency information of the libraries used by the plugin. S204. Obtain the filenames of the static resource files (assets filenames) in the plugin's application package. S205. Based on the package identifier, signature information, dependency information, and static resource filenames, generate plugin information. S206. Upload the plugin information and the plugin manifest file to the cloud (e.g., a cloud server). This allows the host application to directly retrieve the target plugin's manifest file and plugin information from the cloud during subsequent compilation.
[0034] Accordingly, during the plugin compilation process, the manifest file and plugin information are uploaded to the cloud. Subsequently, when compiling the host, the manifest file and plugin information of the target plugin can be pre-configured in the cloud according to the host's needs after the target plugin is determined. Thus, when compiling the host, the manifest file and plugin information of the target plugin can be downloaded from the cloud according to the link.
[0035] As an example, the process of obtaining the plugin manifest file and plugin information and uploading it to the cloud after compiling the plugin can be achieved by setting the plugin compilation module in the compiler; there are no restrictions here.
[0036] S103. Based on the plugin information, verify the host and target plugins according to preset conditions to determine whether the host and target plugins conflict.
[0037] The preset condition can be a condition that determines that there is no conflict between the host and the target plugin. That is, when the plugin information meets the preset condition, there is no conflict between the host and the target plugin.
[0038] If there are no conflicts between the host and the target plugin, then subsequent compilation operations can be performed. This can avoid the problem that the final compiled host program cannot run properly when calling the target plugin due to conflicts between the host and the target plugin.
[0039] For example, the preset conditions for determining whether there is a conflict between the host and target plugins will differ depending on the plugin information. The preset conditions can be set according to the conditions required for the host and plugins to run.
[0040] For example, plugin information can be the package identifier of the target plugin's package. Correspondingly, a preset condition can be that the package identifier of the target plugin's package is different from the package identifier of the host package. That is, when the package identifier of the target plugin's package is different from the package identifier of the host package, it can be determined that the target plugin and the host are not in conflict. In this case, subsequent compilation operations on the host can avoid runtime conflicts between the host and plugin caused by identical package identifiers. Specifically, to ensure that the package identifier of the target plugin's package is different from the package identifier of the host package, the package identifier of the plugin's package can be regenerated according to preset rules and replaced when the plugin is compiled independently.
[0041] For example, plugin information could be the filenames of static resource files in the target plugin's package. Correspondingly, a preset condition could be that the filenames of static resource files in the target plugin's package and the host package are not identical. That is, when the filenames of static resource files in the target plugin's package and the host package are not identical, it can be determined that the target plugin and the host are not in conflict. In this case, subsequent compilation operations on the host program can avoid situations where the compiled host program, when calling the target plugin, cannot correctly obtain the required resources and causes runtime exceptions due to the target plugin having static resource files with the same filenames as the host program.
[0042] For example, plugin information can be the dependency library information of the target plugin, namely the dependency library identifier and version identifier of the dependency libraries used by the target plugin. Correspondingly, the preset condition can be that the dependency libraries used by both the target plugin and the host have the same version in both. That is, after obtaining the dependency library information of the target plugin, the dependency libraries used by both the target plugin and the host can be determined based on the dependency library identifier. Then, based on the version identifier of the dependency libraries used by both the target plugin and the host, it can be determined whether these dependency libraries used by both the target plugin and the host have the same version in both the target plugin and the host. When they are determined to be the same, it can be determined that there is no conflict between the target plugin and the host. At this point, subsequent compilation operations on the host can avoid the situation where the compiled host program, when calling the target plugin, causes a dependency library call exception due to a version difference (two versions) between the target plugin and the host. One way to determine whether the versions of dependency libraries used by both the target plugin and the host are the same is to compare the dependency library identifiers and corresponding version identifiers of each dependency library in the target plugin with those of each dependency library in the host. If the dependency library identifiers are the same but the version identifiers are different, then it can be determined that the dependency libraries used by both the target plugin and the host are different versions in the target plugin and the host. Conversely, if they are the same, then they are the same.
[0043] For example, plugin information can be the signature information of the target plugin, specifically the signature information generated during compilation. Correspondingly, a preset condition could be that the target plugin's signature information matches the host's signature information. That is, when it's determined that the target plugin's signature information matches the host's signature information, it can be confirmed that the target plugin and the host do not conflict. This ensures that the target plugin is a secure plugin certified by the developer. This prevents the host from using an uncertified target plugin during subsequent compilation, improving the security of the final pluggable framework program. It also prevents the developed target plugin from being used by unapproved third-party hosts.
[0044] Optionally, in practical applications, the above-mentioned different plugin information can be combined to verify whether there is a conflict between the target plugin and the host. Thus, when the preset conditions corresponding to each plugin information are met, it is determined that there is no conflict between the target plugin and the host. This ensures that the subsequently compiled host package is more stable during runtime.
[0045] As an example, based on S103, compilation can be stopped when there is a conflict between the host and target plugins.
[0046] If there is a conflict between the host and the target plugin, continuing to compile the host will result in an exception when loading the target plugin. Therefore, stopping the compilation when a conflict between the host and the target plugin is determined can avoid invalid compilation of the host.
[0047] S104. If there is no conflict between the host and target plugins, merge the manifest files of the host and target plugins to generate a master manifest file, and replace the manifest file in the host package with the master manifest file.
[0048] Typically, merging the manifest files of the host and target plugins involves first creating a separate manifest file to merge the manifest information from both. For example, a file named "merged_manifest.xml" can be created. Then, the host's manifest information is copied into the "merged_manifest.xml" file. This includes the host application's package name, application icon, permissions, etc. Next, the target plugin's manifest information is copied into the "merged_manifest.xml" file. This includes the target plugin application's package name, plugin component declarations (Activity, Service, etc.), permissions, etc. It's crucial that the target plugin's package name and plugin component declarations match those in the host's manifest file. Conflicting parts, such as permissions or component declarations, need to be merged or the conflicts resolved. Depending on the situation, you can choose to retain the permissions and component declarations of either the host or target plugin, or make appropriate merges and adjustments. Finally, the original host manifest file can be replaced with the merged master manifest file to ensure that the merged manifest file is used when building and packaging the application.
[0049] Of course, in other possible implementations of this application, some open-source tools and frameworks can also be used to automate the merging of manifest files, such as Gradle's Manifest Merger function, Android AssetPackaging Tool (AAPT), etc., which are not limited here.
[0050] S105. Integrate the plugin information into the host application package.
[0051] For example, one way to integrate plugin information into the host application package is to package the plugin information, for example, into a JSON file, and then place the packaged plugin information into the static resource folder of the host application package. Alternatively, the packaged plugin information can be placed in the root directory of the host application package's static resource folder (assets file).
[0052] Of course, plugin information can also be integrated into the host package in other ways, such as integrating the plugin information into the manifest file of the host package.
[0053] Optionally, in this embodiment, S105 can be executed at any time after S103, without limitation. That is, integrating the plugin information into the host package can be executed in parallel with the manifest file that merges the host and target plugins, or it can be executed before or after S104.
[0054] It should be noted that there can be multiple target plugins in this embodiment. Accordingly, step S103 can be executed for each target plugin, and subsequent steps can be performed only after all target plugins have resolved conflicts with the host. Furthermore, during the subsequent execution of step S104, the manifest files of all target plugins and the host's manifest file can be merged. Finally, in step S105, the plugin information of all target plugins is integrated into the host package.
[0055] As one possible implementation, based on the aforementioned S101-S105, during the compilation of the host program, after compiling the host program to obtain the host program package, it can be done as follows: Figure 3 As shown, execute the following steps S301-S308.
[0056] S301. Obtain the manifest file and plugin information of the target plugin.
[0057] S302. Verify whether there is a conflict in the package identifier (package id) of the target plugin's program package.
[0058] This involves verifying whether the package identifier of the target plugin's package is different from the package identifier of the host package. If they are different, the verification is considered non-conflictual, and the result is negative.
[0059] If the result of S302 is negative, then execute S303 to check whether there are any conflicts between the target plugin and the host's dependency libraries.
[0060] This involves verifying the dependency libraries used by both the target plugin and the host, and checking if their versions are the same. If they are the same, the verification is considered to be non-conflicting, meaning the verification result is negative.
[0061] If the result of S303 is negative, then S304 is executed to verify whether the target plugin and the host have a static resource file (assets file) with the same name.
[0062] This involves verifying whether the filenames of static resource files in the target plugin's package and the host package are identical. If they are not identical, the verification result is "no" because no assets file with the same name exists.
[0063] If the result of S304 is negative, then execute S305 to verify whether the signature information of the target plugin and the host is consistent.
[0064] If so, execute S306 to merge the manifest files of the host and target plugins.
[0065] Then, S307 is executed, integrating plugin information and the merged manifest file into the host package.
[0066] Specifically, if the result of S302 is yes, the result of S303 is yes, the result of S304 is yes, or the result of S305 is no, then S308 is executed to stop compilation.
[0067] This application employs the above-described implementation method, enabling independent compilation of plugins after plugin development to obtain plugin packages. During host compilation, after compiling the host to obtain the host package, the host can obtain the corresponding target plugin's plugin information and manifest file according to actual needs. Then, after verifying the plugin based on the plugin information, the host and plugin manifest files are merged, and the plugin information and the merged manifest file are integrated into the host package, resulting in a host program capable of calling the target plugin. This achieves independent development and compilation of host and plugins within the plugin framework, decoupling the host and plugins, enabling independent plugin development. Different hosts can select the appropriate plugin for application according to their needs, achieving plugin sharing and eliminating the need to repeatedly develop plugins with the same functionality for different program projects.
[0068] Corresponding to the methods in the foregoing embodiments, this application also provides a program compilation apparatus. This apparatus can be applied to an electronic device to implement the methods in the foregoing embodiments. The functions of this apparatus can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0069] For example, such as Figure 4 As shown, the device may include: an acquisition module 401, used to acquire the manifest file and plugin information of the target plugin, wherein the target plugin is a plugin that has been compiled into a program package; a compilation module 402, used to compile the host and generate a host program package, wherein the host program package includes the manifest file of the host; according to the plugin information, the host and the target plugin are verified according to preset conditions to determine whether the host and the target plugin conflict, and if the plugin information meets the preset conditions, the host and the target plugin do not conflict; if the host and the target plugin do not conflict, the manifest files of the host and the target plugin are merged to generate a master manifest file, and the manifest file in the host program package is replaced with the master manifest file; and the plugin information is integrated into the host program package.
[0070] Optionally, module 402 is compiled, specifically for packaging plugin information and placing it in the static resource folder of the host package.
[0071] Optionally, the plugin information includes the package identifier of the target plugin's package and preset conditions, including: the package identifier of the target plugin's package is different from the package identifier of the host package.
[0072] Optionally, the plugin information includes the filenames of static resource files in the target plugin's package, and preset conditions, including: the filenames of static resource files in the target plugin's package and the filenames of static resource files in the host package are not duplicated.
[0073] Optionally, the plugin information includes the target plugin's dependency library information, which includes dependency library identifiers and version identifiers, and preset conditions, including: the dependency libraries used by both the target plugin and the host, and the versions being the same in both the target plugin and the host.
[0074] Optionally, the plugin information includes the signature information of the target plugin and preset conditions, including: the signature information of the target plugin is consistent with the signature information of the host.
[0075] Optionally, the manifest file and plugin information of the target plugin are obtained from the program package compiled from the target plugin and stored on the cloud server; the acquisition module 401 is specifically used to obtain the manifest file and plugin information of the target plugin from the cloud server.
[0076] Optionally, the compilation module 402 is further configured to stop compilation if there is a conflict between the host and the target plugin.
[0077] It should be understood that the division of units or modules (hereinafter referred to as units) in the above device is only a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, all units in the device can be implemented in software through processing element calls; all units can be implemented in hardware; or some units can be implemented in software through processing element calls, and some units can be implemented in hardware.
[0078] For example, each unit can be a separate processing element, or it can be integrated into a chip within the device. Alternatively, it can be stored as a program in memory, invoked and executed by a processing element within the device. Furthermore, these units can be integrated in whole or in part, or implemented independently. The processing element described here can also be called a processor, which can be an integrated circuit with signal processing capabilities. In implementation, each step of the above method or each of the above units can be implemented through integrated logic circuits in the processor element or through software invoked by the processing element.
[0079] In one example, the unit in the above device may be one or more integrated circuits configured to implement the above methods, such as one or more ASICs, or one or more DSPs, or one or more FPGAs, or a combination of at least two of these integrated circuit forms.
[0080] For example, when the units in the device can be implemented through a processing element scheduler, the processing element can be a general-purpose processor, such as a CPU or other processor capable of calling programs. Alternatively, these units can be integrated together to form a system-on-a-chip (SOC).
[0081] In one implementation, the units that implement the corresponding steps in the above methods can be implemented in the form of a processing element scheduler. For example, the device may include a processing element and a storage element, wherein the processing element calls a program stored in the storage element to execute the methods described in the above embodiments. The storage element may be a storage element located on the same chip as the processing element, i.e., an on-chip storage element.
[0082] In another implementation, the program used to perform the above methods can be located on a storage element on a different chip than the processing element, i.e., an off-chip storage element. In this case, the processing element calls or loads the program from the off-chip storage element onto the on-chip storage element to call and execute the methods described in the above method embodiments.
[0083] For example, embodiments of this application may also provide an apparatus, such as an electronic device, which may include a processor and a memory for storing processor-executable instructions. When the processor is configured to execute the aforementioned instructions, the electronic device implements the program compilation method as described in the foregoing embodiments. The memory may be located within or outside the electronic device. Furthermore, the processor may include one or more processors.
[0084] In another implementation, the unit implementing each step of the above method can be configured as one or more processing elements, which can be disposed on the corresponding electronic device described above. These processing elements can be integrated circuits, such as one or more ASICs, one or more DSPs, one or more FPGAs, or combinations of these types of integrated circuits. These integrated circuits can be integrated together to form a chip.
[0085] For example, this application also provides a chip system that can be applied to the aforementioned electronic device. The chip system includes one or more interface circuits and one or more processors; the interface circuits and processors are interconnected via lines; the processor receives and executes computer instructions from the electronic device's memory through the interface circuits to implement the methods related to the electronic device in the above method embodiments.
[0086] This application also provides a computer program product, including an electronic device, such as the electronic device described above, and computer instructions for execution.
[0087] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0088] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0089] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0090] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0091] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product, such as a program. This software product is stored in a program product, such as a computer-readable storage medium, and includes several instructions to cause a device, which may be a microcontroller, chip, or processor, to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0092] For example, embodiments of this application may also provide a computer-readable storage medium storing computer program instructions thereon. When the computer program instructions are executed by an electronic device, the electronic device causes the electronic device to implement the program compilation method as described in the foregoing method embodiments.
[0093] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A program compiling method characterized by comprising: The method comprises the following steps: compiling a host to generate a host program package, wherein the host program package comprises a manifest file of the host; obtaining a manifest file and plugin information of a target plugin, wherein the target plugin is a plugin of the program package after compilation; verifying the host and the target plugin according to the preset condition according to the plugin information, and determining whether the host and the target plugin conflict, wherein when the plugin information meets the preset condition, the host and the target plugin do not conflict; if the host and the target plugin do not conflict, merging the manifest files of the host and the target plugin to generate a total manifest file, and replacing the manifest file in the host program package with the total manifest file; integrating the plugin information into the host program package; the method further comprises the following steps: sequentially performing inspection processing on the target plugin according to a preset order, wherein the inspection processing comprises verifying whether the package identifier of the program package of the target plugin and the program package of the host conflict, verifying whether the dependent library of the target plugin and the host conflict, verifying whether the target plugin and the host have the same static resource file, and verifying whether the signature information of the target plugin and the host is consistent; the method further comprises the following steps: obtaining the package identifier, the signature information, the dependent library information and the file name of the static resource file of the program package of the plugin; integrating the plugin information according to the package identifier, the signature information, the dependent library information and the file name of the static resource file to generate the plugin information; uploading the plugin information and the manifest file of the plugin to the cloud.
2. The method of claim 1, wherein, the step of integrating the plugin information into the host program package comprises the following steps: packing the plugin information and placing it in the static resource folder of the host program package.
3. The method according to claim 1 or 2, characterized in that, the plugin information comprises the package identifier of the program package of the target plugin, and the preset condition comprises that the package identifier of the program package of the target plugin is different from the package identifier of the host program package. the plugin information comprises the file name of the static resource file in the program package of the target plugin, and the preset condition comprises that the file name of the static resource file in the program package of the target plugin is not repeated with the file name of the static resource file in the host program package.
4. The method according to claim 1 or 2, characterized in that, the plugin information comprises the dependent library information of the target plugin, the dependent library information comprises dependent library identifier and version identifier, and the preset condition comprises that the dependent library used by the target plugin and the host is the same in version. the plugin information comprises the signature information of the target plugin, and the preset condition comprises that the signature information of the target plugin is consistent with the signature information of the host.
5. The method according to claim 1 or 2, characterized in that, the manifest file and the plugin information of the target plugin are obtained according to the program package after the target plugin is compiled, and are saved in the cloud server; the step of obtaining the manifest file and the plugin information of the target plugin comprises the following step:
6. The method of claim 1 or 2, wherein, obtaining the manifest file and the plugin information of the target plugin from the cloud server. the method further comprises the following step:
7. The method of claim 1, wherein, if the host and the target plugin conflict, stopping the compilation. the method comprises the following steps: 8. The method of claim 1, wherein, 9. A program compiling apparatus characterized by comprising: An acquisition module is configured to acquire a manifest file and plugin information of a target plugin, the target plugin being a plugin of a compiled program package; A compilation module is configured to compile a host to generate a host program package, the host program package including a manifest file of the host; According to the plugin information, the host and the target plugin are verified according to preset conditions to determine whether the host and the target plugin conflict, and when the plugin information satisfies the preset conditions, the host and the target plugin do not conflict; If the host and the target plugin do not conflict, the manifest files of the host and the target plugin are merged to generate a total manifest file, and the manifest file in the host program package is replaced by the total manifest file; The plugin information is integrated into the host program package; The compilation module is further configured to sequentially perform inspection processing on the target plugin according to a preset order, the inspection processing including verifying whether a package identifier of a program package of the target plugin and a program package of the host conflict, verifying whether a dependent library of the target plugin and the host conflict, verifying whether the target plugin and the host have a same name static resource file, and verifying whether signature information of the target plugin and the host is consistent; A processing module is configured to acquire a package identifier of a program package of a plugin, signature information, dependent library information of a used dependent library, and a file name of a static resource file, integrate the plugin information according to the package identifier, the signature information, the dependent library information, and the file name of the static resource file, and upload the plugin information and a manifest file of the plugin to a cloud.
10. An electronic device, comprising: The electronic device includes at least one processor and a memory connected with the at least one processor in communication; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.
11. A computer readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and when the computer program is executed, the method of any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Android application plug-in implementation method and device, equipment and storage medium
CN111258587A