A method and apparatus for constructing dependencies

By uniformly managing the configuration files of private and public dependency groups in Android projects, the problem of line of business dependency conflicts and tampering is solved, and the security and consistency management of dependencies is achieved.

CN114416051BActive Publication Date: 2025-08-05BEIJING 58 INFORMATION TTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111645530.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-08-05
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In the prior art, the business lines in Android projects are prone to problems such as the same package name but inconsistent version numbers when building dependencies, resulting in dependency conflicts that cannot be merged and compiled normally, and the dependency library is easily tampered with, resulting in forced version numbers upgrades.

Method used

By obtaining the configuration files of the project and business lines, recording multiple private dependencies and public dependencies groups, building dependencies between the business lines and the target private dependencies, uniformly managing all dependencies, avoiding conflicts between multiple versions, and preventing direct tampering with dependencies.

Benefits of technology

It realizes unified management of all dependencies, avoids version conflicts and forced escalation issues, and ensures the security and consistency of dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416051B_ABST
    Figure CN114416051B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method and apparatus for building dependencies, which relates to the field of software development technology. The method includes: obtaining a project configuration file of a project, and a business line configuration file of a business line in the project; wherein the project configuration file records multiple private dependencies and multiple public dependency groups, and any public dependency group in the multiple public dependency groups includes at least one of the multiple private dependencies; the business line configuration file records a target public dependency group required by the business line; then, the target private dependency corresponding to the target public dependency group required by the business line is obtained, and a dependency relationship between the business line and the target private dependency is constructed. The embodiment of the present invention can uniformly manage all individual dependencies, avoiding the problem of multiple version conflicts for the same dependency, and solving the problem that individual dependencies cannot be managed, and that when a single dependency is shared, one party modifies the version number and other business line dependencies are forced to upgrade.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to a dependency building method and a dependency building device. Background Art

[0002] AAR (Android Archive) is a binary archive file of an Android source code library. It contains not only Java files, but also resource files, AndroidManifest.xml, and build.gradle configuration files. An AAR is actually a packaged archive file of an Android source code library (including code, resources, and configuration files).

[0003] Gradle is an open source tool for automated builds based on the JVM (Java Virtual Machine). It uses a Groovy-based domain-specific language (DSL) to declare project settings, supports transitive dependency management, and abandons various cumbersome XML-based configurations.

[0004] In existing technologies, when building dependencies on business lines in a project, this can be achieved through the following methods:

[0005] 1) Add the AAR dependency to the business line's Gradle configuration file build.gradle;

[0006] 2) Configure AAR dependencies uniformly in the config.gradle file in the project root directory, and then each business line obtains the AAR dependencies defined in the global object.

[0007] However, the above methods each have the following defects:

[0008] 1) Due to historical iterations, the AAR dependencies used by each business line often have the same package name but inconsistent version numbers in the overall project, which directly leads to dependency conflicts and prevents normal merging and compilation. For example, if A=a1 in business line Biz_1 and A=a2 in business line Biz_2, then Biz_1 and Biz_2 depend on the same AAR, that is, "a" is the same, but the version numbers 1 and 2 are different;

[0009] 2) The dependencies of each business line can be easily tampered with by other business lines and cannot be managed. In addition, the dependency library cannot set modification permissions. When the dependency library is shared, if one party modifies the version number, the dependencies of other business lines will be forced to upgrade. Summary of the Invention

[0010] In view of the above problems, embodiments of the present invention are proposed to provide a method for building dependencies and a corresponding device for building dependencies that overcome the above problems or at least partially solve the above problems.

[0011] In order to solve the above problem, an embodiment of the present invention discloses a method for building a dependency, characterized in that the method includes:

[0012] Obtaining a project configuration file for a project and a business line configuration file for a business line in the project; wherein the project configuration file records multiple private dependencies and multiple public dependency groups, and any public dependency group in the multiple public dependency groups includes at least one of the multiple private dependencies; and the business line configuration file records a target public dependency group required by the business line;

[0013] Obtain the target private dependency corresponding to the target public dependency group required by the business line;

[0014] Build a dependency relationship between the business line and the target private dependency.

[0015] In one or more embodiments, obtaining the target private dependency corresponding to the target public dependency group required by the business line includes:

[0016] Searching the target public dependency group required by the business line from the project configuration file;

