CN113495728A - Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium - Google Patents

Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium Download PDF

Info

Publication number
CN113495728A
CN113495728A CN202010193360.3A CN202010193360A CN113495728A CN 113495728 A CN113495728 A CN 113495728A CN 202010193360 A CN202010193360 A CN 202010193360A CN 113495728 A CN113495728 A CN 113495728A
Authority
CN
China
Prior art keywords
file
project file
project
cpp
target
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.)
Pending
Application number
CN202010193360.3A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010193360.3A priority Critical patent/CN113495728A/en
Publication of CN113495728A publication Critical patent/CN113495728A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The application provides a dependency relationship determination method, a dependency relationship determination device, electronic equipment and a medium. The method comprises the following steps: when the target project file is updated, acquiring a first project file, a dependency relationship corresponding to the first project file and a second project file, wherein the first project file is the target project file before updating, and the second project file is the updated target project file; determining project file update information based on the first project file and the second project file; and determining the dependency corresponding to the second project file based on the project file updating information and the dependency corresponding to the first project file. According to the method and the device, the time for obtaining the dependency corresponding to the updated project file is shortened, time resources are saved, and the research and development efficiency is improved.

Description

Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium
Technical Field
The present application relates to the field of software development technologies, and in particular, to a dependency relationship determining method, apparatus, electronic device, and medium.
Background
With the continuous development of computer technology, software project development is also more and more important, and the software project development is a process of obtaining project files corresponding to the software project development, wherein the project files comprise a header file, a source code file, a project construction file and the like. In general, a technician needs to obtain a dependency relationship corresponding to a project file, so that the technician can analyze the architecture of a software project and improve development efficiency.
In the prior art, a preset script is required to analyze a target project file to obtain a dependency corresponding to the target project file, such as a dependency between a source code file and a header file. Specifically, the preset script is a connections script, a connections file needs to be generated based on the target project file, and then the connections script is used to analyze the connections file to obtain a dependency relationship corresponding to the target project file. However, the project files are updated frequently, and the project files need to be analyzed by using the preset script after each update to obtain the dependency relationship corresponding to the updated project files, but the updated project files are generally large in size and may contain hundreds of modules and hundreds of thousands of types, so that it is time-consuming to analyze the updated project files each time, a large amount of time resources are required to obtain the dependency relationship corresponding to the updated project files, and the research and development efficiency is low.
Disclosure of Invention
The application provides a dependency relationship determination method, a dependency relationship determination device, an electronic device and a medium, which can solve at least one technical problem.
In a first aspect, a method for determining a dependency relationship is provided, where the method includes:
when the target project file is updated, acquiring a first project file, a dependency relationship corresponding to the first project file and a second project file, wherein the first project file is the target project file before updating, and the second project file is the updated target project file;
determining project file update information based on the first project file and the second project file;
and determining the dependency corresponding to the second project file based on the project file updating information and the dependency corresponding to the first project file.
In one possible implementation, the project file update information includes: at least one of source code Cpp update information and library Target update information;
wherein determining project file update information based on the first project file and the second project file comprises:
comparing the first project file with the second project file to obtain a comparison result;
determining at least one of the Cpp update information and the Target update information based on the comparison result.
In one possible implementation, determining Cpp update information based on the comparison result includes:
determining an updated compiling preprocessing command based on the comparison result to obtain Cpp updating information;
determining Target update information based on the comparison result, wherein the determining Target update information comprises the following steps:
determining an updated project construction file based on the comparison result;
and analyzing the updated project construction file to obtain Target update information.
In one possible implementation, if the project file update information includes Cpp update information, then
Determining a dependency corresponding to a second project file based on the project file update information and the dependency corresponding to the first project file, including:
determining the dependency relationship of each Cpp in the first project file based on the dependency relationship corresponding to the first project file, wherein the dependency relationship of any Cpp comprises: the dependency between any Cpp and the respective header file it contains;
determining a dependency corresponding to the updated Cpp based on the Cpp update information;
and determining the dependency relationship of each Cpp in the second project file based on the dependency relationship of each Cpp in the first project file and the dependency relationship corresponding to the updated Cpp.
In one possible implementation manner, determining a dependency corresponding to the updated Cpp based on the Cpp update information includes:
determining update information of a non-system header file in Cpp where the update occurs based on the Cpp update information;
and determining the dependency corresponding to the Cpp with the update based on the update information of the non-system header file.
In one possible implementation, if the project file update information includes Target update information, then
Determining a dependency corresponding to a second project file based on the project file update information and the dependency corresponding to the first project file, including:
determining the dependency relationship of each Target in the first project file based on the dependency relationship corresponding to the first project file, wherein the dependency relationship of any Target comprises the following steps: at least one of a dependency between any Target and its respective invoked Target and a dependency between any Target and its respective invoked Cpp;
determining a dependency corresponding to the updated Target based on the Target update information;
and determining the dependency relationship of each Target in the second project file based on the dependency relationship of each Target in the first project file and the dependency relationship corresponding to the updated Target.
In one possible implementation manner, the obtaining of the dependency relationship corresponding to the first project file includes:
acquiring a first project file, wherein the first project file comprises a Cpp file and a project construction file;
analyzing a compiling preprocessing command in the Cpp file to obtain the dependency relationship of each Cpp in the first project file;
and analyzing the project construction file information to obtain the dependency relationship of each Target in the first project file.
In a second aspect, there is provided a dependency relationship determination apparatus, including:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a first project file, a dependency corresponding to the first project file and a second project file when the target project file is updated, the first project file is the target project file before updating, and the second project file is the target project file after updating;
the first determining module is used for determining project file updating information based on the first project file and the second project file;
and the second determining module is used for determining the dependency corresponding to the second project file based on the project file updating information and the dependency corresponding to the first project file.
In one possible implementation, the project file update information includes: at least one of source code Cpp update information and library Target update information;
wherein the first determining module comprises a comparing unit and a determining unit, wherein,
the comparison unit is used for comparing the first project file with the second project file to obtain a comparison result;
a determining unit, configured to determine at least one of Cpp update information and Target update information based on the comparison result.
In a possible implementation manner, the determining unit is specifically configured to determine an updated compiling preprocessing command based on the comparison result, so as to obtain Cpp update information;
the determining unit is specifically further used for determining an updated project construction file based on the comparison result;
and the determining unit is specifically used for analyzing the updated project construction file to obtain Target update information.
In one possible implementation, when the project file update information includes Cpp update information, then
The second determining module is specifically configured to determine, based on the dependency relationship corresponding to the first project file, a dependency relationship of each Cpp in the first project file, where the dependency relationship of any Cpp includes: the dependency between any Cpp and the respective header file it contains;
the second determining module is specifically further configured to determine, based on the Cpp update information, a dependency relationship corresponding to the updated Cpp;
the second determining module is specifically further configured to determine the dependency relationship of each Cpp in the second project file based on the dependency relationship of each Cpp in the first project file and the dependency relationship corresponding to the updated Cpp.
In one possible implementation manner, the second determining module is further configured to determine, based on the Cpp update information, a dependency corresponding to the Cpp that is updated, and specifically, determine, based on the Cpp update information, update information of a non-system header file in the Cpp that is updated; and determining the dependency corresponding to the Cpp with the update based on the update information of the non-system header file.
In one possible implementation, when the project file update information includes Target update information, then
The second determining module is specifically configured to determine, based on the dependency corresponding to the first project file, a dependency of each Target in the first project file, where the dependency of any Target includes: at least one of a dependency between any Target and its respective invoked Target and a dependency between any Target and its respective invoked Cpp;
the second determining module is specifically further configured to determine a dependency relationship corresponding to the updated Target based on the Target update information;
the second determining module is specifically configured to determine the dependency relationship of each Target in the second project file based on the dependency relationship of each Target in the first project file and the dependency relationship corresponding to the updated Target.
In one possible implementation, the obtaining module includes an obtaining unit, a first parsing unit, and a second parsing unit, wherein,
the device comprises an acquisition unit, a storage unit and a display unit, wherein the acquisition unit is used for acquiring a first project file, and the first project file comprises a Cpp file and a project construction file;
the first analysis unit is used for analyzing the compiling preprocessing command in the Cpp file to obtain the dependency relationship of each Cpp in the first project file;
and the second analysis unit is used for analyzing the project construction file information to obtain the dependency relationship of each Target in the first project file.
In a third aspect, an electronic device is provided, which includes:
one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: and executing the operation corresponding to the dependency relationship determination method shown in the first aspect.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor, implements the dependency determination method shown in the first aspect.
The beneficial effect that technical scheme that this application provided brought is:
the application provides a dependency relationship determination method, a device, an electronic device and a medium, compared with the prior art, in the application, when an object item file is updated, a first item file, a dependency relationship corresponding to the first item file and a second item file are obtained, the first item file is the object item file before updating, the second item file is the object item file after updating, item file update information is determined based on the first item file and the second item file, a dependency relationship corresponding to the second item file is determined based on the item file update information and the dependency relationship corresponding to the first item file, namely when the dependency relationship corresponding to the object item file after updating is determined, the dependency relationship can be directly determined according to the update information between the item file after updating and the object item file before updating and the dependency relationship corresponding to the item file before updating, the problem that the whole updated target project file is analyzed to obtain the dependency corresponding to the updated project file is solved, so that the time for obtaining the dependency corresponding to the updated project file can be shortened, time resources are saved, and the research and development efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic flowchart of a dependency relationship determining method according to an embodiment of the present application;
fig. 2 is a schematic diagram of a dependent file determining method and a storage device thereof according to an embodiment of the present application;
fig. 3 is a schematic detailed flowchart of step S201 according to an embodiment of the present application;
fig. 4 is a schematic detailed flowchart of step S202 according to an embodiment of the present application;
fig. 5 is a schematic detailed flowchart of step S203 according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a dependency relationship determining apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
An embodiment of the present application provides a dependency relationship determining method, as shown in fig. 1, where the method may be executed by a client or a server, and the method includes:
step S101, when the target project file is updated, the first project file, the dependency corresponding to the first project file and the second project file are obtained.
The first project file is a target project file before updating, and the second project file is a target project file after updating.
For the embodiment of the application, the client or the server may detect whether the project files are updated every preset time period, for example, detect whether each project file is updated every other week; whether the target project file is updated or not can be determined based on the triggering operation of the user, for example, when the updating operation triggered by the user aiming at the project file A is detected, the project file A is determined to be updated. The project file may include a header file (i.e., at least one of an xx.h file and an xx.hpp file), a source code file (i.e., an xx.cpp file), and a project construction file (i.e., a build file).
Further, when it is determined that the target project file is updated, a version number (total name: Commit Id) corresponding to the updated target project file and a version number corresponding to the target project file before updating may be determined, the second project file may be determined based on the version number corresponding to the updated target project file, and the first project file and the corresponding dependency relationship thereof may be determined based on the version number corresponding to the target project file before updating. In this embodiment of the present application, the dependency corresponding to the project file may include a dependency corresponding to a library (full name: Target), a dependency corresponding to a source code (full name: Cpp), and a dependency corresponding to a header file.
Step S102, based on the first project file and the second project file, project file updating information is determined.
For the embodiment of the application, the project file update information in the second project file can be obtained by comparing the first project file with the second project file.
Wherein the project file update information includes: at least one of information added by the second project file compared with the first project file and information deleted by the second project file compared with the first project file, wherein the information added by the second project file compared with the first project file or the information deleted by the second project file may include: at least one of the added header file, the source code and the project construction file is specifically described in the following embodiments, and will not be described herein again.
Step S103, determining the dependency corresponding to the second project file based on the project file updating information and the dependency corresponding to the first project file.
For the embodiment of the present application, if the item file update information includes information that the second target item file is added with respect to the first target item file (for example, a header file is added), the dependency corresponding to the added information is added on the basis of the dependency corresponding to the first item file to obtain a dependency corresponding to the second item file, for example, if the second target item file is added with a header file a with respect to the first target item file, the dependency corresponding to the header file a is added on the basis of the dependency corresponding to the first item file to obtain a dependency corresponding to the second item file; if the item updating information contains that the second target item file deletes some information relative to the first target item file, deleting the dependency corresponding to the information on the basis of the dependency corresponding to the first item file to obtain the dependency corresponding to the second item file; for example, if the second target item deletes the header file a from the first item file, the dependency relationship corresponding to the header file a is deleted after the first item file corresponds to the second target item file, so as to obtain the dependency relationship corresponding to the second item file.
In this embodiment of the present application, the dependency relationship corresponding to the second item file includes a dependency relationship corresponding to a Target, a dependency relationship corresponding to a Cpp, and a dependency relationship corresponding to the header file, where the dependency relationship corresponding to a Target includes a dependency relationship between each Target and each called Target and a dependency relationship between each Target and each called Cpp; the dependency relationship corresponding to the Cpp comprises the dependency relationship between each Cpp and the header file contained in each Cpp; the dependency relationship corresponding to the header file includes the dependency relationship between each header file and each storage path, and specific descriptions of the following embodiments can be found, which are not described herein again.
Compared with the prior art, in the embodiment of the present application, when an object item file is updated, a first item file, a dependency corresponding to the first item file, and a second item file are obtained, where the first item file is the object item file before being updated, the second item file is the object item file after being updated, item file update information is determined based on the first item file and the second item file, a dependency corresponding to the second item file is determined based on the item file update information and the dependency corresponding to the first item file, that is, when the dependency corresponding to the object item file after being updated is determined, the dependency corresponding to the second item file can be determined directly according to update information between the item file after being updated and the object item file before being updated and the dependency corresponding to the item file before being updated, the problem that the whole updated target project file is analyzed to obtain the dependency corresponding to the updated project file is solved, so that the time for obtaining the dependency corresponding to the updated project file can be shortened, time resources are saved, and the research and development efficiency can be improved.
In another possible implementation manner of the embodiment of the present application, in step S101, obtaining the dependency relationship corresponding to the first project file may include: acquiring a first project file; analyzing a compiling preprocessing command in the Cpp file to obtain the dependency relationship of each Cpp in the first project file; and analyzing the project construction file information to obtain the dependency relationship of each Target in the first project file.
The first project file comprises a Cpp file and a project construction file.
For the embodiment of the present application, after the step of obtaining the first project file, a step of analyzing the compiling pretreatment command in the Cpp file to obtain the dependency relationship of each Cpp in the first project file may be performed, a step of analyzing the project building file information to obtain the dependency relationship of each Target in the first project file may be performed, and a step of analyzing the compiling pretreatment command in the Cpp file to obtain the dependency relationship of each Cpp in the first project file and a step of analyzing the project building file information to obtain the dependency relationship of each Target in the first project file may be performed simultaneously, which is not limited in the embodiment of the present application. For details about obtaining the relevant content of the first project file, see the relevant description of the above embodiments, and are not repeated here.
For the embodiment of the present application, the first project file includes at least one Cpp file, each Cpp file in the first project file may be determined based on the first project file, each Cpp file may be parsed to obtain a compiling preprocessing command in each Cpp file, and the dependency relationship of each Cpp in the first project file may be determined based on the compiling preprocessing command. In the embodiment of the present application, the compiling pretreatment command mainly includes that one file contains the content of another file, and the format of the compiling pretreatment command includes at least one of # include < file name > and # include "file name", wherein the format of the system header file includes # include < file name >, and the format of the non-system header file includes # include "file name"; the dependency of any Cpp includes the dependency between any Cpp and the respective header file it contains.
For example, if a map. CPP file (CPP file) is included in the first project file, and the compilation preprocessing command in the map. CPP file includes # include "ma.h" and # include < static.h >, the dependency of the map. CPP file, that is, the dependency of the map. CPP and the ma.h contained therein and the dependency of the map. CPP and the static.h contained therein, may be determined based on # include "ma.h" and # include < static.h >.
Further, a preset header file in the compiling preprocessing command may be determined based on a preset header file format, and the dependency relationship of each Cpp in the first project file may be determined based on the preset header file, where the preset header file is at least one of a system header file and a non-system header file. For example, if the preset header file is a non-system header file, the non-system header file # include "mama.h" in the compilation preprocessing command may be determined based on the non-system header file format (# include "file name"), so that the dependency relationship of the map.cpp file in the first project file is determined to include the dependency relationship of the map.cpp and the mama.h contained therein.
For the embodiment of the present application, the dependency relationship between each Cpp and each header file contained in each Cpp _ h _ Map file may be stored in a Map (Map), where the Map may be stored in a Key-Value pair (i.e. Key-Value) format. Specifically, in the Cpp _ h _ map file, the Value stored in Key is used to characterize Cpp, and the Value stored in Value is used to characterize the header file. For example, when map.cpp is stored in Map form with the dependency of the map.h contained therein, the Value stored in Key is used to characterize map.cpp and the Value stored in Value is used to characterize map.h.
For the embodiment of the application, the first project file comprises at least one project construction file, any project construction file comprises at least one Target code information, any Target code information comprises at least one of deps code information corresponding to any Target and src code information corresponding to any Target, deps code information corresponding to any Target is code information of at least one Target depended by any Target, and src code information corresponding to any Target is code information of at least one Cpp depended by any Target. In the embodiment of the application, at least one piece of Target code information in each project construction file can be obtained by analyzing each project construction file, and the dependency relationship between any Target and each Target called by the Target is determined based on deps code information in any Target code information; and determining the dependency relationship between any Target and each Cpp called by the Target based on the src code information in the Target code information. Wherein, the dependency relationship of any Target includes: at least one of a dependency between any Target and its respective called Target and a dependency between any Target and its respective called Cpp.
For example, the project construction file includes the following Target code information:
name=‘log’,
srcs=[‘log.cpp’,],
deps=[‘#pthread’,‘//thrift_protocol:search_thrift’,]
it can be determined that the Target is log by name ═ log', based on deps code information in the Target code information, that is: deps [ '# pthread', '/thick _ protocol: search _ thick', ] determines the dependency between this Target and the Target it calls, i.e.: the dependency relationship between the log and the search _ threft called by the log is based on the src code information in the Target code information, that is: src [ 'log. Cpp', ], the dependency between the Target and its invoked Cpp, i.e. the dependency between log and its invoked log.
For the embodiment of the present application, a dependency relationship between any Target and any Target called by the Target may be stored in a Target _ deps _ Map file in a Map manner, where in the Target _ deps _ Map file, a Value stored in a Key is used to characterize the Target, a Value stored in a Value is used to characterize the Target called by the Target, for example, when a dependency relationship between a log and a search _ threft called by the log is stored in a Map manner, a Value stored in the Key is used to characterize the log, and a Value stored in the Value is used to characterize the search _ threft; the dependency relationship between any Target and any Cpp called by the Target _ src _ Map file can be stored in a Map manner, wherein in the Target _ src _ Map file, a Value stored in Key is used for characterizing the Target, and a Value stored in Value is used for characterizing the Cpp, for example, when the dependency relationship between log and log.cpp called by the log is stored in a Map manner, a Value stored in Key is used for characterizing the log, and a Value stored in Value is used for characterizing the log.cpp.
For the embodiment of the present application, the dependency corresponding to the first project file may include a dependency of each header file in the first project file, in addition to the dependency of each Cpp in the first project file and a dependency of each Target in the first project file. Specifically, the method comprises the following steps:
the first project file comprises at least one header file, and each header file in the first project file and the storage path of each header file can be determined by traversing the first project file, so that the dependency relationship between each header file in the first project file and the storage path thereof can be obtained. For example, the dependency relationship of the mama.h, namely the dependency relationship between the mama.h and/data/user/0/packname/file, can be determined by traversing the first project file and determining the header file mama.h and the storage path/data/user/0/packname/files in the first project file. In this embodiment of the present application, a dependency relationship between any header file and a storage path thereof may be stored in a filemap file in a Map manner, where in the filemap file, a Value stored in Key is used to characterize the header file, and a Value stored in Value is used to characterize the storage path. For example, the dependency relationship between mama.h and/data/user/0/packname/file is stored in a Map manner, the Value stored in Key is used for representing mama.h, and the Value stored in Value is used for representing/data/user/0/packname/file.
Further, the version number corresponding to the first item file may be obtained, and mapping relationships between the filemap file, the cpp _ h _ map file, the target _ deps _ map file, and the target _ src _ map file and the version number may be respectively established.
In another possible implementation manner of the embodiment of the present application, the item file update information may include: at least one of source code Cpp update information and library Target update information. That is to say, when the item file update information includes at least one of the source code Cpp update information and the library Target update information, step S102 may specifically include: comparing the first project file with the second project file to obtain a comparison result; at least one of Cpp update information and Target update information is determined based on the comparison result.
Further, in this embodiment of the application, the project file update information may further include other update information such as header file update information, which is not limited in this embodiment of the application. That is to say: step S102 may further include: comparing the first project file with the second project file to obtain a comparison result; header file update information is determined based on the comparison result.
Specifically, in this embodiment of the application, the comparison result may include a header file comparison result, a source code comparison result, and a project building file comparison result. In the embodiment of the application, a header file comparison result is obtained by comparing a header file in a first project file with a header file in a second project file; obtaining a source code comparison result by comparing the source code in the first project file with the source code in the second project file; and comparing the project construction file in the first project file with the project construction file in the second project file to obtain a project construction file comparison result.
Further, at least one of header file update information, Cpp update information, and Target update information may be respectively determined based on the comparison result, which will be described in detail below.
For the embodiment of the present application, determining header file update information based on the comparison result may include: and determining the newly added header file and/or the deleted header file based on the header file comparison result in the comparison result to obtain header file updating information. For example, it may be determined that a header file a is newly added and a header file b is deleted based on the header file comparison result, and then the header file update information includes the newly added header file a and the deleted header file b.
Specifically, in the embodiment of the present application, determining Cpp update information based on the comparison result may specifically include: and determining an updated compiling preprocessing command based on the comparison result to obtain Cpp updating information.
For the embodiment of the application, at least one of the newly added compiling preprocessing command and the deleted compiling preprocessing command is determined based on the source code comparison result in the comparison result, so as to obtain Cpp update information. For example, it may be determined that the compiling preprocessing command # include "website.h" is added and the compiling preprocessing command # include < status.h > is deleted based on the source code comparison result, and the Cpp update information includes the added # include "website.h" and the deleted # include < status.h >.
Specifically, in the embodiment of the present application, determining Target update information based on the comparison result may include: determining an updated project construction file based on the comparison result; and analyzing the updated project construction file to obtain Target update information.
For the embodiment of the application, the updated project construction file can be determined based on the comparison result of the project construction files in the comparison result, and the updated project construction file is analyzed to obtain Target update information, wherein the updated project construction file comprises at least one of an added project construction file, a deleted project construction file and an original project construction file with changed content.
For example, a newly added project construction file is determined based on the comparison result of the project construction files, and Target update information is obtained by analyzing the newly added project construction file, where the Target update information is as follows:
cc_binary(
name=‘appas’,
srcs=[‘appas.cpp’,],
deps=[‘#pthread’,‘//thrift_protocol:search_thrift’,],
optimize=[‘std=c++0x’,‘g’,])
specifically, the Target update information is a Target update code: the updating code of the apps comprises deps updating codes corresponding to the apps and src updating codes corresponding to the apps, wherein the deps updating codes corresponding to the apps comprise other Target files depended by the apps: search _ threft; the src updating code corresponding to the appas comprises Cpp files depended by the appas: cpp.
The foregoing details about the related content of step S102, that is, the specific implementation manner of determining the update information of the project file based on the first project file and the second project file, of course, determining the update information of the second project file relative to the first project file is not limited to the implementation manner shown in the foregoing embodiments, and any possible implementation manner is within the protection scope of the embodiment of the present application, and after determining the update information of the project file relative to the first project file, details about the related content of step S103 will be described below, that is, the specific implementation manner of obtaining the update information of the second project file based on the dependency relationship corresponding to the first project file and the update information of the specific project file is specifically shown as follows.
In another possible implementation manner of this embodiment, if the item file update information includes header file update information, step S103 may include: determining the dependency relationship of each header file in the first project file based on the dependency relationship corresponding to the first project file; determining a header file in which an update occurs based on header file update information; traversing the second project file, and determining the dependency corresponding to the updated header file; and determining the dependency corresponding to each header file in the second project file based on the dependency corresponding to the updated header file and the dependency of each header file in the first project file.
Wherein, the dependency relationship of any header file may include: the dependency between any header file and its storage path.
For the embodiment of the present application, the step of determining the dependency relationship of each header file in the first project file based on the dependency relationship corresponding to the first project file may be performed before the step of determining the header file that is updated based on the header file update information, or may be performed after the step of determining the header file that is updated based on the header file update information, or may be performed simultaneously with the step of determining the header file that is updated based on the header file update information, which is not limited in the embodiment of the present application.
For the embodiment of the present application, the first project file includes at least one header file, the dependency corresponding to the first project file includes a dependency corresponding to the at least one header file, and the dependency corresponding to each header file in the first project file may be determined based on the dependency corresponding to the first project file. For example, the first project file includes a website.h file and a static.h file, the dependency relationship corresponding to the first project file includes a dependency relationship of the website.h file and a static.h file, and the dependency relationship of the website.h file and the dependency relationship of the static.h file may be respectively determined based on the dependency relationship corresponding to the first project file.
For the embodiment of the application, the updated header file can be determined based on the header file update information, and the storage path corresponding to the updated header file is obtained by traversing the second project file, so as to determine the dependency relationship corresponding to the updated header file.
Further, the dependency relationship of the corresponding header file in the first project file may be updated based on the dependency relationship corresponding to the updated header file, so as to obtain the dependency relationship of each header file in the second project file. For example, the dependency corresponding to the header file in the first project file includes a dependency of a web.h file and a static.h file, and a newly added dependency between a web.h and a storage path thereof is added to the dependency corresponding to the header file in the first project file to update the dependency of the web.h, so that the dependency of each header file in the second project file is obtained based on the dependency of the web.h file, the dependency of the static.h file, and the dependency of the web.h.
For the embodiment of the present application, it may also be configured to determine each header file and a storage path of each header file in the second project file by traversing the second project file, so as to obtain a dependency relationship between each header file and a storage path thereof in the second project file, which is specifically described in the above description about determining a dependency relationship between each header file and a storage path thereof in the first project file, and is not described herein again.
In another possible implementation manner of the embodiment of the present application, if the project file update information includes Cpp update information, step S103 may include: determining the dependency relationship of each Cpp in the first project file based on the dependency relationship corresponding to the first project file; determining a dependency corresponding to the updated Cpp based on the Cpp update information; and determining the dependency relationship of each Cpp in the second project file based on the dependency relationship of each Cpp in the first project file and the dependency relationship corresponding to the updated Cpp.
For the embodiment of the present application, the step of determining the dependency relationship of each Cpp in the first project file based on the dependency relationship corresponding to the first project file may be performed before the step of determining the dependency relationship corresponding to the updated Cpp based on the Cpp update information, or may be performed after the step of determining the dependency relationship corresponding to the updated Cpp based on the Cpp update information, or may be performed simultaneously with the Cpp update information, which is not limited in the embodiment of the present application.
Wherein, the dependency relationship of any Cpp may include: the dependency between any Cpp and the respective header file it contains. For example, for a Cpp file: the apps. cpp file, which contains the compile preprocess command # include "website.h", then the dependencies of the apps. cpp file may include the dependencies between the apps. cpp file and the website.h file it contains.
For the embodiment of the present application, the first project file includes at least one Cpp file, the dependency relationship corresponding to the first project file includes a dependency relationship corresponding to the at least one Cpp, and the dependency relationship corresponding to each Cpp in the first project file may be determined based on the dependency relationship corresponding to the first project file. For example, the first item file includes a map.cpp file, an apps.cpp file, and a log.cpp file, the dependency relationship corresponding to the first item file includes a dependency relationship corresponding to each of the map.cpp file, the apps.cpp file, and the log.cpp file, and the dependency relationship corresponding to the map.cpp file, the apps.cpp file, and the log.cpp file may be determined based on the dependency relationship corresponding to the first item file.
For the embodiment of the present application, the updated Cpp may be determined based on the Cpp update information, so as to obtain the dependency relationship corresponding to the updated Cpp, for example, the Cpp update information includes a new # include "web.h" and a deleted # include < status.h >, and the Cpp file including # include "web.h" and the Cpp file log.cpp file including # include < status.h >, that is, the updated Cpp may be the apps.cpp file and the log.cpp file, respectively, so as to obtain the dependency relationship corresponding to the updated Cpp, that is, the dependency relationship of the apps.cpp file includes the dependency relationship between the new apps.cpp file and the web.h file, and the dependency relationship of the cp file includes the dependency relationship between the deleted log.cpp.c.p file and the status.p.p.file.
Further, the dependency relationship of the corresponding Cpp in the first project file may be updated based on the updated dependency relationship corresponding to the Cpp, so as to obtain the dependency relationship of each Cpp in the second project file. Namely, based on the dependency relationship corresponding to the updated Cpp, the Cpp _ h _ map file corresponding to the first project file is updated, and the Cpp _ h _ map file corresponding to the second project file is obtained.
For example, the dependency corresponding to the first project file includes dependencies corresponding to a map.cpp file, an apps.cpp file, and a log.cpp file, and the updated dependency corresponding to the Cpp includes a dependency between a new apps.cpp file and a website.h file, and a dependency between a log.cpp file and a static.h file is deleted, so that the dependency corresponding to the apps.cpp file can be updated based on the dependency between the new apps.cpp file and the website.h file in the dependency corresponding to the apps.cpp file; deleting the dependency relationship between the log.cpp file and the static.h file in the dependency relationship corresponding to the log.cpp file, and updating the dependency relationship corresponding to the log.cpp file, so as to obtain the dependency relationship of each Cpp in the second item file based on the dependency relationship corresponding to the map.cpp file, the dependency relationship corresponding to the updated ppas.cpp file, and the dependency relationship corresponding to the updated log.cpp file.
Determining a dependency relationship corresponding to the updated Cpp based on the Cpp update information may include: determining update information of a non-system header file in Cpp where the update occurs based on the Cpp update information; and determining the dependency corresponding to the Cpp with the update based on the update information of the non-system header file.
For the embodiment of the present application, the Cpp update information includes a compilation preprocessing command for updating in Cpp, that is, an update of a header file in Cpp, where the header file includes a system header file and a non-system header file, a format of the system header file includes a format corresponding to # include < filename >, and a format corresponding to # include "filename" is included in a format of the non-system header file. In the embodiment of the present application, the update information of the non-system header file in the Cpp that is updated may be identified in the Cpp update information based on the format of the non-system header file, for example, the Cpp update information includes a newly added # include "website.h" and a deleted # include < status.h >, and the update information of the non-system header file in the Cpp that is updated may be identified in the Cpp update information based on the format of the non-system header file, that is, the newly added # include "website.h" in the Cpp that is updated.
Further, the updated Cpp may be determined based on the update information of the non-system header file in the updated Cpp, so as to obtain a dependency corresponding to the updated Cpp, for example, based on a newly added # include "website.h" in the updated Cpp, the updated Cpp file including the # include "website.h" is determined: and the apps.cpp file obtains the dependency corresponding to the updated Cpp file, namely the dependency between the apps.cpp file and the newly added web.h file contained in the apps.cpp file.
Further, the dependency relationship of the corresponding Cpp in the first project file may be updated based on the updated dependency relationship corresponding to the Cpp, so as to obtain the dependency relationship of each Cpp in the second project file, which is specifically described in the foregoing embodiment and is not described herein again.
In another possible implementation manner of the embodiment of the present application, if the item file update information includes Target update information, step S103 may include: determining the dependency relationship of each Target in the first project file based on the dependency relationship corresponding to the first project file; determining a dependency corresponding to the updated Target based on the Target update information; and determining the dependency relationship of each Target in the second project file based on the dependency relationship of each Target in the first project file and the dependency relationship corresponding to the updated Target.
For the embodiment of the present application, the step of determining the dependency relationship of each Target in the first project file based on the dependency relationship corresponding to the first project file may be performed before the step of determining the dependency relationship corresponding to the Target that is updated based on the Target update information, may be performed after the step of determining the dependency relationship corresponding to the Target that is updated based on the Target update information, or may be performed simultaneously with the step of determining the dependency relationship corresponding to the Target that is updated based on the Target update information, which is not limited in the embodiment of the present application.
Wherein, the dependency relationship of any Target may include: at least one of a dependency between any Target and its respective called Target and a dependency between any Target and its respective called Cpp.
For the embodiment of the application, the first project file includes at least one project building file, any project building file includes at least one Target code information, the dependency relationship corresponding to the first project file includes a dependency relationship corresponding to the at least one project building file, the dependency relationship corresponding to any project building file includes a dependency relationship of each Target in any project building file, and the dependency relationship of each Target in the first project file may be determined based on the dependency relationship corresponding to the first project file, for example, the first project file includes one project building file, the project building file includes two Target code information, which are respectively code information of mars and code information of hoog, and then the dependency relationship of mars and the dependency relationship of hoog may be determined based on the dependency relationship corresponding to the first project file.
For the embodiment of the application, the updated Target can be determined based on the Target update information, so as to obtain the dependency corresponding to the updated Target, wherein the Target update information (namely the Target update code) comprises a deps update code and a src update code, and the dependency between the updated Target and the Target called by the updated Target can be determined based on the deps update code; the dependency between the Target where the update occurs and the Cpp called by the Target can be determined based on the src update code, for example, the Target update information includes the new code as follows:
cc_binary(
name=‘appas’,
srcs=[‘appas.cpp’,],
deps=[‘#pthread’,‘//thrift_protocol:search_thrift’,],
optimize=[‘std=c++0x’,‘g’,])
then, based on the new code, the new Target may be determined: and the apps obtain a dependency corresponding to the new apps, wherein the dependency corresponding to the new apps comprises a dependency between the new apps and the search _ gradient (Target) called by the new apps, and a dependency between the new apps and the apps. Specifically, code is updated based on deps: deps [ '# pthread', '/triple _ protocol: search _ triple', ], determining the dependency between the newly added appas and the search _ triple (i.e., Target) it calls, updating the code based on src: the src [ 'appas. Cpp', ], and the dependency between the newly added appas and the appas. Cpp (i.e. Cpp) it calls is determined.
Further, the dependency relationship of the corresponding Target in the first project file may be updated based on the dependency relationship corresponding to the updated Target, so as to obtain the dependency relationship of each Target in the second project file. Acquiring a Target _ deps _ map file corresponding to a first project file, determining the dependency relationship between an updated Target and a called Target based on a deps updating code, and updating the Target _ deps _ map file based on the dependency relationship between the updated Target and the called Target to obtain a Target _ deps _ map file corresponding to a second project file; acquiring a Target _ src _ map file corresponding to the first project file, determining the dependency relationship between the updated Target and the called Cpp based on the src update code, and updating the Target _ src _ map file based on the dependency relationship between the updated Target and the called Cpp to obtain a Target _ src _ map file corresponding to the second project file.
For example, the dependency relationship of Target in the first project file includes a dependency relationship of mar and a dependency relationship of hoog, and the updated dependency relationship corresponding to Target is a dependency relationship corresponding to the newly added appas, and the dependency relationship corresponding to the newly added appas includes a dependency relationship between the newly added appas and its called search _ threshold (i.e., Target) and a dependency relationship between the newly added appas and its called apps.cpp (i.e., Cpp), and then the dependency relationship corresponding to the newly added appas is added to the dependency relationship of Target in the first project file to update the dependency relationship of appas, so that the dependency relationship of each Target in the second project file is obtained based on the dependency relationship of mar, the dependency relationship of hoog, and the updated dependency relationship of appas.
In the above embodiment, a specific implementation manner of determining a dependency relationship corresponding to an updated project file is described, and in the following embodiment, a specific example is used to further describe a specific implementation manner of determining a dependency relationship corresponding to an updated project file:
as shown in fig. 2, in this embodiment of the application, determining a dependency file corresponding to a second project based on a first project file, a second project file, and a dependency relationship corresponding to the first project file specifically includes: step S201, determining a dependency relationship corresponding to the first project file based on the first project file, step S202, determining a dependency relationship corresponding to the second project file based on the first project file, the second project file and the dependency relationship corresponding to the first project file, and step S203, determining a dependency file based on the dependency relationship corresponding to the second project file. In the embodiment of the application, the first project file and the corresponding dependency relationship thereof, the second project file and the corresponding dependency relationship thereof and the dependency file can be uploaded to the server and stored in the database; the server may also obtain at least one of the first item file and the dependency corresponding thereto, the second item file and the dependency corresponding thereto, and the dependency file from the database, so that when the second item file is updated again, the dependency corresponding to the updated second item file may be calculated based on the obtained first item file and the dependency corresponding thereto, or the second item file and the dependency file. The relevant contents of step S201 to step S203 will be specifically described below, respectively.
For step S201, as shown in fig. 3, determining a dependency relationship corresponding to the first project file based on the first project file includes: acquiring a first project file, wherein the first project file comprises a header file (an h file and an hpp file), a Cpp file and a project construction file (a Build file), firstly, analyzing the h file and the hpp file in the first project file to generate a filemap file, and the filemap file records the dependency relationship of each h and hpp file in the first project file, namely the dependency relationship between the h file and a storage path thereof, and the dependency relationship between the hpp file and a storage path thereof; secondly, analyzing the Cpp file in the first project file to obtain a compiling pretreatment command in the Cpp file, determining a non-system header file in the compiling pretreatment command based on the compiling pretreatment command in the Cpp file, and generating a Cpp _ h _ map file based on the non-system header file, wherein the Cpp _ h _ map file records the dependency relationship of each Cpp in the first project file, namely the dependency relationship between the Cpp and the h file and/or the hpp file contained in the Cpp file; and then analyzing the Build file in the first project file, and respectively generating a Target _ deps _ map file and a Target _ src _ map file, wherein the Target _ deps _ map file records the dependency relationship between each Target in the first project file and the Target called by the Target, and the Target _ src _ map file records the dependency relationship between each Target and the Cpp called by the Target.
For step S202, as shown in fig. 4, determining a dependency relationship corresponding to the second project file based on the first project file, the second project file, and the dependency relationship corresponding to the first project file includes: firstly, acquiring a second item file, analyzing h and hpp files in the second item file, generating a new filemap to update the filemap, recording the dependency relationship of each h and hpp file in the second item file by the updated filemap file, then acquiring a first item file, comparing the first item file with the second item file to obtain a comparison result, on one hand, determining an updated compiling preprocessing command based on the comparison result, determining a non-system header file in the compiling preprocessing command, and determining the dependency relationship corresponding to the Cpp to be deleted based on the deleted non-system header file; determining a dependency relationship corresponding to a Cpp to be newly added based on a newly added non-system header file, acquiring a Cpp _ h _ map file corresponding to a first project file, updating the Cpp _ h _ map file based on a dependency relationship corresponding to a Cpp to be deleted and a dependency relationship corresponding to a Cpp to be newly added, wherein the updated Cpp _ h _ map file records the dependency relationship of each Cpp in a second project file, and on the other hand, determining an updated Build file based on a comparison result, analyzing the updated Build file, determining updated deps code information, acquiring a Target _ deps _ map file corresponding to the first project file, updating a Target _ deps _ map file based on the updated deps code information, and recording the dependency relationship between each Target in the second project file and a Target called by the Target _ deps _ map file; determining the updated src code information, acquiring a Target _ src _ map file corresponding to the first project file, and updating the Target _ src _ map file based on the updated src code information, wherein the updated Target _ src _ map file records the dependency relationship between each Target in the second project file and the Cpp called by the Target.
For step S203, as shown in fig. 5, determining a dependent file based on the dependency relationship corresponding to the second project file includes: firstly, obtaining a Target _ deps _ map file corresponding to a second item file, deeply traversing the Target _ deps _ map file, obtaining the dependency relationship between each Target and the Target called by the Target, then obtaining a Target _ src _ map file corresponding to the second item file, deeply traversing the Target _ src _ map file, obtaining the dependency relationship between each Target and the Cpp called by the Target, obtaining each Cpp _ h _ map file corresponding to the second item file, deeply traversing the Cpp _ h _ map file, obtaining the dependency relationship between each Cpp and the h and the hpp contained in the Cpp, obtaining a filemap file corresponding to the second item file, deeply traversing the filemap file, obtaining the dependency relationship between each h and the hpp and the storage path of the hpp, and finally determining the dependency file, wherein the dependency file can be obtained by sequentially traversing the Target _ deps _ map file, the Cpp _ map file and the Bup _ map file, and the dependency relationship among the Target _ dep _ map file and the Target the dependency file, And (4) each Target-dependent Cpp, each Cpp-dependent h and each hpp, and each storage path corresponding to h and hpp, namely obtaining the dependency file.
The dependency relationship determining method of the present application is described in detail from the perspective of method steps, and the dependency relationship determining apparatus of the present application is described in detail from the perspective of virtual modules, which is specifically as follows:
the embodiment of the present application provides a dependency relationship determining apparatus, as shown in fig. 6, where the apparatus may be a client or a server, and the dependency relationship determining apparatus 60 includes an obtaining module 601, a first determining module 602, and a second determining module 603, where,
the obtaining module 601 is configured to obtain a first project file, a dependency relationship corresponding to the first project file, and a second project file when the target project file is updated, where the first project file is the target project file before being updated, and the second project file is the target project file after being updated.
A first determining module 602, configured to determine project file update information based on the first project file and the second project file.
The second determining module 603 is configured to determine a dependency relationship corresponding to a second project file based on the project file update information and the dependency relationship corresponding to the first project file.
In another possible implementation manner of the embodiment of the present application, the item file update information includes: at least one of source code Cpp update information and library Target update information.
Wherein the first determining module 602 comprises a comparing unit and a determining unit, wherein,
and the comparison unit is used for comparing the first project file with the second project file to obtain a comparison result.
A determining unit, configured to determine at least one of Cpp update information and Target update information based on the comparison result.
In another possible implementation manner of the embodiment of the present application, the determining unit is specifically configured to determine an updated compiling preprocessing command based on the comparison result, so as to obtain Cpp update information.
And the determining unit is specifically further used for determining the updated project construction file based on the comparison result.
And the determining unit is specifically used for analyzing the updated project construction file to obtain Target update information.
In another possible implementation manner of the embodiment of the present application, when the project file update information includes Cpp update information, then
The second determining module 603 is specifically configured to determine, based on the dependency relationship corresponding to the first project file, a dependency relationship of each Cpp in the first project file, where the dependency relationship of any Cpp includes: the dependency between any Cpp and the respective header file it contains.
The second determining module 603 is further specifically configured to determine, based on the Cpp update information, a dependency corresponding to the updated Cpp.
The second determining module 603 is further specifically configured to determine the dependency relationship of each Cpp in the second project file based on the dependency relationship of each Cpp in the first project file and the dependency relationship corresponding to the updated Cpp.
In another possible implementation manner of the embodiment of the present application, the second determining module 603 is further configured to determine, based on the Cpp update information, a dependency relationship corresponding to the updated Cpp, and specifically, is further configured to determine, based on the Cpp update information, update information of a non-system header file in the updated Cpp; and determining the dependency corresponding to the Cpp with the update based on the update information of the non-system header file.
In another possible implementation manner of the embodiment of the present application, when the item file update information includes Target update information, then
The second determining module 603 is further specifically configured to determine, based on the dependency relationship corresponding to the first project file, a dependency relationship of each Target in the first project file, where a dependency relationship of any Target includes: at least one of a dependency between any Target and its respective called Target and a dependency between any Target and its respective called Cpp.
The second determining module 603 is further specifically configured to determine, based on the Target update information, a dependency corresponding to the Target that is updated.
The second determining module 603 is further specifically configured to determine the dependency relationship of each Target in the second project file based on the dependency relationship of each Target in the first project file and the dependency relationship corresponding to the updated Target.
In another possible implementation manner of the embodiment of the present application, the obtaining module 601 includes an obtaining unit, a first parsing unit, and a second parsing unit, wherein,
the acquisition unit is used for acquiring a first project file, and the first project file comprises a Cpp file and a project construction file.
And the first analysis unit is used for analyzing the compiling preprocessing command in the Cpp file to obtain the dependency relationship of each Cpp in the first project file.
And the second analysis unit is used for analyzing the project construction file information to obtain the dependency relationship of each Target in the first project file.
For the embodiment of the present application, the first determining module 602 and the second determining module 603 may be the same determining module, or may be two different determining modules, which is not limited in the embodiment of the present application.
The dependency relationship determining apparatus in the embodiment of the present application is suitable for performing operations corresponding to the dependency relationship determining method in the above method embodiments, and the implementation principles thereof are similar and will not be described herein again.
Compared with the prior art, in the embodiment of the present application, when an object item file is updated, a first item file, a dependency corresponding to the first item file, and a second item file are obtained, where the first item file is the object item file before being updated, the second item file is the object item file after being updated, item file update information is determined based on the first item file and the second item file, a dependency corresponding to the second item file is determined based on the item file update information and the dependency corresponding to the first item file, that is, when the dependency corresponding to the object item file after being updated is determined, the dependency corresponding to the second item file can be determined directly according to update information between the item file after being updated and the object item file before being updated, and the dependency corresponding to the item file before being updated, the problem that the whole updated target project file is analyzed to obtain the dependency corresponding to the updated project file is solved, so that the time for obtaining the dependency corresponding to the updated project file can be shortened, time resources are saved, and the research and development efficiency can be improved.
The dependency relationship determining apparatus provided in the embodiment of the present application is applicable to the dependency relationship determining method shown in the foregoing method embodiment, and is not described herein again.
The dependency relationship determining apparatus of the present application is introduced from the perspective of the virtual module, and the electronic device of the present application is introduced from the perspective of the physical device, which is specifically as follows:
an embodiment of the present application provides an electronic device, as shown in fig. 7, an electronic device 4000 shown in fig. 7 includes: a processor 4001 and a memory 4003. Processor 4001 is coupled to memory 4003, such as via bus 4002. Optionally, the electronic device 4000 may further comprise a transceiver 4004. In addition, the transceiver 4004 is not limited to one in practical applications, and the structure of the electronic device 4000 is not limited to the embodiment of the present application.
The Processor 4001 may be a CPU (Central Processing Unit), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 4001 may also be a combination that performs a computational function, including, for example, a combination of one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
Bus 4002 may include a path that carries information between the aforementioned components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 4002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 7, but this is not intended to represent only one bus or type of bus.
The Memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic Disc storage medium or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.
The memory 4003 is used for storing application codes for executing the scheme of the present application, and the execution is controlled by the processor 4001. Processor 4001 is configured to execute application code stored in memory 4003 to implement what is shown in the foregoing method embodiments.
An embodiment of the present application provides an electronic device, including: a memory and a processor; at least one program stored in the memory for execution by the processor, which when executed by the processor, implements: in the embodiment of the present application, when an object project file is updated, a first project file, a dependency relationship corresponding to the first project file, and a second project file are obtained, where the first project file is an object project file before being updated, the second project file is an object project file after being updated, project file update information is determined based on the first project file and the second project file, and a dependency relationship corresponding to the second project file is determined based on the project file update information and the dependency relationship corresponding to the first project file, that is, when determining a dependency relationship corresponding to an object project file after being updated, the dependency relationship corresponding to the second project file may be determined directly according to update information between the updated project file and the object project file before being updated, and the dependency relationship corresponding to the project file before being updated, so as to avoid parsing the entire updated object project file to obtain the dependency relationship corresponding to the updated project file, therefore, the time for acquiring the dependency relationship corresponding to the updated project file can be reduced, the time resource can be saved, and the research and development efficiency can be improved.
In the above description, an electronic device is introduced from the perspective of an entity device, and the electronic device may be a terminal device or a server, and may be configured to execute the dependency relationship determination method shown in the foregoing embodiment, and the following computer-readable storage medium of the present application is introduced from the perspective of a medium, and specifically as follows:
the present application provides a computer-readable storage medium, on which a computer program is stored, which, when running on a computer, enables the computer to execute the corresponding content in the foregoing method embodiments. Compared with the prior art, in the embodiment of the application, when the target project file is updated, the first project file, the dependency corresponding to the first project file, and the second project file are obtained, the first project file is the target project file before updating, the second project file is the target project file after updating, the project file update information is determined based on the first project file and the second project file, the dependency corresponding to the second project file is determined based on the project file update information and the dependency corresponding to the first project file, that is, when the dependency corresponding to the target project file after updating is determined, the determination can be directly performed according to the update information between the project file after updating and the target project file before updating and the dependency corresponding to the project file before updating, so as to avoid analyzing the whole target project file after updating to obtain the dependency corresponding to the project file after updating, therefore, the time for acquiring the dependency relationship corresponding to the updated project file can be reduced, the time resource can be saved, and the research and development efficiency can be improved.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for determining a dependency relationship, comprising:
when the target project file is updated, acquiring a first project file, a dependency relationship corresponding to the first project file and a second project file, wherein the first project file is the target project file before updating, and the second project file is the target project file after updating;
determining project file update information based on the first project file and the second project file;
and determining the dependency corresponding to the second project file based on the project file updating information and the dependency corresponding to the first project file.
2. The method of claim 1, wherein the project file update information comprises: at least one of source code Cpp update information and library Target update information;
wherein the determining project file update information based on the first project file and the second project file comprises:
comparing the first project file with the second project file to obtain a comparison result;
determining at least one of the Cpp update information and the Target update information based on the comparison result.
3. The method of claim 2, wherein determining the Cpp update information based on the comparison comprises:
determining an updated compiling preprocessing command based on the comparison result to obtain Cpp updating information;
determining the Target update information based on the comparison result, wherein the determining the Target update information comprises:
determining an updated project build file based on the comparison result;
and analyzing the updated project construction file to obtain the Target update information.
4. The method of claim 2, wherein if the project file update information comprises the Cpp update information, then
Determining a dependency relationship corresponding to a second project file based on the project file update information and the dependency relationship corresponding to the first project file, including:
determining the dependency relationship of each Cpp in the first project file based on the dependency relationship corresponding to the first project file, wherein the dependency relationship of any Cpp comprises: a dependency between any of the cpps and the respective header files it contains;
determining a dependency corresponding to the updated Cpp based on the Cpp update information;
and determining the dependency relationship of each Cpp in the second project file based on the dependency relationship of each Cpp in the first project file and the dependency relationship corresponding to the updated Cpp.
5. The method of claim 4, wherein determining the updated Cpp dependency based on the Cpp update information comprises:
determining update information of a non-system header file in Cpp where update occurs based on the Cpp update information;
and determining the dependency corresponding to the updated Cpp based on the update information of the non-system header file.
6. The method of claim 2, wherein if the project file update information comprises the Target update information, then
Determining a dependency relationship corresponding to a second project file based on the project file update information and the dependency relationship corresponding to the first project file, including:
determining the dependency relationship of each Target in the first project file based on the dependency relationship corresponding to the first project file, wherein the dependency relationship of any Target comprises the following steps: at least one of a dependency between any Target and its respective called Target and a dependency between any Target and its respective called Cpp;
determining a dependency corresponding to the updated Target based on the Target update information;
and determining the dependency relationship of each Target in the second project file based on the dependency relationship of each Target in the first project file and the dependency relationship corresponding to the updated Target.
7. The method according to any one of claims 1 to 6, wherein obtaining the dependency corresponding to the first project file comprises:
acquiring the first project file, wherein the first project file comprises a Cpp file and a project construction file;
analyzing the compiling preprocessing command in the Cpp file to obtain the dependency relationship of each Cpp in the first project file;
and analyzing the project construction file information to obtain the dependency relationship of each Target in the first project file.
8. A dependency determination apparatus, comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a first project file, a dependency corresponding to the first project file and a second project file when a target project file is updated, the first project file is the target project file before updating, and the second project file is the target project file after updating;
a first determining module, configured to determine project file update information based on the first project file and the second project file;
and the second determining module is used for determining the dependency corresponding to the second project file based on the project file updating information and the dependency corresponding to the first project file.
9. An electronic device, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: performing the dependency determination method of any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the dependency determination method of any one of claims 1 to 7.
CN202010193360.3A 2020-03-18 2020-03-18 Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium Pending CN113495728A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010193360.3A CN113495728A (en) 2020-03-18 2020-03-18 Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010193360.3A CN113495728A (en) 2020-03-18 2020-03-18 Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN113495728A true CN113495728A (en) 2021-10-12

Family

ID=77994341

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010193360.3A Pending CN113495728A (en) 2020-03-18 2020-03-18 Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN113495728A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821486A (en) * 2021-11-22 2021-12-21 北京金堤科技有限公司 Method and device for determining dependency relationship between pod libraries and electronic equipment
CN114020694A (en) * 2021-10-19 2022-02-08 北京五八信息技术有限公司 Header file address acquisition method and device, electronic equipment and storage medium
CN116991426A (en) * 2023-09-26 2023-11-03 杭州实在智能科技有限公司 Automatic editing method and system for general preprocessing command for packaging OEM version software

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5854932A (en) * 1995-08-17 1998-12-29 Microsoft Corporation Compiler and method for avoiding unnecessary recompilation
US20130198717A1 (en) * 2012-01-31 2013-08-01 Sap Ag Unified Software Build System
CN104866369A (en) * 2015-05-22 2015-08-26 广州华多网络科技有限公司 Data processing method and apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5854932A (en) * 1995-08-17 1998-12-29 Microsoft Corporation Compiler and method for avoiding unnecessary recompilation
US20130198717A1 (en) * 2012-01-31 2013-08-01 Sap Ag Unified Software Build System
CN104866369A (en) * 2015-05-22 2015-08-26 广州华多网络科技有限公司 Data processing method and apparatus

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020694A (en) * 2021-10-19 2022-02-08 北京五八信息技术有限公司 Header file address acquisition method and device, electronic equipment and storage medium
CN113821486A (en) * 2021-11-22 2021-12-21 北京金堤科技有限公司 Method and device for determining dependency relationship between pod libraries and electronic equipment
CN116991426A (en) * 2023-09-26 2023-11-03 杭州实在智能科技有限公司 Automatic editing method and system for general preprocessing command for packaging OEM version software

Similar Documents

Publication Publication Date Title
US10394694B2 (en) Unexplored branch search in hybrid fuzz testing of software binaries
US8286149B2 (en) Apparatus for and method of implementing feedback directed dependency analysis of software applications
US9400733B2 (en) Pattern matching framework for log analysis
CN113495728A (en) Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium
US11675575B2 (en) Checking source code validity at time of code update
US9043757B2 (en) Identifying differences between source codes of different versions of a software when each source code is organized using incorporated files
JP2019053729A (en) Test method and test apparatus of smart contract
CN106557307B (en) Service data processing method and system
CN110737437A (en) compiling method and device based on code integration
CN111124872A (en) Branch detection method and device based on difference code analysis and storage medium
CN112860312A (en) Method and device for detecting item dependency relationship change
CN107391528B (en) Front-end component dependent information searching method and equipment
US9116714B2 (en) Methods and systems for file processing
US11755458B2 (en) Automatic software behavior identification using execution record
WO2015003452A1 (en) Methods and systems for file processing
CN111240987B (en) Method and device for detecting migration program, electronic equipment and computer readable storage medium
US9064042B2 (en) Instrumenting computer program code by merging template and target code methods
US9396239B2 (en) Compiling method, storage medium and compiling apparatus
CN112579146A (en) Interface change detection method and device
CN116578282A (en) Code generation method, device, electronic equipment and medium
US11947966B2 (en) Identifying computer instructions enclosed by macros and conflicting macros at build time
CN113760237A (en) Compiling address updating method and device, terminal equipment and readable storage medium
CN116483735B (en) Method, device, storage medium and equipment for analyzing influence of code change
CN116679852B (en) Project icon quotation method and device, electronic equipment and medium
US11256602B2 (en) Source code file retrieval

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