AAB module compilation acceleration method, device, electronic device and storage medium
By adjusting the execution order of Tasks in the AAB module, priority is given to the execution of target Tasks to determine whether the dependent library code changes, and compilation acceleration is performed when it does not change, the problem of long compilation time of AAB modules is solved and the compilation efficiency is improved.
Patent Information
- Application Number
- CN202410483409.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-22
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-04-22
AI Technical Summary
The prior art cannot degenerate the AAB module's module's source code and module dependencies for acceleration of compilation when there is no change in the changes, resulting in a longer compilation time of AAB modules.
By adjusting the execution order of each task in the AAB module to be compiled, the target task is executed first, the product of the target task is obtained, and the code of the dependent library in the AAB product changes based on the product. In the event of no change, the AAB module is compiled and accelerated according to the preset strategy.
It reduces the compilation time of AAB module, improves the compilation efficiency of AAB modules, and realizes compilation acceleration when the module source code and module dependencies are not changed.
Smart Images

Figure CN118312186B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an AAB module compilation acceleration method, device, electronic device and storage medium. Background Art
[0002] Currently, Android projects usually use a compilation acceleration solution based on degrading source code into Aar (Android archive), but it is not suitable for the AAB (Android App Bundles) module of Qigsaw, a plug-in framework based on the dynamic-feature plugin. That is, it is not possible to degrade the AAB module into Aar for compilation acceleration when the module source code and module dependencies of the AAB module have not changed.
[0003] Therefore, how to accelerate the compilation of AAB modules is a technical problem that needs to be solved at present. Summary of the invention
[0004] In order to overcome the deficiencies of the prior art, the present invention provides an AAB module compilation acceleration method, device, electronic device and storage medium.
[0005] The technical solution of the present invention can be implemented as follows:
[0006] In a first aspect, the present invention provides an AAB module compilation acceleration method, the method comprising:
[0007] For an AAB module to be compiled in a plug-in framework, when the module source code and module dependency of the AAB module to be compiled are not changed, the execution order of each Task in the AAB module to be compiled is adjusted so that the target Task in the AAB module to be compiled is executed first;
[0008] Execute the target Task to obtain a product of the target Task, and determine whether the code of the dependent library in the AAB product corresponding to the AAB module to be compiled is changed according to the product of the target Task;
[0009] When the code of the dependent library in the AAB product corresponding to the AAB module to be compiled does not change, the compilation of the AAB module to be compiled is accelerated according to a preset strategy.
[0010] Optionally, the product of the target Task includes a module dependency tree analysis file of the current version of the AAB module to be compiled, and the step of determining whether the code of the dependency library in the AAB product corresponding to the AAB module to be compiled has changed according to the product of the target Task includes:
[0011] Obtaining a historical AAB product of the AAB module to be compiled, wherein the historical AAB product includes a module dependency tree analysis file of a historical version of the AAB module to be compiled;
[0012] Determine whether the content of the current version module dependency tree analysis file is consistent with the content of the historical version module dependency tree analysis file;
[0013] If yes, it is determined that the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has not changed;
[0014] If not, it is determined that the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has changed.
[0015] Optionally, the step of accelerating the compilation of the AAB module to be compiled according to a preset strategy includes:
[0016] Reuse the historical AAB product and skip each task in the AAB module to be compiled;
[0017] The AAB module to be compiled is compiled based on the historical AAB product.
[0018] Optionally, a preset plug-in configuration is embedded in the main APK of the plug-in framework, and the step of accelerating the compilation of the AAB module to be compiled according to the preset strategy includes:
[0019] Reuse the historical AAB product and the historical product of the preset plug-in configuration, and skip each task in the AAB module to be compiled;
[0020] The AAB module to be compiled is compiled based on the historical AAB product and the historical product of the preset plug-in configuration.
[0021] Optionally, the method further comprises:
[0022] In the case where the code of the dependent library in the AAB product corresponding to the AAB module to be compiled is changed, the execution order of each Task in the AAB module to be compiled is restored and executed in sequence, and the AAB module to be compiled is normally compiled.
[0023] Optionally, the method further includes a step of determining whether a module source code of the AAB module to be compiled has changed, which includes:
[0024] Obtain the git record of the AAB module to be compiled;
[0025] According to the git record of the AAB module to be compiled, determining whether the module source code of the current version of the AAB module to be compiled is consistent with the module source code of the cached version of the AAB module to be compiled;
[0026] If yes, it is determined that the module source code of the AAB module to be compiled has not changed;
[0027] If not, it is determined that the module source code of the AAB module to be compiled has changed.
[0028] Optionally, the method further includes a step of determining whether a module dependency of the AAB module to be compiled has changed, which includes:
[0029] When the module source code of the AAB module to be compiled is unchanged, obtaining the DSL configuration of the module dependency of the AAB module to be compiled;
[0030] According to the DSL configuration of the module dependency of the AAB module to be compiled, determining whether the module dependency declaration of the current version of the AAB module to be compiled is consistent with the module dependency declaration of the cached version of the AAB module to be compiled;
[0031] If yes, it is determined that the module dependency of the AAB module to be compiled has not changed;
[0032] If not, it is determined that the module dependency of the AAB module to be compiled has changed.
[0033] In a second aspect, the present invention provides an AAB module compilation acceleration device, the device comprising:
[0034] An adjustment module, for adjusting the execution order of each Task in the AAB module to be compiled of the plug-in framework, so that the target Task in the AAB module to be compiled is executed first, when the module source code and module dependency of the AAB module to be compiled are not changed;
[0035] A processing module is used to execute the target Task, obtain the product of the target Task, and determine whether the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has changed according to the product of the target Task; if the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has not changed, the compilation of the AAB module to be compiled is accelerated according to a preset strategy.
[0036] In a third aspect, the present invention provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the AAB module compilation acceleration method as described in the first aspect is implemented.
[0037] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the AAB module compilation acceleration method as described in the first aspect above.
[0038] Compared with the prior art, the AAB module compilation acceleration method provided by the present invention is as follows: when the module source code and module dependency of the AAB module to be compiled in the plug-in framework have not changed, the execution order of each Task in the AAB module to be compiled is adjusted so that the target Task in the AAB module to be compiled is executed first, and the product of the target Task is obtained by executing the target Task, and whether the code of the dependency library in the AAB product corresponding to the AAB module to be compiled has changed is determined according to the product of the target Task, and when the code of the dependency library in the AAB product corresponding to the AAB module to be compiled has not changed, the compilation of the AAB module to be compiled is accelerated according to the preset strategy. Because the present invention determines whether the code of the dependency library in the corresponding AAB product has changed by preferentially executing the product obtained by the target Task in the AAB module when the module source code and module dependency of the AAB module have not changed, it determines whether the compilation of the AAB module can be accelerated according to the preset strategy, thereby reducing the compilation time of the AAB module and improving the compilation efficiency of the AAB module.
[0039] Other features and advantages disclosed in the present invention will be described in the following description, or some features and advantages can be inferred or determined without doubt from the description, or can be learned by implementing the above-mentioned technology disclosed in the present invention.
[0040] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0042] Figure 1 A schematic diagram of a process for accelerating the compilation of an AAB module provided by an embodiment of the present invention Figure 1 ;
[0043] Figure 2 A schematic diagram of a process for accelerating the compilation of an AAB module provided by an embodiment of the present invention Figure 2 ;
[0044] Figure 3A schematic diagram of a process for accelerating the compilation of an AAB module provided by an embodiment of the present invention Figure 3 ;
[0045] Figure 4 An example diagram of conventional compilation time consumption of an AAB module provided in an embodiment of the present invention;
[0046] Figure 5 An example diagram of the time consumption for accelerating the compilation of an AAB module provided by an embodiment of the present invention;
[0047] Figure 6 A functional unit block diagram of an AAB module compilation acceleration device provided by an embodiment of the present invention;
[0048] Figure 7 A schematic block diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0049] Icon: 100 - AAB module compilation acceleration device; 101 - adjustment module; 102 - processing module; 200 - electronic device; 210 - memory; 220 - processor. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0051] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0053] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.
[0054] The following are abbreviations and key terms used in the embodiments of the present invention:
[0055] Aar (Android archive), which represents the dependency library of the Android platform;
[0056] AAB (Android App Bundles), a compressed package of auxiliary code functions outside the main APK (Android application package), often released as a plug-in package;
[0057] Gradle, the Android compilation framework;
[0058] dynamic-feature plugin, a Gradle plugin, is used to package code modules into AAB. After using this plugin, you need to use application module as a dependency. In addition, Gradle's application plugin is used to package code modules into APK.
[0059] Qigsaw, a dynamic component solution for Android based on Android App Bundles;
[0060] Task is the smallest unit for executing a piece of code logic in Gradle.
[0061] Currently, when executing compilation, for ordinary modules, if the module source code and module dependencies have not changed, it means that the product obtained by the current regular compilation of the module is consistent with the product obtained by the previous compilation. It can be directly degraded into Aar for compilation acceleration, that is, the source code is no longer compiled, but the historical product of the module is directly reused.
[0062] Since the AAB module is at the top level of the dependency tree of the plug-in framework, it can obtain the global dependency situation. After performing the corresponding dependency analysis, the dependency library used only by the AAB module will be allocated to the corresponding AAB product, with the dependency library as the smallest unit. The dependency library shared with the APK and having intersections will be allocated to the APK and packaged together with the APK. That is, the files in the AAB product contain two parts, one is the related product of the module source code compilation, and the other is the dependency library that the AAB module depends on alone.
[0063] For AAB modules, even if the module source code and module dependencies have not changed, the dependent libraries that the AAB modules depend on may change, so that the AAB products obtained by the two compilations may be inconsistent. In this case, the AAB modules cannot be degraded to Aar for compilation acceleration.
[0064] In order to accelerate the compilation of the AAB module, an embodiment of the present invention provides an AAB module compilation acceleration method, which will be described in detail below.
[0065] Please refer to Figure 1 The AAB module acceleration method includes steps S101 to S103.
[0066] S101, for an AAB module to be compiled of a plug-in framework, when the module source code and module dependency of the AAB module to be compiled are not changed, adjusting the execution order of each Task in the AAB module to be compiled so that the target Task in the AAB module to be compiled is executed first.
[0067] Among them, the plug-in framework can be Qigsaw, the AAB module to be compiled includes multiple Tasks, and the target Task is the code logic used to analyze the dependency tree of the AAB module to be compiled. By executing the target Task, the dependency tree of the AAB module to be compiled can be analyzed and a corresponding module dependency tree analysis report can be generated. The report contains relevant information about the dependency library that the AAB module to be compiled depends on separately.
[0068] It can be understood that tasks other than the target task are tasks that need to be skipped during compilation acceleration, that is, when the AAB module to be compiled can be compiled and accelerated, these tasks are not executed.
[0069] In an embodiment of the present invention, in order to determine whether the AAB module to be compiled can be compiled and accelerated, it is necessary to adjust the execution order of each Task, set the target Task before all other Tasks, and force the target Task to be executed first, so as to determine whether the AAB module to be compiled can be compiled and accelerated by analyzing the product of the target Task.
[0070] S102, executing the target Task, obtaining the product of the target Task, and determining whether the code of the dependent library in the AAB product corresponding to the AAB module to be compiled is changed according to the product of the target Task.
[0071] Among them, the product of the target Task includes the current version module dependency tree analysis report dep.txt1 of the AAB module to be compiled, and the AAB product corresponding to the AAB module to be compiled refers to the AAB product generated if the AAB module to be compiled is currently compiled normally.
[0072] By forcing the target Task to execute first, dep.txt1 is obtained. According to dep.txt1, it is determined whether the code of the dependent library in the AAB product obtained if the AAB module to be compiled is normally compiled has changed.
[0073] In a possible implementation, the step S102 of "determining whether the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has changed according to the product of the target Task" may be as follows:
[0074] First, obtain the historical AAB product of the AAB module to be compiled;
[0075] Then, determine whether the content of the current version module dependency tree analysis file is consistent with the content of the historical version module dependency tree analysis file;
[0076] If so, it is determined that the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has not changed;
[0077] If not, it is determined that the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has changed.
[0078] The historical AAB product is the product of the most recent compilation of the AAB module to be compiled, and the most recent compilation of the AAB module to be compiled may be a regular compilation or an accelerated compilation. The historical AAB product includes the module dependency tree analysis file dep.txt0 of the historical version of the AAB module to be compiled.
[0079] If the content of dep.txt1 is consistent with the content of dep.txt0, that is, the dependent library that the AAB module to be compiled contained in dep.txt1 depends on separately is consistent with the dependent library that the AAB module to be compiled contained in dep.txt0 depends on separately, then it can be determined that if the AAB product generated by the current regular compilation of the AAB module to be compiled is compared with the historical AAB product, the codes of the dependent libraries contained in the two are consistent.
[0080] S103, when the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has not changed, the compilation of the AAB module to be compiled is accelerated according to a preset strategy.
[0081] In a possible implementation, the implementation process of "accelerating the compilation of the AAB module to be compiled according to the preset strategy" in step S103 can be as follows:
[0082] First, reuse the historical AAB products and skip the tasks in the AAB modules to be compiled.
[0083] Then, the AAB module to be compiled is compiled based on the historical AAB product.
[0084] In another possible implementation, if the plug-in framework is Qigsaw, the implementation process of "accelerating the compilation of the AAB module to be compiled according to the preset strategy" in step S103 can also be as follows:
[0085] First, reuse historical AAB products and historical products with preset plug-in configurations, and skip each task in the AAB module to be compiled.
[0086] Then, based on the historical AAB products and the historical products with preset plug-in configuration, the AAB modules to be compiled are compiled.
[0087] Among them, the preset plug-in configuration is embedded in the main APK of Qigsaw. The preset plug-in configuration includes json and manifest. The historical products of the preset plug-in configuration include remotely cached json and manifest configuration files.
[0088] In addition to reusing historical AAB products, the compilation acceleration of the AAB module to be compiled requires that when Qigsaw needs to read the sub-packaging information in the relevant json and the list in the manifest, the remotely cached json and manifest configuration files are read for reuse, thereby accelerating the compilation of the AAB module to be compiled.
[0089] In the embodiment of the present invention, the AAB module to be compiled can be compiled and accelerated according to the preset strategy only when the module source code, module dependency and the code of the dependency library in the corresponding AAB product have not changed.
[0090] However, if "the module source code and module dependencies of the AAB module to be compiled have not changed, but the code of the dependent library in the corresponding AAB product has changed", the AAB module to be compiled cannot be compiled and accelerated according to the preset strategy.
[0091] Please refer to Figure 2 , the AAB module compilation acceleration method also includes step S104.
[0092] S104, when the code of the dependent library in the AAB product corresponding to the AAB module to be compiled is changed, the execution order of each Task in the AAB module to be compiled is restored and executed in sequence, and the AAB module to be compiled is normally compiled.
[0093] It can be understood that when the module source code and module dependencies of the AAB module to be compiled have not changed, but the code of the dependent library in the corresponding AAB product has changed, the AAB module to be compiled is compiled normally, that is, each Task in the AAB module to be compiled is executed.
[0094] Since the embodiment of the present invention determines whether the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has changed when the module source code and module dependency of the AAB module to be compiled have not changed, the following describes how to determine whether the module source code and module dependency of the AAB module to be compiled have changed.
[0095] Please refer to Figure 3Before executing step S101, the AAB module compilation acceleration method also includes steps S105 and S106.
[0096] S105, determining whether the module source code of the AAB module to be compiled has changed.
[0097] In a possible implementation, step S105 includes sub-steps S105 - 1 to S105 - 4 .
[0098] S105-1, obtaining the git record of the AAB module to be compiled.
[0099] S105 - 2 , judging, based on the git record of the AAB module to be compiled, whether the module source code of the current version of the AAB module to be compiled is consistent with the module source code of the cached version of the AAB module to be compiled.
[0100] Among them, git can record the file modification history. When Gradle executes the config configuration stage, the modification history of the module source code of the AAB module to be compiled can be known by obtaining the git record of the AAB module to be compiled.
[0101] According to the modification history of the module source code of the AAB module to be compiled, it can be determined whether the module source code of the current version is consistent with the module source code of the cached version of the AAB module to be compiled.
[0102] In the embodiment of the present invention, if it is determined that the two are consistent, step S106-3 is executed; if it is determined that the two are inconsistent, step S106-4 is executed.
[0103] S105-3, determining that the module source code of the AAB module to be compiled has not changed.
[0104] S105-4, determining whether the module source code of the AAB module to be compiled has changed.
[0105] In the embodiment of the present invention, if the module source code has not changed, step S106 is executed; if the module source code has changed, the AAB module to be compiled is compiled normally.
[0106] S106, determining whether the module dependency of the AAB module to be compiled has changed.
[0107] In a possible implementation, step S106 includes sub-steps S106 - 1 to S106 - 4 .
[0108] S106-1, obtaining the DSL configuration of the module dependency of the AAB module to be compiled.
[0109] S106 - 2 , judging whether the module dependency declaration of the current version of the AAB module to be compiled is consistent with the module dependency declaration of the cached version of the AAB module to be compiled according to the DSL configuration of the module dependency of the AAB module to be compiled.
[0110] Gradle is a very advanced and powerful project building tool that uses a Groovy-based domain-specific language (DSL) to declare project settings. During the config configuration phase of Gradle, by analyzing the DSL configuration of the module dependencies of the AAB module to be compiled, the module dependency declaration of the current version of the AAB module to be compiled can be obtained, and the module dependency declaration of the current version of the AAB module to be compiled can be compared with the module dependency declaration of the cached version of the AAB module to be compiled to determine whether the two are consistent.
[0111] In the embodiment of the present invention, if it is determined that the two are consistent, step S106-3 is executed; if it is determined that the two are inconsistent, step S106-4 is executed.
[0112] S106-3, determining that the module dependency of the AAB module to be compiled has not changed.
[0113] S106-4, determining whether the module dependency of the AAB module to be compiled has changed.
[0114] In the embodiment of the present invention, if the module dependency has not changed, step S101 is executed; if the module dependency has changed, the AAB module to be compiled is compiled normally.
[0115] The embodiment of the present invention further introduces the implementation principle of the above-mentioned AAB module compilation acceleration method through the following examples.
[0116] For the AAB module to be compiled, during the stage when Gradle executes the config configuration, by obtaining the git record of the AAB module to be compiled, it is determined whether the current version of the module source code of the AAB module to be compiled is consistent with the cached version.
[0117] If the current version of the module source code of the AAB module to be compiled is inconsistent with the cached version, the compilation acceleration process is terminated and the AAB module to be compiled is compiled normally.
[0118] If the current version of the module source code of the AAB module to be compiled is consistent with the cached version, during the config configuration phase of Gradle, the DSL configuration of the module dependency of the AAB module to be compiled is analyzed to confirm whether the current version of the module dependency of the AAB module to be compiled is consistent with the cached version.
[0119] If the current version of the module dependency of the AAB module to be compiled is inconsistent with the cached version, the compilation acceleration process is terminated and the AAB module to be compiled is compiled normally.
[0120] If the current version of the module dependency of the AAB module to be compiled is consistent with the cached version, when executing the compilation process, hook (callback) the Task of the AAB module to be compiled in Gradle: generate${variantName}FeatureTransitiveDeps (variantName is the configuration of this build, indicating debug or release package), and adjust its execution order to force the Task to be executed first and obtain the product of the Task.
[0121] The path to obtain the module dependency tree analysis report in the product of this Task is:
[0122] intermediates / packaged_dependencies / ${variantDirName} / deps.txt
[0123] Analyze and compare the module dependency tree analysis report to determine whether the code of the dependent library in the corresponding AAB product has changed, and accelerate the compilation of the AAB module to be compiled if no change has occurred.
[0124] The tasks that need to be skipped when accelerating the compilation of the AAB module are as follows:
[0125]
[0126]
[0127]
[0128] For the configuration json and manifest related to the plug-in framework embedded in the APK package, download the remotely cached json and manifest related configuration files, and hook task:qigsawAssemble$variantName.
[0129] When accelerating the compilation of the AAB module, if the plug-in framework needs to read the sub-package information in the relevant json and the list in the manifest, it directly reads the relevant configuration files of the json and manifest published remotely last time.
[0130] like Figure 4 As shown in the figure, the normal compilation of the AAB module to be compiled takes 1 minute and 27.25 seconds, while the compilation is accelerated, as shown in the figure. Figure 5 As shown, the entire compilation process only takes 27.324 seconds.
[0131] In order to execute the corresponding steps in the above method embodiment and various possible implementations, an implementation of the AAB module compilation acceleration device 100 is provided below.
[0132] Please refer to Figure 6 The AAB module compilation acceleration device 100 includes an adjustment module 101 and a processing module 102 .
[0133] The adjustment module 101 is used for adjusting the execution order of each task in the AAB module to be compiled of the plug-in framework, so that the target task in the AAB module to be compiled is executed first, when the module source code and module dependency of the AAB module to be compiled are not changed;
[0134] The processing module 102 is used to execute the target Task, obtain the product of the target Task, and determine whether the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has changed according to the product of the target Task; if the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has not changed, the compilation of the AAB module to be compiled is accelerated according to a preset strategy.
[0135] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the AAB module compilation acceleration device 100 described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0136] Furthermore, the embodiment of the present invention also provides an electronic device 200, please refer to Figure 7 , the electronic device 200 may include a memory 210 and a processor 220 .
[0137] Among them, the processor 220 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the program execution of an AAB module compilation acceleration method provided by the above method embodiment.
[0138] The memory 210 may be a ROM or other types of static storage devices that can store static information and instructions, a RAM or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 210 may exist independently and be connected to the processor 220 via a communication bus. The memory 210 may also be integrated with the processor 220. Among them, the memory 210 is used to store machine executable instructions for executing the scheme of the present application. The processor 220 is used to execute the machine executable instructions stored in the memory 210 to implement the above-mentioned method embodiment.
[0139] An embodiment of the present invention further provides a computer-readable storage medium containing a computer program. When the computer program is executed, it can be used to perform relevant operations in an AAB module compilation acceleration method provided in the above method embodiment.
[0140] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for accelerating AAB module compilation, characterized in that: The method comprises: For an AAB module to be compiled in a plug-in framework, when the module source code and module dependency of the AAB module to be compiled are not changed, the execution order of each Task in the AAB module to be compiled is adjusted so that the target Task in the AAB module to be compiled is executed first; Execute the target Task to obtain a product of the target Task, and determine whether the code of the dependent library in the AAB product corresponding to the AAB module to be compiled is changed according to the product of the target Task; When the code of the dependent library in the AAB product corresponding to the AAB module to be compiled does not change, the compilation of the AAB module to be compiled is accelerated according to a preset strategy.
2. The method according to claim 1, characterized in that The product of the target Task includes a module dependency tree analysis file of the current version of the AAB module to be compiled, and the step of determining whether the code of the dependency library in the AAB product corresponding to the AAB module to be compiled has changed according to the product of the target Task includes: Obtaining a historical AAB product of the AAB module to be compiled, wherein the historical AAB product includes a module dependency tree analysis file of a historical version of the AAB module to be compiled; Determine whether the content of the current version module dependency tree analysis file is consistent with the content of the historical version module dependency tree analysis file; If yes, it is determined that the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has not changed; If not, it is determined that the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has changed.
3. The method according to claim 2, characterized in that The step of accelerating the compilation of the AAB module to be compiled according to the preset strategy includes: Reuse the historical AAB product and skip each task in the AAB module to be compiled; The AAB module to be compiled is compiled based on the historical AAB product.
4. The method according to claim 2, characterized in that The main APK of the plug-in framework has a preset plug-in configuration embedded therein, and the step of accelerating the compilation of the AAB module to be compiled according to the preset strategy includes: Reuse the historical AAB product and the historical product of the preset plug-in configuration, and skip each task in the AAB module to be compiled; The AAB module to be compiled is compiled based on the historical AAB product and the historical product of the preset plug-in configuration.
5. The method according to claim 1, characterized in that The method further comprises: In the case where the code of the dependent library in the AAB product corresponding to the AAB module to be compiled is changed, the execution order of each Task in the AAB module to be compiled is restored and executed in sequence, and the AAB module to be compiled is normally compiled.
6. The method according to claim 1, characterized in that The method further includes a step of determining whether the module source code of the AAB module to be compiled has changed, which includes: Obtain the git record of the AAB module to be compiled; According to the git record of the AAB module to be compiled, determining whether the module source code of the current version of the AAB module to be compiled is consistent with the module source code of the cached version of the AAB module to be compiled; If yes, it is determined that the module source code of the AAB module to be compiled has not changed; If not, it is determined that the module source code of the AAB module to be compiled has changed.
7. The method according to claim 6, characterized in that The method further includes a step of determining whether the module dependency of the AAB module to be compiled has changed, which includes: When the module source code of the AAB module to be compiled is unchanged, obtaining the DSL configuration of the module dependency of the AAB module to be compiled; According to the DSL configuration of the module dependency of the AAB module to be compiled, determining whether the module dependency declaration of the current version of the AAB module to be compiled is consistent with the module dependency declaration of the cached version of the AAB module to be compiled; If yes, it is determined that the module dependency of the AAB module to be compiled has not changed; If not, it is determined that the module dependency of the AAB module to be compiled has changed.
8. An AAB module compilation acceleration device, characterized in that: The device comprises: An adjustment module, for adjusting the execution order of each Task in the AAB module to be compiled of the plug-in framework, so that the target Task in the AAB module to be compiled is executed first, when the module source code and module dependency of the AAB module to be compiled are not changed; A processing module is used to execute the target Task, obtain the product of the target Task, and determine whether the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has changed according to the product of the target Task; if the code of the dependent library in the AAB product corresponding to the AAB module to be compiled has not changed, the compilation of the AAB module to be compiled is accelerated according to a preset strategy.
9. An electronic device, characterized in that: It includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the AAB module compilation acceleration method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the AAB module compilation acceleration method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Compilation processing method and device, equipment and storage medium
CN112882718A
Method and device for improving Android compiling efficiency, equipment, storage medium and product
CN115756490A