Project program upgrade package generation method and device, equipment and storage medium
By building the tree structure data and dependencies of the project program, determining the module to be upgraded and generating the upgrade package, the problem of business code dependency obfuscation in traditional technology is solved, and efficient incremental upgrade of the project program is achieved.
Patent Information
- Application Number
- CN202411356268.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-02-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The lack of service-related information between traditional business codes leads to confusion between application release and construction dependencies and business, and inconvenience in maintenance and incremental upgrades.
By loading the configuration files of each module in the project program, obtaining dependency data, and building tree structure data to represent the hierarchical relationship between modules. According to the target version number, traverse the tree structure data, determine the module to be upgraded, and package it to generate the project program upgrade package.
Incremental upgrade of project programs is realized, upgrading efficiency is improved, and module relationships are clearly represented through tree structure data, simplifying the maintenance and upgrade process.
Smart Images

Figure CN119512590A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of server-side program update, and in particular to a method, device, equipment and storage medium for generating a project program upgrade package. Background Art
[0002] With the construction and popularization of information highways, electronic informationization in all walks of life has been deeply cultivated and developed rapidly. Correspondingly, various information systems have assumed more and more functions and responsibilities, and the technical fields have become more and more refined. A system is usually composed of multiple microservice modules of reasonable scale defined by upstream and downstream businesses. Multiple application microservice modules have the same tool or component dependency packages.
[0003] Traditional business codes lack service association information, and application release builds confuse dependencies with business, making maintenance and incremental upgrades inconvenient. Summary of the invention
[0004] The present invention intends to provide a method, device, equipment and storage medium for generating a project program upgrade package to solve the deficiencies in the prior art. The technical problem to be solved by the present invention is achieved through the following technical solutions.
[0005] An embodiment of the present invention provides a method for generating a project program upgrade package, the method comprising: In response to a project program upgrade package generation instruction triggered by a developer in a code base, dependency data is loaded through configuration files of various modules in the project program; Constructing tree structure data according to dependency data of each module, wherein the tree structure data is used to represent the hierarchical relationship between modules in the project program; Traversing the tree structure data, and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction; The modules to be upgraded are packaged to obtain a project program upgrade package with the target version number.
[0006] In an optional embodiment, traversing the tree structure data and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction includes: Traversing the tree structure data, determining a module in the project program whose version number is lower than the target version number or has no version number as a first module; Determine a module that the first module depends on and whose version number is also lower than the target version number as a second module; The first module and the second module are determined as modules to be upgraded in the project program.
[0007] In an optional embodiment, before traversing the tree structure data and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction, the method further includes: Create modules according to business functions under the parent project, and write dependency data and version numbers in the configuration file of each module.
[0008] In an optional embodiment, the module includes a common component module and an application module; the application module is a business-related program module, and the common component module is a business-independent program module.
[0009] In an optional embodiment, packaging the module to be upgraded to obtain the project program upgrade package of the target version number includes: Based on the operating system environment parameters of the project program, the git code path of the module to be upgraded is compiled and source code is compiled to obtain a project program upgrade package with the target version number, wherein the project program upgrade package carries the version number.
[0010] In an optional embodiment, the method further includes: generating a project program upgrade package carrying the target version number into a specified project finished product library path.
[0011] An embodiment of the present invention provides a device for generating a project program upgrade package, the device comprising: A loading module is used to respond to a project program upgrade package generation instruction triggered by a developer in a code base, and load dependency data through configuration files of various modules in the project program; A construction module, used to construct tree structure data according to dependency data of each module, wherein the tree structure data is used to represent the hierarchical relationship between the modules in the project program; A determination module, used for traversing the tree structure data, and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction; The packaging module is used to package the modules to be upgraded to obtain a project program upgrade package with the target version number.
[0012] The embodiments of the present invention include the following advantages: The embodiment of the present invention provides a method, device, computer equipment and storage medium for generating a project program upgrade package. In response to a project program upgrade package generation instruction triggered by a developer in a code base, dependency data is loaded through configuration files of each module in the project program, and then tree structure data is constructed according to the dependency data of each module, and the tree structure data is traversed. The module to be upgraded in the project program is determined according to the target version number in the project program upgrade package generation instruction, and finally the module to be upgraded is packaged to obtain a project program upgrade package with a target version number. Since the tree structure data in the present invention can represent the hierarchical relationship between the modules in the project program, the module to be upgraded in the project program can be determined by traversing the tree structure data, and then the module to be upgraded is packaged to obtain a project program upgrade package with a target version number, thereby improving the efficiency of incremental upgrade of the project program through the project program upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 It is a flowchart of the steps of an embodiment of a method for generating a project program upgrade package of the present invention; Figure 2 It is a flowchart of steps for determining an embodiment of a module to be upgraded in a project program of the present invention; Figure 3 It is a structural schematic diagram of an embodiment of a device for generating a project program upgrade package of the present invention. DETAILED DESCRIPTION
[0014] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0015] Embodiment 1: See also Figure 1 , a method for generating a project program upgrade package provided by an embodiment of the present invention, the method specifically includes S101-S104: S101, in response to a project program upgrade package generation instruction triggered by a developer in a code base, dependency data is loaded through configuration files of each module in the project program.
[0016] Wherein, dependency data is used to represent the parent-child relationship between modules. In this embodiment, the project program includes multiple modules, which can be divided into common component modules and application modules according to type. The application module is a business-related program module, and the business application module can be a user information management, order management and other modules. It can also be divided into multiple business sub-modules according to the business field, and the business sub-modules are also established in accordance with the principle of independence at the same level and parent-child inclusion; the common component module is a business-independent program module, and the business application module can be a database operation, communication protocol, cache operation and other modules. It is divided into multiple component sub-modules according to the division of field functions, and the sub-modules are independent of each other. The parent-child affiliation relationship is established between the sub-module and the parent module through XML.
[0017] In this embodiment, when a developer initiates a project program upgrade package generation instruction, the developer also needs to specify the program version number in the instruction. Specifically, the developer creates a new version branch in the code base, executes the project program upgrade package generation instruction in the project root directory path, and sets the "program version number" field contained in the project program upgrade package generation instruction, such as setting the program version number to "1.1".
[0018] S102, constructing tree structure data according to dependency data of each module, wherein the tree structure data is used to represent the hierarchical relationship between modules in the project program.
[0019] In this embodiment, after receiving the project program upgrade package generation instruction, the build service program automatically loads the dependency data of the configuration files of each module in the project program, and generates tree structure data representing the hierarchical relationship between the modules in the project program in the memory.
[0020] S103, traversing the tree structure data, and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction.
[0021] In an optional embodiment provided by the present application, before traversing the tree structure data and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction, the method further includes: creating modules according to business function divisions under the parent project, and writing dependency data and version numbers in the configuration file of each module. The modules include common component modules and application modules; the application modules are business-related program modules, and the common component modules are business-irrelevant program modules.
[0022] Specifically, this embodiment first creates a parent project, then divides the common component modules and application modules according to the business under the parent project, and constructs the dependency relationship between the corresponding parent and child modules through the XML file configuration method, that is, the hierarchical relationship between the modules is recorded through the configuration file.
[0023] For example, this embodiment can set the module level rules: the first level sets the common component module and the business application module, and the second level sets the specific implementation modules of various middleware and business applications according to the corresponding first level modules. By editing the parent class xml file to configure the version number node and the subclass unified variable parameter version number, the version numbers of all modules are uniformly managed.
[0024] S104, packaging the modules to be upgraded to obtain a project program upgrade package with a target version number.
[0025] In this embodiment, the step of packaging the module to be upgraded to obtain the project program upgrade package of the target version number includes: based on the operating system environment parameters of the project program, performing source code compilation operation on the git code path of the module to be upgraded to obtain the project program upgrade package of the target version number, wherein the project program upgrade package carries the version number. The project program upgrade package of the target version number carrying the version number is generated into the specified project finished product library path.
[0026] It should be noted that in order to realize the incremental packaging and rapid iteration of each application module in the project program, an engineering construction packaging plug-in is added to the project program packaging configuration, and the plug-in is injected into the configuration file in the form of a jar package. The configuration file not only injects the plug-in jar name, but also configures the output directory, file suffix type, etc., which is not specifically limited in this embodiment. Among them, the construction service program sets the environment variable parameters, different release system environment parameters and corresponding encryption keys through a unified shell script to ensure application security and version uniformity. The access key is started in the form of environment variable parameters instead of being placed in the configuration center system. Therefore, this embodiment can prevent the risk of configuration information leakage.
[0027] It should be noted that the shell script automatically created by building the service program in this embodiment supports execution in multiple operating system environments, and has built-in file startup permission detection and related permission operation instructions for different operating system environments, without the need to manually add startup parameters.
[0028] After packaging the project program upgrade package with the target version number, by executing the deploy instruction, the build service program will load the embedded multi-operating system compatible shell script and identify the startup parameters of the corresponding operating system to implement operations such as uploading the compiled release package to the production server, archiving historical release packages, upgrading the new version release package, and restarting the application.
[0029] Through multi-module business division, parent-child association and version number inheritance association are established to ensure the consistency of application versions of each module; program packaging distinguishes between dependent packages, real application packages and configuration files, laying the foundation for subsequent rapid release and incremental upgrades of operation and maintenance; through shell script version control, unified management of startup parameters, environment variables, and encryption key configuration is achieved to ensure the consistency of project release and data security. Under the application program, the automatically created shell script will automatically execute the relevant start, stop, and restart commands when the program package is upgraded and updated, and the release of the program is uniformly maintained and managed.
[0030] In an actual application scenario provided by this embodiment, when the project program needs to be upgraded, a release package must be built first. The developer enters the project program upgrade package generation instruction and packaging method (supporting All-in-one overall packaging and module packaging) in the build service program, and specifies the program version number in the project program upgrade package generation instruction as "1.1". Then, the build service program will automatically read the environmental parameters of the project, build tree structure data in memory according to the dependency data of each module, traverse the tree structure data, and determine the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction, and then find the git code path of the module and perform the source code compilation operation, and finally generate the project program upgrade package with the target version number to the specified project finished product library path.
[0031] The present embodiment provides a method for generating a project program upgrade package. In response to a project program upgrade package generation instruction triggered by a developer in a code base, dependency data is loaded through configuration files of each module in the project program, and then tree structure data is constructed according to the dependency data of each module, and the tree structure data is traversed. The module to be upgraded in the project program is determined according to the target version number in the project program upgrade package generation instruction, and finally the module to be upgraded is packaged to obtain a project program upgrade package with a target version number. Since the tree structure data in the present invention can represent the hierarchical relationship between the modules in the project program, the module to be upgraded in the project program can be determined by traversing the tree structure data, and then the module to be upgraded is packaged to obtain a project program upgrade package with a target version number, thereby improving the efficiency of incremental upgrade of the project program through the project program upgrade.
[0032] Embodiment 2: See also Figure 2 , is a flow chart of determining a module to be upgraded in a project program provided by an embodiment of the present invention, the method specifically includes S201-S203: S201, traversing the tree structure data, and determining a module in the project program whose version number is lower than the target version number or has no version number as the first module.
[0033] Among them, the modules without version numbers are newly created common component modules and / or application modules in the project program, that is, after the new modules are added in this embodiment, they initially do not contain version numbers. Therefore, this embodiment needs to traverse the tree structure data to obtain modules in the project program with version numbers lower than the target version number or without version numbers, thereby realizing the package upgrade of modules in the project program with version numbers lower than the target version number or newly added modules.
[0034] S202: Determine a module that the first module depends on and whose version number is also lower than the target version number as the second module.
[0035] In this embodiment, after determining the module in the project program whose version number is lower than the target version number or has no version number as the first module, it is also necessary to determine the module on which the first module depends through tree structure data, and then determine whether the version number of the module on which it depends is also lower than the target version number or has no version number. If the version number of the template on which it depends is lower than the target version number or has no version number, the module on which it depends is determined as the second module.
[0036] S203: Determine the first module and the second module as modules to be upgraded in the project program.
[0037] In this embodiment, by traversing the tree structure data, a module in the project program whose version number is lower than the target version number or has no version number is determined as the first module, and a module that is dependent on the first module and whose version number is also lower than the target version number is determined as the second module, and finally the first module and the second module are determined as the modules to be upgraded in the project program. Thus, this embodiment can realize the package upgrade of the incremental modules in the project program.
[0038] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0039] Embodiment 3: In one embodiment, a device for generating a project program upgrade package is provided, and the device for generating the project program upgrade package corresponds one-to-one to the method for generating the project program upgrade package in the above embodiment. Figure 3 As shown, the detailed description of each functional module of the program upgrade acquisition device of this project is as follows: A loading module 31 is used to load dependency data through configuration files of various modules in the project program in response to a project program upgrade package generation instruction triggered by a developer in a code base; A construction module 32, used to construct tree structure data according to dependency data of each module, wherein the tree structure data is used to represent the hierarchical relationship between the modules in the project program; A determination module 33, used for traversing the tree structure data and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction; The packaging module 34 is used to package the modules to be upgraded to obtain a project program upgrade package with the target version number.
[0040] In an optional embodiment, the determining module 33 is specifically configured to: Traversing the tree structure data, determining a module in the project program whose version number is lower than the target version number or has no version number as a first module; Determine a module that the first module depends on and whose version number is also lower than the target version number as a second module; The first module and the second module are determined as modules to be upgraded in the project program.
[0041] In an optional embodiment, the device for generating the project program upgrade package further includes a creation module 35; The creation module 35 is used to create modules according to business function divisions under the parent project, and write dependency data and version numbers into the configuration file of each module.
[0042] In an optional embodiment, the module includes a common component module and an application module; the application module is a business-related program module, and the common component module is a business-independent program module.
[0043] In an optional embodiment, the packaging module 34 is specifically used to obtain the project program upgrade package of the target version number based on the operating system environment parameters of the project program, and to perform source code compilation operations on the git code path of the module to be upgraded, wherein the project program upgrade package carries the version number.
[0044] In an optional embodiment, the packaging module 34 is further used to generate a project program upgrade package carrying the target version number into a specified project finished product library path.
[0045] It should be noted that the above detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the present application belongs.
[0046] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should also be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0047] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.
[0048] In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products, or apparatuses.
[0049] For ease of description, spatially relative terms, such as "above", "above", "on the upper surface of", "above", etc., may be used herein to describe the spatial positional relationship between a device or feature and other devices or features as shown in the figure. It should be understood that spatially relative terms are intended to include different orientations of the device in use or operation in addition to the orientation described in the figure. For example, if the device in the accompanying drawings is inverted, the device described as "above other devices or structures" or "above other devices or structures" will be positioned as "below other devices or structures" or "below other devices or structures". Thus, the exemplary term "above" may include both "above" and "below". The device may also be positioned in other different ways, such as rotated 90 degrees or in other orientations, and the spatially relative descriptions used herein are interpreted accordingly.
[0050] In the above detailed description, reference is made to the accompanying drawings, which form a part of this document. In the accompanying drawings, similar symbols typically identify similar components unless the context indicates otherwise. The illustrated embodiments described in the detailed description, drawings, and claims are not meant to be limiting. Other embodiments may be used, and other changes may be made, without departing from the spirit or scope of the subject matter presented herein.
[0051] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for generating a project program upgrade package, characterized in that: The method comprises: In response to a project program upgrade package generation instruction triggered by a developer in a code base, dependency data is loaded through configuration files of various modules in the project program; Constructing tree structure data according to dependency data of each module, wherein the tree structure data is used to represent the hierarchical relationship between modules in the project program; Traversing the tree structure data, and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction; The modules to be upgraded are packaged to obtain a project program upgrade package with the target version number.
2. The method according to claim 1, characterized in that The traversing the tree structure data and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction includes: Traversing the tree structure data, determining a module in the project program whose version number is lower than the target version number or has no version number as a first module; Determine a module that the first module depends on and whose version number is also lower than the target version number as a second module; The first module and the second module are determined as modules to be upgraded in the project program.
3. The method according to claim 2, characterized in that Before traversing the tree structure data and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction, the method further includes: Create modules according to business functions under the parent project, and write dependency data and version numbers in the configuration file of each module.
4. The method according to claim 3, characterized in that The modules include common component modules and application modules; the application modules are business-related program modules, and the common component modules are business-independent program modules.
5. The method according to claim 1, characterized in that The step of packaging the module to be upgraded to obtain a project program upgrade package with the target version number includes: Based on the operating system environment parameters of the project program, the git code path of the module to be upgraded is compiled and source code is compiled to obtain a project program upgrade package with the target version number, wherein the project program upgrade package carries the version number.
6. The method according to claim 5, characterized in that The method further comprises: Generate a project program upgrade package carrying the target version number into the specified project finished product library path.
7. A device for generating a project program upgrade package, characterized in that: The device comprises: A loading module is used to respond to a project program upgrade package generation instruction triggered by a developer in a code base, and load dependency data through configuration files of various modules in the project program; A construction module, used to construct tree structure data according to dependency data of each module, wherein the tree structure data is used to represent the hierarchical relationship between the modules in the project program; A determination module, used for traversing the tree structure data, and determining the module to be upgraded in the project program according to the target version number in the project program upgrade package generation instruction; The packaging module is used to package the modules to be upgraded to obtain a project program upgrade package with the target version number.
8. The device according to claim 7, characterized in that The determination module is specifically used for: Traversing the tree structure data, determining a module in the project program whose version number is lower than the target version number or has no version number as a first module; Determine a module that the first module depends on and whose version number is also lower than the target version number as a second module; The first module and the second module are determined as modules to be upgraded in the project program.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for generating a project program upgrade package according to any one of claims 1 to 6 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for generating a project program upgrade package according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Program development project management method and device based on single code repository Monorepo
CN114089965A
Android application program packaging method and device, equipment and storage medium
CN114610318A
Method for building software project
KR1020080013422A
Cited By
Construction method and device of project engineering, equipment and storage medium
CN120523505A