[0017] Obtain at least one dependency pattern corresponding to at least one target private dependency in the target public dependency group;

[0018] Obtain a dependency file of the at least one target private dependency in a corresponding dependency mode.

[0019] In one or more embodiments, obtaining the dependency file of the at least one target private dependency in the corresponding dependency mode includes:

[0020] For any target private dependency of the at least one target private dependency, if the dependency mode is an engineering source code mode, obtaining an engineering source code dependency file of the any target private dependency;

[0021] If the dependency mode is the Android archive mode, then obtain the Android archive dependency file of any target private dependency.

[0022] In one or more embodiments, obtaining the engineering source code dependency file of any target private dependency includes:

[0023] Get the project source code dependency file of any target private dependency through the findProject() method;

[0024] The obtaining of the Android archive dependency file of any target private dependency includes:

[0025] Get the Android archive dependency file of any target private dependency through the rootProject.ext method.

[0026] In one or more embodiments, the project configuration file further records the dependency pattern; the dependency pattern is defined in the pattern configuration file of the project;

[0027] The obtaining of at least one dependency pattern corresponding to at least one target private dependency in the target public dependency group includes:

[0028] At least one dependency pattern corresponding to at least one target private dependency in the target public dependency group is obtained from the pattern configuration file.

[0029] In one or more embodiments, the multiple public dependency groups are defined in an ext object in the project configuration file, and the multiple private dependencies are defined outside the ext object in the project configuration file.

[0030] Accordingly, an embodiment of the present invention discloses a dependency construction device, characterized in that the device includes:

[0031] an acquisition module configured to acquire a project configuration file for a project and a line of business configuration file for a line of business in the project; wherein the project configuration file records a plurality of private dependencies and a plurality of public dependency groups, wherein any public dependency group in the plurality of public dependency groups includes at least one of the plurality of private dependencies; and the line of business configuration file records a target public dependency group required by the line of business;

[0032] The acquisition module is further configured to acquire the target private dependency corresponding to the target public dependency group required by the business line;

[0033] A construction module is used to construct a dependency relationship between the business line and the target private dependency.

[0034] In one or more embodiments, the acquisition module includes:

[0035] A search submodule, configured to search the project configuration file for the target public dependency group required by the business line;

[0036] A pattern acquisition submodule, configured to acquire at least one dependency pattern corresponding to at least one target private dependency in the target public dependency group;

[0037] The dependency acquisition submodule is used to obtain the dependency file of the at least one target private dependency in the corresponding dependency mode.

[0038] In one or more embodiments, the dependency acquisition submodule is specifically configured to:

[0039] For any target private dependency of the at least one target private dependency, if the dependency mode is the engineering source code mode, obtain the engineering source code dependency file of the any target private dependency; if the dependency mode is the Android archive mode, obtain the Android archive dependency file of the any target private dependency.

[0040] In one or more embodiments, the dependency acquisition submodule is specifically configured to:

[0041] The project source code dependency files of any target private dependency described by the findProject() method;

[0042] as well as,

[0043] Get the Android archive dependency file of any target private dependency through the rootProject.ext method.

[0044] In one or more embodiments, the project configuration file further records the dependency pattern; the dependency pattern is defined in the pattern configuration file of the project;

[0045] The mode acquisition submodule is specifically used to:

[0046] At least one dependency pattern corresponding to at least one target private dependency in the target public dependency group is obtained from the pattern configuration file.

[0047] In one or more embodiments, the multiple public dependency groups are defined in an ext object in the project configuration file, and the multiple private dependencies are defined outside the ext object in the project configuration file.

[0048] Accordingly, an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various steps of the above-mentioned construction dependency method embodiment are implemented.

[0049] Accordingly, an embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various steps of the above-mentioned embodiment of the method for constructing a dependency are implemented.

[0050] The embodiments of the present invention include the following advantages:

[0051] Obtain a project configuration file for the project, as well as a business line configuration file for the business line in the project; wherein the project configuration file records multiple private dependencies and multiple public dependency groups, and any public dependency group in the multiple public dependency groups includes at least one of the multiple private dependencies; the business line configuration file records the target public dependency group required by the business line; then obtain the target private dependency corresponding to the target public dependency group required by the business line, and establish a dependency relationship between the business line and the target private dependency. In this way, all individual dependencies and global objects are stored in the same project configuration file, and all individual dependencies are uniformly defined outside the global object, so that all individual dependencies can be uniformly managed, avoiding the problem of multiple version conflicts for the same dependency. At the same time, precisely because all individual dependencies are uniformly defined outside the global object, the business line cannot directly access the individual dependency, but instead accesses the public dependency group including multiple individual dependencies. Therefore, the business line cannot directly tamper with the individual dependency, nor can it directly access the individual dependency, thereby solving the problem of individual dependencies being unable to be managed, and the problem of one party modifying the version number when a single dependency is shared, forcing the dependencies of other business lines to be upgraded. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 is a flowchart of steps of an embodiment of a method for building a dependency of the present invention;

[0053] Figure 2 This is a schematic diagram of the structural framework of a construction dependency method of the present invention. Figure 1 ;

[0054] Figure 3 This is a schematic diagram of the structural framework of a construction dependency method of the present invention. Figure 2 ;

[0055] Figure 4 It is a structural block diagram of an embodiment of a construction-dependent device of the present invention. DETAILED DESCRIPTION

[0056] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0057] One of the core concepts of the embodiment of the present invention is to obtain a project configuration file of a project and a business line configuration file of a business line in the project; wherein the project configuration file records multiple private dependencies and multiple public dependency groups, and any public dependency group in the multiple public dependency groups includes at least one of the multiple private dependencies; the business line configuration file records the target public dependency group required by the business line; then obtain the target private dependency corresponding to the target public dependency group required by the business line, and establish a dependency relationship between the business line and the target private dependency. In this way, all individual dependencies and global objects are stored in the same project configuration file, and all individual dependencies are uniformly defined outside the global object, so that all individual dependencies can be uniformly managed, avoiding the problem of multiple version conflicts of the same dependency. At the same time, it is precisely because all individual dependencies are uniformly defined outside the global object that the business line cannot directly access the individual dependency, but instead accesses the public dependency group including multiple individual dependencies. Therefore, the business line cannot directly tamper with the individual dependency or directly access the individual dependency, thereby solving the problem of individual dependencies being unable to be managed and the problem of one party modifying the version number when the individual dependency is shared, forcing the dependencies of other business lines to be upgraded.

[0058] Reference Figure 1 , shows a flowchart of a method for building a dependency according to an embodiment of the present invention, which may specifically include the following steps:

[0059] Step 101: Obtain a project configuration file of a project and a business line configuration file of a business line in the project; wherein the project configuration file records multiple private dependencies and multiple public dependency groups, and any public dependency group in the multiple public dependency groups includes at least one of the multiple private dependencies; and the business line configuration file records a target public dependency group required by the business line;

[0060] Specifically, a project can be a target object for which dependencies need to be built. Building dependencies can be performed using Gradle, meaning that the project's configuration files can be retrieved through Gradle. Gradle is an open-source tool for automated builds based on the JVM (Java Virtual Machine). It uses a Groovy-based domain-specific language (DSL) to declare project settings, supports transitive dependency management, and eliminates the need for complex XML-based configuration.

[0061] Furthermore, the project configuration file may be config.gradle, which may be a lower-level configuration file of build.gradle. In the project configuration file, multiple private dependencies and multiple public dependency groups are recorded, and each public dependency group includes at least one of the multiple private dependencies.

[0062] For example, the private dependencies are A, B, and C, the public dependency group Biz_1 includes A, B, and C, and the public dependency group Biz_2 includes A.

[0063] In an embodiment of the present invention, the multiple public dependency groups are defined in the ext object in the project configuration file, and the multiple private dependencies are defined outside the ext object in the project configuration file.

[0064] Specifically, the project configuration file provides a global object, the ext object, in which you can define at least one private dependency for each public dependency group. Outside the ext object, you can define individual private dependencies using the def field.

[0065] For example, the specific content of a config.gradle is as follows:

[0066]

[0067] Among them, A, B, and C are private dependencies defined outside the ext global object, Biz_1 and Biz_2 are public dependency groups defined in the ext global object, Biz_1 includes private dependencies A, B, and C, Biz_2 includes private dependency A, a1 is the parameter value of A, b1 is the parameter value of B, and c1 is the parameter value of C.

[0068] Furthermore, a project can include business lines, each with a corresponding business line configuration file. This configuration file can also be a build.gradle file, which records the public dependency groups required by the business line. For example, if the build.gradle file for a business line contains "rootProject.ext.Biz_1," it means that the public dependency group required by the business line is Biz_1.

[0069] It's important to note that a project has a corresponding project interface, through which you can access the business lines within that project. Furthermore, the configuration file for that project interface contains a method for obtaining the public dependency group, which is "rootProject.ext" in the example above.

[0070] Furthermore, private dependencies in a project configuration file can be accessed by the public dependency group in the project configuration file, but cannot be accessed by the public dependency groups in other project configuration files. In this way, all individual dependencies and the ext global object are stored in the same config.gradle file. Moreover, they are uniformly defined outside the ext global object through the def field definition, so that all individual dependencies can be managed uniformly, avoiding the problem of multiple version conflicts of the same dependency.

[0071] For ease of understanding, Figure 2 A schematic diagram of projects, project interfaces, business lines, project configuration files and contents, project interface configuration files and contents, and business line configuration files and contents is shown. For details, please refer to the above content. To avoid repetition, it will not be described here.

[0072] Step 102: Obtain the target private dependency corresponding to the target public dependency group required by the business line;

[0073] After obtaining the business line configuration file, you can obtain the target public dependency group required by the business line and the target private dependencies in the target public dependency group based on the business line configuration file.

[0074] In the embodiment of the present invention, obtaining the target private dependency corresponding to the target public dependency group required by the business line includes:

[0075] Searching the target public dependency group required by the business line from the project configuration file;

[0076] Obtain at least one dependency pattern corresponding to at least one target private dependency in the target public dependency group;

[0077] Obtain a dependency file of the at least one target private dependency in a corresponding dependency mode.

[0078] Specifically, after obtaining the business line configuration file, determine the target public dependency group recorded in the business line configuration file, and then search for the target public dependency group from the project configuration file. After finding it, obtain the dependency pattern corresponding to each private dependency in the target public dependency group, and obtain the corresponding dependency file based on the dependency pattern of each private dependency.

[0079] In an embodiment of the present invention, the project configuration file further records the dependency pattern; the dependency pattern is defined in the pattern configuration file of the project;

[0080] The obtaining of at least one dependency pattern corresponding to at least one target private dependency in the target public dependency group includes:

[0081] At least one dependency pattern corresponding to at least one target private dependency in the target public dependency group is obtained from the pattern configuration file.

[0082] Specifically, the project configuration file also records the dependency mode (dependencyMode), and the dependency mode is defined in the project's mode configuration file (settings.gradle).

[0083] For example, the specific contents of the project settings.gradle are as follows:

[0084] include switches["M"]? "":"M"

[0085] include switches["N"]? "":"N"

[0086] Among them, two dependency modes, M and N, are defined.

[0087] The dependency pattern is recorded outside the ext object in the project configuration file. For example, the specific content of the project config.gradle is as follows:

[0088]

[0089] The parameter value of dependency mode M recorded in switches is AAR (Android Archive), indicating AAR mode. The parameter value of dependency mode N is empty, indicating project source code mode. In addition, private dependency A in the public dependency group Biz_1 adopts AAR mode, private dependency B adopts project source code mode, and private dependency C has no dependency mode recorded, so the default dependency mode can be used.

[0090] In this way, after finding the public dependency group, you can get the dependency pattern corresponding to each private dependency. For example, after finding Biz_1, you can get the dependency pattern corresponding to A, B, and C.

[0091] In an embodiment of the present invention, obtaining the dependency file of the at least one target private dependency in the corresponding dependency mode includes:

[0092] For any target private dependency of the at least one target private dependency, if the dependency mode is an engineering source code mode, obtaining an engineering source code dependency file of the any target private dependency;

[0093] If the dependency mode is the Android archive mode, then obtain the Android archive dependency file of any target private dependency.

[0094] Specifically, for any private dependency in each private dependency, if the dependency mode of that private dependency is project source code mode, then the project source code dependency file of that target private dependency is obtained; if the dependency mode of that private dependency is AAR mode, then the AAR dependency file of that target private dependency is obtained. This process can be repeated in this way to obtain all the dependency files required by the business line.

