CN111679852B - Detection method and device for conflict dependency library - Google Patents

Detection method and device for conflict dependency library Download PDF

Info

Publication number
CN111679852B
CN111679852B CN202010474805.5A CN202010474805A CN111679852B CN 111679852 B CN111679852 B CN 111679852B CN 202010474805 A CN202010474805 A CN 202010474805A CN 111679852 B CN111679852 B CN 111679852B
Authority
CN
China
Prior art keywords
dependency
conflict
library
version number
dependency library
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010474805.5A
Other languages
Chinese (zh)
Other versions
CN111679852A (en
Inventor
况众文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN202010474805.5A priority Critical patent/CN111679852B/en
Publication of CN111679852A publication Critical patent/CN111679852A/en
Application granted granted Critical
Publication of CN111679852B publication Critical patent/CN111679852B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9032Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a detection method of a conflict dependency library, which comprises the steps of firstly, obtaining dependency trees corresponding to all service modules in an application program, then, determining the conflict dependency library according to the dependency trees, and comparing the highest version number of the conflict dependency library with the highest version number of the conflict dependency library recorded in a conflict dependency library white list to determine a target conflict dependency library. Therefore, the detection method of the conflict dependency library can accurately determine the target conflict dependency library without affecting the normal use of the conflict dependency library in the white list of the conflict dependency library, thereby ensuring the normal operation of the application program.

Description

Detection method and device for conflict dependency library
Technical Field
The present disclosure relates to the field of application program development technologies, and in particular, to a method and an apparatus for detecting a conflict dependency library.
Background
When developing an application program, as the application program becomes larger and larger, the application program contains more and more business modules, each business module may depend on multiple dependency libraries when compiled, and different business modules may depend on the same dependency library. When the dependency library is upgraded, if only the dependency library is upgraded to a higher version and the service modules which depend on the dependency library are not correspondingly upgraded, the service modules are defaulted to depend on the higher version of the dependency library under the principle of operating system dependency management default dependency high version dependency library, in this case, if the function modules still need to depend on the lower version of the dependency library, the service modules can not realize the dependency, so that the service modules can not realize the corresponding functions, and the dependency library is the conflict dependency library.
Therefore, when developing the application program, the conflict dependency libraries are found in time, and further operations such as upgrading or modifying the dependency relationship are performed on the service modules related to the conflict dependency libraries, which is an important point for maintaining the normal operation of the application program. Typically, the version of the dependency library on which each service module depends is forcibly specified by the resolution structure.force api, for example, the version of the dependency library on which each service module depends is manually modified, so that after the version of the dependency library is forcibly specified, the dependency relationship of the service module is not changed no matter how the version of the dependency library is upgraded, but the improvement of the overall performance of the application program is affected.
In order not to affect the performance upgrade of the application program, the default solution strategy can be modified in the application program development process, namely when the conflict dependency library appears after the dependency library upgrade, a version error prompt is sent out, and the operation of the service module or the application program is prevented until a developer repairs the conflict dependency library. However, since the service modules related to the application program are generally huge, the dependency libraries and the dependency relationships are also complex, and some conflict dependency libraries do not affect the operation of the whole application program or can hardly be repaired, if version error prompts are sent out for the conflict dependency libraries, the operation of the service modules or the application program is prevented, and the development progress of the application program is seriously affected.
Disclosure of Invention
The application provides a method and a device for detecting a conflict dependency library, so as to accurately determine the conflict dependency library which really needs to be modified.
In a first aspect, the present application provides a method for detecting a conflict dependency library, the method comprising:
acquiring a dependency tree corresponding to all service modules in an application program, wherein the dependency tree comprises dependency relations between all service modules and corresponding dependency libraries;
determining a conflict dependency library according to the dependency tree, wherein the conflict dependency library is a dependency library of which at least two versions are respectively depended on by different business modules;
obtaining the highest version number of each conflict-dependent library and the highest version number of each conflict-dependent library recorded in a conflict-dependent library white list;
detecting a target conflict dependency library according to the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in a conflict dependency library white list, wherein the target conflict dependency library is a dependency library corresponding to the highest version number of the conflict dependency library which is not recorded in the conflict dependency library white list.
Optionally, the obtaining the dependency tree corresponding to all the service modules in the application program includes:
creating a precompiled sentence according to a query sentence used for acquiring a dependency tree corresponding to all service modules, wherein when the precompiled sentence is created, the query sentence is sent to a database management system corresponding to the application program, the query sentence is compiled, the compiled query sentence is obtained, and the precompiled sentence is used for the database management system to call the compiled query sentence;
and calling the compiled query statement by using the precompiled statement to acquire dependency trees corresponding to all service modules in the application program from a database corresponding to the database management system.
Optionally, the determining the conflict dependency library according to the dependency tree includes:
obtaining dependency information corresponding to each business module from the dependency tree, wherein the dependency information comprises unique identifiers of groups of dependency libraries corresponding to the business modules, unique identifiers of the dependency libraries in the groups and version numbers of the dependency libraries;
and comparing the dependency information of each business module to determine a conflict dependency library, wherein the conflict dependency library is a dependency library which has the same unique identifier of the belonging group and the unique identifier in the belonging group and corresponds to at least two version numbers.
Optionally, the determining the conflict dependency library according to the dependency tree further includes:
and summarizing the unique identification of the group corresponding to each conflict dependency library, the unique identification of the conflict dependency library in the group and all version numbers corresponding to the conflict dependency library, and generating a linked list of the conflict dependency library.
Optionally, the obtaining the highest version number of each of the conflict dependent libraries, and the highest version number of each of the conflict dependent libraries recorded in the conflict dependent library whitelist includes:
acquiring the highest version number of each conflict dependency library from a linked list of the conflict dependency library;
determining all version numbers corresponding to the conflict dependent libraries from the conflict dependent library white list;
and acquiring the highest version number from all version numbers recorded in the conflict dependency library white list.
Optionally, the detecting the target conflict dependency library according to the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in the conflict dependency library white list includes:
and if the highest version number of the conflict dependent library is higher than the highest version number recorded in the conflict dependent library white list, the conflict dependent library is the target conflict dependent library.
In a second aspect, the present application provides a detection apparatus for a conflict dependency library, the apparatus comprising:
the dependency tree acquisition unit is used for acquiring dependency trees corresponding to all the service modules in the application program, wherein the dependency trees comprise dependency relations between all the service modules and corresponding dependency libraries;
a conflict dependency library determining unit, configured to determine a conflict dependency library according to the dependency tree, where the conflict dependency library is a dependency library on which at least two versions are respectively relied by different service modules;
the highest version number acquisition unit is used for acquiring the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in the conflict dependency library white list;
the detection unit is used for detecting a target conflict dependency library according to the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in the conflict dependency library white list, wherein the target conflict dependency library is a dependency library corresponding to the highest version number of the conflict dependency library which is not recorded in the conflict dependency library white list.
Optionally, the dependency tree acquisition unit includes:
the creating unit is used for creating a precompiled sentence according to the query sentence of the dependency tree corresponding to all the service modules, wherein when the precompiled sentence is created, the query sentence is sent to a database management system corresponding to the application program, the query sentence is compiled, the compiled query sentence is obtained, and the precompiled sentence is used for the database management system to call the compiled query sentence;
and the execution unit is used for calling the compiled query statement by utilizing the pre-compiled statement so as to acquire dependency trees corresponding to all service modules in the application program from a database corresponding to the database management system.
Optionally, the conflict dependency library determining unit includes:
a dependency information obtaining unit, configured to obtain dependency information corresponding to each service module from the dependency tree, where the dependency information includes a unique identifier of a group of a dependency library corresponding to the service module, a unique identifier of the dependency library in the group, and a version number of the dependency library;
the information comparison unit is used for comparing the dependency information of each business module to determine a conflict dependency library, wherein the conflict dependency library is a dependency library which has the same unique identifier of the belonging group and the unique identifier in the belonging group and corresponds to at least two version numbers.
Optionally, the conflict dependency library determining unit further includes:
the linked list generation unit is used for summarizing the unique identifier of the group corresponding to each conflict dependency library, the unique identifier of the conflict dependency library in the group and all version numbers corresponding to the conflict dependency library, and generating a linked list of the conflict dependency library.
Optionally, the highest version number obtaining unit includes:
the conflict dependency library highest version number acquisition unit is used for acquiring the highest version number of each conflict dependency library from a linked list of the conflict dependency library;
a version number acquisition unit in the white list, configured to determine all version numbers corresponding to the conflict dependency library from the conflict dependency library white list;
and the white list highest version number acquisition unit is used for acquiring the highest version number from all version numbers recorded in the conflict dependency library white list by the conflict dependency library.
Optionally, the detection unit includes:
and the judging unit is used for judging that the conflict dependent library is a target conflict dependent library if the highest version number of the conflict dependent library is higher than the highest version number recorded in the conflict dependent library white list.
In a third aspect, the present application provides an electronic device, including:
processor and method for controlling the same
A memory for storing executable instructions of the processor;
wherein the processor is configured to perform a respective detection method via execution of the executable instructions.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements a corresponding detection method.
The application provides a method for detecting a dependency library conflict, which comprises the steps of firstly, acquiring dependency trees corresponding to all service modules in an application program, then determining a conflict dependency library according to the dependency trees, and comparing the highest version number of the conflict dependency library with the highest version number of the conflict dependency library recorded in a conflict dependency library white list to determine a target conflict dependency library. Therefore, the method for detecting the dependency library conflict can accurately determine the target conflict dependency library without affecting the normal use of the conflict dependency library in the conflict dependency library white list, thereby ensuring the normal operation of the application program.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings that are needed in the embodiments will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flow chart of a method for detecting a conflict dependency library according to an embodiment of the present application;
FIG. 2 provides a flow chart of a method of pre-compiling a query statement;
FIG. 3 provides a flow chart of a method of determining a conflict dependency library;
FIG. 4 provides a flow chart of a method of obtaining the highest version number of a conflict dependency library;
FIG. 5 is a schematic structural diagram of an embodiment I of a detection apparatus for detecting a conflict dependency library according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a second embodiment of a detection apparatus for detecting a conflict dependency library according to the embodiment of the present application;
fig. 7 is a schematic structural diagram of a third embodiment of a detection apparatus for detecting a conflict dependency library according to the present application;
fig. 8 is a schematic structural diagram of an embodiment four of a detection apparatus for detecting a conflict dependency library according to the embodiment of the present application;
fig. 9 is a schematic structural diagram of an embodiment five of a detection apparatus for detecting a conflict dependency library according to the embodiment of the present application;
fig. 10 is a schematic structural diagram of an embodiment six of a detection apparatus for detecting a conflict dependency library according to the embodiment of the present application;
fig. 11 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 is a flow chart of a method for detecting a conflict dependency library according to an embodiment of the present application, as shown in fig. 1, where the method includes:
s1, acquiring a dependency tree corresponding to all service modules in an application program, wherein the dependency tree comprises dependency relations between all service modules and corresponding dependency libraries.
An application program generally comprises a plurality of service modules, each service module has a dependent dependency library, and different service modules also depend on the same dependency library, so that a relationship network formed by the dependency relationship between the service modules and the dependency libraries is a dependency tree. The dependency tree comprises a dependency relation character string and uses a code represented by a specific symbol and a retraction relation, and further, the dependency tree can also be a relation diagram established by adopting the pointing relation of the nodes of the image and the arrows, wherein the nodes are dependency libraries (service modules), the arrows represent the dependency relations, the nodes comprise the version numbers of the dependency libraries, and generally, different version numbers of the same dependency library correspond to different nodes.
Typically, dependency tree information may be obtained by script execution gradlew dependencies task, which is complete and accurate with the dependency tree information obtained by executing the script.
Further, a hook opportunity for executing the script may be configured, if the script for obtaining the dependency tree information is executed by adopting a normal execution method, that is, executing the query Statement through the state interface, at this time, the state interface needs to be created first, then the query Statement is sent to the database corresponding to the application program, then the query Statement is compiled, for example, the query Statement is parsed, the grammar and the semantics of the query Statement are checked, and the generated code is finally, the compiled query Statement is called and executed by using the state interface, but the process of compiling the query Statement consumes a great amount of time, so that the speed for obtaining the dependency tree information is seriously affected, and even the speed of the subsequent overall operation is affected.
In order to solve the above problem, in the embodiment of the present application, before the database management system executes the query statement, the query statement is compiled in advance, so that when the query statement is executed, the compiled query statement can be directly used without waiting for compiling the query statement in a time-consuming manner.
Specifically, fig. 2 provides a flowchart of a method for precompiled query terms, as shown in fig. 2, the method comprising:
s101, creating a precompiled sentence according to a query sentence used for acquiring a dependency tree corresponding to all service modules, wherein when the precompiled sentence is created, the query sentence is sent to a database management system corresponding to the application program, and the query sentence is compiled to obtain a compiled query sentence, and the precompiled sentence is used for the database management system to call the compiled query sentence;
s102, calling the compiled query statement by using the pre-compiled statement to acquire dependency trees corresponding to all service modules in the application program from a database corresponding to the database management system.
In general, development of an application program is a relatively long process, and during the development process, the application program needs to detect dependency library conflicts for all service modules even after each modification of each service module, so that the detection operation of the dependency library conflicts needs to be repeated multiple times, for example, the action of acquiring the dependency tree needs to be performed each time, and the detection operation is repeated multiple times. However, the statement format of the query statement corresponding to the acquisition dependency tree is fixed. Based on such an action of querying and acquiring information by changing parameters using the fixed sentence format, in order to reduce the time for compiling a query sentence, the query sentence may be executed using a precompiled sentence.
Specifically, first, a precompiled statement is established, the precompiled statement is an interface of a database management system, and the database management system can call and execute a corresponding query statement through the precompiled statement. Since the statement format of the dependency tree is known, query statements to be used can be specified, a precompiled statement is established, the query statements are sent to a database management system and compiled by the database management system, and when the precompiled statement is established, the query statements can be compiled, so that the database management system can execute the compiled query statements by directly utilizing the precompiled statements without waiting for compiling the query statements before executing the query statements, and the speed of acquiring the dependency tree is increased.
S2, determining a conflict dependency library according to the dependency tree, wherein the conflict dependency library is a dependency library of which at least two versions are respectively depended on by different business modules.
In general, the code in the dependency tree includes the name of the service module, the name of the dependency library on which the service module depends, and the version number of the dependent dependency library, so that by analyzing the dependency library, it is possible to clearly find a conflict dependency library on which at least two corresponding version numbers are dependent on different service modules. Or the dependency library is a relation diagram established by adopting the pointing relation of the nodes and the arrows of the images, and at the moment, the dependency library which has the same dependency library name and corresponds to a plurality of nodes at the same time can be accurately found from the relation diagram, namely the conflict dependency library.
Specifically, fig. 3 provides a flowchart of a method for determining a conflict dependency library, as shown in fig. 3, the method comprising:
s201, acquiring dependency information corresponding to each business module from the dependency tree, wherein the dependency information comprises unique identifiers of groups of dependency libraries corresponding to the business modules, unique identifiers of the dependency libraries in the groups and version numbers of the dependency libraries;
s202, comparing the dependency information of each business module to determine a conflict dependency library, wherein the conflict dependency library is a dependency library which has the same unique identifier of the belonging group and the unique identifier in the belonging group and corresponds to at least two version numbers.
The dependency tree includes dependency information corresponding to the service module, for example, a unique identifier of a group to which the dependency library belongs and a unique identifier of the dependency library in the group, and according to the two unique identifiers, a unique dependency library, that is, a name of the dependency library, can be located in the dependency tree. Meanwhile, the version number of the dependent version corresponding to each dependent library can be obtained from the dependency library, for example, the dependent library corresponding to the service module A is a, and the version number is a1; the dependency library corresponding to the service module B is a, and the version number is a3; the dependency library corresponding to the service module C is b, and the version number is b2.
By comparing the dependency information of each service module, it can be found that the service module a and the service module B depend on the same dependency library a, but depend on different versions, and thus, the dependency library a is a conflict dependency library. The dependent library b is only dependent by the business module c, and thus, the dependent library b is not a collision dependent library.
Further, a unique identifier of the group corresponding to each conflict dependency library, a unique identifier of the conflict dependency library in the group and all version numbers corresponding to the conflict dependency library are summarized, and a linked list of the conflict dependency library is generated. In this way, the management of conflict-dependent libraries may be facilitated.
And S3, obtaining the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in a conflict dependency library white list.
Because of the long-term development of the application program, the dependency relationship between the business module and the dependency library is complicated, and some dependency libraries are conflict dependency libraries, however, the developer is inconvenient to modify the dependency library, and in general, the conflict dependency libraries do not influence the normal running of the application program or influence the running of the application program within an allowable range, so that the conflict dependency libraries are considered to be allowed to exist, and the conflict dependency libraries which do not need to be modified are ignored in the application. The version numbers of these negligible conflict dependency libraries and the versions they depend on are recorded in a white list for subsequent use.
Firstly, the highest version number in the version on which the conflict dependency library is dependent is obtained from the above, then all corresponding version numbers are found from the conflict dependency library white list according to the name of the conflict dependency library, and the highest version number is further determined from the version numbers.
Further, as described above, if the conflict dependency library is summarized as a linked list of conflict dependency libraries, the version numbers of the conflict dependency libraries may be compared by a method, and fig. 4 provides a flowchart of a method for obtaining the highest version number of the conflict dependency library, as shown in fig. 4, where the method includes:
s301, acquiring the highest version number of each conflict dependency library from a linked list of the conflict dependency library;
s302, determining all version numbers corresponding to the conflict dependency library from the conflict dependency library white list;
s303, acquiring the highest version number from all version numbers recorded in the conflict dependency library white list by the conflict dependency library.
The list of the conflict dependency library summarizes the version numbers of the conflict dependency library to which the conflict dependency library depends, and the highest version number of the dependency can be obtained from the version numbers. Meanwhile, the unique identifiers of the groups corresponding to the conflict dependency library and the unique identifiers of the conflict dependency library in the groups are summarized in the linked list of the conflict dependency library, and the conflict dependency library can be uniquely determined through the two unique identifiers. Similarly, the conflict-dependent library white list also records the unique identifier of the group to which each conflict-dependent library corresponds and the unique identifier of the conflict-dependent library in the group to which each conflict-dependent library belongs, so that the information of the conflict-dependent library corresponding to the conflict-dependent library which is required to be detected in the conflict-dependent library white list, namely the version number of the conflict-dependent library recorded in the conflict-dependent library white list, can be determined uniquely through the two unique identifiers. Thus, by comparing the respective version numbers, the highest version number can be selected therefrom.
S4, detecting a target conflict dependency library according to the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in a conflict dependency library white list, wherein the target conflict dependency library is a dependency library corresponding to the highest version number of the conflict dependency library which is not recorded in the conflict dependency library white list.
Since the version number corresponds to the version number of the dependent library upgrade, wherein the higher the version number is, the higher the dependent library upgrade is represented, so that if the highest version number of the conflict dependent library is lower than or equal to the highest version number recorded in the conflict dependent library white list, the conflict dependent library is defaulted not to be upgraded, and therefore, the conflict dependent library is still in a range with negligible conflict relation; if the highest version number of the conflict dependency library is higher than the highest version number recorded in the white list of the conflict dependency library, the conflict dependency library is considered to be updated, and the updated version does not belong to the range with negligible conflict relation, so that the conflict dependency library is the target conflict dependency library.
Therefore, the method for detecting the dependence library conflict can accurately determine the target conflict dependence library without modifying the negligible conflict dependence library in the white list.
Fig. 5 is a schematic structural diagram of an embodiment one of a detection apparatus for detecting a conflict dependency library according to an embodiment of the present application, where the apparatus includes:
a dependency tree obtaining unit 1, configured to obtain a dependency tree corresponding to all service modules in an application program, where the dependency tree includes a dependency relationship between all service modules and a corresponding dependency library;
a conflict dependency library determining unit 2, configured to determine a conflict dependency library according to the dependency tree, where the conflict dependency library is a dependency library on which at least two versions are respectively relied by different service modules;
a highest version number obtaining unit 3, configured to obtain a highest version number of each of the conflict dependency stores, and a highest version number of each of the conflict dependency stores recorded in a white list of the conflict dependency stores;
and the detection unit 4 detects a target conflict dependency library according to the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in the conflict dependency library white list, wherein the target conflict dependency library is a dependency library corresponding to the highest version number of the conflict dependency library which is not recorded in the conflict dependency library white list.
Fig. 6 is a schematic structural diagram of an embodiment two of a detection apparatus for detecting a conflict dependency library according to the embodiment of the present application, where the dependency tree obtaining unit 1 includes:
a creating unit 11, configured to create a precompiled sentence according to a query statement for obtaining a dependency tree corresponding to all service modules, where when the precompiled sentence is created, send the query statement to a database management system corresponding to the application program, and compile the query statement to obtain a compiled query statement, where the precompiled statement is used by the database management system to call the compiled query statement;
and the execution unit 12 is configured to invoke the compiled query statement by using the precompiled statement, so as to obtain dependency trees corresponding to all service modules in the application program from a database corresponding to the database management system.
Fig. 7 is a schematic structural diagram of an embodiment three of a detection apparatus for detecting a conflict-dependent library provided in the embodiment of the present application, where the conflict-dependent-library determining unit 2 includes:
a dependency information obtaining unit 21, configured to obtain, from the dependency tree, dependency information corresponding to each service module, where the dependency information includes a unique identifier of a group of a dependency library corresponding to the service module, a unique identifier of the dependency library in the group, and a version number of the dependency library;
the information comparing unit 22 is configured to compare the dependency information of each service module, and determine a conflict dependency library, where the conflict dependency library is a dependency library having the same unique identifier of the group to which the conflict dependency library belongs and a unique identifier in the group to which the conflict dependency library belongs, and corresponds to at least two version numbers.
Fig. 8 is a schematic structural diagram of an embodiment four of a detection apparatus for detecting a conflict-dependent library provided in the embodiment of the present application, where the conflict-dependent-library determining unit 2 further includes:
the linked list generating unit 23 is configured to aggregate the unique identifier of the group to which each conflict dependency library corresponds, the unique identifier of the conflict dependency library in the group to which each conflict dependency library belongs, and all version numbers corresponding to the conflict dependency library, and generate a linked list of conflict dependency libraries.
Fig. 9 is a schematic structural diagram of an embodiment five of a detection apparatus for detecting a conflict dependency library provided in the embodiment of the present application, where the highest version number obtaining unit 3 includes:
a conflict dependency library highest version number obtaining unit 31, configured to obtain a highest version number of each conflict dependency library from a linked list of the conflict dependency library;
a version number obtaining unit 32 in the white list, configured to determine all version numbers corresponding to the conflict dependency library from the conflict dependency library white list;
a whitelist highest version number obtaining unit 33, configured to obtain the highest version number from all version numbers recorded in the whitelist of the conflict dependency library.
Fig. 10 is a schematic structural diagram of an embodiment six of a detection apparatus for detecting a conflict dependency library provided in the embodiment of the present application, where the detection unit 4 includes:
a judging unit 41, configured to, if the highest version number of the conflict-dependent library is higher than the highest version number recorded in the white list of the conflict-dependent library, determine that the conflict-dependent library is a target conflict-dependent library.
Fig. 11 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention, where the electronic device includes: a memory 101 and a processor 102;
a memory 101 for storing a computer program;
a processor 102 for executing a computer program stored in a memory to implement the method for detecting a dependency library conflict in the above-described embodiment. Reference may be made in particular to the relevant description of the embodiments of the method described above.
Alternatively, the memory 101 may be separate or integrated with the processor 102.
When the memory 101 is a device separate from the processor 102, the electronic device may further include:
a bus 103 for connecting said memory 101 and processor 102.
The electronic device provided in the embodiment of the present invention may be used to execute the method for detecting a dependency library conflict shown in any one of the foregoing embodiments, and its implementation manner and technical effects are similar, which is not described herein.
The embodiment of the invention also provides a readable storage medium, in which a computer program is stored, and when at least one processor of the message sending device executes the computer program, the message sending device executes the method for detecting the dependency library conflict according to any one of the above embodiments.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer-readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that modifications may be made to the technical solutions described in the foregoing embodiments, or equivalents may be substituted for some or all of the technical features thereof, without departing from the spirit of the technical solutions of the embodiments of the invention.

Claims (7)

1. A method for detecting a conflict-dependent library, the method comprising:
acquiring a dependency tree corresponding to all service modules in an application program, wherein the dependency tree comprises dependency relations between all service modules and corresponding dependency libraries;
determining a conflict dependency library according to the dependency tree, wherein the conflict dependency library is a dependency library of which at least two versions are respectively depended on by different business modules;
obtaining the highest version number of each conflict-dependent library and the highest version number of each conflict-dependent library recorded in a conflict-dependent library white list;
detecting a target conflict dependency library according to the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in a conflict dependency library white list, wherein the target conflict dependency library is a dependency library corresponding to the highest version number of the conflict dependency library which is not recorded in the conflict dependency library white list;
wherein said determining a conflict dependency library from said dependency tree comprises:
obtaining dependency information corresponding to each business module from the dependency tree, wherein the dependency information comprises unique identifiers of groups of dependency libraries corresponding to the business modules, unique identifiers of the dependency libraries in the groups and version numbers of the dependency libraries;
comparing the dependency information of each business module, and determining a conflict dependency library, wherein the conflict dependency library is a dependency library which has the same unique identifier of the group and the unique identifier in the group and corresponds to at least two version numbers;
the detecting the target conflict dependency library according to the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in the conflict dependency library white list comprises:
and if the highest version number of the conflict dependent library is higher than the highest version number recorded in the conflict dependent library white list, the conflict dependent library is the target conflict dependent library.
2. The method of claim 1, wherein the obtaining the dependency tree corresponding to all business modules in the application program comprises:
creating a precompiled sentence according to a query sentence used for acquiring a dependency tree corresponding to all service modules, wherein when the precompiled sentence is created, the query sentence is sent to a database management system corresponding to the application program, the query sentence is compiled, the compiled query sentence is obtained, and the precompiled sentence is used for the database management system to call the compiled query sentence;
and calling the compiled query statement by using the precompiled statement to acquire dependency trees corresponding to all service modules in the application program from a database corresponding to the database management system.
3. The method of claim 1, wherein said determining a conflict dependency library from said dependency tree further comprises:
and summarizing the unique identification of the group corresponding to each conflict dependency library, the unique identification of the conflict dependency library in the group and all version numbers corresponding to the conflict dependency library, and generating a linked list of the conflict dependency library.
4. The method of claim 3, wherein said obtaining a highest version number of each of said conflict-dependent libraries and a highest version number of each of said conflict-dependent libraries recorded in a conflict-dependent-library whitelist comprises:
acquiring the highest version number of each conflict dependency library from a linked list of the conflict dependency library;
determining all version numbers corresponding to the conflict dependent libraries from the conflict dependent library white list;
and acquiring the highest version number from all version numbers recorded in the conflict dependency library white list.
5. A device for detecting a collision dependency library, the device comprising:
the dependency tree acquisition unit is used for acquiring dependency trees corresponding to all the service modules in the application program, wherein the dependency trees comprise dependency relations between all the service modules and corresponding dependency libraries;
a conflict dependency library determining unit, configured to determine a conflict dependency library according to the dependency tree, where the conflict dependency library is a dependency library on which at least two versions are respectively relied by different service modules;
the highest version number acquisition unit is used for acquiring the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in the conflict dependency library white list;
the detection unit is used for detecting a target conflict dependency library according to the highest version number of each conflict dependency library and the highest version number of each conflict dependency library recorded in a conflict dependency library white list, wherein the target conflict dependency library is a dependency library corresponding to the highest version number of the conflict dependency library which is not recorded in the conflict dependency library white list;
the conflict dependency library determination unit is further configured to:
obtaining dependency information corresponding to each business module from the dependency tree, wherein the dependency information comprises unique identifiers of groups of dependency libraries corresponding to the business modules, unique identifiers of the dependency libraries in the groups and version numbers of the dependency libraries;
comparing the dependency information of each business module, and determining a conflict dependency library, wherein the conflict dependency library is a dependency library which has the same unique identifier of the group and the unique identifier in the group and corresponds to at least two version numbers;
the detection unit is further configured to:
and if the highest version number of the conflict dependent library is higher than the highest version number recorded in the conflict dependent library white list, determining the conflict dependent library as a target conflict dependent library.
6. An electronic device, the electronic device comprising:
processor and method for controlling the same
A memory for storing executable instructions of the processor;
wherein the processor is configured to perform the detection method of any one of claims 1-4 via execution of the executable instructions.
7. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the detection method according to any one of claims 1-4.
CN202010474805.5A 2020-05-29 2020-05-29 Detection method and device for conflict dependency library Active CN111679852B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010474805.5A CN111679852B (en) 2020-05-29 2020-05-29 Detection method and device for conflict dependency library

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010474805.5A CN111679852B (en) 2020-05-29 2020-05-29 Detection method and device for conflict dependency library

Publications (2)

Publication Number Publication Date
CN111679852A CN111679852A (en) 2020-09-18
CN111679852B true CN111679852B (en) 2023-06-02

Family

ID=72434423

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010474805.5A Active CN111679852B (en) 2020-05-29 2020-05-29 Detection method and device for conflict dependency library

Country Status (1)

Country Link
CN (1) CN111679852B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111158741B (en) * 2019-12-23 2024-04-12 北京五八信息技术有限公司 Method and device for monitoring dependency relationship change of service module on third party class library
CN113051004B (en) * 2021-03-30 2022-04-15 北京字节跳动网络技术有限公司 Processing method, device and equipment of dependence function and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110764778A (en) * 2019-10-21 2020-02-07 深圳市珍爱捷云信息技术有限公司 Pre-compiling method, device, equipment and storage medium in application construction

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10489150B2 (en) * 2015-05-05 2019-11-26 Netflix, Inc. Software dependency shading
US9720688B1 (en) * 2016-01-25 2017-08-01 International Business Machines Corporation Extensible change set conflict and merge gap detection
CN110007920B (en) * 2018-01-04 2022-07-29 阿里巴巴集团控股有限公司 Method and device for acquiring code dependency relationship and electronic equipment
CN108334334B (en) * 2018-03-07 2022-02-01 政采云有限公司 Method and system for managing dependent package version
CN108628751B (en) * 2018-05-17 2021-06-11 北京三快在线科技有限公司 Useless dependency item detection method and device
CN110825377A (en) * 2018-08-07 2020-02-21 北京国双科技有限公司 Dependency conflict analysis method and device
CN109284125A (en) * 2018-08-14 2019-01-29 中国平安人寿保险股份有限公司 Dependence packet configuration method, device, equipment and medium in big data platform
CN109683954A (en) * 2018-12-29 2019-04-26 北京小米移动软件有限公司 The library lib integrated approach, device and storage medium
CN111158741B (en) * 2019-12-23 2024-04-12 北京五八信息技术有限公司 Method and device for monitoring dependency relationship change of service module on third party class library

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110764778A (en) * 2019-10-21 2020-02-07 深圳市珍爱捷云信息技术有限公司 Pre-compiling method, device, equipment and storage medium in application construction

Also Published As

Publication number Publication date
CN111679852A (en) 2020-09-18

Similar Documents

Publication Publication Date Title
CN103064720B (en) The JIT code building of profile guiding
US8434054B2 (en) System and method for managing cross project dependencies at development time
KR100995199B1 (en) Reflection-based processing of input parameters for commands
KR101036679B1 (en) Test case inheritance controlled via attributes
US20090249368A1 (en) Runtime Code Hooking
JP2021002317A (en) Method, apparatus, device and storage medium for upgrading application
CN111158741B (en) Method and device for monitoring dependency relationship change of service module on third party class library
US7765520B2 (en) System and method for managing cross project dependencies at development time
CN111679852B (en) Detection method and device for conflict dependency library
US20080141219A1 (en) Multiple inheritance facility for java script language
US11422917B2 (en) Deriving software application dependency trees for white-box testing
CN111240772A (en) Data processing method and device based on block chain and storage medium
US20120311552A1 (en) Runtime optimization of application bytecode via call transformations
US20210232378A1 (en) Program calling, electronic device, and storage medium
US9841982B2 (en) Locating import class files at alternate locations than specified in classpath information
CN112668008A (en) Method for realizing dynamic system call hijacking based on LSM
CN111240728A (en) Application program updating method, device, equipment and storage medium
JP5377522B2 (en) Efficiently correlate nominally incompatible types
CN109426546B (en) Application starting method and device, computer storage medium and equipment
CN111796832B (en) Hot patch file generation method, device, equipment and storage medium
CN114706586A (en) Code compiling method, code running method, code compiling device, code running device, computer equipment and storage medium
CN109308256B (en) Dynamic analysis method, equipment and storage medium for java program
CN112579156A (en) Processing system, processing method, processing device and processing equipment of business event
US7082376B1 (en) State full test method executor
CN115729560B (en) Program code processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant