A dependency management method and device, electronic equipment and storage medium
By introducing dependency library identifier information and combining it with a dependency management platform and project-side plugins, the automated management of application dependency configurations is achieved, solving the problems of cumbersome operation and slow updates in existing technologies, and improving the convenience and timeliness of dependency configuration management.
Patent Information
- Application Number
- CN202111481047.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2041-12-06
AI Technical Summary
Existing application dependency management methods are cumbersome, slow to update, require operators to understand Gradle script syntax and configuration property properties, and the management process is complex and cannot achieve automated management.
By introducing the identifier information of the dependency library, dependency configuration data is generated, parsed, and applied. With the cooperation of the dependency management platform and the project-side plugin, the automated management of dependency configuration is achieved, and the dependency configuration can be updated instantly without updating the code.
It simplifies the dependency configuration process, improves management convenience and update timeliness, supports dependency library snapshot version management, and facilitates development and debugging.
Smart Images

Figure CN116225478B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to a dependency management method and device, electronic equipment and storage medium. BACKGROUND
[0002] The existing dependency management method for application development generally uses the dependency management function of Gradle (an open source project automation build tool) to configure and manage dependencies in the dependencies configuration item of the build.gradle (a configuration center for specifying dependency information) file using a script language according to a syntax convention. After a developer modifies the dependency configuration in the build.gradle, the file changes are submitted to the code repository through a code management tool such as Git (an open source distributed version control system) or SVN (an open source version control system), and after other developers or CICD (continuous integration) systems actively update the code, the relevant dependency configuration takes effect in the project engineering. The existing solution is tedious to operate, slow to update, and requires operators to understand the script syntax and configuration item attributes of Gradle. After manually modifying the configuration file of Gradle, the changes are submitted through a code management tool (Git, SVN, etc.), and after the manager audits the changes and stores the code in the warehouse, the user updates the engineering code to make the dependency configuration effective. SUMMARY
[0003] To solve the above technical problems, embodiments of the present application provide a dependency management method, device, electronic equipment and storage medium.
[0004] Embodiments of the present application provide a dependency management method, which comprises:
[0005] obtaining update data of a dependency configuration of an application;
[0006] organizing the update data based on first identifiers corresponding to each dependency library in a first dependency library group of the application to generate dependency configuration data; the first dependency library group includes at least one dependency library corresponding to the update data;
[0007] analyzing the dependency configuration data based on the first identifiers corresponding to the first dependency library group to obtain parsed dependency configuration data;
[0008] applying the parsed dependency configuration data to a code engineering.
[0009] In an optional embodiment of the present application, the obtaining of the update data of the dependency configuration of the application comprises:
[0010] In a case where the user performs an update operation on the dependency configuration of the application program, update data of the dependency configuration of the application program is acquired.
[0011] In an optional embodiment of the present application, the update data includes dependency information and dependency configuration types; the update data is organized based on the first identifiers corresponding to the dependency libraries in the first dependency library group of the application program, and dependency configuration data is generated, including:
[0012] For the dependency information, each of the first identifiers is taken as a key and the dependency information corresponding to the dependency library corresponding to each of the first identifiers is taken as a value according to a preset organization manner, and dependency information data in the dependency configuration data is obtained;
[0013] For the dependency configuration types, each of the first identifiers is taken as a key and at least one configuration type corresponding to the dependency library corresponding to each of the first identifiers is taken as a value according to a preset organization manner, and dependency configuration type data in the dependency configuration data is obtained; wherein the at least one configuration type corresponding to each of the dependency libraries corresponding to the first identifiers is organized in an array manner.
[0014] In an optional embodiment of the present application, the update data further includes version configuration information, the update data is organized based on the first identifiers of the dependency libraries in the first dependency library group using a specified version, and dependency configuration data is further generated, including:
[0015] For the version configuration information, the first identifiers of the dependency libraries in the first dependency library group using a specified version are organized in an array manner based on the first identifiers of the dependency libraries in the first dependency library group using the specified version, and version configuration data in the dependency configuration data is generated.
[0016] In an optional embodiment of the present application, before the parsed dependency configuration data is applied to the code project, the method further includes:
[0017] The parsed dependency configuration data and the parsed local configuration data are merged to obtain merged dependency configuration data;
[0018] Correspondingly, the parsed dependency configuration data is applied to the code project, including:
[0019] The merged dependency configuration data is applied to the code project.
[0020] In an optional embodiment of this application, the parsed local configuration data includes configuration data corresponding to the second dependency library group of the application; each dependency library in the second dependency library group has a corresponding second identifier; the step of merging the parsed dependency configuration data with the parsed local configuration data to obtain merged dependency configuration data includes:
[0021] If a first target identifier in each of the first identifiers in the parsed dependency configuration data is the same as a second target identifier in each of the second identifiers in the parsed local configuration data, the parsed local configuration data corresponding to the second target identifier is used to overwrite the parsed dependency configuration data corresponding to the first target identifier.
[0022] In one optional embodiment of this application, applying the parsed dependency configuration data to the code project includes:
[0023] Based on the corresponding third identifiers of the third dependency library group, the dependency information and dependency configuration type information of the dependency library corresponding to each third identifier are obtained; the third dependency library group includes the first dependency library group and the second dependency library group; the third identifier includes the first identifier corresponding to each dependency library in the first dependency library group and the second identifier corresponding to each dependency library in the second dependency library group.
[0024] The application programming interface for adding dependency configurations applies the dependency information and dependency configuration type information corresponding to each third identifier to the code project.
[0025] In an optional embodiment of this application, after obtaining the dependency information of the dependency library corresponding to each third identifier based on the corresponding third identifier of the third dependency library group, the method further includes:
[0026] Determine whether the version configuration information of the dependency library corresponding to each third identifier in the dependency configuration data is the specified version;
[0027] For a dependency library whose version configuration information is a third identifier corresponding to a specified version, the specified identifier is appended to the dependency information corresponding to the dependency library. The specified identifier is used to indicate that the dependency library needs to use the specified version.
[0028] In one optional embodiment of this application, the method further includes:
[0029] When using the application programming interface for adding dependency configuration to apply the dependency information and dependency configuration type information corresponding to each third identifier to the code project, for the dependency library corresponding to the third identifier with version configuration information of a specified version, the dependency library of the specified version corresponding to the dependency library is applied to the code project.
[0030] This application embodiment also provides a dependency management device, the device comprising:
[0031] The retrieval unit is used to retrieve updated data for the application's dependency configuration.
[0032] An organization unit is used to organize the updated data based on the first identifier corresponding to each dependency library in the first dependency library group of the application, and generate dependency configuration data; the first dependency library group includes at least one dependency library corresponding to the updated data.
[0033] The parsing unit is used to parse the dependency configuration data based on the first identifiers corresponding to the first dependency library group to obtain the parsed dependency configuration data.
[0034] The application unit is used to apply the parsed dependency configuration data to the code project.
[0035] In one optional embodiment of this application, the acquisition unit is specifically used to: acquire the update data of the application's dependency configuration when the user performs an update operation on the application's dependency configuration.
[0036] In an optional embodiment of this application, the updated data includes dependency information and dependency configuration types. The organization unit is specifically used for: for the dependency information, according to a preset organization method, taking each of the first identifiers as a key and the dependency information corresponding to the dependency library corresponding to each of the first identifiers as a value, to obtain dependency information data in the dependency configuration data; for the dependency configuration types, according to a preset organization method, taking each of the first identifiers as a key and the at least one configuration type corresponding to the dependency library corresponding to each of the first identifiers as a value, to obtain dependency configuration type data in the dependency configuration data; wherein, the at least one configuration type corresponding to each dependency library corresponding to each of the first identifiers is organized in an array manner.
[0037] In an optional embodiment of this application, the update data further includes version configuration information. The parsing unit is specifically used to: based on the first identifier of each dependency library in the first dependency library group using the specified version, organize the first identifiers of each dependency library in the first dependency library group using the specified version in an array manner to generate version configuration data in the dependency configuration data.
[0038] In one optional embodiment of this application, before the application unit applies the parsed dependency configuration data to the code project, the apparatus further includes:
[0039] The merging unit is used to merge the parsed dependency configuration data with the parsed local configuration data to obtain merged dependency configuration data.
[0040] Accordingly, the application unit is specifically used to: apply the merged dependency configuration data to the code project.
[0041] In an optional embodiment of this application, the parsed local configuration data includes configuration data corresponding to the second dependency library group of the application; each dependency library in the second dependency library group has a corresponding second identifier; the merging unit is specifically used to: when there is a first target identifier in each first identifier of the parsed dependency configuration data that is the same as the second target identifier in each second identifier of the parsed local configuration data, use the parsed local configuration data corresponding to the second target identifier to overwrite the parsed dependency configuration data corresponding to the first target identifier.
[0042] In an optional embodiment of this application, the application unit is specifically used to: obtain the dependency information and dependency configuration type information of the dependency library corresponding to each third identifier based on the corresponding third identifier of the third dependency library group; the third dependency library group includes a first dependency library group and a second dependency library group; the third identifier includes a first identifier corresponding to each dependency library in the first dependency library group and a second identifier corresponding to each dependency library in the second dependency library group; and apply the dependency information and dependency configuration type information corresponding to each third identifier to the code project using the application programming interface for adding dependency configuration.
[0043] In an optional embodiment of this application, after the application unit obtains the dependency information of the dependency library corresponding to each third identifier based on the corresponding third identifier of the third dependency library group, the device further includes:
[0044] The concatenation unit is used to determine whether the version configuration information of the dependency library corresponding to each third identifier in the dependency configuration data is a specified version; for the dependency library corresponding to the third identifier whose version configuration information is a specified version, a specified identifier is concatenated after the dependency information corresponding to the dependency library, and the specified identifier is used to indicate that the dependency library needs to use the specified version.
[0045] In one optional embodiment of this application, the apparatus further includes:
[0046] The processing unit is used to apply the dependency information and dependency configuration type information corresponding to each third identifier to the code project when the application interface for adding dependency configuration applies the dependency information and dependency configuration type information corresponding to each third identifier with version configuration information of a specified version.
[0047] This application also provides an electronic device, which includes a memory and a processor. The memory stores computer-executable instructions, and the processor can implement the methods described in the above embodiments when it executes the computer-executable instructions in the memory.
[0048] This application also provides a computer storage medium storing executable instructions, which, when executed by a processor, implement the methods described in the above embodiments.
[0049] The technical solution of this application embodiment obtains updated dependency configuration data of an application; organizes the updated data based on the first identifiers corresponding to each dependency library in the first dependency library group of the application to generate dependency configuration data; the first dependency library group includes at least one dependency library corresponding to the updated data; parses the dependency configuration data based on the first identifiers corresponding to the first dependency library group to obtain parsed dependency configuration data; and applies the parsed dependency configuration data to the code project. Thus, by introducing corresponding identifier information to the application's dependency libraries and processing the generation, parsing, and activation of the application's dependency configuration data based on the identifier information of the dependency libraries, automated management of the application's dependency configuration is achieved. The solution of this application embodiment supports immediate updating and application of dependency configurations without updating the code, improving the convenience and timeliness of application dependency configuration management. Attached Figure Description
[0050] Figure 1 A flowchart illustrating a dependency management method provided in this application embodiment. Figure 1 ;
[0051] Figure 2 This is a schematic diagram of a data format that depends on configuration data, provided in an embodiment of this application.
[0052] Figure 3 This is an example diagram illustrating a dependency on configuration data provided in an embodiment of this application.
[0053] Figure 4 A flowchart illustrating a dependency management method provided in this application embodiment. Figure 2 ;
[0054] Figure 5 This is a schematic diagram illustrating the processing flow of dependency configuration data provided in an embodiment of this application;
[0055] Figure 6 This is a schematic diagram of the application process for dependency configuration provided in the embodiments of this application;
[0056] Figure 7This is a schematic diagram illustrating the structural composition of a dependency management device provided in an embodiment of this application;
[0057] Figure 8 This is a schematic diagram of the structural composition of an electronic device provided in an embodiment of this application. Detailed Implementation
[0058] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.
[0059] The dependency management method provided in this application embodiment is specifically an automated dependency management method based on application (i.e., APP) development. Specifically, it combines the application's dependency management platform and a Gradle-based dependency management plugin, and generates, parses, and activates dependency configurations based on the identifiers of dependency libraries, thereby achieving automated dependency management for application projects.
[0060] The dependency management method provided in this application supports independent dependency configuration change requests and approvals, simplifies operations, facilitates configuration management and risk control. Through a dependency management plugin within the application project, edits or modifications made by users to application dependency configurations on the dependency management platform are updated and take effect instantly. The dependency configuration process does not require updating code on the user side, improving the convenience and timeliness of application dependency configuration management. This application solves the problem of cooperation and interaction between the application dependency management platform and the application project by introducing corresponding identifier information to the dependency library and generating and parsing dependency configuration data based on this identifier information. By combining the application dependency management platform (also called the dependency configuration platform) with the dependency management plugin within the application project, automated dependency management for application development is achieved. Furthermore, this application enhances the scalability of dependency configuration. Specifically, it facilitates the management of dependency library snapshot versions and supports local temporary configurations (i.e., local dependency configuration data) on the project side to overwrite the configurations distributed by the application dependency management platform (i.e., dependency configuration data distributed by the dependency management platform), facilitating application development and debugging.
[0061] Figure 1 A flowchart illustrating a dependency management method provided in this application embodiment. Figure 1 ,like Figure 1 As shown, the dependency management method of this application embodiment includes the following steps 101 to 104. In this application embodiment, the above steps 101 and 102 are executed by the application's dependency management platform, and the above steps 103 and 104 are executed by the dependency management plugin on the project side.
[0062] Step 101: Obtain updated data for the application's dependency configuration.
[0063] In this embodiment of the application, the updated data includes dependency information and dependency configuration type.
[0064] In one optional embodiment of this application, the application can specifically be an Android system application, i.e., an Android APP.
[0065] In this embodiment, the Gradle-based project dependency configuration data, also known as dependency configuration information, can be divided into dependency information (Dependency) and dependency configuration type (Configuration). The updated data in this embodiment refers to the updated dependency information and dependency configuration type of the application.
[0066] The dependency information can be specifically based on Maven (a project build system), which includes GroupId (the project's group), ArtifactId (the project's ID in the group), and Version (the project's version) data. The general format is "GroupId:ArtifactId:Version", for example, "androidx.appcompat:appcompat:1.2.0".
[0067] In Gradle, dependency configuration types include basic ones like `implementation`, `api`, `runtimeOnly`, and `compileOnly`. Beyond these, custom dependency configuration types can be derived by combining them with those defined in the operating system's build plugins, such as `buildType` and `ProductFlavor`. Examples include `debugApi` and `releaseImplementation`. It's important to note that each dependency library can have multiple dependency configuration types.
[0068] In an optional embodiment of this application, step 101 specifically includes:
[0069] When a user performs an update operation on the application's dependency configuration, retrieve the updated data of the application's dependency configuration.
[0070] In this embodiment of the application, the user's operation to update the application's dependency configuration specifically refers to the user's editing and modification of the application's dependency configuration on the application's dependency management platform.
[0071] In this embodiment of the application, information on all dependent libraries can be entered into the application dependency management platform, and the dependency management platform can be used to maintain the identifier information of the dependent libraries, which is called UniqueName. The dependency management platform is used to ensure the uniqueness of the UniqueName of each dependent library.
[0072] In this embodiment, a dependency configuration corresponding to the application version can be created on the application dependency management platform. Users can edit and modify the dependency configuration corresponding to the application version as needed on the dependency management platform. The dependency management platform supports the management and tracing of application dependency configurations based on application version.
[0073] Step 102: Organize the update data based on the first identifier corresponding to each dependency library in the first dependency library group of the application to generate dependency configuration data.
[0074] Here, the first dependency library group includes at least one dependency library corresponding to the updated data.
[0075] In this embodiment of the application, after the user modifies the dependency configuration on the application dependency management platform and the administrator approves the modified dependency configuration, the dependency management platform will use the dependency configuration organization method based on the UniqueName of each dependency library to generate dependency configuration data, and then send the generated dependency configuration data to the project end through the dependency configuration interface.
[0076] In an optional embodiment of this application, step 102 specifically includes the following steps:
[0077] For the dependency information, according to a preset organization method, each of the first identifiers is used as a key, and the dependency information corresponding to the dependency library corresponding to each of the first identifiers is used as the value to obtain the dependency information data in the dependency configuration data.
[0078] For the dependency configuration type, according to a preset organization method, each of the first identifiers is used as a key, and at least one configuration type corresponding to the dependency library corresponding to each first identifier is used as a value to obtain the dependency configuration type data in the dependency configuration data; wherein, at least one configuration type corresponding to each dependency library corresponding to each first identifier is organized in the form of an array.
[0079] Specifically, Figure 2 This is a schematic diagram illustrating a data format that depends on configuration data, as provided in an embodiment of this application. Figure 3 This is an example diagram illustrating a dependency on configuration data provided in an embodiment of this application.
[0080] In this embodiment of the application, when organizing the updated data, based on the uniqueName identifier information added to each dependency library, the dependency information (Dependency) and dependency configuration type (Configuration) in the updated data are respectively mapped to the uniqueName corresponding to the dependency library.
[0081] In one implementation, for the dependency information portion, a Map data structure is used to organize the data, using the UniqueName of the dependency library that the application depends on as the key and the dependency information data of the dependency library as the value to generate the application's dependency information data.
[0082] For the dependency configuration type (Configuration) part, a Map data structure is used to organize the data. The UniqueName of the dependency library that the application depends on is used as the key. Since the same dependency library can be configured with multiple dependency configuration types, the dependency configuration type data can be organized as an array and used as the value to generate the dependency configuration type data of each dependency library of the application.
[0083] In an optional embodiment of this application, the update data further includes version configuration information, and step 102 above specifically includes the following steps:
[0084] For the version configuration information, based on the first identifier of each dependency library in the first dependency library group using the specified version, the first identifiers of each dependency library in the first dependency library group using the specified version are organized in an array to generate the version configuration data in the dependency configuration data.
[0085] In this embodiment of the application, the version configuration information specifically includes configuration items for whether the dependency library is allowed to use the Snapshot version (allowSnapshot boolean value type) and the dependency library that uses the Snapshot version (useSnapshot array), which are used to manage the Snapshot version of the dependency library.
[0086] like Figure 2 and Figure 3As shown, when organizing version configuration information in the update data, the configuration for whether to allow the use of Snapshot versions (allowSnapshot) can use boolean values, with true representing that the use of Snapshot versions is allowed and false representing that the use of Snapshot versions is not allowed. By using the dependency library (useSnapshot) configuration item for Snapshot versions, the UniqueNames of all dependencies using Snapshot versions can be organized into an array to generate the corresponding configuration data.
[0087] Step 103: Parse the dependency configuration data based on the first identifiers corresponding to the first dependency library group to obtain the parsed dependency configuration data.
[0088] In this embodiment of the application, after the application dependency management platform generates dependency configuration data by executing the above step 103, it sends the generated dependency configuration data to the project end through the dependency configuration interface of the dependency management platform. The project end is configured with a dependency management plugin.
[0089] When synchronizing Gradle, the project can automatically trigger the dependency management plugin integrated into the project to update the dependency configuration. Alternatively, the dependency management plugin's `updateConfig` task can be manually triggered to update the dependency configuration. When the dependency management plugin receives dependency configuration data from the dependency management platform's dependency configuration interface, it can parse the data using the dependency library's `UniqueName` dependency configuration parsing method.
[0090] When the dependency management plugin parses dependency configuration data, the parsing of the dependency information (Dependency) and dependency configuration type (Configuration) parts is done using a Map with each dependency library's UniqueName as the key, named according to the data node names in the JSON, which can be dependencies and configuration respectively. For the version configuration information part, allowSnapshot is parsed as a boolean value, and useSnapshot is parsed as an array.
[0091] Step 104: Apply the parsed dependency configuration data to the code project.
[0092] In this embodiment, the project-side dependency management plugin applies the parsed configuration to the code project, making the dependency configuration data effective and completing the automated dependency configuration process.
[0093] In one optional embodiment of this application, before performing step 104 above, the following steps may also be performed:
[0094] The parsed dependency configuration data is merged with the parsed local configuration data to obtain the merged dependency configuration data.
[0095] Accordingly, step 104 above includes:
[0096] Apply the merged dependency configuration data to the code project.
[0097] In this embodiment, when the dependency management plugin on the project side receives dependency configuration data from the dependency configuration interface of the dependency management platform, it also attempts to read local temporary configuration data, specifically local dependency configuration data. If local temporary configuration data exists, the dependency management plugin parses both the dependency configuration data from the dependency management platform and the local temporary configuration data. Here, the parsing rules for the local temporary configuration data are the same as those for the dependency configuration data from the dependency management platform; both are based on the dependency configuration parsing method of the dependency library's UniqueName.
[0098] In an optional embodiment of this application, the parsed local configuration data includes configuration data corresponding to the second dependency library group of the application; each dependency library in the second dependency library group has a corresponding second identifier; the step of merging the parsed dependency configuration data with the parsed local configuration data to obtain the merged dependency configuration data can be implemented in the following way:
[0099] If a first target identifier in each of the first identifiers in the parsed dependency configuration data is the same as a second target identifier in each of the second identifiers in the parsed local configuration data, the parsed local configuration data corresponding to the second target identifier is used to overwrite the parsed dependency configuration data corresponding to the first target identifier.
[0100] In this embodiment, when the dependency management plugin on the engineering side merges the dependency configuration data obtained from the application's dependency management platform and the local temporary configuration data, for the same parts and configurations with the same UniqueName, the local temporary configuration data is used first, thus achieving the purpose of local configuration overriding the issued configuration. Here, by adding the function of parsing the local temporary configuration file and supporting the function of local temporary configuration data overriding the dependency configuration data issued by the application's dependency management platform, it is convenient for the engineering side to develop and debug functions under development.
[0101] In an optional embodiment of this application, step 104 specifically includes the following steps:
[0102] Based on the corresponding third identifiers of the third dependency library group, the dependency information and dependency configuration type information of the dependency library corresponding to each third identifier are obtained; the third dependency library group includes the first dependency library group and the second dependency library group; the third identifier includes the first identifier corresponding to each dependency library in the first dependency library group and the second identifier corresponding to each dependency library in the second dependency library group.
[0103] The application programming interface for adding dependency configurations applies the dependency information and dependency configuration type information corresponding to each third identifier to the code project.
[0104] Here, after obtaining the parsed dependency configuration data, the dependency management plugin on the project side will traverse the data Map of the dependency information part of the parsed dependency configuration data. During the traversal, it will use the UniqueName of the dependency library as the association key and retrieve other configuration data with the same UniqueName from other dependency configuration data.
[0105] Specifically, after obtaining the dependency information (dependency) of the dependency library from the parsed dependency configuration data, the dependency management plugin retrieves the dependency configuration type data to be applied to this dependency library from the data map of the dependency configuration type (Configuration) using the dependency library's UniqueName. According to the generation rules of dependency configuration data, this retrieves an array collection. The dependency management plugin continues to iterate through the retrieved dependency configuration type array; each iterated item represents a dependency configuration type that needs to be applied to the project, referred to here as a config. Then, the processed dependency data and config data are applied to the code project by calling the Gradle Application Programming Interface (API) for adding project dependency configurations. For example, the API call is: project.dependencies.add(config, dependency), where project is the global object of the currently built project in Gradle.
[0106] In an optional embodiment of this application, after obtaining the dependency information of the dependency library corresponding to each third identifier based on the third identifier of the third dependency library group, it can be further determined whether the version configuration information of the dependency library corresponding to each third identifier in the dependency configuration data is a specified version.
[0107] For a dependency library whose version configuration information is a third identifier corresponding to a specified version, the specified identifier is appended to the dependency information corresponding to the dependency library. The specified identifier is used to indicate that the dependency library needs to use the specified version.
[0108] In one optional embodiment of this application, when the dependency information and dependency configuration type information corresponding to each third identifier are applied to the code project using the application programming interface for adding dependency configuration, for the dependency library corresponding to the third identifier with version configuration information of a specified version, the dependency library of the specified version corresponding to the dependency library is applied to the code project.
[0109] Specifically, when the parsed dependency configuration data contains version configuration information of the dependency library, the dependency management plugin, after obtaining the dependency information of the dependency library in the parsed dependency configuration data, i.e., dependency, determines the value of allowSnapshot in the parsed dependency configuration data. If the value is true, it means that the snapshot version of the dependency library is allowed to be used; if the value is false, it means that the snapshot version of the dependency library is not allowed to be used.
[0110] If the value of allowSnapshot in the parsed dependency configuration data is true, check if the useSnapshot array contains the UniqueName value of the dependency library. If it does, the corresponding dependency library needs to use the Snapshot version. Concatenate "-SNAPSHOT" to the Version data at the end of the dependency information dependency in the parsed dependency configuration data to use the Snapshot version of the dependency library.
[0111] The technical solution of this application, by introducing corresponding identifier information to the dependency library and generating and parsing dependency configuration data based on the identifier information of the dependency library, solves the problem of cooperation and interaction between the application dependency management platform and the application project. It achieves automated dependency management for application development by cooperating with the application dependency management platform and the dependency management plugin within the application project. Furthermore, this application enhances the extensibility of dependency configuration. Specifically, it facilitates the management of dependency library snapshot versions and supports local temporary configurations on the project side to override the configurations distributed by the application dependency management platform, thus facilitating application development and debugging.
[0112] Below, in conjunction with Figures 4 to 6 The following specific embodiments illustrate the dependency management process of the embodiments of this application.
[0113] Figure 4 A flowchart illustrating a dependency management method provided in this application embodiment. Figure 2 ,like Figure 4 As shown, the dependency management method provided in this application embodiment specifically includes the following steps:
[0114] Step 401: Enter dependency library information and generate UniqueName.
[0115] Enter all dependency library information into the application dependency management platform, maintain the dependency library identifier information UniqueName through the dependency management platform, and use the dependency management platform to ensure the uniqueness of UniqueName.
[0116] Step 402: Edit / modify dependency configuration by application version.
[0117] Create dependency configurations for the corresponding version of the application in the application dependency management platform, and edit and modify the dependency configurations as needed. The dependency management platform supports the management and traceability of application dependency configurations based on the application version.
[0118] Step 403: Generate dependency configuration data based on UniqueName.
[0119] After a user modifies the dependency configuration on the application dependency management platform and it is approved by the administrator, the dependency management platform automatically generates dependency configuration data using the dependency configuration organization method based on UniqueName, and distributes it to the project through the dependency configuration interface.
[0120] Step 404: Obtain the merged dependency configuration data.
[0121] When the project synchronizes Gradle, the integrated dependency management plugin is automatically triggered to update the dependency configuration. Alternatively, the plugin's `updateConfig` task can be manually triggered to update the configuration. When the dependency configuration data is received from the dependency configuration interface, the dependency management plugin also attempts to read local temporary configuration data (if it exists) and parses both sets of configuration data.
[0122] Step 405: Resolve dependency configuration data based on UniqueName.
[0123] The project-side dependency management plugin uses a dependency configuration parsing method based on the dependency library's UniqueName. It parses dependency configuration data distributed by the dependency management platform and local temporary configuration data according to rules. The specific parsing process can be found in [link / details]. Figure 5 To understand this, we need to look at the processing flow of the dependency configuration data.
[0124] Step 406: Apply and activate dependency configurations in the code project.
[0125] The project-side dependency management plugin applies the parsed dependency configuration data to the code project, making the dependency configuration effective and completing the automated dependency configuration process. For detailed execution steps, please refer to [link to documentation / reference]. Figure 6The application process of dependency configuration.
[0126] Figure 5 This is a schematic diagram of the dependency configuration data processing flow provided in the embodiments of this application, specifically a schematic diagram of the dependency management plugin processing dependency configuration data, such as... Figure 5 As shown, the dependency management plugin processes dependency configuration data through the following steps:
[0127] Step 501: Trigger dependency configuration data check.
[0128] When synchronizing Gradle configurations on the project side, the dependency management plugin will be automatically triggered to check the dependency configuration data. Alternatively, you can manually execute a Gradle Task (i.e., a project task) to check the dependency configuration data.
[0129] Step 502: Obtain and parse the dependency configuration data issued by the dependency management platform.
[0130] The dependency management platform's dependency configuration interface distributes the generated dependency configuration data to the project side, enabling the dependency management plugin on the project side to obtain this data. When parsing the dependency configuration data, the plugin parses the dependency information (Dependency) and dependency configuration type (Configuration) parts using a Map with each dependency library's UniqueName as the key, named according to the data node names in the JSON, which can be dependencies and configuration respectively. For the version configuration information part, allowSnapshot is parsed as a boolean value, and useSnapshot is parsed as an array.
[0131] Step 503: Obtain and parse local configuration data.
[0132] When the dependency management plugin on the project side receives dependency configuration data from the dependency configuration interface of the dependency management platform, it also attempts to read local temporary configuration data (if it exists). This local temporary configuration data is specifically the local dependency configuration data. If local temporary configuration data exists, the dependency management plugin will parse both the dependency configuration data from the dependency management platform and the local temporary configuration data. Here, the parsing rules for the local temporary configuration data are the same as the parsing rules for the dependency configuration data from the dependency management platform; see step 502 above for details.
[0133] Step 504: Merge the distributed dependency configuration data and local configuration data, and prioritize the local configuration for the same UniqueName.
[0134] When the dependency management plugin on the project side merges the dependency configuration data issued by the application's dependency management platform with the local temporary configuration data, for the same parts and configurations with the same UniqueName, the local temporary configuration data will be used first, so as to achieve the purpose of local configuration overriding the issued configuration.
[0135] Step 505: Traverse the merged dependency configuration data, process all configuration items in each data entry using UniqueName, and apply them to the project.
[0136] Iterate through the dependency information map, retrieving other configuration data with the same uniqueName from other configuration data using the uniqueName as the association key. Figure 6 The processing methods in the text are combined and applied to the project.
[0137] Figure 6 The following is a schematic diagram illustrating the application process of dependency configuration provided in this application embodiment. Specifically, it illustrates the process by which the dependency processing plugin applies the parsed dependency configuration data to the project, including the following steps:
[0138] Step 601: Retrieve the dependency information of the dependency library using UniqueName.
[0139] Specifically, this involves retrieving the dependency information of the dependent libraries, which is referred to here as dependency.
[0140] Step 602: Determine if allowSnapshot is true.
[0141] If the parsed dependency configuration data contains version configuration information for the dependency libraries, the dependency management plugin, after obtaining the dependency information (dependency) of the dependency libraries in the parsed dependency configuration data, determines the value of allowSnapshot in the parsed dependency configuration data. If the value is true, it means that the snapshot version of the dependency library is allowed, and then proceeds to step 603; if the value is false, it means that the snapshot version of the dependency library is not allowed, and then skips step 603 and proceeds to step 604.
[0142] Step 603: Determine if the same UniqueName exists in the useSnapshot array.
[0143] Check if the useSnapshot array contains the UniqueName value of the dependency library. If it does, then the dependency library needs to use the Snapshot version.
[0144] Step 604: append "-SNAPSHOT" to the dependency data to use the snapshot version of the dependency library.
[0145] The Version data at the end of the dependency extracted in step 601 is appended with "-SNAPSHOT" to use the Snapshot version of the dependency library.
[0146] Step 605: Retrieve the dependency configuration type array of the dependency library using UniqueName.
[0147] Using the uniqueName of the dependency library, the dependency configuration type data to be applied to this dependency library is retrieved from the data map of the dependency configuration type (Configuration) part. According to the generation rules of dependency configuration data, what is retrieved here is an array collection.
[0148] Step 606: Iterate through the dependency configuration type array. After combining each dependency configuration type with the processed dependency data, call the Gradle API to add dependency configurations to the project.
[0149] Iterate through the dependency configuration type array retrieved in step 604. Each iterated item represents a dependency configuration type that needs to be applied to the project, referred to here as a config. Then, apply the processed dependency data and config data to the project by calling the Gradle API for adding project dependency configurations.
[0150] above Figures 4 to 6 This refers to the complete process and method by which the application dependency management platform generates configuration information based on UniqueName, and the project-side dependency management plugin parses, processes, and applies the configuration information to the project based on UniqueName.
[0151] The technical solution of this application introduces UniqueName as the unique identifier of the dependency library and uses a dependency configuration data application method based on UniqueName to handle the generation, parsing, and activation of dependency configuration data, thereby realizing automated dependency management. It also enhances the scalability of dependency management, as this method can be extended to, but is not limited to, the following management methods: 1. A method for managing the snapshot version of the dependency library; 2. A method for implementing local temporary configuration overriding and distributing configurations.
[0152] Furthermore, this application uses UniqueName to simultaneously support both Maven dependency methods (with Maven dependency information) and local dependency methods (depending on local library files or projects, without Maven dependency information), unifying the unique identifier in dependency management. By using UniqueName to link various configurations in dependency management, dependency configuration information can be easily maintained and parsed on both the APP dependency management platform and the project side, solving the problem of difficult organization and management of APP dependency configuration.
[0153] Furthermore, this application adds an application dependency management platform to maintain and manage dependency library information and application dependency configuration data, provides an application dependency configuration interface, and integrates a dependency management plugin on the project side. The dependency management plugin obtains dependency configuration data through the dependency configuration interface, parses it, and applies the dependency configuration data to the project, thus realizing the automation of the dependency management process. This eliminates the need for manual modification of dependency configuration scripts and supports the instant updating and application of dependency configurations without updating the code, improving convenience and update timeliness.
[0154] Figure 7 This is a schematic diagram of the structural composition of a dependency management device provided in an embodiment of this application, as shown below. Figure 7 As shown, the device includes:
[0155] The acquisition unit 701 is used to acquire updated data of the application's dependency configuration;
[0156] Organization unit 702 is used to organize the update data based on the first identifier corresponding to each dependency library in the first dependency library group of the application, and generate dependency configuration data; the first dependency library group includes at least one dependency library corresponding to the update data.
[0157] The parsing unit 703 is used to parse the dependency configuration data based on the first identifiers corresponding to the first dependency library group to obtain the parsed dependency configuration data.
[0158] Application unit 704 is used to apply the parsed dependency configuration data to the code project.
[0159] In an optional embodiment of this application, the acquisition unit 701 is specifically used to: acquire the update data of the application's dependency configuration when the user performs an update operation on the application's dependency configuration.
[0160] In an optional embodiment of this application, the updated data includes dependency information and dependency configuration types. The organization unit 702 is specifically used for: for the dependency information, according to a preset organization method, taking each of the first identifiers as a key and the dependency information corresponding to the dependency library corresponding to each of the first identifiers as a value, to obtain dependency information data in the dependency configuration data; for the dependency configuration types, according to a preset organization method, taking each of the first identifiers as a key and the at least one configuration type corresponding to the dependency library corresponding to each of the first identifiers as a value, to obtain dependency configuration type data in the dependency configuration data; wherein, the at least one configuration type corresponding to each dependency library corresponding to each of the first identifiers is organized in an array manner.
[0161] In an optional embodiment of this application, the update data further includes version configuration information. The parsing unit 703 is specifically used to: based on the first identifier of each dependency library in the first dependency library group using the specified version, organize the first identifiers of each dependency library in the first dependency library group using the specified version in an array manner to generate version configuration data in the dependency configuration data.
[0162] In one optional embodiment of this application, before the application unit 704 applies the parsed dependency configuration data to the code project, the apparatus further includes:
[0163] The merging unit 705 is used to merge the parsed dependency configuration data with the parsed local configuration data to obtain merged dependency configuration data.
[0164] Accordingly, the application unit 704 is specifically used to apply the merged dependency configuration data to the code project.
[0165] In an optional embodiment of this application, the parsed local configuration data includes configuration data corresponding to the second dependency library group of the application; each dependency library in the second dependency library group has a corresponding second identifier; the merging unit 705 is specifically used to: when there is a first target identifier in each first identifier of the parsed dependency configuration data that is the same as the second target identifier in each second identifier of the parsed local configuration data, use the parsed local configuration data corresponding to the second target identifier to overwrite the parsed dependency configuration data corresponding to the first target identifier.
[0166] In an optional embodiment of this application, the application unit 704 is specifically used to: obtain the dependency information and dependency configuration type information of the dependency library corresponding to each third identifier based on the corresponding third identifier of the third dependency library group; the third dependency library group includes a first dependency library group and a second dependency library group; the third identifier includes a first identifier corresponding to each dependency library in the first dependency library group and a second identifier corresponding to each dependency library in the second dependency library group; and apply the dependency information and dependency configuration type information corresponding to each third identifier to the code project using the application programming interface for adding dependency configuration.
[0167] In an optional embodiment of this application, after the application unit 704 obtains the dependency information of the dependency library corresponding to each third identifier based on the corresponding third identifier of the third dependency library group, the device further includes:
[0168] The splicing unit 706 is used to determine whether the version configuration information of the dependency library corresponding to each third identifier in the dependency configuration data is a specified version; for the dependency library corresponding to the third identifier whose version configuration information is a specified version, a specified identifier is spliced after the dependency information corresponding to the dependency library, and the specified identifier is used to indicate that the dependency library needs to use the specified version.
[0169] In one optional embodiment of this application, the apparatus further includes:
[0170] The processing unit 707 is used to apply the dependency information and dependency configuration type information corresponding to each third identifier to the code project when the application interface for adding dependency configuration is used to apply the dependency information and dependency configuration type information corresponding to each third identifier with version configuration information of a specified version to the code project.
[0171] Those skilled in the art should understand that Figure 7 The functions of each unit in the dependency management device shown can be understood by referring to the relevant description of the aforementioned dependency management method. Figure 7 The functions of each unit in the dependency management device shown can be implemented by a program running on a processor or by specific logic circuits.
[0172] This application also provides an electronic device. Figure 8 This is a schematic diagram of the hardware structure of the electronic device according to an embodiment of this application, such as... Figure 8As shown, the electronic device includes: a communication component 803 for data transmission, at least one processor 801, and a memory 802 for storing computer programs capable of running on the processor 801. The various components in the terminal are coupled together via a bus system 804. It is understood that the bus system 804 is used to implement communication between these components. In addition to a data bus, the bus system 804 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 8 The general labeled all buses as Bus System 804.
[0173] Wherein, when the processor 801 executes the computer program, it performs at least the following: Figure 1 The steps of the method shown.
[0174] It is understood that memory 802 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 802 described in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0175] The methods disclosed in the embodiments of this application can be applied to or implemented by processor 801. Processor 801 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 801 or by instructions in software form. The processor 801 may be a general-purpose processor, DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 801 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 802. Processor 801 reads the information in memory 802 and combines its hardware to complete the steps of the aforementioned method.
[0176] In an exemplary embodiment, the electronic device may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), FPGAs, general-purpose processors, controllers, MCUs, microprocessors, or other electronic components to perform the aforementioned call recording method.
[0177] This application also provides a computer-readable storage medium storing a computer program thereon, characterized in that the program, when executed by a processor, is at least used to perform... Figure 1 The steps of the method are shown. The computer-readable storage medium may specifically be a memory. The memory may be, for example... Figure 8 The memory 802 shown.
[0178] The technical solutions described in the embodiments of this application can be combined arbitrarily without conflict.
[0179] In the several embodiments provided in this application, it should be understood that the disclosed methods and smart devices can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0180] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0181] In addition, each functional unit in the various embodiments of this application can be integrated into a second processing unit, or each unit can be a separate unit, or two or more units can be integrated into a unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0182] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A dependency management method, characterized in that, The method includes: Obtain updated data of the application's dependency configuration; the updated data includes dependency information and dependency configuration types; The updated data is organized based on the first identifier corresponding to each dependency library in the first dependency library group of the application to generate dependency configuration data; the first dependency library group includes at least one dependency library corresponding to the updated data. The dependency configuration data is parsed based on the first identifiers corresponding to the first dependency library group to obtain the parsed dependency configuration data. The parsed dependency configuration data is merged with the parsed local configuration data to obtain the merged dependency configuration data; Apply the merged dependency configuration data to the code project; The step of organizing the update data based on the first identifier corresponding to each dependency library in the first dependency library group of the application to generate dependency configuration data includes: For the dependency information, according to a preset organization method, each of the first identifiers is used as a key, and the dependency information corresponding to the dependency library corresponding to each of the first identifiers is used as the value to obtain the dependency information data in the dependency configuration data. For the dependency configuration type, according to a preset organization method, each of the first identifiers is used as a key, and at least one configuration type corresponding to the dependency library corresponding to each first identifier is used as a value to obtain the dependency configuration type data in the dependency configuration data; wherein, at least one configuration type corresponding to each dependency library corresponding to each first identifier is organized in the form of an array.
2. The method according to claim 1, characterized in that, The process of obtaining updated dependency configuration data for the application includes: When a user performs an update operation on the application's dependency configuration, retrieve the updated data of the application's dependency configuration.
3. The method according to claim 1, characterized in that, The update data also includes version configuration information. The step of organizing the update data based on the first identifier corresponding to each dependency library in the first dependency library group of the application to generate dependency configuration data further includes: For the version configuration information, based on the first identifier of each dependency library in the first dependency library group using the specified version, the first identifiers of each dependency library in the first dependency library group using the specified version are organized in an array to generate the version configuration data in the dependency configuration data.
4. The method according to claim 1, characterized in that, The parsed local configuration data includes configuration data corresponding to the second dependency library group of the application; each dependency library in the second dependency library group has a corresponding second identifier. The step of merging the parsed dependency configuration data with the parsed local configuration data to obtain merged dependency configuration data includes: If a first target identifier in each of the first identifiers in the parsed dependency configuration data is the same as a second target identifier in each of the second identifiers in the parsed local configuration data, the parsed local configuration data corresponding to the second target identifier is used to overwrite the parsed dependency configuration data corresponding to the first target identifier.
5. The method according to claim 1, characterized in that, Applying the merged dependency configuration data to the code project includes: Based on the corresponding third identifiers of the third dependency library group, the dependency information and dependency configuration type information of the dependency library corresponding to each third identifier are obtained; the third dependency library group includes the first dependency library group and the second dependency library group; the third identifier includes the first identifier corresponding to each dependency library in the first dependency library group and the second identifier corresponding to each dependency library in the second dependency library group. The application programming interface for adding dependency configurations applies the dependency information and dependency configuration type information corresponding to each third identifier to the code project.
6. The method according to claim 5, characterized in that, After obtaining the dependency information of the dependency library corresponding to each third identifier based on the corresponding third identifier of the third dependency library group, the method further includes: Determine whether the version configuration information of the dependency library corresponding to each third identifier in the dependency configuration data is the specified version; For a dependency library whose version configuration information is a third identifier corresponding to a specified version, the specified identifier is appended to the dependency information corresponding to the dependency library. The specified identifier is used to indicate that the dependency library needs to use the specified version.
7. The method according to claim 6, characterized in that, The method further includes: When using the application programming interface for adding dependency configuration to apply the dependency information and dependency configuration type information corresponding to each third identifier to the code project, for the dependency library corresponding to the third identifier with version configuration information of a specified version, the dependency library of the specified version corresponding to the dependency library is applied to the code project.
8. A dependency management device, characterized in that, The device includes: The acquisition unit is used to acquire updated data of the application's dependency configuration; the updated data includes dependency information and dependency configuration type. An organization unit is configured to organize the updated data based on each first identifier corresponding to each dependency library in the first dependency library group of the application, and generate dependency configuration data; the first dependency library group includes at least one dependency library corresponding to the updated data; the organization unit is further configured to, according to a preset organization method, use each of the first identifiers as a key and the dependency information corresponding to the dependency library corresponding to each of the first identifiers as a value to obtain dependency information data in the dependency configuration data; and according to a preset organization method, use each of the first identifiers as a key and at least one configuration type corresponding to the dependency library corresponding to each of the first identifiers as a value to obtain dependency configuration type data in the dependency configuration data; wherein, at least one configuration type corresponding to each dependency library in each dependency library corresponding to each first identifier is organized in an array manner. The parsing unit is used to parse the dependency configuration data based on the first identifiers corresponding to the first dependency library group to obtain the parsed dependency configuration data. The merging unit is used to merge the parsed dependency configuration data with the parsed local configuration data to obtain merged dependency configuration data. The application unit is used to apply the merged dependency configuration data to the code project.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, wherein the memory stores computer-executable instructions, and the processor, when executing the computer-executable instructions in the memory, can implement the method of any one of claims 1 to 7.
10. A computer storage medium, characterized in that, The storage medium stores executable instructions that, when executed by a processor, implement the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Dependent component information extraction method and device and computer readable storage medium
CN112711438A
System and method for constructing software provided with dynamic expandability
JP1999161483A