[0095] In an embodiment of the present invention, obtaining the engineering source code dependency file of any target private dependency includes:

[0096] The project source code dependency files of any target private dependency described by the findProject() method;

[0097] The obtaining of the Android archive dependency file of any target private dependency includes:

[0098] Get the Android archive dependency file of any target private dependency through the rootProject.ext method.

[0099] Specifically, when obtaining project source code dependency files, you can use the system's findProject() method to obtain them, and when obtaining AAR dependency files, you can use the system's rootProject.ext method to obtain them.

[0100] For ease of understanding, Figure 3 A schematic diagram of projects, project interfaces, business lines, project configuration files and contents, project interface configuration files and contents, business line configuration files and contents, and mode configuration files and contents is shown. Please refer to the above content for details. To avoid repetition, it will not be described here.

[0101] In this way, by defining multiple dependency patterns, building dependencies on business lines becomes simpler, more flexible, and safer, especially when there are a large number of business lines.

[0102] Step 103: Build a dependency relationship between the business line and the target private dependency.

[0103] Specifically, after obtaining all target private dependencies required by the business line, a dependency relationship between the business line and all target private dependencies is established, so that the business line can access the parameter values of all target private dependencies.

[0104] In an embodiment of the present invention, a project configuration file of a project and a business line configuration file of a business line in the project are obtained; wherein the project configuration file records multiple private dependencies and multiple public dependency groups, and any public dependency group in the multiple public dependency groups includes at least one of the multiple private dependencies; the business line configuration file records the target public dependency group required by the business line; then, the target private dependency corresponding to the target public dependency group required by the business line is obtained, and a dependency relationship between the business line and the target private dependency is established. In this way, all individual dependencies and global objects are stored in the same project configuration file, and all individual dependencies are uniformly defined outside the global object, so that all individual dependencies can be uniformly managed, avoiding the problem of multiple version conflicts of the same dependency. At the same time, it is precisely because all individual dependencies are uniformly defined outside the global object that the business line cannot directly access the individual dependency, but instead accesses the public dependency group including multiple individual dependencies. Therefore, the business line cannot directly tamper with the individual dependency or directly access the individual dependency, thereby solving the problem of individual dependencies being unable to be managed and the problem of one party modifying the version number when the individual dependency is shared, forcing the dependencies of other business lines to be upgraded.

[0105] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0106] Reference Figure 4 , shows a structural block diagram of an embodiment of a construction dependency device of the present invention, which may specifically include the following modules:

[0107] Acquisition module 401 is configured to acquire a project configuration file of a project and a line of business configuration file of a line of business in the project; wherein the project configuration file records multiple private dependencies and multiple public dependency groups, wherein any public dependency group in the multiple public dependency groups includes at least one of the multiple private dependencies; and the line of business configuration file records a target public dependency group required by the line of business;

[0108] The acquisition module is further configured to acquire the target private dependency corresponding to the target public dependency group required by the business line;

[0109] The construction module 402 is used to construct a dependency relationship between the business line and the target private dependency.

[0110] In an embodiment of the present invention, the acquisition module includes:

[0111] A search submodule, configured to search the project configuration file for the target public dependency group required by the business line;

[0112] A pattern acquisition submodule, configured to acquire at least one dependency pattern corresponding to at least one target private dependency in the target public dependency group;

[0113] The dependency acquisition submodule is used to obtain the dependency file of the at least one target private dependency in the corresponding dependency mode.

[0114] In an embodiment of the present invention, the dependency acquisition submodule is specifically configured to:

[0115] For any target private dependency of the at least one target private dependency, if the dependency mode is the engineering source code mode, obtain the engineering source code dependency file of the any target private dependency; if the dependency mode is the Android archive mode, obtain the Android archive dependency file of the any target private dependency.

[0116] In an embodiment of the present invention, the dependency acquisition submodule is specifically configured to:

[0117] The project source code dependency files of any target private dependency described by the findProject() method;

[0118] as well as,

[0119] Get the Android archive dependency file of any target private dependency through the rootProject.ext method.

[0120] In an embodiment of the present invention, the project configuration file further records the dependency pattern; the dependency pattern is defined in the pattern configuration file of the project;

[0121] The mode acquisition submodule is specifically used to:

[0122] At least one dependency pattern corresponding to at least one target private dependency in the target public dependency group is obtained from the pattern configuration file.

[0123] In an embodiment of the present invention, the multiple public dependency groups are defined in the ext object in the project configuration file, and the multiple private dependencies are defined outside the ext object in the project configuration file.

[0124] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0125] An embodiment of the present invention further provides an electronic device, including:

[0126] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-mentioned construction dependency method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0127] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned construction dependency method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0128] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0129] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, apparatus, or computer program products. Thus, embodiments of the present invention may take the form of a fully hardware embodiment, a fully software embodiment, or an embodiment combining software and hardware. Furthermore, embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0130] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the process in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0131] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1The function specified in one or more boxes.

[0132] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0133] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0134] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.

[0135] The above is a detailed introduction to a method for building dependencies and a device for building dependencies provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for building dependencies, characterized in that: The method comprises: Obtaining a project configuration file for a project and a line of business configuration file for a line of business in the project; wherein the project configuration file records a plurality of private dependencies and a plurality of public dependency groups, wherein any public dependency group in the plurality of public dependency groups includes at least one of the plurality of private dependencies; and wherein the line of business configuration file records a target public dependency group required by the line of business, wherein the plurality of public dependency groups are defined in a global object provided by the project configuration file, and the plurality of private dependencies are defined outside the global object; Obtain the target private dependency corresponding to the target public dependency group required by the business line; Establishing a dependency relationship between the business line and the target private dependency; The obtaining of the target private dependency corresponding to the target public dependency group required by the business line includes: Searching the target public dependency group required by the business line from the project configuration file; Obtaining at least one dependency pattern corresponding to at least one target private dependency in the target public dependency group; the dependency pattern is also recorded in the project configuration file; the dependency pattern is defined in the pattern configuration file of the project; Obtain a dependency file of the at least one target private dependency in a corresponding dependency mode.

2. The method for building dependencies according to claim 1, wherein: The obtaining of the dependency file of the at least one target private dependency in the corresponding dependency mode includes: For any target private dependency of the at least one target private dependency, if the dependency mode is an engineering source code mode, obtaining an engineering source code dependency file of the any target private dependency; If the dependency mode is the Android archive mode, then obtain the Android archive dependency file of any target private dependency.

3. The method for building dependencies according to claim 2, wherein: The obtaining of the engineering source code dependency file of any target private dependency includes: Get the project source code dependency file of any target private dependency through the findProject() method; The obtaining of the Android archive dependency file of any target private dependency includes: Get the Android archive dependency file of any target private dependency through the rootProject.ext method.

4. The method for building dependencies according to claim 1, wherein: The obtaining of at least one dependency pattern corresponding to at least one target private dependency in the target public dependency group includes: At least one dependency pattern corresponding to at least one target private dependency in the target public dependency group is obtained from the pattern configuration file.

5. The method for building dependencies according to claim 1, wherein: The multiple public dependency groups are defined in the ext object in the project configuration file, and the multiple private dependencies are defined outside the ext object in the project configuration file.

6. A construction dependency device, characterized in that: The device comprises: An acquisition module is configured to acquire a project configuration file of a project and a line of business configuration file of a line of business in the project; wherein the project configuration file records a plurality of private dependencies and a plurality of public dependency groups, wherein any public dependency group of the plurality of public dependency groups includes at least one of the plurality of private dependencies; and wherein the line of business configuration file records a target public dependency group required by the line of business, wherein the plurality of public dependency groups are defined in a global object provided by the project configuration file, and the plurality of private dependencies are defined outside the global object. The acquisition module is further configured to acquire the target private dependency corresponding to the target public dependency group required by the business line; A construction module, configured to construct a dependency relationship between the business line and the target private dependency; The acquisition module includes: A search submodule, configured to search the project configuration file for the target public dependency group required by the business line; A pattern acquisition submodule, configured to acquire at least one dependency pattern corresponding to at least one target private dependency in the target public dependency group; the dependency pattern is also recorded in the project configuration file; the dependency pattern is defined in the pattern configuration file of the project; The dependency acquisition submodule is used to obtain the dependency file of the at least one target private dependency in the corresponding dependency mode.

7. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the dependency construction method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the dependency construction method according to any one of claims 1 to 5 are implemented.