CN111158741A - Method and device for monitoring change of dependency relationship of business module on third-party class library - Google Patents

Method and device for monitoring change of dependency relationship of business module on third-party class library Download PDF

Info

Publication number
CN111158741A
CN111158741A CN201911340722.0A CN201911340722A CN111158741A CN 111158741 A CN111158741 A CN 111158741A CN 201911340722 A CN201911340722 A CN 201911340722A CN 111158741 A CN111158741 A CN 111158741A
Authority
CN
China
Prior art keywords
service module
version data
code
information
gradle
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.)
Granted
Application number
CN201911340722.0A
Other languages
Chinese (zh)
Other versions
CN111158741B (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 CN201911340722.0A priority Critical patent/CN111158741B/en
Publication of CN111158741A publication Critical patent/CN111158741A/en
Application granted granted Critical
Publication of CN111158741B publication Critical patent/CN111158741B/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a method and a device for monitoring the change of a dependency relationship of a business module on a third-party class library, wherein first version data before code change and second version data after code change of a target business module with code change in an application program are obtained. And then, extracting first dependency information from the first version data of each target service module, extracting second dependency information from the second version data of each target service module, and comparing the first dependency information and the second dependency information of each target service module to obtain a comparison result. And finally, monitoring the change of the dependency relationship of each target service module on the third-party class library according to the comparison result of each target service module. Therefore, the method provided by the application can effectively and integrally monitor the change condition of the business module in the application program on the dependency relationship of the third-party class library.

Description

Method and device for monitoring change of dependency relationship of business module on third-party class library
Technical Field
The application relates to the technical field of application program development, in particular to a method and a device for monitoring the change of a dependency relationship of a business module on a third-party class library.
Background
The normal operation of the application program needs the support of a plurality of service modules to meet various requirements of users, for example, the application program a needs to meet the requirements of users for photographing, positioning, searching and the like, and the corresponding requirements in the application program a have service modules corresponding to photographing, positioning and searching. The photographing service module is usually a native application of the device where the application program is located, that is, the application program a may directly invoke the photographing function of the device. However, the function of the positioning service module needs to call a third-party library, such as various map software, to implement the positioning function, and at this time, the call relationship between the positioning service module and these third-party libraries is the dependency relationship. In order to meet the changing demands of users, developers need to continuously update each business module in the application program.
Generally, a developer uploads update codes corresponding to a service module to be changed to a wireless application version management platform, and a reviewer reviews the update codes. Specifically, the update code corresponding to the service module to be changed may cause the dependency relationship between the service module and the third-party class library to be changed, for example, the third-party class library N is called before the service module P is changed, but after the service module P is changed, the third-party class library M is called; or the calling method of the service module P to the third-party class library N before the change is a, but the calling method of the service module P to the third-party class library N after the change is b. Because there is also a coupling relationship between the service modules, that is, the application program needs to be matched between the service modules when the user needs to be completed, and meanwhile, there is a calling relationship between the service modules because of this matching relationship, if the dependency relationship of a certain service module after being changed changes, it is easy for a plurality of service modules to call a certain third-party class library or call a calling path corresponding to a certain calling method at the same time in the running process, so that the calling process conflicts. Therefore, the auditor needs to compare whether there is a difference between each update code and its corresponding original code to determine whether the dependency relationship of the business module on the third-party class library changes.
However, many updated codes are difficult to find and prone to errors because of the small differences between the updated codes and the original codes. Moreover, the update of one application program may involve a plurality of business modules at the same time, and it is difficult for this auditing manner to integrally monitor changes in the dependency relationship of all business modules in the application program on the third-party class library.
Disclosure of Invention
The application provides a method and a device for monitoring the change of the dependency relationship of a business module on a third-party class library, which can effectively monitor the change of the dependency relationship of the business module on the third-party class library in an application program integrally and improve the monitoring accuracy.
In a first aspect, the present application provides a method for monitoring a change in a dependency relationship of a business module on a third-party class library, including:
acquiring first version data before code change and second version data after code change of each target business module in an application program, wherein the target business module is a business module with code change;
extracting first dependency information from the first version data of each target service module, and extracting second dependency information from the second version data of each target service module, wherein the first dependency information is a calling relationship between the target service module before changing a code and a third party library, and the second dependency information is a calling relationship between the target service module after changing the code and the third party library;
comparing the first dependency information and the second dependency information of each target service module to obtain a comparison result;
and monitoring the change of the dependency relationship of each target service module on the third-party class library according to the comparison result of each target service module.
In a possible implementation manner of the first aspect of the embodiment of the present invention, the obtaining first version data and second version data corresponding to a target service module in an application includes:
acquiring service module information of each target service module in an application program, wherein the service module information comprises a code bin identifier, a main bin identifier and an auxiliary bin identifier, the main bin identifier corresponds to first version data, the code bin identifier is used for identifying a corresponding code bin in a code library formed by the code bins corresponding to all service modules of the application program, the main bin is used for storing the first version data of the service module, and the auxiliary bin is used for storing the second version data of the service module;
determining a code bin corresponding to the target service module in the code base according to the code bin identification;
and extracting first version data from the code bin of each target service module according to the main bin identification corresponding to each target service module, and extracting second version data from the code bin of each target service module according to the auxiliary bin identification corresponding to each target service module.
In a possible implementation manner of the first aspect of the embodiment of the present invention, the extracting first dependency information from the first version data of each target service module, and extracting second dependency information from the second version data of each target service module includes:
extracting first jar packet information and first build gradle file information from first version data, wherein the first jar packet information comprises the number of first jar packets and the name of the first jar packets, the first build gradle file information comprises the name of a third-party class library called by a first gradle command, and the number of the first jar packets, the name of the first jar packets and the name of the third-party class library called by the first gradle command are used as first dependency information;
extracting second jar packet information and second build gradle file information from second version data, wherein the second jar packet information comprises the number of second jar packets and the name of the second jar packets, the second build gradle file information comprises the name of a third party class library called by a second gradle command, and the number of the second jar packets, the name of the second jar packets and the name of the third party class library called by the second gradle command are used as second dependency information.
In a possible implementation manner of the first aspect of the embodiment of the present invention, the extracting the first build gram file information from the first version data and the extracting the second build gram file information from the second version data includes:
and respectively matching the first version data and the second version data by using a preset regular expression, and determining the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command, wherein the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command are matched with the name extraction format of the preset regular expression.
In a possible implementation manner of the first aspect of the embodiment of the present invention, the method further includes:
and generating prompt information aiming at the problem service module, wherein the problem service module is a target service module with at least one of the number of jar packages, the names of jar packages and the names of the third-party class libraries called by the gradle command changed.
In a second aspect, the present application provides an apparatus for monitoring a change in a dependency relationship of a business module on a third-party class library, including:
the version data acquisition unit is used for acquiring first version data before code change and second version data after code change of each target business module in the application program, wherein the target business module is a business module with code change;
the dependency information extraction unit is used for extracting first dependency information from the first version data of each target service module and extracting second dependency information from the second version data of each target service module, wherein the first dependency information is a calling relationship between the target service module and a third party library before a code is changed, and the second dependency information is a calling relationship between the target service module and the third party library after the code is changed;
the information comparison unit is used for comparing the first dependency information and the second dependency information of each target service module to obtain a comparison result;
and the monitoring unit is used for monitoring the change of the dependency relationship of each target service module on the third-party class library according to the comparison result of each target service module.
In a possible implementation manner of the second aspect of the embodiment of the present invention, the version data acquiring unit includes: the service module information acquisition unit is used for acquiring service module information of each target service module in an application program, wherein the service module information comprises a code bin identifier, a main bin identifier and an auxiliary bin identifier corresponding to first version data, the code bin identifier is used for identifying a corresponding code bin in a code library consisting of code bins corresponding to all service modules of the application program, the main bin is used for storing the first version data of the service module, and the auxiliary bin is used for storing the second version data of the service module;
a code bin determining unit, configured to determine, in the code library according to the code bin identifier, a code bin corresponding to the target service module;
and the version data extraction unit is used for extracting first version data from the code bin of each target business module according to the main bin identification corresponding to each target business module, and extracting second version data from the code bin of each target business module according to the auxiliary bin identification corresponding to each target business module.
In a possible implementation manner of the second aspect of the embodiment of the present invention, the dependency information extracting unit includes:
the first extraction unit is used for extracting first jar packet information and first build gradle file information from first version data, wherein the first jar packet information comprises the number of first jar packets and the names of the first jar packets, the first build gradle file information comprises the names of third-party libraries called through first gradle commands, and the number of the first jar packets, the names of the first jar packets and the names of the third-party libraries called through the first gradle commands are used as first dependency information;
the second extraction unit is used for extracting second jar packet information and second build gradle file information from second version data, wherein the second jar packet information comprises the number of second jar packets and the names of the second jar packets, the second build gradle file information comprises the names of third party libraries called through second gradle commands, and the number of the second jar packets, the names of the second jar packets and the names of the third party libraries called through the second gradle commands are used as second dependency information.
In a possible implementation manner of the second aspect of the embodiment of the present invention, the first extraction unit and the second extraction unit each include:
the regular matching unit is used for respectively matching the first version data and the second version data by using a preset regular expression, determining the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command, and matching the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command with the name extraction format of the preset regular expression.
In a possible implementation manner of the second aspect of the embodiment of the present invention, the apparatus further includes:
and the prompt information generating unit is used for generating prompt information aiming at the problem service module, wherein the problem service module is a target service module with at least one of the number of jar packages, the name of jar packages and the name of a third-party class library called by a gradle command changed.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
a processor, and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of monitoring business module for third party class library dependency changes via execution of the executable instructions.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for monitoring a change in a dependency relationship between a business module and a third-party class library.
The application provides a method and a device for monitoring the change of a dependency relationship of a business module on a third-party class library, wherein first version data before code change and second version data after code change of a target business module with code change in an application program are obtained. And then, extracting first dependency information from the first version data of each target service module, extracting second dependency information from the second version data of each target service module, and comparing the first dependency information and the second dependency information of each target service module to obtain a comparison result. And finally, monitoring the change of the dependency relationship of each target service module on the third-party class library according to the comparison result of each target service module. Therefore, the method provided by the application can effectively and integrally monitor the change of the dependency relationship of the business module in the application program on the third-party class library, and improves the monitoring accuracy by accurately extracting the dependency information.
Drawings
In order to more clearly explain the technical solution of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to the drawings without any creative effort.
Fig. 1 is a flowchart of a method for monitoring a change in a dependency relationship between a business module and a third-party class library according to an embodiment of the present application;
fig. 2 is a flowchart of a method for acquiring first version data and second version data corresponding to a target service module in an application according to an embodiment of the present application;
fig. 3 is a flowchart of a method for extracting dependency information according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a first apparatus for monitoring a change in a dependency relationship between a service module and a third-party class library according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a second apparatus for monitoring a change in a dependency relationship between a service module and a third-party class library according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a third embodiment of a device for monitoring a change in a dependency relationship between a service module and a third-party class library according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a fourth embodiment of an apparatus for monitoring a change in a dependency relationship between a service module and a third-party class library according to the embodiment of the present application;
fig. 8 is a schematic structural diagram of a fifth embodiment of an apparatus for monitoring a change in a dependency relationship between a service module and a third-party class library according to an embodiment of the present application;
fig. 9 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of a method for monitoring a change in a dependency relationship of a service module on a third-party class library according to an embodiment of the present application, where as shown in fig. 1, the method provided in this embodiment includes:
s1, acquiring first version data before code change and second version data after code change of each target business module in the application program, wherein the target business module is a business module with code change.
The normal operation of the application program needs the support of a plurality of service modules to meet various requirements of users, for example, the application program a needs to meet the requirements of users for photographing, positioning, searching and the like, and the corresponding requirements in the application program a have service modules corresponding to photographing, positioning and searching. The photographing service module is usually a native application of the device where the application program is located, that is, the application program a may directly invoke the photographing function of the device. However, the function of the positioning service module needs to call a third-party library, such as various map software, to implement the positioning function, and at this time, the call relationship between the positioning service module and these third-party libraries is the dependency relationship. In order to meet the changing demands of users, developers need to continuously update each business module in the application program.
And the service module generates code change, namely iteration corresponding to the version of the service module, wherein the code change of the version of the service module can be addition of the service module, deletion of the service module or change of a calling relation or a calling method of a third-party class library in the existing service module. Generally, a developer may first upload changed codes, that is, second version data corresponding to a service module that needs to be changed to a wireless application version management platform, where the wireless application version management platform may employ an AVM platform, and may be used for code submission process management, such as code submission, test submission, code REVIEW, code merging, package inspection, and the like, and generally relies on GitLab development. And the auditor audits the second version data. The business modules with the code changes are target business modules, and the abnormal operation of the application program after the version is updated is mainly caused by the change of the dependency relationship between the business modules and the third-party class library, so that the corresponding business modules with the code changes can effectively monitor the whole operation state of the application program by mainly monitoring the version update of the application program every time. Therefore, the workload of each monitoring can be effectively reduced, and the monitoring efficiency is improved. Furthermore, the version data of the target service module before the code is changed is the first version data, and the first version data is used as a comparison basis, so that whether the dependency relationship between a certain block of the target service after the code is changed and the third-party class library is changed or not can be effectively determined. The first version data and the second version data may be stored in a code form, a file form, or the like.
Specifically, as shown in fig. 2, a flowchart of a method for acquiring a first version data and a second version data corresponding to a target service module in an application provided by the present application is provided, where the method includes:
s101, obtaining service module information of each target service module in an application program, wherein the service module information comprises code bin identifications, main bin identifications corresponding to first version data and auxiliary bin identifications, the code bin identifications are used for identifying corresponding code bins in a code base formed by the code bins corresponding to all service modules of the application program, the main bin is used for storing the first version data of the service module, and the auxiliary bins are used for storing the second version data of the service module.
The service module information may also be referred to as project information, and the service module information at least includes a code bin identifier, a main bin identifier corresponding to the first version data, and a sub bin identifier. The code bin identifier may also be referred to as project ID, and in general, the application program is composed of a plurality of business modules, and each business module corresponds to one code bin, and the code bin is used for storing all codes of the business module, so that the application program corresponds to the plurality of code bins, and a set composed of all the code bins is defined as a code library of the application program. It should be noted that, in the present application, the code bin corresponding to each service module is composed of a main bin and an auxiliary bin, where the main bin is used to store a code before a code change occurs in the service module, that is, first version data, and the auxiliary bin is used to store a code after a code change occurs in the service module, that is, second version data. Therefore, before the second version data is approved, the second version data is clearly distinguished from the first version data for storage, and management of the two version data is facilitated. Meanwhile, compared with the code change operation of the existing business module, the second version data is directly written into the AVM, and the second version data is written into the auxiliary bin of the corresponding business module, so that the correspondence between the second version data and the business module is increased, the follow-up comparison operation is more targeted, and the accuracy of the comparison result is improved.
The service module information may be expressed in the following manner,
params=[{project_id:12360,branch:["release-8.11.0","f-test-8.11.0"]},
wherein params represents service module information, project _ id represents code bin identification, branch represents branch, release-8.11.0 represents main bin identification, and f-test-8.11.0 represents auxiliary bin identification.
And S102, determining a code bin corresponding to the target service module in the code base according to the code bin identification.
Because the code bin identifications and the code bins have a one-to-one mapping relation, the corresponding code bins can be accurately matched from the code library by using the code bin identifications.
S103, extracting first version data from the code bin of each target service module according to the main bin identification corresponding to each target service module, and extracting second version data from the code bin of each target service module according to the auxiliary bin identification corresponding to each target service module.
The codes in the code bins can be distinguished by the main bin identification and the auxiliary bin identification, so that first version data can be correspondingly extracted from the main bin, and second version data can be correspondingly extracted from the auxiliary bin.
S2, extracting first dependency information from the first version data of each target service module, and extracting second dependency information from the second version data of each target service module, wherein the first dependency information is a calling relationship between the target service module before code change and a third party library, and the second dependency information is a calling relationship between the target service module after code change and the third party library.
After the first version data and the second version data are accurately obtained through the steps, since the calling relationship between the service module and the third-party class library, that is, the dependency relationship is the key point of comparison, it is necessary to extract the first dependency information from the first version data and extract the second dependency information from the second version data.
The first dependency information and the second dependency information reflect the calling relationship between the target service module and the third-party class library before and after the code change, for example, the third-party class library N is called before the target service module P is changed, but after the change, the third-party class library M is called by the service module P; or the calling method of the service module P to the third-party class library N before the change is a, but the calling method of the service module P to the third-party class library N after the change is b.
Specifically, as shown in fig. 3, a flowchart of a method for extracting dependency information provided in an embodiment of the present application is provided, where the method includes:
s201, extracting first jar packet information and first build gradle file information from first version data, wherein the first jar packet information comprises the number of first jar packets and the names of the first jar packets, the first build gradle file information comprises the names of third-party libraries called through first gradle commands, and the number of the first jar packets, the names of the first jar packets and the names of the third-party libraries called through the first gradle commands are used as first dependency information;
s202, extracting second jar packet information and second build gradle file information from second version data, wherein the second jar packet information comprises the number of second jar packets and the names of the second jar packets, the second build gradle file information comprises the names of third-party libraries called through second gradle commands, and the number of the second jar packets, the names of the second jar packets and the names of the third-party libraries called through the second gradle commands are used as second dependency information.
Generally, the service module calls the third-party class library in two modes, the first mode is that the third-party class library is called through a gradle command, the second mode is that the third-party class library is called through a jar file, correspondingly, for the first calling mode, a build gradle file appears in the first version data and the second version data, and the build gradle file at least comprises the name of the called third-party class library and can also comprise a specific code of the gradle command; for the second calling mode, jar packages appear in the first version data and the second version data, and the jar packages are usually located in the libs directory, wherein the calling relationship between the target service module and the third party class library is closely related to the number and the name of the jar packages by a method for calling the third party class library by the jar packages, specifically, the number of the third party class libraries which are usually called and the number of the jar packages have a corresponding relationship, and meanwhile, the name of the third party class library which is called and the name of the jar packages have a corresponding relationship.
Through the analysis, the dependency relationship between the target service module and the third-party class library can be accurately judged through the number of jar packages, the names of jar packages and the names of the third-party class libraries called through the gradle command, so that the relevant parameters can be extracted from the first version data and the second version data only to serve as data bases for monitoring, the code amount of the data to be analyzed is greatly reduced, and the monitoring efficiency can be improved.
Further, the first version data and the second version data may be respectively matched by using a preset regular expression, and a name of a third-party class library called by a first gradle command and a name of a third-party class library called by a second gradle command are determined, where the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command match with the name extraction format of the preset regular expression.
In general, the build gradle file information extracted from the first version data and the second version data is in the following format,
Figure BDA0002332183170000091
it can be seen that the code amount of the build gram file information is large, it is difficult to obtain the name of the third-party class library from the build gram file information, and in order to more conveniently and accurately obtain the name of the third-party class library, required dependent data can be matched in the build gram file by using a regular expression, for example, the regular expression is
var reg=/(|\n)*(?<!(\/\/(.*))|(\/\*\*(.*)))compile('|\('|'|"|").*('|\)|")/g
Dependent data can be obtained through the matching function of the regular expression
compile'com.alibaba.android:tangram:2.2.3@aar'
compile'com.alibaba.android:tangram:2.2.4@aar'
Therefore, the code quantity of the dependent data obtained after the regular expression matching is utilized is obviously reduced, the data is more regular, and the names of the third-party class libraries matched with the name extraction format of the regular expression can be quickly obtained by the dependent data.
And S3, comparing the first dependency information and the second dependency information of each target service module to obtain a comparison result.
And S4, monitoring the change of the dependency relationship of each target service module on the third-party class library according to the comparison result of each target service module.
And judging whether the first dependency information and the second dependency information of each target service module are changed or not by comparing the first dependency information and the second dependency information of each target service module, and obtaining a comparison result, wherein the comparison result comprises a change and an unchanged change. Therefore, by monitoring each target business module in the application program at the same time, the application program can be monitored globally.
Further, after the comparison result is obtained, prompt information is generated for a problem service module, wherein the problem service module is a target service module in which at least one of the number of jar packages, the names of jar packages and the names of third-party class libraries called through a gradle command changes.
Therefore, the problem of the second version data of the developer can be timely reminded, so that the developer is prevented from mistakenly merging the second version data corresponding to the problem business module into the application program, and larger loss is caused. Further, specific problem data, such as the name of a problem service module, the name of a changed jar package and/or the name of a changed third party class library, can be carried in the prompt message, so that a developer can more quickly position the problem data to perform development and modification operations.
Fig. 4 is a schematic structural diagram of a first embodiment of a device for monitoring a change in a dependency relationship between a service module and a third-party class library, provided in the embodiment of the present application, where the device includes: the version data acquiring unit 1 is used for acquiring first version data before code change and second version data after code change of each target business module in an application program, wherein the target business module is a business module with code change; the dependency information extraction unit 2 is configured to extract first dependency information from the first version data of each target service module, and extract second dependency information from the second version data of each target service module, where the first dependency information is a calling relationship between the target service module and a third-party class library before changing a code, and the second dependency information is a calling relationship between the target service module and the third-party class library after changing the code; the information comparison unit 3 is used for comparing the first dependency information and the second dependency information of each target service module to obtain a comparison result; and the monitoring unit 4 is used for monitoring the change of the dependency relationship of each target service module on the third-party class library according to the comparison result of each target service module.
Fig. 5 is a schematic structural diagram of a second embodiment of an apparatus for monitoring a change in a dependency relationship between a service module and a third-party class library provided in an embodiment of the present application, where the version data acquiring unit 1 includes: a service module information obtaining unit 11, configured to obtain service module information of each target service module in an application program, where the service module information includes a code bin identifier, a main bin identifier corresponding to first version data, and an auxiliary bin identifier, the code bin identifier is used to identify a corresponding code bin in a code library formed by code bins corresponding to all service modules of the application program, the main bin is used to store the first version data of a service module, and the auxiliary bin is used to store the second version data of the service module; a code bin determining unit 12, configured to determine, in the code library according to the code bin identifier, a code bin corresponding to the target service module; and the version data extraction unit 13 is configured to extract first version data from the code bin of each target service module according to the main bin identifier corresponding to each target service module, and extract second version data from the code bin of each target service module according to the auxiliary bin identifier corresponding to each target service module.
Fig. 6 is a schematic structural diagram of a third embodiment of an apparatus for monitoring a change in a dependency relationship between a service module and a third-party class library provided in an embodiment of the present application, where the dependency information extraction unit 2 includes: a first extracting unit 21, configured to extract first jar packet information and first build gradle file information from the first version data, where the first jar packet information includes a number of first jar packets and a name of the first jar packets, the first build gradle file information includes a name of a third-party class library invoked by a first gradle command, and the number of first jar packets, the name of the first jar packets, and the name of the third-party class library invoked by the first gradle command are used as first dependency information; the second extracting unit 22 is configured to extract second jar packet information and second build gradle file information from the second version data, where the second jar packet information includes the number of second jar packets and the name of the second jar packets, the second build gradle file information includes the name of a third-party class library called by a second gradle command, and the number of second jar packets, the name of the second jar packets, and the name of the third-party class library called by the second gradle command are used as second dependency information.
Fig. 7 is a schematic structural diagram of a fourth embodiment of the apparatus for monitoring a change in a dependency relationship between a service module and a third-party class library according to the embodiment of the present application, where the first extraction unit 21 and the second extraction unit 22 both include: the regular matching unit 23 is configured to match the first version data and the second version data respectively by using a preset regular expression, and determine a name of a third-party class library called by a first gradle command and a name of a third-party class library called by a second gradle command, where the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command are matched with the name extraction format of the preset regular expression.
Fig. 8 is a schematic structural diagram of a fifth embodiment of a device for monitoring a change in a dependency relationship between a service module and a third-party class library, provided in the embodiment of the present application, where the device further includes: and the prompt information generating unit 5 is configured to generate prompt information for a problem service module, where the problem service module is a target service module in which at least one of the number of jar packages, the name of jar packages, and the name of a third-party class library called by a gradle command changes.
Fig. 9 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. The electronic device includes: a memory 101 and a processor 102;
a memory 101 for storing a computer program;
the processor 102 is configured to execute the computer program stored in the memory to implement the flow data monitoring method in the above embodiments. Reference may be made in particular to the description relating to the method embodiments described above.
Alternatively, the memory 101 may be separate or integrated with the processor 102.
When the memory 101 is a device independent of the processor 102, the electronic apparatus may further include:
a bus 103 for connecting the memory 101 and the processor 102.
The electronic device provided in the embodiment of the present invention may be configured to execute any one of the methods for monitoring a change in a dependency relationship between a service module and a third-party class library shown in the foregoing embodiments, and an implementation manner and a technical effect of the method are similar to each other.
The embodiment of the present invention further provides a readable storage medium, where a computer program is stored in the readable storage medium, and when at least one processor of a message sending apparatus executes the computer program, the message sending apparatus executes the method for monitoring a change in a dependency relationship between a service module and a third-party class library, which is described in any of the above embodiments.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program described above may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.

Claims (12)

1. A method for monitoring the change of the dependency relationship of a business module on a third-party class library is characterized by comprising the following steps:
acquiring first version data before code change and second version data after code change of each target business module in an application program, wherein the target business module is a business module with code change;
extracting first dependency information from the first version data of each target service module, and extracting second dependency information from the second version data of each target service module, wherein the first dependency information is a calling relationship between the target service module before changing a code and a third party library, and the second dependency information is a calling relationship between the target service module after changing the code and the third party library;
comparing the first dependency information and the second dependency information of each target service module to obtain a comparison result;
and monitoring the change of the dependency relationship of each target service module on the third-party class library according to the comparison result of each target service module.
2. The method of claim 1, wherein the obtaining of the first version data and the second version data corresponding to the target service module in the application program comprises:
acquiring service module information of each target service module in an application program, wherein the service module information comprises a code bin identifier, a main bin identifier and an auxiliary bin identifier, the main bin identifier corresponds to first version data, the code bin identifier is used for identifying a corresponding code bin in a code library formed by the code bins corresponding to all service modules of the application program, the main bin is used for storing the first version data of the service module, and the auxiliary bin is used for storing the second version data of the service module;
determining a code bin corresponding to the target service module in the code base according to the code bin identification;
and extracting first version data from the code bin of each target service module according to the main bin identification corresponding to each target service module, and extracting second version data from the code bin of each target service module according to the auxiliary bin identification corresponding to each target service module.
3. The method of claim 1, wherein extracting first dependency information from the first version data of each target business module and extracting second dependency information from the second version data of each target business module comprises:
extracting first jar packet information and first build gradle file information from first version data, wherein the first jar packet information comprises the number of first jar packets and the name of the first jar packets, the first build gradle file information comprises the name of a third-party class library called by a first gradle command, and the number of the first jar packets, the name of the first jar packets and the name of the third-party class library called by the first gradle command are used as first dependency information;
extracting second jar packet information and second build gradle file information from second version data, wherein the second jar packet information comprises the number of second jar packets and the name of the second jar packets, the second build gradle file information comprises the name of a third party class library called by a second gradle command, and the number of the second jar packets, the name of the second jar packets and the name of the third party class library called by the second gradle command are used as second dependency information.
4. The method of claim 3, wherein extracting the first build gram file information from the first version data and extracting the second build gram file information from the second version data comprises:
and respectively matching the first version data and the second version data by using a preset regular expression, and determining the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command, wherein the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command are matched with the name extraction format of the preset regular expression.
5. The method according to claim 3 or 4, characterized in that the method further comprises:
and generating prompt information aiming at the problem service module, wherein the problem service module is a target service module with at least one of the number of jar packages, the names of jar packages and the names of the third-party class libraries called by the gradle command changed.
6. An apparatus for monitoring changes in the dependency of a business module on a third party class library, comprising:
the version data acquisition unit is used for acquiring first version data before code change and second version data after code change of each target business module in the application program, wherein the target business module is a business module with code change;
the dependency information extraction unit is used for extracting first dependency information from the first version data of each target service module and extracting second dependency information from the second version data of each target service module, wherein the first dependency information is a calling relationship between the target service module and a third party library before a code is changed, and the second dependency information is a calling relationship between the target service module and the third party library after the code is changed;
the information comparison unit is used for comparing the first dependency information and the second dependency information of each target service module to obtain a comparison result;
and the monitoring unit is used for monitoring the change of the dependency relationship of each target service module on the third-party class library according to the comparison result of each target service module.
7. The apparatus according to claim 6, wherein the version data obtaining unit includes:
the service module information acquisition unit is used for acquiring service module information of each target service module in an application program, wherein the service module information comprises a code bin identifier, a main bin identifier and an auxiliary bin identifier corresponding to first version data, the code bin identifier is used for identifying a corresponding code bin in a code library consisting of code bins corresponding to all service modules of the application program, the main bin is used for storing the first version data of the service module, and the auxiliary bin is used for storing the second version data of the service module;
a code bin determining unit, configured to determine, in the code library according to the code bin identifier, a code bin corresponding to the target service module;
and the version data extraction unit is used for extracting first version data from the code bin of each target business module according to the main bin identification corresponding to each target business module, and extracting second version data from the code bin of each target business module according to the auxiliary bin identification corresponding to each target business module.
8. The apparatus of claim 6, wherein the dependency information extraction unit comprises:
the first extraction unit is used for extracting first jar packet information and first build gradle file information from first version data, wherein the first jar packet information comprises the number of first jar packets and the names of the first jar packets, the first build gradle file information comprises the names of third-party libraries called through first gradle commands, and the number of the first jar packets, the names of the first jar packets and the names of the third-party libraries called through the first gradle commands are used as first dependency information;
the second extraction unit is used for extracting second jar packet information and second build gradle file information from second version data, wherein the second jar packet information comprises the number of second jar packets and the names of the second jar packets, the second build gradle file information comprises the names of third party libraries called through second gradle commands, and the number of the second jar packets, the names of the second jar packets and the names of the third party libraries called through the second gradle commands are used as second dependency information.
9. The apparatus of claim 8, wherein the first extraction unit and the second extraction unit each comprise:
the regular matching unit is used for respectively matching the first version data and the second version data by using a preset regular expression, determining the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command, and matching the name of the third-party class library called by the first gradle command and the name of the third-party class library called by the second gradle command with the name extraction format of the preset regular expression.
10. The apparatus of claim 8 or 9, further comprising:
and the prompt information generating unit is used for generating prompt information aiming at the problem service module, wherein the problem service module is a target service module with at least one of the number of jar packages, the name of jar packages and the name of a third-party class library called by a gradle command changed.
11. An electronic device, characterized in that the electronic device comprises:
a processor, and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of monitoring changes in business module dependency on third party class libraries of any of claims 1-5 via execution of the executable instructions.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of monitoring changes in the dependency of a business module on a third-party class library according to any one of claims 1 to 5.
CN201911340722.0A 2019-12-23 2019-12-23 Method and device for monitoring dependency relationship change of service module on third party class library Active CN111158741B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911340722.0A CN111158741B (en) 2019-12-23 2019-12-23 Method and device for monitoring dependency relationship change of service module on third party class library

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911340722.0A CN111158741B (en) 2019-12-23 2019-12-23 Method and device for monitoring dependency relationship change of service module on third party class library

Publications (2)

Publication Number Publication Date
CN111158741A true CN111158741A (en) 2020-05-15
CN111158741B CN111158741B (en) 2024-04-12

Family

ID=70557928

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911340722.0A Active CN111158741B (en) 2019-12-23 2019-12-23 Method and device for monitoring dependency relationship change of service module on third party class library

Country Status (1)

Country Link
CN (1) CN111158741B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111679852A (en) * 2020-05-29 2020-09-18 北京五八信息技术有限公司 Detection method and device for conflict dependency library
CN112416459A (en) * 2020-11-23 2021-02-26 杭州当虹科技股份有限公司 System for solving version strong dependence between micro services
CN112559024A (en) * 2020-12-14 2021-03-26 建信金融科技有限责任公司 Method and device for generating transaction code change list
CN112860312A (en) * 2021-02-19 2021-05-28 百果园技术(新加坡)有限公司 Method and device for detecting item dependency relationship change
CN113094280A (en) * 2021-04-27 2021-07-09 杭州天谷信息科技有限公司 Upgrading method, system and readable storage medium
CN115543410A (en) * 2022-11-29 2022-12-30 深圳开源互联网安全技术有限公司 Component dependency relationship analysis method, device and medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010067703A1 (en) * 2008-12-08 2010-06-17 日本電気株式会社 Data dependence analyzer, information processor, data dependence analysis method, and program
CN102253999A (en) * 2011-07-12 2011-11-23 北京新媒传信科技有限公司 Verification method for service dependency
CN107239298A (en) * 2017-04-28 2017-10-10 北京五八信息技术有限公司 Application program adjustment method and device
CN108197020A (en) * 2017-12-28 2018-06-22 掌阅科技股份有限公司 Plug-in unit method of calibration, electronic equipment and computer storage media
CN108334334A (en) * 2018-03-07 2018-07-27 政采云有限公司 A kind of management relies on the method and system of packet version
CN109254765A (en) * 2018-08-22 2019-01-22 平安科技(深圳)有限公司 Timing task management method, apparatus, computer equipment and storage medium
AU2019100273A4 (en) * 2019-03-15 2019-05-02 Data One Technologies Pty Ltd BinWin is a modern-day waste collection technology enabling councils and waste management authorities to manage waste effectively. The framework consists of IoT, AI, mobile & web applications integrated to monitor, track, and plan. The bins ensure eco-friendliness by keeping a constant check on fill levels enabling waste collection on a needs basis preventing over-flow, maintaining a hygienic environment using solar self-charging capability. BinWin promises to increase operational efficiencies in the waste collection chain, reducing cost and labour associated with rubbish collection & removal.
CN110347398A (en) * 2018-04-08 2019-10-18 阿里巴巴集团控股有限公司 A kind of packaging method and device of application program
CN110502222A (en) * 2019-07-23 2019-11-26 北京字节跳动网络技术有限公司 AAR method, apparatus, medium and the equipment in outgoing dependence inner base library
CN110531993A (en) * 2019-08-21 2019-12-03 苏州浪潮智能科技有限公司 Software installation method, device, equipment and medium
CN111679852A (en) * 2020-05-29 2020-09-18 北京五八信息技术有限公司 Detection method and device for conflict dependency library
CN113515269A (en) * 2021-09-13 2021-10-19 腾讯科技(深圳)有限公司 Application package processing method and device, computer equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010067703A1 (en) * 2008-12-08 2010-06-17 日本電気株式会社 Data dependence analyzer, information processor, data dependence analysis method, and program
CN102253999A (en) * 2011-07-12 2011-11-23 北京新媒传信科技有限公司 Verification method for service dependency
CN107239298A (en) * 2017-04-28 2017-10-10 北京五八信息技术有限公司 Application program adjustment method and device
CN108197020A (en) * 2017-12-28 2018-06-22 掌阅科技股份有限公司 Plug-in unit method of calibration, electronic equipment and computer storage media
CN108334334A (en) * 2018-03-07 2018-07-27 政采云有限公司 A kind of management relies on the method and system of packet version
CN110347398A (en) * 2018-04-08 2019-10-18 阿里巴巴集团控股有限公司 A kind of packaging method and device of application program
CN109254765A (en) * 2018-08-22 2019-01-22 平安科技(深圳)有限公司 Timing task management method, apparatus, computer equipment and storage medium
AU2019100273A4 (en) * 2019-03-15 2019-05-02 Data One Technologies Pty Ltd BinWin is a modern-day waste collection technology enabling councils and waste management authorities to manage waste effectively. The framework consists of IoT, AI, mobile & web applications integrated to monitor, track, and plan. The bins ensure eco-friendliness by keeping a constant check on fill levels enabling waste collection on a needs basis preventing over-flow, maintaining a hygienic environment using solar self-charging capability. BinWin promises to increase operational efficiencies in the waste collection chain, reducing cost and labour associated with rubbish collection & removal.
CN110502222A (en) * 2019-07-23 2019-11-26 北京字节跳动网络技术有限公司 AAR method, apparatus, medium and the equipment in outgoing dependence inner base library
CN110531993A (en) * 2019-08-21 2019-12-03 苏州浪潮智能科技有限公司 Software installation method, device, equipment and medium
CN111679852A (en) * 2020-05-29 2020-09-18 北京五八信息技术有限公司 Detection method and device for conflict dependency library
CN113515269A (en) * 2021-09-13 2021-10-19 腾讯科技(深圳)有限公司 Application package processing method and device, computer equipment and storage medium

Non-Patent Citations (9)

* Cited by examiner, † Cited by third party
Title
A.K.M ZAHIDUL QUAIUM等: "Process centric Work Breakdown Structure of software coding for improving accuracy of estimation, resource loading and progress monitoring of code development", 《2009 12TH INTERNATIONAL CONFERENCE ON COMPUTERS AND INFORMATION TECHNOLOGY》, pages 520 - 525 *
HARINI RAGAVAN: "Mitigating Malicious Updates: Prevention of Insider Threat to Databases", 2013 12TH IEEE INTERNATIONNAL CONFERENCE ON TRUST, SECURITY AND PRIVACY IN COMPUTING AND COMMUNICATIONS, 12 December 2013 (2013-12-12), pages 1 *
ITEST_2016: "自动依赖扫描-demo", pages 1, Retrieved from the Internet <URL:https://blog.csdn.net/itest_2016/article/details/78527021> *
JIFTLE: "jar第三方组件Dependency-check依赖检查工具", pages 1, Retrieved from the Internet <URL:https://www.cnblogs.com/jiftle/p/11880388.html> *
三方库相关: "Android Studio 使用Gradle引入第三方库文件的总结(Jar文件,so文件,Library库文件,aar文件,远程jcenter、maven仓库文件)", pages 1, Retrieved from the Internet <URL:https://blog.csdn.net/haoxuhong/article/details/103125303> *
叶璐: "多任务环境下监测监控软件程序监视问题的探讨", 煤矿自动化, no. 3, 10 June 2000 (2000-06-10), pages 34 - 36 *
王广南: "基于系统调用依赖图的程序相似性研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 2, pages 138 - 1425 *
韩承锋等: "适用于分布式静态检测的Java代码依赖性分析技术", 《计算机系统应用》, vol. 28, no. 3, pages 133 - 139 *
鸡蛋壳儿: "Gradle构建SpringBoot程序依赖管理之依赖版本自动控制", pages 1, Retrieved from the Internet <URL:https://blog.csdn.net/cradle2006/article/details/95073867> *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111679852A (en) * 2020-05-29 2020-09-18 北京五八信息技术有限公司 Detection method and device for conflict dependency library
CN112416459A (en) * 2020-11-23 2021-02-26 杭州当虹科技股份有限公司 System for solving version strong dependence between micro services
CN112416459B (en) * 2020-11-23 2024-03-01 杭州当虹科技股份有限公司 System for solving version strong dependence among micro services
CN112559024A (en) * 2020-12-14 2021-03-26 建信金融科技有限责任公司 Method and device for generating transaction code change list
CN112860312A (en) * 2021-02-19 2021-05-28 百果园技术(新加坡)有限公司 Method and device for detecting item dependency relationship change
CN113094280A (en) * 2021-04-27 2021-07-09 杭州天谷信息科技有限公司 Upgrading method, system and readable storage medium
CN115543410A (en) * 2022-11-29 2022-12-30 深圳开源互联网安全技术有限公司 Component dependency relationship analysis method, device and medium

Also Published As

Publication number Publication date
CN111158741B (en) 2024-04-12

Similar Documents

Publication Publication Date Title
CN111158741B (en) Method and device for monitoring dependency relationship change of service module on third party class library
CN112394942B (en) Distributed software development compiling method and software development platform based on cloud computing
CN110489310B (en) Method and device for recording user operation, storage medium and computer equipment
CN103186463B (en) Determine the method and system of the test specification of software
CN109032631A (en) Application program service packs acquisition methods, device, computer equipment and storage medium
US20120290560A1 (en) Mechanism for efficiently querying application binary interface/application programming interface-related information
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN111400102A (en) Application program change monitoring method, device, equipment and storage medium
CN107357721B (en) Method and device for testing system
CN115576600A (en) Code change-based difference processing method and device, terminal and storage medium
US20210026756A1 (en) Deriving software application dependency trees for white-box testing
CN111679852B (en) Detection method and device for conflict dependency library
CN113138768A (en) Application package generation method and device, electronic equipment and readable storage medium
CN112445706A (en) Program abnormal code acquisition method and device, electronic equipment and storage medium
CN110826074A (en) Application vulnerability detection method and device and computer readable storage medium
CN111752838A (en) Question checking method and device, server and storage medium
CN111240728A (en) Application program updating method, device, equipment and storage medium
WO2023206873A1 (en) Abstract syntax tree-based code test method, apparatus, device, and storage medium
CN111352631A (en) Interface compatibility detection method and device
CN115951916A (en) Component processing method and device, electronic equipment and storage medium
CN113918384A (en) Data saving method, device, equipment and storage medium
CN111488144A (en) Data processing method and equipment
CN111338956A (en) Automatic pressure measurement method, device, equipment and storage medium
CN109308256A (en) A kind of java dynamically analyzing of program method, equipment and storage medium
CN116432185B (en) Abnormality detection method and device, readable storage medium and electronic equipment

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