Application package publishing method and device, readable medium and electronic device
By employing modular development and categorized compilation methods, the problem of low application development efficiency in different markets was solved, achieving unified source code management and efficient development across various markets.
Patent Information
- Application Number
- CN202111192574.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-13
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-10-13
AI Technical Summary
Developing applications for different markets requires writing different source code, which leads to low development efficiency and difficulty in maintenance.
A modular development approach is adopted, dividing the application source code into basic code modules and dynamic code modules. The modules are then categorized according to their installation method, and compiled in parallel to form basic installation packages and dynamic installation packages. Finally, the application installation package is formed according to the release method.
It improved application development efficiency, reduced the workload of developers, and enabled unified source code management across different markets.
Smart Images

Figure CN113900704B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of computers, and particularly relates to a method and device for publishing an application installation package, a readable medium and an electronic device. BACKGROUND
[0002] Application programs (APPs) are ubiquitous in the Internet world. To use an application program, a user can install an application installation package on a device. With the development of Internet technology, the size of application programs is becoming larger and larger, and many super-large application programs need to be run simultaneously in domestic and foreign markets. At present, the development modes of application programs in domestic and foreign markets are different. Foreign countries usually split a super-large application program into multiple application suites for development, and use Google Play to publish multiple application suite APKs. In China, super-large application programs are usually developed modularly according to functional modules, and then multiple modules are combined into a final APK for publishing. In this case, if an application program needs to be run simultaneously in domestic and foreign markets, the developer needs to write different application source codes to generate two different installation packages for domestic and foreign markets. This not only consumes a large amount of human resources, but also is inefficient and inconvenient for later maintenance.
[0003] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present application, and therefore can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY
[0004] The present application aims to provide a method and device for publishing an application installation package, a readable medium and an electronic device, to solve the problem in the related art that different application source codes need to be written to generate application installation packages under different application publishing modes, and at least improve the development efficiency of application programs.
[0005] Other characteristics and advantages of the present application will become apparent from the following detailed description, or will be learned by practice of the present application.
[0006] According to an aspect of an embodiment of the present application, a method for publishing an application installation package is provided, comprising:
[0007] Obtaining an application source code, the application source code comprising at least two code modules, one code module corresponding to one functional module of an application program;
[0008] Classifying the code modules according to the installation mode of the functional module corresponding to the code module, to obtain a basic code module and a dynamic code module.
[0009] The resource configuration module is configured to configure resources for the at least two code modules to determine the resources corresponding to each code module.
[0010] The compiling module is configured to compile all the basic code modules and the resources corresponding to the basic code modules to obtain a basic installation package, and compile each dynamic code module and the resources corresponding to the dynamic code module to obtain a dynamic installation package corresponding to the dynamic code module.
[0011] The publishing module is configured to form an application installation package based on an application publishing manner and publish the application installation package according to the basic installation package and the dynamic installation package corresponding to each dynamic code module.
[0012] According to an aspect of an embodiment of the present application, an application installation package publishing device is provided, which includes:
[0013] The code obtaining module is configured to obtain application source code, the application source code including at least two code modules, one code module corresponding to one function module of an application.
[0014] The code classifying module is configured to classify the code modules according to the installation manner of the function modules corresponding to the code modules to obtain basic code modules and dynamic code modules.
[0015] The resource configuration module is configured to configure resources for the at least two code modules to determine the resources corresponding to each code module.
[0016] The compiling module is configured to compile all the basic code modules and the resources corresponding to the basic code modules to obtain a basic installation package, and compile each dynamic code module and the resources corresponding to the dynamic code module to obtain a dynamic installation package corresponding to the dynamic code module.
[0017] The publishing module is configured to form an application installation package based on an application publishing manner and publish the application installation package according to the basic installation package and the dynamic installation package corresponding to each dynamic code module.
[0018] In an embodiment of the present application, the resource configuration module is specifically configured to:
[0019] The resource configuration module is configured to configure resources for the at least two code modules to determine the resources corresponding to each code module.
[0020] In an embodiment of the present application, the resource configuration module is further configured to:
[0021] generating a resource index of the code module according to a resource name, a resource identifier corresponding to the code module, and a dependency relationship between the code module and other code modules;
[0022] When there are a first code module and a second code module with the same resource name, removing a resource identifier of the first code module, and inheriting a resource index of the first code module from a resource index of the second code module; wherein the first code module is a dynamic code module, and the second code module is a basic code module.
[0023] In an embodiment of the present application, the apparatus further comprises:
[0024] a dependency configuration module configured to configure dependency relationships of the code modules, wherein a dynamic code module depends on a basic code module, and dynamic code modules cannot depend on each other.
[0025] In an embodiment of the present application, the application program publishing manner comprises a first publishing manner, and the publishing module comprises:
[0026] an unpacking unit configured to unpack the basic installation package and dynamic installation packages corresponding to the code modules based on the first publishing manner, to obtain at least two code packages and at least two resource packages, wherein the code packages and the resource packages correspond to each other in one-to-one manner;
[0027] a code package integration unit configured to integrate the at least two resource packages into a target resource package, and integrate the at least two code packages into at least one target code package, wherein a number of the target code packages is less than a number of the code packages;
[0028] a first publishing unit configured to form the application program installation package according to the target resource package and the at least one target code package, and publish the application program installation package.
[0029] In an embodiment of the present application, the code package integration unit is specifically configured to:
[0030] sort the at least two code packages according to an execution order of the code packages;
[0031] respectively integrate a preset number of code packages into a target code package according to the arrangement order of the at least two code packages, to obtain at least one target code package.
[0032] In an embodiment of the present application, the application program publishing manner comprises a second publishing manner, and based on the application program publishing manner, the publishing module comprises:
[0033] The second publishing unit is configured to publish the basic installation package as the application installation package and publish the dynamic installation package corresponding to each dynamic code module as a dynamic component of the application according to the second publishing mode.
[0034] According to an aspect of the embodiments of the present application, a computer readable medium is provided, and the computer readable medium stores a computer program. The computer program is executed by a processor to implement the application installation package publishing method in the above technical solutions.
[0035] According to an aspect of the embodiments of the present application, an electronic device is provided, and the electronic device comprises a processor and a memory for storing executable instructions of the processor. The processor executes the executable instructions to enable the electronic device to perform the application installation package publishing method in the above technical solutions.
[0036] According to an aspect of the embodiments of the present application, a computer program product or a computer program is provided, and the computer program product or the computer program comprises computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform the application installation package publishing method in the above technical solutions.
[0037] In the technical solutions provided in the embodiments of the present application, one code module of the application source code corresponds to one function module, which is equivalent to modular development of the application, so that the application source code is more convenient to manage. The code modules are classified according to the installation mode of the function modules, and then the code modules of different types are compiled in different ways. Finally, the application installation package comprises one basic installation package and multiple dynamic installation packages, so that parallel compilation of multiple code modules can be implemented to speed up the compilation. According to different application publishing modes, the final application installation package is formed, so that the application installation packages under different application publishing modes can have the same application source code, and the developers do not need to write the application source code according to different application publishing modes, which reduces the workload of the developers and greatly improves the development efficiency.
[0038] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0039] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the application and, together with the description, further serve to explain the principles of the application. It is to be understood that the drawings are only schematic, and that they do not purport to be to scale with respect to one another. The embodiments will be described with reference to the drawings in which:
[0040] Figure 1 An exemplary system architecture block diagram to which the technical solution of the present application is applied is schematically shown.
[0041] Figure 2 A flowchart of a method for publishing an application installation package provided by an embodiment of the present application is schematically shown.
[0042] Figure 3 A flowchart of a first publishing method provided by an embodiment of the present application is schematically shown.
[0043] Figure 4A An App architecture schematic diagram of a layered dependency structure is schematically shown.
[0044] Figure 4B An App architecture schematic diagram after grouping reconstruction is schematically shown.
[0045] Figure 5 A system architecture diagram of a compiling process to implement the technical solution of the present application is schematically shown.
[0046] Figure 6 A schematic diagram of a compiling process provided by an embodiment of the present application is schematically shown.
[0047] Figure 7 A system architecture diagram to which the technical solution of the present application is applied is schematically shown.
[0048] Figure 8 A comprehensive system architecture diagram of the four publishing methods of the present application is schematically shown.
[0049] Figure 9 A structural block diagram of a publishing device for an application installation package provided by an embodiment of the present application is schematically shown.
[0050] Figure 10 A computer system structural block diagram of an electronic device suitable for implementing an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0051] Example implementations are now described with reference to the following drawings. The example implementations, can, however, be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these implementations are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example implementations to those skilled in the art.
[0052] Moreover, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the
[0053] The block diagrams in the drawings show only the functionality of the example implementations and do not imply any particular physical or architectural arrangement of the example implementations. For example, functions shown as discrete blocks in the example implementations can be implemented in monolithic form with separate instantiation of the functions, or implemented in distributed form by partitioning of the functions, or even implemented in some other form, such as a combination of hardware and software.
[0054] The flow diagrams depicted in the drawings show example implementations only, and are not necessarily to be construed as reflecting an order of execution or the necessity of all illustrated operations or steps. For example, some operations / steps can be performed in a different order, or can be combined or partially combined with other operations / steps, and the actual order can depend on the implementation.
[0055] Figure 1 An example system architecture diagram to which the techniques of this application can be applied is shown schematically.
[0056] As Figure 1 shown, the system architecture 100 can include a terminal device 110, a network 120, and a server 130. The terminal device 110 can include, but is not limited to, a smartphone, a tablet computer, a notebook computer, a desktop computer, a smart voice interactive device, a smart home appliance, a vehicle-mounted terminal, etc. The server 130 can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The network 120 can be various connection types of communication media capable of providing a communication link between the terminal device 110 and the server 130, such as a wired communication link or a wireless communication link.
[0057] According to implementation requirements, the system architecture in the embodiments of the present application can have any number of terminal devices, networks and servers. For example, the server 130 can be a server group composed of multiple server devices. In addition, the technical solutions provided by the embodiments of the present application can be applied to the terminal device 110, can be applied to the server 130, or can be implemented by the terminal device 110 and the server 130 together, and the present application does not make special limitations on this.
[0058] For example, a developer writes an application source code through the terminal device 110, the application source code including at least two code modules, one code module corresponding to one functional module of the application. The terminal device 110 sends the application source code to the server 130, and after the server 130 obtains the application source code, the server 130 classifies the code modules according to the installation mode of the functional modules corresponding to the code modules, to obtain basic code modules and dynamic code modules; then performs resource configuration on the at least two code modules to determine the resources corresponding to each code module; then integrates and compiles all the basic code modules obtained by classification and the resources corresponding to all the basic code modules, to obtain a basic installation package; respectively compiles each dynamic code module obtained by classification and the resources corresponding to each dynamic code module, to obtain a dynamic installation package corresponding to each dynamic code module; and finally, based on an application publishing mode, forms an application installation package according to the basic installation package and the dynamic installation package corresponding to each dynamic code module and publishes the application installation package.
[0059] In an embodiment of the present application, after the server 130 publishes the application installation package, a user can download and use the application installation package through the terminal device 110.
[0060] In an embodiment of the present application, the application installation package publishing method provided by the embodiments of the present application can also be executed by the terminal device 110, and accordingly, the application installation package publishing apparatus can also be arranged in the terminal device 110, and the present exemplary embodiment does not make special limitations on this.
[0061] The application installation package publishing method provided by the present application will be described in detail below in combination with a specific implementation manner.
[0062] Figure 2 A flowchart of the application installation package publishing method provided by an embodiment of the present application is schematically shown, which can be implemented by a server, such as the server 130 shown in Figure 1 , or can be implemented by a terminal device, such as the terminal device 110 shown in Figure 1 . As shown in Figure 2 , the application installation package publishing method provided by the embodiments of the present application includes steps 210 to 250, and specifically as follows.
[0063] Step 210, obtaining application source code, the application source code comprising at least two code modules, one code module corresponding to one function module of the application.
[0064] Specifically, the application source code is computer language instructions written by a developer using a language supported by a development tool (usually a high-level language such as C++, Java, etc.), which can implement the specified functions of the application. In an embodiment of the present application, the modular development method is adopted, and code writing is performed according to the function modules required by the application source code, so that the application source code is composed of at least two code modules, one code module corresponding to one function module of the application, that is, the computer language instructions of one code module can implement one function of the application when executed. The functions of the application include registration, login, search, information receiving, information sending, process approval, memo, cloud backup, etc.
[0065] In an embodiment of the present application, the at least two code modules included in the application source code can be written by different developers at the same time.
[0066] Step 220, classifying the code modules according to the installation mode of the function module corresponding to the code module to obtain a basic code module and a dynamic code module.
[0067] Specifically, an application usually has multiple function modules, some of which are installed by the application to implement its functions, and some of which can be selectively installed by the user according to their own needs. The installation mode of such a must-install function module is first installation, and the installation mode of a selectively installable function module is on-demand installation. According to the installation mode of the function module, the code modules are classified, so that the at least two code modules of the application source code are divided into two categories: basic code modules and dynamic code modules.
[0068] In an embodiment of the present application, the way of classifying the code modules is: if the installation mode of the function module is first installation, then the code module corresponding to the function module is classified as a basic code module; if the installation mode of the function module is on-demand installation, then the code module corresponding to the function module is classified as a dynamic code module. For example, registration, login, search, information receiving, information sending, etc. are functions that must be installed by the application, and their installation mode is first installation, so the corresponding code modules are classified as basic code modules. Process approval, memo, cloud backup, etc. are functions installed by the user according to their own needs, and their installation mode is on-demand installation, so the corresponding code modules are classified as dynamic code modules.
[0069] In an embodiment of the present application, after the developer writes the source code of the application, the developer can set an installation identifier for each code module according to the installation mode of each function module, and can classify the code modules according to the installation identifiers when classifying the code modules. For example, the installation identifier of the first installation is set as 0, and the installation identifier of the on-demand installation is set as 1.
[0070] Step 230, resource configuration is performed on the at least two code modules to determine the resources corresponding to each code module.
[0071] Specifically, the specific content of the resources is files of things that can be drawn on the screen, layout files of classes, or values that can be accessed in the application, such as strings, color hexadecimal values, pictures, page layouts, and the like.
[0072] In an embodiment of the present application, the specific process of the resource configuration of the code modules includes: configuring a resource name and a resource identifier for the code module, so as to determine the resources corresponding to the code module based on the resource name and the resource identifier.
[0073] Specifically, the resources can be represented by the resource name and the resource identifier, and the resource identifier is also a resource ID, which is usually used to indicate the storage location of the resources. After the resource name and the resource identifier are configured, the resources of the code module are stored in the location indicated by the resource identifier, and finally a res (resource) file is generated, and the specific content of the res file represents the resources corresponding to the code module.
[0074] In an embodiment of the present application, the resources corresponding to the code module further include a resource index, and the resource index is used to find the resources. After the resources corresponding to the code module are determined, the method further includes: generating the resource index of the code module according to the resource name and the resource identifier of the code module and the dependency relationship between the code module and other code modules.
[0075] Specifically, the dependency relationship between two code modules is equivalent to the logical relationship between the two code modules, and when the dependency relationship exists between the two code modules, the running of one of the code modules will be changed and will affect the other code module. The resource index of the code module is automatically generated according to the resource name and the resource identifier of the code module and the dependency relationship between the code module and other code modules, and the resource index exists in the form of an R.java file.
[0076] In an embodiment of the present application, there can be duplication when assigning resource names to each code module. In order to avoid this, in the process of generating the resource index, when there are a first code module and a second code module with the same resource name, the resource identifier of the first code module is removed, and the resource index of the first code module is inherited from the resource index of the second code module; wherein the type of the first code module is a dynamic code module, and the type of the second code module is a basic code module.
[0077] Specifically, according to the classification of the code modules according to the foregoing steps, the types of the code modules include dynamic code modules and basic code modules. When performing resource configuration, there can be a case where the resource names of the dynamic code modules and the basic code modules are the same but the resource identifiers are different. When the resource name corresponding to a dynamic code module is the same as the resource name corresponding to a basic code module, it means that the two refer to the same resource. In order to avoid duplication, the resource identifier corresponding to the dynamic code module is removed, and the resource index corresponding to the dynamic code module is inherited from the resource index of the basic code module. In this way, it can be ensured that the dynamic code module also has a correct resource index.
[0078] In an embodiment of the present application, since generating the resource index requires determining the dependency relationship between each code module, before performing resource configuration, it further includes performing dependency relationship configuration on each code module, wherein the dynamic code modules depend on the basic code modules, and each dynamic code module cannot depend on each other. That is, the dynamic code modules should depend on the basic code modules, but cannot depend on other dynamic code modules, and the basic code modules cannot depend on the dynamic code modules. At the same time, the dependency relationship between each code module conforms to a hierarchical dependency structure, which is expressed as: app / module / api / library.
[0079] For example, as shown in FIG. 1, the resource names of the dynamic code modules and the basic code modules are the same, but the resource identifiers are different. In this case, the resource identifier of the dynamic code module is removed, and the resource index of the dynamic code module is inherited from the resource index of the basic code module. Figure 4A Figure 4A An App architecture diagram showing a layered dependency structure is shown. library represents a library, which is a set of binary relocatable object files that can be linked separately at compile time or runtime with an application, wherein library1, library2 and library3 are the same library module, and the numbering is only used to correspond to structures with the same number. api (Application Programming Interface) represents an interface, which is a set of functions or programs defined in advance, wherein api1, api2 and api3 represent three different interfaces. module represents a code module with a specific function, wherein module1, module2 and module3 represent three different modules. app represents a basic function module of an application.
[0080] After the layered dependency relationship is configured, the module, api and library are grouped and reconstructed, and a reconstructed App architecture diagram is shown in Figure 4B Feature1, Feature2 and Feature3 are dynamic code modules of the embodiments of the present application, and Base is a basic code module of the embodiments of the present application. 0x7fTTNNNN is a resource identifier of the basic code module Base, and 0x7eTTNNNN, 0x7dTTNNNN and 0x7cTTNNNN are resource identifiers corresponding to the dynamic code modules Feature1, Feature2 and Feature3, respectively. One grouping and reconstruction method is that library1, api1 and module1 are reconstructed into the dynamic code module Feature1, library2, api2 and module2 are reconstructed into the dynamic code module Feature2, library3, api3 and module3 are reconstructed into the dynamic code module Feature3, and finally, app represents a basic function module of an application as the basic code module Base.
[0081] Step 240, integrating and compiling all the basic code modules obtained by classification and the resources corresponding to the basic code modules to obtain a basic installation package; and compiling each dynamic code module obtained by classification and the resources corresponding to each dynamic code module to obtain a dynamic installation package corresponding to each dynamic code module.
[0082] Specifically, the compiling is a process of converting source code written in a high-level language into target code composed of binary language recognizable by a computer, and a product of the compiling is an installation package (APK). The computer can realize the function represented by the source code by running the target code in the APK.
[0083] In the embodiment of the present application, all the basic code modules obtained by the classification and the resources corresponding to the basic code modules are integrated and compiled to obtain a basic installation package (base_apk), that is, all the basic code modules form a basic installation package. Each dynamic code module obtained by the classification and the resources corresponding to the dynamic code module are respectively compiled to obtain a dynamic installation package corresponding to each dynamic code module, that is, one dynamic code module forms one dynamic installation package (feature_apk). In this way, after the compiling, a basic installation package and multiple dynamic installation packages can be finally obtained.
[0084] In an embodiment of the present application, the compiling of each dynamic code module and the resources corresponding to the dynamic code module is parallel compiling, and the parallel compiling means that the compiling of each dynamic code module is independent and simultaneous. The parallel compiling of each dynamic code module can be performed by a distributed cluster of build machines, and the build machine is a special machine used for building an application, also known as a build server. The parallel compiling can accelerate the compiling speed and improve the compiling efficiency.
[0085] An exemplary compiling process is shown in FIG. 5. As shown in FIG. 5, the compiling process includes the following steps. Figure 5 A system architecture diagram of the compiling process for implementing the technical solution of the present application is shown in FIG. 6. As shown in FIG. 6, base represents the basic code module 511, m_account, m_msg, etc. represent different dynamic code modules 521, base.apk represents the basic installation package 512, m_account.apk, m_msg.apk, etc. represent different dynamic installation packages 522. Figure 5
[0086] In the embodiment of the present application, the compiling of each dynamic code module and the resources corresponding to the dynamic code module is parallel compiling, and the parallel compiling means that the compiling of each dynamic code module is independent and simultaneous. The parallel compiling of each dynamic code module can be performed by a distributed cluster of build machines, and the build machine is a special machine used for building an application, also known as a build server. The parallel compiling can accelerate the compiling speed and improve the compiling efficiency. Figure 5 In the illustrated system architecture, different users can independently develop the base code module 511 or the dynamic code module 521 in their own work area (WxWork). When compiling, on one hand, the dynamic code module 521 can be directly compiled into the corresponding dynamic installation package 522 by using local compilation; on the other hand, in order to speed up the compilation, the remote pipeline compilation can be used to compile multiple code modules to generate corresponding installation packages at the same time, for example, base.apk is obtained by compiling base, m_account.apk is obtained by compiling m_account, and m_msg.apk is obtained by compiling m_msg. The remote pipeline compilation is to use multiple build machines to form a distributed build machine group to compile multiple code packages at the same time. Optionally, the pipeline compilation can also be to compile multiple code packages in sequence according to the arrangement order, and this compilation method is suitable for the case where the number of code packages is small.
[0087] After the installation packages are compiled, the corresponding application installation package can be generated for publishing. The multi-apk publishing method can be realized through Google Play. In places other than Google Play, the adb install-multiple needs to be used for debugging to realize the multi-apk publishing method, as shown in the following formula. Figure 5 After the installation package is published, the terminal device 530 can download and install the apk, and use the application.
[0088] In an embodiment of the present application, since the dynamic code modules can be compiled in parallel, when the content of part of the dynamic installation packages needs to be changed, only the changed dynamic installation package needs to be focused on and recompiled, and all the dynamic installation packages do not need to be recompiled. In this way, the configuration change can be accelerated, and the change efficiency can be improved.
[0089] In an embodiment of the present application, the base code module and the dynamic code module use different compilation steps, Figure 6 A schematic diagram of the compilation process provided by the embodiment of the present application is shown. As shown in the following formula, Figure 6As shown, the compilation includes three parts: module dependency conflict, Manifest merging error and code resource compilation error. For module dependency conflict, the base code module Base uses steps 1 and 3 to solve the problem, and the dynamic code module Dynamic Feature uses step 2 to solve the problem. Step 1 refers to generating debug feature dependencies (generateDebugFeatureTransitiveDeps), step 2 refers to checking debug libraries (checkDebugLibraries), and step 3 is the same as step 1. The above steps 1-3 can be managed by the Gradle tool for conflict strategy.
[0090] For Manifest merging error, the base code module Base uses steps 5 and 6 to solve the problem, and the dynamic code module Dynamic Feature uses step 4 to solve the problem. Step 4 refers to merging debug resources (mergeDebugResources), step 5 is the same as step 4, and step 6 refers to processing debug resources (processDebugResources). The above steps 4-6 can filter Manifest merging configurations, and skip merging errors (such as duplicate resources, invalid resources, etc.) in bundle compilation under the premise of meeting system running rules.
[0091] For code resource compilation error, the base code module Base uses steps 7 and 8 to solve the problem, and the dynamic code module Dynamic Feature uses step 9 to solve the problem. Step 7 refers to processing debug resources (processDebugResources), step 8 refers to processing debug classes by the budndle tool (budndleDebugClasses), and step 9 refers to compiling debug in Java and Javac (compileDebugJavaWithJavac). Step 250, based on the application release method, forms an application installation package according to the base installation package and the dynamic installation package corresponding to each dynamic code module and releases it.
[0092] Specifically, there are many application release methods, which are optional. When the application release method is different, the final application installation package is also different.
[0093] In the technical scheme provided in the embodiments of the present application, one code module of the application source code corresponds to one function module, which is equivalent to modular development of the application, so that the application source code is more convenient to manage; the code modules are classified according to the installation mode of the function modules, then the code modules of different types are compiled in different modes, and finally the application installation package includes one basic installation package and multiple dynamic installation packages, so that parallel compilation of multiple code modules can be implemented to speed up the compilation speed; the final application installation package is formed according to different application publishing modes, so that the application installation packages under different application publishing modes can have the same application source code, without the need for the developer to write the application source code according to different application publishing modes, thereby reducing the workload of the developer and greatly improving the development efficiency. In one embodiment of the present application, if the application publishing mode is the first publishing mode, the publishing process of the application installation package is as shown in steps 310 to 330, specifically as follows: Figure 3
[0094] Step 310, based on the first publishing mode, unpacking the basic installation package and the dynamic installation package corresponding to each dynamic code module to obtain at least two code packages and at least two resource packages, wherein the code package and the resource package correspond to each other.
[0095] Specifically, the first publishing mode is domestic publishing, that is, the application needs to be online in China. At this time, the basic installation package and each dynamic installation package are unpacked and processed, and one installation package (the basic installation package and the dynamic installation package are collectively referred to as an installation package) can obtain one code package (Java package) and one resource package (res package). The basic installation package is unpacked to obtain a basic code package, and one dynamic installation package is unpacked to obtain a dynamic code package.
[0096] Step 320, integrating the at least two resource packages into a target resource package, and integrating the at least two code packages into at least one target code package, wherein the number of target code packages is less than the number of code packages.
[0097] Specifically, after unpacking the installation package, all the resource packages are integrated into one target resource package, and at least two code packages are integrated into at least one target code package according to a certain rule. One target code package should include multiple code packages. It can be seen that the size of the target code package should be larger than the size of the code package, and the number of target code packages is less than the number of code packages.
[0098] In one embodiment of the present application, the integration process of the code package is as follows: sorting the at least two code packages according to the execution order of the code packages; and according to the arrangement order of the at least two code packages, integrating a preset number of code packages into one target code package to obtain at least one target code package.
[0099] Specifically, all code packages are sorted according to the execution order of the codes, and then a preset number of code packages are obtained according to the arrangement order of the code packages to form a target code package. How many code packages a target code package specifically includes needs to be determined according to the size of the target code package actually needed, that is, the size of the target code package can be determined in advance.
[0100] For example, there are totally 50 code packages, and suppose that after the 50 code packages are sorted according to the execution order of the codes, they are numbered 1, 2, 3, …, 50 in sequence. If a target code package can include 10 code packages, then the code packages numbered 1-10 are integrated into a target code package, the code packages numbered 11-20 are integrated into a target code package, the code packages numbered 21-30 are integrated into a target code package, the code packages numbered 31-40 are integrated into a target code package, and the code packages numbered 41-50 are integrated into a target code package. Finally, 5 target code packages can be obtained.
[0101] Step 330: forming an application installation package according to the target resource package and the at least one target code package and publishing the application installation package.
[0102] Specifically, after the target resource package and the target code package are obtained, a final application installation package is formed based on the target resource package and the at least one target code package, that is, an APK is finally formed. The APK is published, that is, the application installation package is published in the first publishing mode. In this publishing mode, when the terminal device runs the application installation package, the terminal device only needs to load a small number of target code packages instead of loading a large number of code packages, for example, the terminal device only needs to load 5 target code packages instead of 50 code packages. In this way, the number of loaded code packages is greatly reduced, and the loading speed of the application installation package when running is improved.
[0103] In an embodiment of the present application, if the application publishing mode is a second publishing mode, the second publishing mode is a foreign publishing mode, that is, the application needs to be online in a foreign country. At this time, the publishing process of the application installation package is: based on the second publishing mode, publishing the basic installation package as the application installation package and publishing the dynamic installation package corresponding to each dynamic code module as the dynamic component of the application.
[0104] Specifically, in the foreign release mode, the base installation package and the dynamic installation package are released separately, the base installation package is released as an application installation package, and the dynamic installation package is released as a dynamic component of the application. The base installation package and the dynamic installation package can be released through Google Play. This release mode can reduce the size of the application installation package downloaded by the user side. If the user wants to use the application, the user first downloads and installs the base installation package, and then selectively downloads and installs the dynamic installation package according to the user's own needs. In this way, the user does not have to download all the installation packages of the application at one time, and thus the size of the application installation package downloaded by the user side is reduced.
[0105] In an embodiment of the present application, after obtaining the base installation package and the dynamic installation package, debug development can also be performed. In the debug development mode, one installation package can quickly call the functions of all the remaining installation packages among the installation packages composed of the base installation package and the dynamic installation package, and rapid joint debugging is achieved.
[0106] Exemplarily, Figure 7 A system architecture diagram in which the technical solution of the present application is applied is shown. As Figure 7 shown, the technical solution of the present application can include two parts of local construction and remote construction, wherein the remote construction includes base installation package (Base APK) release and dynamic installation package (Feature APK) release.
[0107] As Figure 7As shown, the local build includes four steps of version control, configuration, compilation, and deployment. The version control step includes code pulling (git checkout), metadata synchronization (rsync.moudule_metadata), and version comparison (git diff). The configuration step includes module management (local.group), acceleration configuration (settings.gradle.kit), dependency management (deps.json), maven redirection (library>.aar, featur>.apk), and base fixed R (aapt2-stable-ids). The compilation step includes base acceleration (build-cache), base dependency check blocking (checkDebugLibraries), base pre-assignment, and PP package number segment (generateDebugFeatureMetadata), base manifest blocking (processDebugManifest), base non-final R processing (processDebugReasources), feature cache synchronization (maven resalve), and parallel compilation optimization step (assembelDebugfeature), wherein the parallel compilation optimization step includes feature resource & R processing (processDebugReasources), feature dependency optimization (compileOnlybotinc / javac), and feature incremental optimization. The deployment step includes incremental diff (adb shell pmpath), incremental installation (adb install compile), and launch detection (launchintent).
[0108] With continued reference to Figure 7, Base APK release includes version control, pre-compile and pre-allocate. The version control includes git clone, rsync.moudule_metadata, git gradle configuration.incoming and orchestration feature sub-pipeline tasks. The pre-compile includes base sync and fixed R, r-stable-ids.txt maven-publishing, resources-debug.ap_-R.java processDebugResources and classes.jarbundleDEbugClasses. The pre-allocate includes code commit, maven base cache GAV and PP package number segment.
[0109] With reference to the foregoing Figure 7 , Feature APK release includes presetting, parallel compilation and release. The presetting includes git clone, specified version and base cache decompression. The parallel compilation includes feature build bundle.zip(bundleDebug) and feature build APK(assembleDebug). The release includes base merge.aab(bundleDebug), feature cache optimization(.apk maven-publishing) and metadata update(push.moudule_metadata).
[0110] Exemplarily, Figure 8 A comprehensive system architecture diagram of four release modes of the application is shown. As Figure 8 shown, the four release modes of the application are: domestic release, Debug development, overseas release (i.e. foreign release) and cooperative development.
[0111] As Figure 8 shown, the architecture of domestic release includes: repo, R&D process, build.apk, application store and domestic users. The repo is a Python script developed by Android for the convenience of managing multiple git libraries. The R&D process is used to execute the application installation package release method provided by the embodiments of the application. The technical solution of the basic application obtains an application installation package, releases it through an application store, and thus reaches domestic users.
[0112] With reference to the foregoing Figure 8The architecture of the Debug development includes: repo, development process, build.apk, cache / .apk, adb install-multiple, and WeChat for enterprise development. The Debug development is mainly used for debugging the application package obtained by the technical solution of the application.
[0113] With reference to the foregoing Figure 8 The architecture of the overseas release (i.e., foreign release) includes: repo, development process, cache / .aab, Google Play, and overseas users. The overseas release is similar to the domestic release, except that the overseas release is finally released to overseas users through Google Play.
[0114] With reference to the foregoing Figure 8 The architecture of the cooperative development includes internal team development and external team development. The internal team development includes cache / .aar, development process, build / .json, pre-allocated module, and cache / .aab. The external team development includes third-party repo, maven-publishing, bundletool, build / .apks, Andriod Studio, and a virtual module. The virtual module includes a placeholder feature, a third-party lib, an empty base, and an external aab build. The pre-allocated module is used to pre-allocate a dependent interface, an external interface, a pre-allocated resource number segment, and a corresponding package name and module name for the virtual module. It should be noted that although the steps of the method in the application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in this specific order, or that all of the steps shown must be performed to achieve the desired result. In addition or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be divided into multiple steps, etc.
[0115] The following describes an apparatus embodiment of the application, which can be used to perform the application release method of the application package described above. Figure 9 The structure block diagram of the application package release apparatus provided by the embodiment of the application is schematically shown. As Figure 9 shown, the application package release apparatus provided by the embodiment of the application includes:
[0116] The code obtaining module 910 is configured to obtain application source code, the application source code including at least two code modules, one code module corresponding to one functional module of an application;
[0117] The code classifying module 920 is configured to classify the code modules according to the installation mode of the functional modules corresponding to the code modules, to obtain a basic code module and a dynamic code module.
[0118] The resource configuration module 930 is configured to perform resource configuration on the at least two code modules to determine resources corresponding to each code module.
[0119] The compiling module 940 is configured to perform integrated compiling on all the basic code modules obtained through classification and the resources corresponding to the basic code modules to obtain a basic installation package, and perform compiling on each dynamic code module obtained through classification and the resource corresponding to the dynamic code module respectively to obtain a dynamic installation package corresponding to the dynamic code module.
[0120] The publishing module 950 is configured to form an application installation package according to the basic installation package and the dynamic installation package corresponding to each dynamic code module based on an application publishing manner and publish the application installation package.
[0121] In an embodiment of the present application, the resource configuration module 930 is specifically configured to:
[0122] configure a resource name and a resource identifier for the code module, and determine the resource corresponding to the code module based on the resource name and the resource identifier.
[0123] In an embodiment of the present application, the resource configuration module 930 is further configured to:
[0124] generate a resource index of the code module according to the resource name, the resource identifier of the resource corresponding to the code module, and a dependency relationship between the code module and other code modules.
[0125] When there are a first code module and a second code module with the same resource name, remove the resource identifier of the first code module, and inherit the resource index of the first code module from the resource index of the second code module, wherein the type of the first code module is a dynamic code module, and the type of the second code module is a basic code module.
[0126] In an embodiment of the present application, the apparatus further comprises:
[0127] The dependency configuration module is configured to perform dependency relationship configuration on the code modules, wherein a dynamic code module depends on a basic code module, and the dynamic code modules cannot depend on each other.
[0128] In an embodiment of the present application, the application publishing manner includes a first publishing manner, and the publishing module 950 includes:
[0129] The unpacking unit is configured to unpack the basic installation package and the dynamic installation package corresponding to each dynamic code module based on the first publishing manner to obtain at least two code packages and at least two resource packages, wherein the code packages and the resource packages correspond to each other in one-to-one manner.
[0130] The code package integrating unit is configured to integrate the at least two resource packages into a target resource package and integrate the at least two code packages into at least one target code package, wherein the number of the target code packages is less than the number of the code packages.
[0131] The first publishing unit is configured to form the application installation package according to the target resource package and the at least one target code package and publish the application installation package.
[0132] In an embodiment of the present application, the code package integrating unit is specifically configured to:
[0133] sort the at least two code packages according to the execution order of each code package;
[0134] obtain a preset number of code packages according to the arrangement order of the at least two code packages to integrate the code packages into one target code package, to obtain at least one target code package.
[0135] In an embodiment of the present application, the application publishing manner includes a second publishing manner, and based on the application publishing manner, the publishing module 950 includes:
[0136] The second publishing unit is configured to publish the basic installation package as the application installation package and publish the dynamic installation package corresponding to each dynamic code module as a dynamic component of the application based on the second publishing manner.
[0137] The specific details of the application installation package publishing apparatus provided in the embodiments of the present application have been described in detail in the corresponding method embodiments, and will not be described here.
[0138] Figure 10 The computer system structure block diagram of the electronic device for implementing the embodiments of the present application is schematically shown.
[0139] It should be noted that, Figure 10 The computer system 1000 of the electronic device shown is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present application.
[0140] As Figure 10As shown, the computer system 1000 includes a central processing unit 1001 (CPU), which can execute various appropriate actions and processes according to programs stored in a read-only memory 1002 (ROM) or loaded into a random access memory 1003 (RAM) from a storage section 1008. In the random access memory 1003, various programs and data required for the operation of the system are also stored. The central processing unit 1001, the read-only memory 1002, and the random access memory 1003 are connected to each other through a bus 1004. An input / output interface 1005 (I / O interface) is also connected to the bus 1004.
[0141] The following components are connected to the input / output interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a local area network card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the input / output interface 1005 as necessary. A removable recording medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 1010 as necessary, so that a computer program read therefrom is installed in the storage section 1008 as necessary.
[0142] In particular, according to embodiments of the present application, the processes described in the various method flowcharts can be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 1009, and / or installed from the removable recording medium 1011. When the computer program is executed by the central processing unit 1001, various functions defined in the system of the present application are executed.
[0143] It should be noted that the computer-readable medium in the embodiments of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, device or apparatus. In this application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including, but not limited to, an electromagnetic signal, an optical signal, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium that can send, transmit, propagate, or transport a program for use by or in connection with an instruction execution system, device or apparatus. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including, but not limited to, wireless, wired, or the like, or any suitable combination thereof.
[0144] The flow diagrams and block diagrams in the drawings are illustrations of possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flow diagrams, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.
[0145] It should be noted that, although several modules or units for a device for action execution are mentioned in the above detailed description, such a division is not mandatory. Indeed, according to an embodiment of the application, the features and functionalities of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functionalities of one module or unit described above can be further divided into several modules or units embodied.
[0146] Those skilled in the art can easily understand, through the above description of the embodiments, that the example embodiments described herein can be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.) or a network, and includes several instructions to make a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) execute the methods according to the embodiments of the present application.
[0147] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the present application cover any and all variations of the application that come within the scope of the present application, along with all equivalents thereof. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.
[0148] It should be understood that the application is not limited to the precise construction that has been described above and illustrated in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application should be limited only by the appended claims.
Claims
1. A method for distributing an application installation package, characterized in that, include: Obtain the application source code, which includes at least two code modules, one of which corresponds to a functional module of the application. When a computer language instruction of the code module is executed, it implements a function of the application. Based on the hierarchical dependencies between the code modules, each code module is grouped and refactored. Then, based on the installation method of the corresponding functional modules, the refactored code modules are categorized into basic code modules and dynamic code modules. The hierarchical dependencies conform to a hierarchical dependency structure, represented as: app / module / api / library; where library represents a library, api represents an interface, module represents a code module with specific functionality, and app represents the basic functional module of the application. A group of module, api, and library modules is refactored into a single dynamic code module. Configure resource names and resource identifiers for the code module to determine the resources corresponding to the code module based on the resource names and resource identifiers; Based on the resource name, resource identifier, and dependencies between the code module and other code modules, a resource index is generated for the code module. When a first code module and a second code module with the same resource name exist, the resource identifier of the first code module is removed, and the resource index of the first code module inherits the resource index of the second code module. The first code module is a dynamic code module, and the second code module is a basic code module. All basic code modules obtained from the classification and their corresponding resources are integrated and compiled to obtain a basic installation package; each dynamic code module obtained from the classification and its corresponding resources are compiled separately to obtain a dynamic installation package corresponding to each dynamic code module; wherein, the compilation includes detecting module dependency conflicts, which refer to the situation where the dependencies between modules conflict during the compilation process; the basic code modules resolve the module dependency conflicts by generating debug feature dependencies and checking the debug library; the dynamic code modules resolve the module dependency conflicts by generating debug feature dependencies. Based on the first release method, an application installation package is formed by combining the basic installation package and the dynamic installation packages corresponding to each dynamic code module, and then released.
2. The method for distributing an application installation package according to claim 1, characterized in that, Before configuring resources for the at least two code modules to determine the resources corresponding to each code module, the method further includes: Configure the dependency relationships for each code module, wherein dynamic code modules depend on base code modules, and dynamic code modules cannot depend on each other.
3. The method for distributing an application installation package according to claim 1, characterized in that, An application installation package is formed based on the base installation package and the corresponding dynamic installation packages for each dynamic code module, and then released, including: The basic installation package and the dynamic installation packages corresponding to each dynamic code module are unpacked to obtain at least two code packages and at least two resource packages, wherein the code packages and the resource packages correspond one-to-one; The at least two resource packages are integrated into a target resource package, and the at least two code packages are integrated into at least one target code package, wherein the number of target code packages is less than the number of code packages; An application installation package is formed based on the target resource package and the at least one target code package and then released.
4. The method for distributing an application installation package according to claim 3, characterized in that, Integrating the at least two code packages into at least one target code package includes: Sort the at least two code packages according to the execution order of each code package; According to the arrangement order of the at least two code packages, a preset number of code packages are obtained and integrated into a target code package to obtain at least one target code package.
5. The method for distributing an application installation package according to claim 1, characterized in that, After obtaining the base installation package and the dynamic installation package, the method further includes: Based on the second release method, the basic installation package is released as the application installation package, and the dynamic installation packages corresponding to each dynamic code module are released as dynamic components of the application.
6. An application installation package distribution apparatus, characterized in that, include: The code acquisition module is used to acquire the application source code, which includes at least two code modules, and each code module corresponds to a functional module of the application. When a computer language instruction of the code module is executed, it implements a function of the application. The code classification module is used to group and refactor code modules according to their hierarchical dependencies, and to classify the grouped and refactored code modules according to the installation method of the corresponding functional modules, resulting in basic code modules and dynamic code modules. The hierarchical dependencies conform to a hierarchical dependency structure, which is represented as: app / module / api / library; where library represents a library, api represents an interface, module represents a code module with specific functions, and app represents the basic functional module of the application; a group of module, api, and library are grouped and refactored into a dynamic code module. A resource configuration module is used to configure resource names and resource identifiers for the code modules, so as to determine the resources corresponding to the code modules based on the resource names and resource identifiers; generate a resource index for the code modules according to the resource names, resource identifiers, and dependencies between the code modules and other code modules; when there are first code modules and second code modules with the same resource names, remove the resource identifier of the first code module and inherit the resource index of the second code module; wherein, the type of the first code module is a dynamic code module, and the type of the second code module is a basic code module; The compilation module is used to integrate and compile all the basic code modules obtained from the classification and their corresponding resources to obtain a basic installation package; and to compile each dynamic code module obtained from the classification and its corresponding resources to obtain a dynamic installation package for each dynamic code module; wherein, the compilation includes detecting module dependency conflicts, which refer to the situation where the dependencies between modules conflict during the compilation process. The basic code modules resolve the module dependency conflicts by generating debug feature dependencies and checking the debug library, and the dynamic code modules resolve the module dependency conflicts by generating debug feature dependencies. The publishing module is used to generate an application installation package based on the base installation package and the dynamic installation packages corresponding to each dynamic code module, and then publish it, according to the first publishing method.
7. A computer-readable medium, characterized in that, It stores a computer program that, when executed by a processor, implements the method for distributing an application installation package as described in any one of claims 1 to 5.
8. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor executes the executable instructions to cause the electronic device to perform the application installation package publishing method according to any one of claims 1 to 5.
9. A computer program product, characterized in that, The computer program product or computer program includes computer instructions stored in a computer-readable storage medium; The processor of the computer device reads the computer instructions from a computer-readable storage medium, and executes the computer instructions to cause the computer device to perform the method for distributing an application installation package as described in any one of claims 1 to 5.
Citation Information
Patent Citations
A method and apparatus for Android plug-in development
CN109542445A
Channel package generation method and device, equipment and storage medium
CN112905170A