Method and device for automatically generating installation package
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-02
- Publication Date
- 2026-03-13
AI Technical Summary
In component-based application software projects, existing technologies result in high maintenance and usage costs when components are frequently updated or involve a large number of components, and they cannot automatically generate installation packages.
By listening to code merging events on the source code management platform, a pre-configured configuration file is obtained, and an installation package is generated based on the component-based application framework, including the source code of the selected branch of the component.
It enables the automatic generation of installation packages without releasing a new version after a component update, thus improving the efficiency of installation package generation.
Smart Images

Figure CN121658064A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for automatically generating installation packages. Background Technology
[0002] In the development of application software projects, if the project is large and involves many developers and designers, a component-based design can be adopted, where components are business modules. After componentization, several issues need to be addressed, such as how to handle the main project's dependencies, how to handle dependencies between components, how to handle component A and component B simultaneously depending on component C, how to handle dependency conflicts between components, and how to directly generate an installation package for the project. To address these issues, some operating systems provide private repository solutions. For example, HarmonyOS provides the OHPM (OpenHarmony Package Manager) private repository solution to resolve dependency issues in componentized projects. However, these solutions require releasing new versions after component changes. If component updates are frequent, or if the project involves many components or many engineers developing a particular component, the maintenance and usage costs of the components will increase significantly, failing to meet development requirements. Furthermore, private repository solutions cannot automatically generate installation packages after component changes. Therefore, there is an urgent need for a method to efficiently and automatically generate application installation packages based on changed components. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a method and apparatus for automatically generating installation packages to eliminate or improve one or more defects existing in the prior art.
[0004] According to a first aspect, a method for automatically generating an installation package is provided, characterized in that the method: in response to a code merge event detected from a source code management platform used for developing a target application, whereby the update branch corresponding to the target component is merged with the target branch on the source code management platform, a first configuration file pre-configured for the pre-launch time is obtained from a preset configuration center based on the pre-launch time of the target branch, wherein the first configuration file includes component information of multiple components used by the target application, including the target component, and the component information of each component includes the component address storing multiple component branches of the component and the selected component branch identifier, wherein the selected component branch of the target component in the first configuration file is the update branch; according to the component address and selected component branch identifier of each component in the first configuration file, the source code of the selected component branch corresponding to the selected component branch identifier of each component is obtained; and based on the componentized application framework of the target application and the source code of the selected component branches of the multiple components, an installation package of the target application is generated.
[0005] According to a second aspect, an apparatus for automatically generating an installation package is provided, comprising: an acquisition unit configured to, in response to a code merge event detected from a source code management platform for developing a target application, whereby an update branch corresponding to a target component is merged with a target branch on the source code management platform, acquire a first configuration file pre-configured for the pre-launch time from a preset configuration center based on the pre-launch time of the target branch, wherein the first configuration file includes component information of multiple components used by the target application, including the target component, and the component information of each component includes component addresses storing multiple component branches of the component and a selected component branch identifier, wherein the selected component branch of the target component in the first configuration file is the update branch; a source code acquisition unit configured to, based on the component addresses and selected component branch identifiers of each component in the first configuration file, acquire the source code of the selected component branch corresponding to the selected component branch identifier of each component; and a generation unit configured to, based on the componentized application framework of the target application and the source code of the selected component branches of the multiple components, generate an installation package of the target application.
[0006] According to a third aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method described in any implementation of the first aspect.
[0007] According to a fourth aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method described in any implementation of the first aspect.
[0008] The method and apparatus for automatically generating installation packages provided in the embodiments of this specification can monitor whether a code merging event occurs on the source code management platform used to develop the target application. When a code merging event is detected where the update branch corresponding to the target component merges with the target branch on the source code management platform, a first configuration file pre-configured for the pre-release time can be obtained from the configuration center based on the pre-release time of the target branch. This first configuration file can include component information of multiple components (including the target component) used by the target application. The component information of each component can include the component address (which can store multiple component branches of the component) and the selected component branch identifier. In the first configuration file, the selected component branch of the target component is the update branch. Then, the source code of the selected component branch corresponding to the selected component branch identifier of each component can be obtained according to the component address and the selected component branch identifier of each component in the first configuration file. Finally, based on the componentized application framework of the target application and the source code of the selected component branches of multiple components, the installation package of the target application is generated. Thus, it is not necessary to release a new version after component changes or to control the version number of the components. The installation package containing the update branch of the component can be automatically generated based on the triggering of the code merging event, which improves the efficiency of generating the installation package.
[0009] Additional advantages, objects, and features of the invention will be set forth in part in the description which follows, and will also become apparent in part to those skilled in the art upon studying the description, or may be learned by practice of the invention. The objects and other advantages of the invention can be realized and obtained by means of the structures specifically pointed out in the description and drawings.
[0010] Those skilled in the art will understand that the objectives and advantages achievable with the present invention are not limited to those specifically described above, and that the above and other objectives achievable with the present invention will become clearer from the following detailed description. Attached Figure Description
[0011] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.
[0012] Figure 1 A flowchart illustrating a method for automatically generating an installation package according to one embodiment is shown; Figure 2 A schematic diagram is shown illustrating one application scenario in which the embodiments of this specification can be applied; Figure 3 A schematic block diagram of an apparatus for automatically generating installation packages according to one embodiment is shown. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this invention are used to explain the invention, but are not intended to limit the invention.
[0014] It should also be noted that, in order to avoid obscuring the invention with unnecessary details, only the structures and / or processing steps closely related to the solution according to the invention are shown in the accompanying drawings, while other details that are not closely related to the invention are omitted.
[0015] It should be emphasized that the term "including / comprises" as used herein refers to the presence of a feature, element, step, or component, but does not exclude the presence or addition of one or more other features, elements, steps, or components.
[0016] It is understood that the ordinal numbers such as "first" and "second" mentioned in this specification are only used to distinguish multiple objects of the same or different categories (such as components, steps, parameters, etc.), and do not indicate the priority, importance or order relationship between objects, nor do they constitute a limitation on the technical features.
[0017] As mentioned earlier, how to efficiently and automatically generate application installation packages based on the changed components is an urgent problem to be solved.
[0018] Therefore, the embodiments of this specification provide a method for automatically generating installation packages, which can automatically generate installation packages containing updated branches of components based on the triggering of code merging events on the source code management platform, thereby improving the efficiency of generating installation packages.
[0019] See also Figure 1 , Figure 1 A flowchart of a method for automatically generating an installation package according to one embodiment is shown. It is understood that this method can be executed by any device, apparatus, platform, or device cluster with computing and processing capabilities. For example, the steps of the method for automatically generating an installation package in this embodiment can be encapsulated into a component installation engine and set in the aforementioned device, apparatus, platform, or device cluster with computing and processing capabilities to implement the method for automatically generating an installation package in this embodiment.
[0020] like Figure 1 As shown, the method for automatically generating the installation package may include the following steps 101 to 103, specifically: Step 101: In response to the code merge event detected by the source code management platform used to develop the target application, where the update branch corresponding to the target component is merged with the target branch on the source code management platform, the first configuration file pre-configured for the pre-launch time is obtained from the preset configuration center based on the pre-launch time of the target branch.
[0021] In this embodiment, the target application can be a componentized application developed by developers through a software project, and the target application can include multiple components. Here, a component can be a reusable, independently developable, independently maintainable software unit with clearly defined functions and interfaces. The target application can be developed using a pre-defined source code management platform. As an example, the pre-defined source code management platform can be a centralized source code management platform. As another example, the pre-defined source code management platform can also be a source code management platform based on a distributed version control system. For example, the source code management platform can include GitLab, Gitee, GitHub, GitCode, Bitbucket, etc. These platforms are Git-based source code management platforms that provide functions such as code hosting, version control, branch management, and collaborative development. Here, Git is an open-source distributed version control system, and the functions provided by Git include branch creation and management, local version commits, multi-branch merging, and intelligent conflict resolution, etc.
[0022] Understandably, when developers use a source code management platform to develop applications, they can create multiple branches as needed to isolate development and allow different tasks to run in parallel without interfering with each other. For example, a main branch, such as `main` or `master`, can be created to store stable, releasable code. Another example is a `develop` branch, used to store code currently under development. Yet another example is a `feature` branch, used for developing new features. A `release` branch can be created to prepare for release, performing final testing, documentation updates, and version number adjustments. Furthermore, to modify, upgrade, or fix a specific component, an update branch for that component can be created independently from the main branch. Based on developer requests, the source code management platform can merge code from these branches.
[0023] In this embodiment, to better facilitate collaborative development, a configuration center can be pre-created. This configuration center can be an independent service that centrally and uniformly manages application configuration information. For example, the configuration center can have an interface through which developers can input, view, and modify configuration information. This allows developers to configure their application software projects within the configuration center. For instance, a configuration file can be set in the configuration center to specify the pre-release time for each branch of each application. This configuration file can record component information for all components (including direct and indirect dependencies) that the application depends on for that branch, such as component identifiers (e.g., component name, number, etc.), component addresses, and selected component branch identifiers (e.g., branch name, number, etc.). Here, the component address can include the component's Git address, the component's local address, etc. The component's Git address can refer to the network address of the version control repository (GitRepository) storing the component's source code. The component address can store the source code of multiple component branches. Different component branches have different branch identifiers, and different component branches can correspond to different versions or states of the component. Therefore, the source code of a specific component branch can be obtained through the component address and component branch identifier. Here, the selected component branch identifier can refer to the branch corresponding to the configuration file, that is, the specific component branch used. For example, suppose component A has three component branches, named component branch A1, component branch A2, and component branch A3. The source code of these three component branches can be stored under the component address corresponding to component A. Therefore, the source code of component branch A1 can be obtained based on the component address of component A and the component name "component branch A1".
[0024] In the configuration center, a pre-release date can be preset for each branch of an application software development project, and the correspondence between the branch, pre-release date, and configuration file is stored in the configuration center. This way, when a developer develops a component on a branch, they can modify the configuration file corresponding to the pre-release date. For example, assuming the pre-release date for the Release-3 branch is September 1, 2026, a configuration file 20260901 can be set for this pre-release date. Configuration file 20260901 can record component information for all components that the Release-3 branch depends on, such as component identifier, component address, and selected component branch identifier. For component A, which the Release-3 branch depends on, a developer can create an update branch A4 for component A in the source code management platform to upgrade component A. After the component is updated, the developer can push the component A's Git address and the update branch name "Update Branch A4" to the configuration center, and modify the selected component branch identifier of component A to "Update Branch A4" in configuration file 20260901. In addition, to merge the code between the update branch A4 and the Release-3 branch, developers can send a merge request to the source code management platform, which will then merge the code between the two branches. For example, when multiple developers are collaborating, after one developer sends a merge request to the source code management platform, the other developers can review the code corresponding to the merge request. Once the review is approved, they can instruct the source code management platform to merge the code.
[0025] In this embodiment, the source code management platform used for developing the target application can be monitored in real time for code merging events. If a code merging event is detected where the update branch corresponding to the target component merges with the target branch on the source code management platform, a first configuration file with a preset configuration for the pre-launch time can be obtained from a preset configuration center based on the pre-launch time of the target branch. This first configuration file can include component information for multiple components used by the target application, including the target component. The component information for each component can include the component address storing multiple component branches of that component and the selected component branch identifier. Here, the selected component branch identifier can refer to the branch identifier of the specific component branch being used. The selected component branch for the target component in this first configuration file is the update branch. Here, the target component can be any component used by the target application; that is, after any component in the target application is updated, a corresponding new installation package can be generated.
[0026] In some examples, the first configuration file stored in the configuration center, along with the component address of the target component and the selected component branch identifier, may be sent by the developer updating the branch. Code merge events can occur based on merge requests sent by developers to the source code management platform, where the merge request requests the merging of the updated branch with the target branch.
[0027] In some examples, developers can also configure conflicting components or third-party libraries by configuring information in the first configuration file. For instance, component information for multiple components used by the target application can include first component information for a first component and second component information for a second component. The first component is configured to work with a first version of library M (i.e., the first component depends on a first version of library M), and the second component is configured to work with a second version of library M. Component developers configure the first and second components to work with the same version of library M through a configuration center.
[0028] For example, suppose component A depends on version 1.0.0 of third-party library M, and component B depends on version 2.0.0 of third-party library M. Therefore, there is a conflict between the versions of the third-party libraries. Developers can configure components A and B to use version 2.0.0 as the standard, overriding version 1.0.0.
[0029] Step 102: Based on the component address and selected component branch identifier of each component in the first configuration file, obtain the source code of the selected component branch corresponding to the selected component branch identifier of each component.
[0030] In this embodiment, for each component recorded in the first configuration file, the location of multiple component branches storing that component can be determined based on the component's component address. Then, the source code of the selected component branch corresponding to the selected component branch identifier is selected from the multiple component branches based on the selected component branch identifier. For example, the source code of the selected component branch corresponding to the selected component branch identifier of each component can be downloaded to a preset component directory.
[0031] In some examples, the source code of multiple components of the target application can be stored in a pre-defined version control repository, such as a Git repository, or the source code of multiple components of the target application can be stored locally. Based on this, step 102 above can be specifically performed as follows: according to the component address and selected component branch identifier of each component in the first configuration file, obtain the source code of the selected component branch corresponding to the selected component branch identifier of each component from the version control repository and / or the local machine.
[0032] Step 103: Based on the component-based application framework of the target application and the source code of selected component branches of multiple components, generate the installation package of the target application.
[0033] In this embodiment, the component-based application framework of the target application can be obtained in advance, and an installation package for the target application can be generated based on the source code of the component-based application framework and selected component branches of multiple components. Here, the component-based application framework can be the basic platform of the target application, providing a set of standards and specifications that allow a target application to be broken down into multiple independent, reusable components (or "modules"), and these components can be flexibly assembled into a complete application like building blocks. The component-based application framework itself consists of lines of code and is part of the final application code. When generating the installation package, the source code of the component-based application framework and the source code of selected component branches of multiple components are compiled and packaged together to form a complete, independently runnable application.
[0034] For example, suppose you're developing an e-commerce app using a component-based framework called MyAppFramework. The e-commerce app can be broken down into multiple components such as HomeComponent, ProductComponent, CartComponent, UserComponent, and ShareComponent. This allows different development teams to develop these components simultaneously. They only need to adhere to the interface specifications defined by MyAppFramework (e.g., how to register components, how to navigate between pages, etc.). When generating the installation package, build tools (e.g., Gradle, Xcode, Hvigor, etc.) can combine the MyAppFramework code, the source code of all components, and their dependent libraries for compilation, linking, and packaging, generating a complete installation package.
[0035] In some examples, the source code of selected component branches of multiple components downloaded in step 102 can be stored in a preset component directory. Based on this, step 103 above can include steps 1) to 3), specifically: Step 1), obtain the componentized application framework of the target application.
[0036] In this example, the componentized application framework of the target application can be obtained, which may include a second configuration file. This second configuration file is set for the operating system (e.g., HarmonyOS, Android, etc.) corresponding to the target application. Here, the operating system corresponding to the target application can refer to the operating system running the target application. The second configuration file may include the application's identity information, the application's constituent components, the system and hardware resources required by the application, application compatibility requirements, etc. The application's constituent components may include component identifiers, component branch identifiers, component source code paths, etc.
[0037] Step 2), modify the second configuration file according to the first configuration file and component directory.
[0038] In this example, the second configuration file can be modified based on the first configuration file. For example, the component branch identifier of the component in the second configuration file can be modified based on the selected component branch identifier of the component in the first configuration file. Or, the source code path of the component in the second configuration file can be modified so that the source code path of the component in the modified second configuration file points to the preset component directory.
[0039] Step 3) Generate the installation package of the target application based on the component-based application framework, the source code of selected component branches of multiple components, and the modified second configuration file.
[0040] In this example, an installation package for the target application can be generated based on the target application's component-based application framework, the source code of selected component branches from multiple components, and a modified second configuration file. This allows the generated installation package to include a more accurate modified second configuration file, enabling the operating system to better install, run, and manage the application.
[0041] In some examples, the second configuration file may also include the target application's development certificate and certificate key. Based on this, step 3) above may include: generating an installation package for the target application based on the componentized application framework, the source code of multiple target components, the modified second configuration file, the development certificate, and the certificate key.
[0042] In this example, a development certificate can be used to prove that the application was created by a specific, traceable developer. A certificate key can be used for signing. For example, when the application is signed using the key, the signature information is packaged into the installation package along with the development certificate. It's understandable that the use of development certificates and certificate keys is a widely used technology, and will not be elaborated upon here.
[0043] In some examples, the above method for automatically generating installation packages may also include the following steps: sending the installation package to a terminal device used by a tester so that the tester can test the installation package.
[0044] In this example, the generated installation package can be sent to testers for testing.
[0045] See also Figure 2 , Figure 2 This diagram illustrates one application scenario to which the embodiments of this specification can be applied. Figure 2In the application scenario shown, for ease of description, the steps of the automatic installation package generation method in the embodiments of this specification are encapsulated into a component installation engine. In this application scenario, the source code management platform is GitLab. GitLab can store the source code of component branches of multiple components corresponding to the target application through GitRepository. Based on this, after the component installation engine detects a code merge event from GitLab where the update branch corresponding to the target component merges with the target branch, it can obtain a first configuration file from the configuration center according to the pre-release time of the target branch. Then, the component installation engine can obtain the source code from GitRepository according to the git address of each component and the selected component branch identifier in the first configuration file. Finally, the component installation engine can generate and output the installation package of the target application based on the componentized application framework of the target application and the source code of the selected component branches of multiple components.
[0046] According to another embodiment, an apparatus for automatically generating installation packages is provided. This apparatus can be deployed in any device, platform, or cluster of devices with computing and processing capabilities.
[0047] Figure 3 A schematic block diagram of an apparatus for automatically generating installation packages according to one embodiment is shown. Figure 3 As shown, the device 300 for automatically generating an installation package includes: an acquisition unit 301 configured to, in response to a code merge event detected from a source code management platform for developing a target application, where the update branch corresponding to the target component is merged with the target branch on the source code management platform, acquire a first configuration file pre-configured for the pre-launch time from a preset configuration center based on the pre-launch time of the target branch, wherein the first configuration file includes component information of multiple components used by the target application, including the target component, and the component information of each component includes the component address storing multiple component branches of the component and the selected component branch identifier, wherein the selected component branch of the target component in the first configuration file is the update branch; a source code acquisition unit 302 configured to, according to the component address and selected component branch identifier of each component in the first configuration file, acquire the source code of the selected component branch corresponding to the selected component branch identifier of each component; and a generation unit 303 configured to, based on the componentized application framework of the target application and the source code of the selected component branches of the multiple components, generate an installation package for the target application.
[0048] According to another embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed in a computer, causes the computer to perform... Figure 1 The method described.
[0049] According to another embodiment, a computing device is also provided, including a memory and a processor, characterized in that the memory stores executable code, and when the processor executes the executable code, it implements... Figure 1 The method described.
[0050] Those skilled in the art will understand that the exemplary components, systems, and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. Whether implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention. When implemented in hardware, it can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the desired tasks. The programs or code segments can be stored in a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave.
[0051] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.
[0052] In this invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or in place of features of other embodiments.
[0053] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations of the embodiments of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for automatically generating an installation package, characterized in that, The method described: In response to a code merge event detected from the source code management platform used to develop the target application, where the update branch corresponding to the target component is merged with the target branch on the source code management platform, a first configuration file pre-configured for the pre-launch time is obtained from a preset configuration center based on the pre-launch time of the target branch. The first configuration file includes component information of multiple components used by the target application, including the target component. The component information of each component includes the component address storing multiple component branches of the component and the selected component branch identifier. The selected component branch of the target component in the first configuration file is the update branch. Based on the component address and selected component branch identifier of each component in the first configuration file, obtain the source code of the selected component branch corresponding to the selected component branch identifier of each component; Based on the component-based application framework of the target application and the source code of selected component branches of the multiple components, an installation package for the target application is generated.
2. The method according to claim 1, characterized in that, The source code of selected component branches of the multiple components is stored in a preset component directory; and the generation of the installation package of the target application based on the componentized application framework of the target application and the source code of selected component branches of the multiple components includes: Obtain the componentized application framework of the target application, wherein the componentized application framework includes a second configuration file, the second configuration file is a configuration file set for the operating system corresponding to the target application, and the second configuration file includes the component branch identifier and the source code path of the component; Based on the first configuration file and the component directory, the second configuration file is modified, wherein the source code path of the component in the modified second configuration file points to the component directory; Based on the component-based application framework, the source code of selected component branches of the multiple components, and the modified second configuration file, an installation package for the target application is generated.
3. The method according to claim 2, characterized in that, The second configuration file also includes the development certificate and certificate key of the target application; and the step of generating the installation package of the target application based on the componentized application framework, the source code of selected component branches of the multiple components, and the modified second configuration file includes: Based on the component-based application framework, the source code of the multiple target components, the modified second configuration file, the development certificate, and the certificate key, an installation package for the target application is generated.
4. The method according to claim 1, characterized in that, The first configuration file stored in the configuration center, as well as the component address and selected component branch identifier of the target component, are sent by the developer of the updated branch; and the code merge event occurs based on a merge request sent by the developer to the source code management platform, wherein the merge request is used to request the merge of the updated branch with the target branch.
5. The method according to claim 4, characterized in that, The component information of the multiple components includes first component information of the first component and second component information of the second component. The first component is configured to work in collaboration with a first version of the library M, and the second component is configured to work in collaboration with a second version of the library M. The developer configures the first component and the second component to work in collaboration with the same version of the library M through the configuration center.
6. The method according to claim 1, characterized in that, The method further includes: The installation package is sent to the terminal device used by the tester so that the tester can test the installation package.
7. The method according to claim 1, characterized in that, The source code of the multiple components is stored in a preset version control repository and / or locally; and, the step of obtaining the source code of the selected component branch corresponding to the selected component branch identifier of each component according to the component address and selected component branch identifier of each component in the first configuration file includes: Based on the component address and selected component branch identifier of each component in the first configuration file, obtain the source code of the selected component branch corresponding to the selected component branch identifier of each component from the version control repository and / or local machine.
8. The method according to claim 1, characterized in that, The source code management platform is a source code management platform based on a distributed version control system.
9. A computing device, comprising a processor, a memory, and computer programs / instructions stored in the memory, characterized in that, The processor is configured to execute the computer program / instructions, and when the computer program / instructions are executed, the computing device implements the steps of the method as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method as described in any one of claims 1 to 8.