A processing method and device of a plug-in application
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
- Filing Date
- 2022-10-21
- Publication Date
- 2026-08-07
AI Technical Summary
[0004]有鉴于此,本发明实施例提供一种插件应用的处理方法及装置,以解决由于插件宿主的组件和基础库类没有参与到插件的编译过程中,导致插件在向父类查找链路时出现中断,编译失败的问题
[0054]Based on the above embodiments of the present invention, a method and apparatus for processing plug-in applications are provided. The method includes: when a compilation command is received, obtaining the corresponding component; determining whether the component is a target component contained in a preset configuration file; if the component is a target component, obtaining the address of the compilation dependency package from the preset configuration file, obtaining the corresponding compilation dependency package, and loading the compilation dependency package into a preset class pool; when successfully loaded into the preset class pool, determining the type of the parent component of the target component; if it is a host component, processing the parent component of the target component using a first processing method to obtain a first compilation chain; compiling the first compilation chain; if it is a native component, processing the parent component of the target component using a second processing method to obtain a second compilation chain; compiling the second compilation chain. Using the first and second processing methods to process the plug-in compilation chain improves component reusability, reduces dependencies on the application's basic library, and improves the development efficiency of plug-in transformation.
Smart Images

Figure CN115586934B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of terminal application development technology, and in particular to a method and apparatus for processing plug-in applications. Background Technology
[0002] In the application plugin development scheme based on the Android operating system, the application needs to replace the top-level parent class in the inheritance relationship of the plugin application component with the pre-built class of the plugin framework when using plugin technology, so as to realize the plugin function.
[0003] However, because the plugin's host components and base library classes do not participate in the plugin's compilation process, the plugin encounters an interruption when searching for the parent class's dependency, resulting in compilation failure. Furthermore, even if the base library classes participate in the plugin's compilation process, they cannot achieve the expected plugin functionality because they replace the compilation dependency packages provided by the plugin's host that are not packaged into the plugin. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method and apparatus for processing plugin applications to solve the problem that the plugin fails to compile when searching for the link from the parent class because the plugin's host components and basic library classes do not participate in the plugin's compilation process.
[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0006] The first aspect of this invention discloses a method for processing plug-in applications, the method comprising:
[0007] When a compilation command carrying a plugin identifier is received, the component corresponding to the plugin identifier is obtained;
[0008] Determine whether the component is a target component contained in a preset configuration file, wherein the target component is a component whose parent component is a host component or a native component;
[0009] If the component is a target component contained in a preset configuration file, obtain the address corresponding to the target component from the preset configuration file. The address is the compilation dependency package address of the parent component of the target component.
[0010] Obtain the corresponding compilation dependency package based on the address of the compilation dependency package, and load the compilation dependency package into the preset class pool;
[0011] When the compilation dependency package is successfully loaded into the preset class pool, the type of the parent component of the target component is determined;
[0012] If the parent component of the target component is the host component, the parent component of the target component is processed using the first processing method to obtain the first compilation chain;
[0013] Compile the first compilation chain;
[0014] If the parent component of the target component is a native component, the parent component of the target component is processed using the second processing method to obtain the second compilation chain;
[0015] Compile the second compilation chain.
[0016] Preferably, after determining whether the component is a target component contained in a preset configuration file, the method further includes:
[0017] If the component is not a target component contained in the preset configuration file, find the parent component of the component;
[0018] When the parent component of the component is found, a new component is obtained, and the process returns to determine whether the component is a target component contained in the preset configuration file.
[0019] When the parent component of the component cannot be found, compile the component corresponding to the plugin identifier and the parent component of the component.
[0020] Preferably, after obtaining the corresponding compilation dependency package based on the compilation dependency package address and loading the compilation dependency package into the preset class pool, the method further includes:
[0021] When the compilation dependency package fails to be loaded into the preset class pool, the component corresponding to the plugin identifier and the parent component of the component are compiled.
[0022] Preferably, if the parent component of the target component is the host component, the parent component of the target component is processed using the first processing method to obtain the first compilation chain, including:
[0023] When the parent component of the target component is the host component, the parent component of the target component is determined as the first parent component;
[0024] Set the parent component of the target component as the first preset component of the plugin framework;
[0025] The parent component of the first preset component is set to the first parent component, thus obtaining the first compilation chain.
[0026] Preferably, if the parent component of the target component is a native component, the parent component of the target component is processed using the second processing method to obtain the second compilation chain, including:
[0027] When the parent component of the target component is a native component, the parent component of the target component is determined as the second parent component;
[0028] The parent component of the target component is set to the empty component of the plugin framework, and the parent component of the empty component is set to the second parent component.
[0029] The second parent component is replaced with the second pre-built component of the plugin framework to obtain the second compilation chain.
[0030] A second aspect of this invention discloses a processing apparatus for plug-in applications, the apparatus comprising:
[0031] The first acquisition unit is used to acquire the component corresponding to the plugin identifier when a compilation command carrying a plugin identifier is received;
[0032] The judgment unit is used to determine whether the component is a target component contained in a preset configuration file, wherein the target component is a component whose parent component is a host component or a native component;
[0033] The second acquisition unit is used to acquire the address corresponding to the target component from the preset configuration file if the component is a target component contained in the preset configuration file. The address is the compilation dependency package address of the parent component of the target component.
[0034] The third acquisition unit is used to acquire the corresponding compilation dependency package according to the address of the compilation dependency package, and load the compilation dependency package into a preset class pool;
[0035] The determining unit is used to determine the type of the parent component of the target component when the compilation dependency package is successfully loaded into the preset class pool;
[0036] The first processing unit is configured to process the parent component of the target component using a first processing method if the parent component of the target component is the host component, thereby obtaining a first compilation chain.
[0037] The first compilation unit is used to compile the first compilation chain;
[0038] The second processing unit is used to process the parent component of the target component using a second processing method if the parent component of the target component is a native component, thereby obtaining a second compilation chain.
[0039] The second compilation unit is used to compile the second compilation chain.
[0040] Preferably, the device further includes:
[0041] The search unit is used to search for the parent component of the component if the component is not a target component contained in the preset configuration file.
[0042] The return unit is used to obtain a new component when the parent component of the component is found, and return to execute the step of determining whether the component is a target component contained in the preset configuration file;
[0043] The third compilation unit is used to compile the component corresponding to the plugin identifier and the parent component of the component when the parent component of the component cannot be found.
[0044] Preferably, the device further includes:
[0045] The fourth compilation unit is used to compile the component corresponding to the plugin identifier and the parent component of the component when the compilation dependency package fails to be loaded into the preset class pool.
[0046] Preferably, the first processing unit includes:
[0047] The first determining module is used to determine the parent component of the target component as the first parent component when the parent component of the target component is the host component;
[0048] The first setting module is used to set the parent component of the target component as the first preset component of the plugin framework;
[0049] The second setting module is used to set the parent component of the first preset component to the first parent component, thereby obtaining the first compilation chain.
[0050] Preferably, the second processing unit includes:
[0051] The second determining module is used to determine the parent component of the target component as the second parent component when the parent component of the target component is a native component;
[0052] The third setting module is used to set the parent component of the target component to the empty component of the plugin framework, and at the same time set the parent component of the empty component to the second parent component;
[0053] The replacement module is used to replace the second parent component with the second preset component of the plugin framework to obtain the second compilation chain.
[0054] Based on the above embodiments of the present invention, a method and apparatus for processing plug-in applications are provided. The method includes: when a compilation command is received, obtaining the corresponding component; determining whether the component is a target component contained in a preset configuration file; if the component is a target component, obtaining the address of the compilation dependency package from the preset configuration file, obtaining the corresponding compilation dependency package, and loading the compilation dependency package into a preset class pool; when successfully loaded into the preset class pool, determining the type of the parent component of the target component; if it is a host component, processing the parent component of the target component using a first processing method to obtain a first compilation chain; compiling the first compilation chain; if it is a native component, processing the parent component of the target component using a second processing method to obtain a second compilation chain; compiling the second compilation chain. Using the first and second processing methods to process the plug-in compilation chain improves component reusability, reduces dependencies on the application's basic library, and improves the development efficiency of plug-in transformation. Attached Figure Description
[0055] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0056] Figure 1 A flowchart illustrating a method for processing plug-in applications according to an embodiment of the present invention;
[0057] Figure 2 This is a structural block diagram of a plug-in application processing device provided in an embodiment of the present invention. Detailed Implementation
[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0059] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0060] As the background technology indicates, in application plugin development, the top-level parent class of the plugin application component inheritance relationship needs to be replaced with a pre-built class of the plugin framework to implement plugin functionality. However, because the plugin host's components and base library classes do not participate in the plugin's compilation process, the plugin's search for the parent class chain is interrupted, leading to compilation failure. For example, given the component dependency relationship AActivity→BActivity→CActivity, the normal logic would be to process them as AActivity→BActivity→PActivity (plugin framework component). However, since the plugin only performs code validation dependencies on the host, BActivity's code does not actually participate in the plugin framework application packaging process. Consequently, AActivity cannot find BActivity when searching for the parent component, and the compilation of modified CActivity cannot be completed.
[0061] Therefore, embodiments of the present invention provide a method and apparatus for processing plugin applications. When a compilation command is received, the corresponding component is obtained; it is determined whether the component is a target component contained in a preset configuration file; if the component is a target component, the address of the compilation dependency package is obtained from the preset configuration file, and the corresponding compilation dependency package is obtained and loaded into a preset class pool; when successfully loaded into the preset class pool, the type of the parent component of the target component is determined; if it is a host component, the parent component of the target component is processed using a first processing method to obtain a first compilation chain; the first compilation chain is compiled; if it is a native component, the parent component of the target component is processed using a second processing method to obtain a second compilation chain; the second compilation chain is compiled. By using the first and second processing methods to process the plugin compilation chain, the component reusability is improved, the dependency on the application base library is reduced, the application decoupling complexity is reduced, and the size of the plugin application package is also reduced, thus improving the plugin application release efficiency.
[0062] join Figure 1 The flowchart illustrates a method for processing a plugin application according to an embodiment of the present invention. The method includes:
[0063] It should be noted that this solution is based on a plugin framework for compiling plugins. During the compilation process, the plugin framework searches and replaces the inheritance relationships of components. The plugin framework consists of four main parts: The first part, HostLib, is a JAR library integrated into the host application, mainly consisting of Java classes responsible for framework initialization, loading, and starting the plugin APK. The second part, HostGradlePlugin, is a Gradle script library that the host application needs to import. Its main function is to participate in the host APK compilation process, inserting code and component declarations in AndroidManifest.xml. The third part, PluginLib, is a JAR library integrated into the plugin APK project. By using reflection to call relevant interfaces in HostLib, the plugin project can start the four main components of the plugin, the host application, or other plugins in a native Android way, making plugin development consistent with regular Android application development. The fourth part, PluginGradleLib, is a Gradle script library integrated into the plugin project, used to dynamically replace inherited base classes in the project during plugin compilation, such as Activity inheritance and Provider redirection.
[0064] Step S101: When a compilation command carrying a plugin identifier is received, obtain the component corresponding to the plugin identifier.
[0065] In the specific implementation step S101, if a compilation command carrying a plugin identifier is received, it instructs the plugin corresponding to the plugin identifier to be packaged and compiled, the plugin corresponding to the plugin identifier is determined, and the plugin framework obtains the components reused by the plugin.
[0066] Step S102: Determine whether the component is a target component contained in the preset configuration file. If the component is a target component contained in the preset configuration file, proceed to step S103; if the component is not a target component contained in the preset configuration file, proceed to step S111.
[0067] In the specific implementation step S102, it is determined whether the component is a target component contained in the configuration file. The target component is a component whose parent component is a host component or a native component; that is, if the component's parent component is a host component or a native component, then the component is determined to be a target component contained in the preset configuration file. If the component is a target component contained in the preset configuration file, step S103 is executed; if the component is not a target component contained in the preset configuration file, step S111 is executed.
[0068] Step S103: Obtain the address corresponding to the target component from the preset configuration file.
[0069] In the specific implementation step S103, when the component is a target component contained in the preset configuration file, the address corresponding to the target component is obtained from the preset configuration file.
[0070] It is understandable that the default configuration file contains at least one target component whose parent component is a host component or a native component. Each target component corresponds to an address, where the address is the compilation dependency package address of the target component's parent component.
[0071] For example, the default configuration file contains: the parent component of component A is a native component (a native component of the Android operating system, such as Activity, FragmentActivity, etc.), and the corresponding native jar package address is / xx / xx / xx / ss.jar.
[0072] Step S104: Obtain the corresponding compilation dependency package according to the compilation dependency package address, and load the compilation dependency package into the preset class pool.
[0073] In the specific implementation step S104, the corresponding compilation dependency package is obtained according to the compilation dependency package address of the target component, and the obtained compilation dependency package is loaded into the preset class pool.
[0074] It's important to note that when modifying or replacing bytecode, a collection class containing information about the .class files of the classes to be replaced is typically created; this is known as a class pool. Android operating systems are developed using Java, and usually, a class creates a .java file. This .java file is compiled into a .class file, which contains relevant class information (such as the class name, member variables, and member methods). Multiple .class files are packaged into a .jar file to obtain the class pool.
[0075] Step S105: Determine whether the compilation dependency package has been successfully loaded into the preset class pool. If the compilation dependency package has been successfully loaded into the preset class pool, proceed to step S106; if the compilation dependency package has not been successfully loaded into the preset class pool, proceed to step S114.
[0076] In the specific implementation of step S105, it is determined whether the compilation dependency package has been successfully loaded into the preset class pool. When the compilation dependency package is successfully loaded into the preset class pool, it is instructed to compile the component according to the successfully configured compilation method and execute step S106. When the compilation dependency package is not successfully loaded into the preset class pool, it is instructed to compile the component according to the unsuccessfully configured compilation method and execute step S114.
[0077] Step S106: Determine the type of the parent component of the target component.
[0078] In the specific implementation step S106, when the compilation dependency package is successfully loaded into the preset class pool, the type of the parent component of the target component is determined.
[0079] It should be noted that in the preset configuration file, the type of the parent component of the target component includes the host component and the native component; when the parent component of the target component is the host component, step S107 is executed; when the parent component of the target component is the native component, step S109 is executed.
[0080] It is understandable that the appropriate processing method is determined based on the type of the parent component of the target component.
[0081] Step S107: If the parent component of the target component is the host component, process the parent component of the target component using the first processing method to obtain the first compilation chain.
[0082] In the specific implementation step S107, when the parent component of the target component is the host component, the first processing method is used to determine the parent component of the target component as the first parent component; the parent component of the target component is set as the first preset component of the plugin framework; the parent component of the first preset component is set as the first parent component to obtain the first compilation chain.
[0083] For example, component AActivity in the plugin and component BActivity in the host application have a dependency relationship: AActivity → BActivity. Since BActivity is the host component, the first processing method is used to process the parent component of the target component.
[0084] In other words, the parent component BActivity of the target component AActivity is determined as the first parent component; the parent component of the target component AActivity is set as the first preset component P1Activity of the plugin framework; then the parent component of the first preset component is set as the first parent component, i.e., P1Activity→BActivity; thus, the first compilation chain AActivity→P1Activity→BActivity is obtained.
[0085] It should be noted that AActivity originally inherited from BActivity. Using the first processing method, the bytecode was replaced so that AActivity inherits from P1Activity.
[0086] Understandably, the first approach enables the use of the plugin framework without packaging the host component, so that both AActivity and P1Activity are in the plugin, and the parent component of AActivity has a pre-built class of the plugin framework, which can be called in a plugin-like manner. It also reduces the dependency on BActivity and the corresponding base library.
[0087] Step S108: Compile the first compilation chain.
[0088] In the specific implementation step S108, the first compilation chain obtained after processing by the first processing method is compiled.
[0089] Step S109: If the parent component of the target component is a native component, process the parent component of the target component using the second processing method to obtain the second compilation chain.
[0090] In the specific implementation step S109, when the parent component of the target component is a native component, the second processing method is used to determine the parent component of the target component as the second parent component; the parent component of the target component is set to the empty component of the plugin framework, and the parent component of the empty component is set to the second parent component; the second parent component is replaced with the second preset component of the plugin framework to obtain the second compilation chain.
[0091] For example, there's a dependency relationship between component AActivity in the plugin and native component FragmentActivity in the host: AActivity→FragmentActivity→Activity (Activity is a native dependency). Since FragmentActivity is a native component, the second processing method is used to process the parent component of the target component.
[0092] In other words, the parent component FragmentActivity of the target component AActivity is determined as the second parent component; the parent component of the target component AActivity is set to the empty component PEmptyAcitivty of the plugin framework, i.e., AActivity→PEmptyAcitivty, and the parent component of the empty component PEmptyAcitivty is set to the second parent component FragmentActivity, i.e., PEmptyAcitivty→FragmentActivity; the second parent component FragmentActivity is replaced with the second pre-built component PFragmentActivity of the plugin framework, i.e., PEmptyAcitivty→PFragmentActivity, resulting in the second compilation chain: AActivity→PEmptyAcitivty→PFragmentActivity→Activity.
[0093] Understandably, the second approach enables the use of plugin functionality without packaging native components into the application. In other words, AActivity and PFragmentActivity are both in the plugin and can be called in a plugin-based manner.
[0094] Step S110: Compile the second compilation chain.
[0095] In the specific implementation step S110, the second compilation chain obtained after the second processing method is compiled.
[0096] Step S111: Find the parent component of the component.
[0097] In the specific implementation step S111, if the component is not a target component contained in the preset configuration file, the parent component of the component is searched according to the inheritance relationship.
[0098] For example, if there is an inheritance relationship in the plugin: A→B→C, determine whether component A is a target component contained in the preset configuration file. If component A is not a target component contained in the preset configuration file, find the parent component B of component A according to the inheritance relationship.
[0099] Step S112: Determine whether a parent component of the component is found. If a parent component of the component is found, proceed to step S113; if a parent component of the component is not found, proceed to step S114.
[0100] In the specific implementation of step S112, it is determined whether a parent component of the component is found, that is, whether the component is the top-level parent. If a parent component of the component is found, step S113 is executed; if a parent component of the component is not found, step S114 is executed.
[0101] Step S113: When the parent component of the component is found, the new component is obtained, and the process returns to step S102.
[0102] In the specific implementation of step S113, when the parent component of the component is found, the parent component of the component is determined as the new component, and the process returns to step S102.
[0103] In other words, there is an inheritance relationship in the plugin: A→B→C. It is determined whether component A is a target component contained in the preset configuration file. If component A is not a target component contained in the preset configuration file, the parent component B of component A is searched according to the inheritance relationship. Then, it is determined whether the new component B is a target component contained in the preset configuration file.
[0104] Step S114: Compile the component corresponding to the plugin identifier and the component's parent component.
[0105] In the specific implementation step S114, when no parent component of the component can be found, it indicates that the component no longer inherits from any other component, the inheritance relationship ends, and then the component corresponding to the plugin identifier and the component's parent component are compiled normally.
[0106] In this embodiment of the invention, by combining the first processing method and the second processing method, the plugin can search and replace the inheritance relationship upwards according to the set rules during the compilation process, thereby achieving the goal of successful compilation and normal function of the plugin under reuse conditions, improving development efficiency, reducing the size of the plugin package, and thus improving the release efficiency of the plugin application.
[0107] Corresponding to the plug-in application processing method provided in the above embodiments of the present invention, see also... Figure 2 The diagram illustrates a structural block diagram of a plugin application processing device according to an embodiment of the present invention. The processing device includes: a first acquisition unit 201, a judgment unit 202, a second acquisition unit 203, a third acquisition unit 204, a determination unit 205, a first processing unit 206, a first compilation unit 207, a second processing unit 208, and a second compilation unit 209. The implementation principles of each unit are as follows:
[0108] The first acquisition unit 201 is used to acquire the component corresponding to the plugin identifier when a compilation command carrying a plugin identifier is received.
[0109] Judgment unit 202 is used to determine whether a component is a target component contained in a preset configuration file. The target component is a component whose parent component is a host component or a native component.
[0110] The second acquisition unit 203 is used to obtain the address corresponding to the target component from the preset configuration file if the component is a target component contained in the preset configuration file. The address is the compilation dependency package address of the parent component of the target component.
[0111] The third acquisition unit 204 is used to obtain the corresponding compilation dependency package according to the compilation dependency package address and load the compilation dependency package into the preset class pool.
[0112] Unit 205 is used to determine the type of the parent component of the target component when the compilation dependency package is successfully loaded into the preset class pool.
[0113] The first processing unit 206 is used to process the parent component of the target component using a first processing method if the parent component of the target component is the host component, thereby obtaining a first compilation chain.
[0114] The first compilation unit 207 is used to compile the first compilation chain.
[0115] The second processing unit 208 is used to process the parent component of the target component using the second processing method if the parent component of the target component is a native component, thereby obtaining the second compilation chain.
[0116] The second compilation unit 209 is used to compile the second compilation chain.
[0117] In this embodiment of the invention, by using two processing methods for native components and host components, the host components are reused to the greatest extent, the decoupling difficulty of application modification and development and the size of plugin applications are reduced, and the release efficiency of plugin applications is improved.
[0118] Preferred, combined Figure 2 The processing unit of the plugin application, as shown, also includes: a lookup unit, a return unit, and a compilation unit.
[0119] The search unit is used to find the parent component of a component if the component is not a target component contained in the preset configuration file.
[0120] The return unit is used to find the parent component of the component, obtain the new component, and return to the step of determining whether the component is the target component contained in the preset configuration file.
[0121] The third compilation unit is used to compile the component corresponding to the plugin identifier and the component's parent component when the parent component of the component cannot be found.
[0122] Preferred, combined Figure 2 The processing device for the plugin application, as shown, also includes a fourth compilation unit, used to compile the component corresponding to the plugin identifier and the parent component of the component when the compilation dependency package fails to be loaded into the preset class pool.
[0123] Preferred, combined Figure 2 The content shown, the first processing unit 206, includes: a first determining module, a first setting module and a second setting module.
[0124] The first determining module is used to determine the parent component of the target component as the first parent component when the parent component of the target component is the host component.
[0125] The first settings module is used to set the parent component of the target component as the first preset component of the plugin framework.
[0126] The second setting module is used to set the parent component of the first preset component as the first parent component, thereby obtaining the first compilation chain.
[0127] Preferred, combined Figure 2 The second processing unit 208, as shown, includes: a second determining module, a third setting module, and a replacement module.
[0128] The second determining module is used to determine the parent component of the target component as the second parent component when the parent component of the target component is a native component.
[0129] The third settings module is used to set the parent component of the target component to the empty component of the plugin framework, and at the same time set the parent component of the empty component to the second parent component.
[0130] The replacement module is used to replace the second parent component with the second pre-built component of the plugin framework to obtain the second compilation chain.
[0131] In summary, the embodiments of the present invention provide a method and apparatus for processing plug-in applications. By using a first processing method and a second processing method to process the plug-in compilation chain, the component reusability is improved, the dependency on the application base library is reduced, the size of the plug-in package is reduced, thereby improving the release efficiency of plug-in applications.
[0132] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0133] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0134] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing plug-in applications, characterized in that, The method includes: When a compilation command carrying a plugin identifier is received, the component corresponding to the plugin identifier is obtained; Determine whether the component is a target component contained in a preset configuration file, wherein the target component is a component whose parent component is a host component or a native component; If the component is a target component contained in a preset configuration file, obtain the address corresponding to the target component from the preset configuration file. The address is the compilation dependency package address of the parent component of the target component. Obtain the corresponding compilation dependency package based on the address of the compilation dependency package, and load the compilation dependency package into the preset class pool; When the compilation dependency package is successfully loaded into the preset class pool, the type of the parent component of the target component is determined; If the parent component of the target component is the host component, the parent component of the target component is processed using the first processing method to obtain the first compilation chain; Compile the first compilation chain; If the parent component of the target component is a native component, the parent component of the target component is processed using the second processing method to obtain the second compilation chain; Compile the second compilation chain; If the component is not a target component contained in the preset configuration file, find the parent component of the component; When the parent component of the component is found, a new component is obtained, and the process returns to determine whether the component is a target component contained in the preset configuration file. When the parent component of the component cannot be found, compile the component corresponding to the plugin identifier and the parent component of the component.
2. The method according to claim 1, characterized in that, After obtaining the corresponding compilation dependency package based on the compilation dependency package address and loading the compilation dependency package into the preset class pool, the method further includes: When the compilation dependency package fails to be loaded into the preset class pool, the component corresponding to the plugin identifier and the parent component of the component are compiled.
3. The method according to claim 1, characterized in that, If the parent component of the target component is the host component, the parent component of the target component is processed using a first processing method to obtain a first compilation chain, including: When the parent component of the target component is the host component, the parent component of the target component is determined as the first parent component; Set the parent component of the target component as the first preset component of the plugin framework; The parent component of the first preset component is set to the first parent component, thus obtaining the first compilation chain.
4. The method according to claim 1, characterized in that, If the parent component of the target component is a native component, the parent component of the target component is processed using a second processing method to obtain a second compilation chain, including: When the parent component of the target component is a native component, the parent component of the target component is determined as the second parent component; The parent component of the target component is set to the empty component of the plugin framework, and the parent component of the empty component is set to the second parent component. The second parent component is replaced with the second pre-built component of the plugin framework to obtain the second compilation chain.
5. A processing device for plug-in applications, characterized in that, The device includes: The first acquisition unit is used to acquire the component corresponding to the plugin identifier when a compilation command carrying a plugin identifier is received; The judgment unit is used to determine whether the component is a target component contained in a preset configuration file, wherein the target component is a component whose parent component is a host component or a native component; The second acquisition unit is used to acquire the address corresponding to the target component from the preset configuration file if the component is a target component contained in the preset configuration file. The address is the compilation dependency package address of the parent component of the target component. The third acquisition unit is used to acquire the corresponding compilation dependency package according to the address of the compilation dependency package, and load the compilation dependency package into a preset class pool; The determining unit is used to determine the type of the parent component of the target component when the compilation dependency package is successfully loaded into the preset class pool; The first processing unit is configured to process the parent component of the target component using a first processing method if the parent component of the target component is the host component, thereby obtaining a first compilation chain. The first compilation unit is used to compile the first compilation chain; The second processing unit is used to process the parent component of the target component using a second processing method if the parent component of the target component is a native component, thereby obtaining a second compilation chain. The second compilation unit is used to compile the second compilation chain; The search unit is used to search for the parent component of the component if the component is not a target component contained in the preset configuration file. The return unit is used to obtain a new component when the parent component of the component is found, and return to execute the step of determining whether the component is a target component contained in the preset configuration file; The third compilation unit is used to compile the component corresponding to the plugin identifier and the parent component of the component when the parent component of the component cannot be found.
6. The apparatus according to claim 5, characterized in that, The device further includes: The fourth compilation unit is used to compile the component corresponding to the plugin identifier and the parent component of the component when the compilation dependency package fails to be loaded into the preset class pool.
7. The apparatus according to claim 5, characterized in that, The first processing unit includes: The first determining module is used to determine the parent component of the target component as the first parent component when the parent component of the target component is the host component; The first setting module is used to set the parent component of the target component as the first preset component of the plugin framework; The second setting module is used to set the parent component of the first preset component to the first parent component, thereby obtaining the first compilation chain.
8. The apparatus according to claim 5, characterized in that, The second processing unit includes: The second determining module is used to determine the parent component of the target component as the second parent component when the parent component of the target component is a native component; The third setting module is used to set the parent component of the target component to the empty component of the plugin framework, and at the same time set the parent component of the empty component to the second parent component; The replacement module is used to replace the second parent component with the second preset component of the plugin framework to obtain the second compilation chain.
Citation Information
Patent Citations
Application compiling method and device, electronic equipment and storage medium
CN110659031A
Plug-in application compiling method and device and computer readable storage medium
CN111309335A