Software item dependency analysis method and apparatus, computer device, and storage medium
By adding a scanning plugin and creating threads to the pipeline, dependency analysis for different types of software projects is achieved, solving the problem of tool diversity in existing technologies and improving analysis efficiency and quality.
Patent Information
- Application Number
- CN202210709741.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-22
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-06-22
AI Technical Summary
Current technology cannot use a single tool to perform dependency analysis for all types of software projects, requiring the deployment of different analysis tools for different types of software projects.
A pre-developed scanning plugin is added to a pre-deployed pipeline. By creating threads and using the scanning plugin to scan software projects in the pipeline, project types and dependency information are obtained. A single analysis tool is used to complete dependency analysis for all software projects.
It enables dependency analysis for all software projects in the pipeline, reduces the complexity of tool deployment, and provides timely feedback on dependency errors, thereby improving the quality of software projects.
Smart Images

Figure CN115202709B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software development, and in particular to a software project dependency analysis method and device, computer equipment and a storage medium. BACKGROUND
[0002] In the current technical field of software development, the analysis method for dependencies in software projects is a software tool for dependency analysis developed for a single target type of project. The inventors have found that in the pipeline of the development and operation system DevOps, a large number of different dependency analysis tools need to be used for a large number of different types of software projects, and it is not possible to use one analysis tool to complete dependency analysis for all types of software projects. SUMMARY
[0003] The embodiments of the present application provide a software project dependency analysis method and device, computer equipment and a storage medium to solve the problem that the prior art cannot use one tool to complete dependency analysis for all types of software projects.
[0004] A software project dependency analysis method comprises:
[0005] adding a pre-developed scanning plug-in to a pre-deployed pipeline;
[0006] finding a network address of at least one target software project to be analyzed for dependencies in the pipeline;
[0007] creating a corresponding thread for each target software project and assigning an analysis task for the target software project to the corresponding thread;
[0008] starting the thread, using the scanning plug-in to scan files of the target software project according to the corresponding network address, obtaining a target format file for representing the type of the target software project, and obtaining the type of the target software project according to the obtained result;
[0009] using the scanning plug-in to analyze the target format file according to the type of the project through the thread, and obtaining dependency information of the target software project according to the analysis result.
[0010] A software project dependency analysis device comprises:
[0011] a scanning plug-in module for adding a pre-developed scanning plug-in to a pre-deployed pipeline;
[0012] a network address module for finding a network address of at least one target software project to be analyzed for dependencies in the pipeline;
[0013] a thread module, configured to create a corresponding thread for each of the target software projects, and allocate an analysis task of the target software project to the corresponding thread;
[0014] a type analysis module, configured to start the thread, use the scanning plug-in to scan files of the target software project according to the corresponding network address, obtain a target format file used to represent a type of the target software project, and obtain the type of the target software project according to an analysis result of the target format file.
[0015] a dependency analysis module, configured to use the scanning plug-in to analyze the target format file according to the type of the target software project through the thread, and obtain dependency information of the target software project according to an analysis result of the target format file.
[0016] A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the software project dependency analysis method when executing the computer program.
[0017] A computer readable storage medium, which stores a computer program, wherein the computer program is executable on a processor to implement the steps of the software project dependency analysis method.
[0018] The software project dependency analysis method, device, computer device, and storage medium, by adding the pre-developed scanning plug-in to the pre-deployed pipeline, creating and starting a thread, using the scanning plug-in to scan all software projects managed in the pipeline through the thread, obtaining the types and dependency information of all software projects, and analyzing the dependency information of all software projects, only one analysis tool is used to complete the analysis of the dependencies of all software projects in the pipeline, and different analysis tools do not need to be deployed or added for different projects. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0020] Figure 1 is an application environment diagram of a software project dependency analysis method in an embodiment of the present application;
[0021] Figure 2 is a flowchart of a software project dependency analysis method in an embodiment of the present application;
[0022] Figure 3 is a structural schematic diagram of a software item dependency analysis device in an embodiment of the present application;
[0023] Figure 4 is a schematic diagram of a computer device in an embodiment of the present application;
[0024] Figure 5 is a schematic diagram of another computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0026] The software item dependency analysis method provided in the present application can be applied in an application environment as shown in Figure 1 , wherein the computer device can communicate with the server through a network. The computer device can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers.
[0027] At present, in the field of software development technology, DevOps (Development and Operations) is a general term for a set of processes, methods and systems used to promote communication, cooperation and integration between development (application / software engineering), technical operation and quality assurance (QA) departments. DevOps makes the construction of software projects, testing of software projects and release of software projects become more efficient, frequent and reliable through the automation of "software delivery" and "architecture change" processes. The pipeline in DevOps is a set of automated processes, and the common components included in the pipeline are build automation or continuous integration, test automation and deployment automation. The specific component tool classification includes but is not limited to: source code control tools, build tools, containerization tools, configuration management tools and monitoring tools. When there is no DevOps, the dependency management mode of each software project is a mode of separate management of each software project. After the source code control tool is added in DevOps, the detailed code content of each software project in the pipeline can be obtained, and then the software item dependency analysis method provided in the present application can be used to analyze the dependency of each software project in the pipeline.
[0028] In an embodiment, as shown in Figure 2 , a software item dependency analysis method is provided, and the method is applied inFigure 1 The server in the above steps S101-S105 is taken as an example for illustration, including the following steps S101-S105:
[0029] S101, add the pre-developed scanning plug-in to the pre-deployed pipeline.
[0030] Specifically, the scanning plug-in can be developed based on any computer language for plug-in development, but it needs to meet the necessary condition that the scanning plug-in can run in the pipeline, otherwise the subsequent scheme in the embodiment cannot be performed. The function that the scanning plug-in can meet is to execute the running instructions of a specific programming language, for example, the javac command of Java programming language, or the npx command of JavaScript programming language, etc. Since there are many types of computer programming languages, they will not be described here. At the same time, the specific programming language also needs to have the language function of file reading, that is, the specific programming language must have the target function of "scanning" files, otherwise the subsequent scheme in the embodiment cannot be performed. For example, the specific programming language can be JavaScript programming language, because JavaScript programming language contains fs module, and the language function of the fs module is the function of file reading and writing. Further, when selecting the specific programming language, the performance and ease of use of the target module for implementing the "scanning" file function in the specific programming language need to be fully considered, that is, the selected specific programming needs to be quickly mastered and used by relevant software development technical personnel, and the specific programming language can complete the "scanning" task of the files of all software items in the pipeline at a faster speed with less consumption of computer system hardware resources.
[0031] S102, find the network address of at least one target software item to be analyzed in the pipeline.
[0032] Specifically, a source code control tool is integrated in the pipeline. The source code control tool includes, but is not limited to, Git, Subversion, Concurrent Versions System (CVS), Vesta, Mercurial, etc. The source code control tool is generally used for version management, branch management, merge management, etc. of the source code of a software project in the field of software development technology. Meanwhile, in the field of software development technology, it is a common practice to store the source code of a software project in a code server dedicated to source code management and grant relevant personnel with corresponding permissions of the software project with corresponding operation permissions and network addresses of the code server. In the DevOps software operation system, the deployed pipeline needs to manually fill in the network addresses of the code servers of the source code of the software projects in the pipeline by the relevant personnel because the pipeline needs to manage numerous software projects. Further, a specific scanning tool can be used in the pipeline to scan each network address in the corresponding network segment or network space according to the formulated scanning rules to determine whether there is a software project on each network address. However, the foregoing method of discovering a software project by scanning a network is not the basic technology and associated technology of the present application, and therefore, the detailed technical details are not described herein.
[0033] S103, creating a corresponding thread for each target software project and distributing the analysis task of the target software project to the corresponding thread.
[0034] Specifically, first, a first total number of target software projects is acquired, and a second total number of threads is created according to the first total number. Then, a many-to-one surjective correspondence is established between the first total number of target software projects and the second total number of threads, that is, the second number of threads all correspond to at least one target software project. Wherein, the dependency analysis of each target software project needs to be based on the dependency that has been acquired, and the purpose of creating a second total number of threads is to allocate the task of acquiring the dependency of the target software project to the second total number of threads for execution. It needs to be particularly pointed out that the creation of the second number of threads also needs to follow the basic thread creation principle and meet the basic requirements, that is, the second number of threads also needs to be flexibly handled according to the remaining situation of the hardware resources of the computer system at the current time during the creation process, and cannot occupy too many hardware resources of the computer system to cause abnormal situations such as lag or crash of the computer system running, and the second number should be equal to or less than the first total number, if the second number is greater than the first number, it will cause waste of hardware resources of the computer system, and if the second number is less than the first number, there must be at least one thread allocated with more than one dependency acquisition task of the software project. For example, the dependencies of 6 software projects need to be analyzed, if 7 threads are created, it will cause waste of threads, and if 5 threads are created, there must be at least one thread allocated with multiple analysis tasks.
[0035] S104, start the thread, use the scanning plug-in to scan the files of the target software project according to the network address corresponding to the target software project, acquire a target format file for representing the type of the target software project, and obtain the project type of the target software project according to the acquisition result.
[0036] In a specific embodiment, a corresponding file scanning function is developed using JavaScript programming language to scan all files of the target software project, and the foregoing corresponding file scanning function is packaged as a corresponding NPM package, and the NPM package is published to an NPM package management warehouse. Further, before starting the thread and using the scanning plug-in to scan the files of the corresponding target software project according to the network address, the scanning plug-in further includes: executing a download command of a node package executor NPX to download a pre-developed node package manager NPM software package; executing a running command of the node package executor NPX to run the node package manager NPM software package, wherein the running command includes the network address. Wherein, the scanning plug-in downloads the software package from the NPM package management warehouse to download the latest version of the NPM package by default.
[0037] Further, the obtaining the target format file corresponding to the target software project type includes: firstly, obtaining the file type of each file in the target software project, and matching the file type in a pre-set project dependency file type set; adding the file with a successful matching result to a target dependency file set as the target format file. If the target dependency file set is an empty set, a failure result is returned, and a project type selected manually according to a pre-set project type set is received; if there is only one target dependency file in the target dependency file set, the project type corresponding to the target software project is the type corresponding to the target dependency file; if there are at least two target dependency files in the target dependency file set, a failure result and the target dependency file are returned, and a project type analyzed manually according to the target dependency file is received. The project dependency file type set includes the formats of dependency configuration files of software projects of all types, such as.gradle format files of Android projects, pom.xml and setttings.xml of Java projects, requirements.txt of Python projects, Podfile.lock files of iOS projects, and package.json of HTML5 projects. It should be particularly noted that in an actual software development process, a software developer and / or a software development team may modify configuration files in a software project, and in some software projects, the configuration files include information such as the type and name of a dependency information file, so the fixed file type and / or the fixed file name of the file in the above examples may be different in some software projects, and need to be changed flexibly according to specific use scenarios. For example, in a project configuration file of an HTML5 project, the name of a file containing dependency information is changed from the original default package.json to x.json.
[0038] Further, before the receiving the manually selected project type according to the preset project type set, further comprising: first, using the scanning plug-in to scan the file type of each file in the target software project, and obtaining the proportion data of each file type in the target software project according to the scanning result. Then, according to the proportion data, and the preset project type analysis rule and historical project type analysis record, the prediction value of each project type in the project type set corresponding to the target software project is obtained. It should be particularly pointed out that the proportion data of each file type in the target software project is only a reference data, because there is a certain error in some projects. For example, in the development of Android project, there are mainly using Java programming language for development, or mainly using Kotlin programming language for development, or mainly using JavaScript programming language and Html programming language for development, the use of the foregoing three different programming languages can completely correspond to an Android project, and there is a possibility of identifying the Android project as a front-end project. According to the conventional phenomenon in the field of software development, the type of a software project generally does not change after the project type is determined at the beginning of the establishment of the software project, unless the software project is completely redone or refactored by using another development language. For example, a project originally developed by using Java programming language is redone by using Go programming language or Python programming language due to some actual needs, so the type of the software project changes from Java type to Go type or Python type. Therefore, the historical project type analysis record can be used as a parameter in the method of generating the prediction value of the project type. For example, the analysis result of the latest analysis in the software project type analysis record is the most valuable information for analyzing the type of the current target software project.
[0039] Further, after obtaining the number and proportion of all types of files in the target software project using the scanning plug-in, the number and proportion are sent to a preset artificial intelligence dependency analysis model. The artificial intelligence dependency analysis model is trained and improved according to the number and proportion of all types of files in each software project, and the type result obtained by analyzing the corresponding software project each time. The artificial intelligence dependency analysis model receives the number and proportion of all types of files in the target software project, outputs the prediction value of the target software project for various software project types, and assists the relevant personnel of the target software project to make a judgment according to the prediction value output by the artificial intelligence dependency analysis model, and then specifies the project type of the target software project.
[0040] Further, the returning of the analysis failure result and the target dependent file further comprises: sequentially obtaining file content of each target dependent file, comparing the file content with type text content coding rules of each target dependent file. If the file content does not conform to the type text content coding rules, the target dependent file is removed from the target dependent file set. That is, the target dependent file with content coding error in the target dependent file set needs to be removed. On the one hand, the analysis of the target dependent file with error is invalid, and on the other hand, the target dependent file with error and the specific error can be returned to the relevant technical developer of the target software project, so as to facilitate the relevant technical developer to correct the target dependent file with error in time.
[0041] Further, it needs to be noted that in the field of software development technology, there are many software development technologies that need to be upgraded. Among them, after the target software project is upgraded, the text content coding rules of the target dependent file are also upgraded, that is, the text content in the target dependent file adopts a brand-new content coding rule. In this case, if the old content coding rule is used for judgment, the result obtained is that all the dependencies in the target dependent file are wrong. In this case, on the one hand, this situation can be treated as a special case, and the target dependent file with all wrong dependencies is sent to the relevant personnel of the target software project for judgment and error analysis, on the other hand, all content coding rules can be summarized and a timing task can be started to obtain the latest content coding rule from the network address source corresponding to the content coding rule. In addition, it also needs to be specially pointed out that there are many software projects managed in the pipeline, including first dependent files encoded using old version content coding rules and second dependent files encoded using new version content coding rules. At this time, multiple versions of content coding rules need to be used to match the text content in the first dependent file and the text content in the second dependent file, and the probability that the text content in the first dependent file and the text content in the second dependent file are all wrong should be extremely small.
[0042] S105, by using the scanning plug-in, the target format file is analyzed according to the corresponding project type, and the dependency information of the target software project is obtained according to the analysis result.
[0043] Specifically, the analyzing, by the thread, the text content of the target format file according to the corresponding project type comprises: first, reading, by the thread, the text content of the target format file using the scanning plug-in; then, analyzing the text content according to the coding rule of the target format file; if a piece of dependent text content in the target format file conforms to the coding rule of the target format file, the text content is identified as correct dependency; if a piece of dependent text content in the target format file does not conform to the coding rule of the target format file, the text content is identified as error dependency.
[0044] Further, the project information of the software project where the error dependency is located is acquired, the project information includes but is not limited to: software project name, software project type, software project address, software project latest version number, software project last code commit time, etc. Then, a one-to-many corresponding relationship between the project information and the error dependency is established, that is, there is at least one error dependency for one software project. Finally, the corresponding relationship established according to the project information and the error dependency is sent to the associated personnel of the software project. After the associated personnel modifies the error dependency, the steps of the project dependency analysis method are re-executed to verify whether the modification of the error dependency by the associated personnel is correct.
[0045] The software project dependency analysis method provided in the embodiment adds the pre-developed scanning plug-in to the pre-deployed pipeline, creates and starts a thread, uses the scanning plug-in to scan all software projects managed in the pipeline through the thread, acquires the types and dependency information of all software projects, and analyzes the dependency information of all software projects. Only one analysis tool is used to complete the analysis of the dependencies of all software projects in the pipeline, and different analysis tools do not need to be deployed or added for different projects. At the same time, some dependency errors found in the analysis process are fed back to the associated personnel of the software project in time, facilitating the elimination of errors and the timely improvement of the quality of the software project.
[0046] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0047] In an embodiment, a software project dependency analysis device 100 is provided, which corresponds to the software project dependency analysis method in the above embodiment one-to-one. As shown in FIG. 1, the software project dependency analysis device 100 comprises a scanning plug-in 101, a pipeline 102, a thread 103, a project dependency analysis module 104, a project information acquisition module 105, and a project dependency modification module 106. Figure 3As shown, the software project dependency analysis device 100 comprises a scanning plug-in module 11, a network address module 12, a thread module 13, a type analysis module 14 and a dependency analysis module 15. The functions of the modules are described in detail as follows:
[0048] The scanning plug-in module 11 is configured to add a pre-developed scanning plug-in to a pre-deployed pipeline.
[0049] The network address module 12 is configured to find a network address of at least one target software project to be analyzed for dependency in the pipeline.
[0050] The thread module 13 is configured to create a corresponding thread for each target software project and assign an analysis task of the target software project to the corresponding thread.
[0051] The type analysis module 14 is configured to start the thread, use the scanning plug-in to scan files of the target software project according to the corresponding network address, obtain a target format file for representing a type of the target software project, and obtain the type of the target software project according to a result of the scanning.
[0052] The dependency analysis module 15 is configured to use the scanning plug-in to analyze the target format file according to the type of the target software project through the thread, and obtain dependency information of the target software project according to a result of the analysis.
[0053] Further, the thread module 13 further comprises:
[0054] A software package downloading submodule is configured to execute a downloading command of a node package executor NPX through the scanning plug-in, and download a pre-developed node package manager NPM software package.
[0055] A software package running submodule is configured to execute a running command of the node package executor NPX through the scanning plug-in, and run the node package manager NPM software package, wherein the running command comprises the network address.
[0056] Further, the type analysis module 14 further comprises:
[0057] A dependency file collection submodule is configured to obtain a file type of each file in the target software project, match the file type in a pre-set project dependency file type collection, and add a file that is successfully matched to a target dependency file collection as the target format file.
[0058] An empty set processing submodule is configured to return an analysis failure result if the target dependency file collection is an empty set, and receive a project type that is manually selected according to a pre-set project type collection.
[0059] a single set sub-module, configured to determine the project type of the target software project as the type corresponding to the target dependent file if there is only one target dependent file in the target dependent file set;
[0060] a complex set sub-module, configured to return an analysis failure result and the target dependent file if there are at least two target dependent files in the target dependent file set, and receive a project type obtained by manual analysis according to the target dependent file.
[0061] Further, the empty set processing sub-module further comprises:
[0062] a type proportion sub-unit, configured to scan the file type of each file corresponding to the target software project by using the scanning plug-in, and obtain proportion data of each file type in the target software project according to a scanning result;
[0063] a type prediction sub-unit, configured to obtain a prediction value of each project type in the project type set corresponding to the target software project according to the proportion data, and a preset project type analysis rule and a historical project type analysis record.
[0064] Further, the complex set sub-module further comprises:
[0065] a first content comparison sub-unit, configured to sequentially obtain file content of each target dependent file, and compare the file content with a type text content coding rule of each target dependent file;
[0066] a set processing sub-unit, configured to remove the target dependent file from the target dependent file set if the file content does not conform to the type text content coding rule.
[0067] Further, the project type module 14 further comprises:
[0068] a result returning sub-module, configured to return an analysis result of the project type of the target software to the pipeline;
[0069] a type specifying sub-module, configured to receive a confirmation instruction of the project type of the target software or a manual specified result of the project type of the target software project.
[0070] Further, the dependent analysis module 15 further comprises:
[0071] a content reading sub-module, configured to read each text content of the target format file by using the scanning plug-in through the thread;
[0072] a second content comparison submodule, configured to analyze the text content according to the encoding rule of the target format file;
[0073] a correct dependency submodule, configured to identify the text content as correct dependency if the text content of one dependency in the target format file meets the encoding rule of the target format file;
[0074] an error dependency submodule, configured to identify the text content as error dependency if the text content of one dependency in the target format file does not meet the encoding rule corresponding to the target format file.
[0075] The "first" and "second" in the above modules / units are only used to distinguish different modules / units, and are not used to limit the priority of which module / unit is higher or other limiting meanings. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or modules does not have to be limited to only those steps or modules clearly listed, but can include other steps or modules not clearly listed or inherent to these processes, methods, products or devices. The division of modules in this application is only a logical division, and other division methods can be used in actual application.
[0076] The specific limitations of the software project dependency analysis device can refer to the limitations of the software project dependency analysis method described above, which will not be repeated here. Each module in the above software project dependency analysis device can be realized by software, hardware and their combination. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0077] In one embodiment, a computer device, which can be a server, is provided, and its internal structure diagram can be as shown in Figure 4 The computer device includes a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the data involved in the software project dependency analysis method. The network interface of the computer device is used to communicate with the external terminal through the network connection. The computer program is executed by the processor to implement a software project dependency analysis method.
[0078] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with an external server via a network connection. When the computer program is executed by the processor, it implements a software project dependency analysis method.
[0079] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the software project dependency analysis method described in the above embodiments, for example... Figure 2 The steps S101 to S105 shown, as well as other extensions and related steps of the method, are examples. Alternatively, when the processor executes a computer program, it implements the functions of each module / unit of the software project dependency analysis device in the above embodiments, for example... Figure 3 The functions of modules 11 to 15 are shown. To avoid repetition, they will not be described again here.
[0080] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the computer device, connecting various parts of the computer device via various interfaces and lines.
[0081] The memory can be used to store the computer program and / or modules, and the processor realizes various functions of the computer device by running or executing the computer program and / or modules stored in the memory, and calling data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), and the like; and the data storage area can store data created according to the use of the mobile phone (such as audio data, video data, etc.), and the like.
[0082] The memory can be integrated in the processor or arranged separately from the processor.
[0083] In one embodiment, a computer readable storage medium is provided, and the computer program is stored on the computer readable storage medium. The computer program is executed by the processor to realize the steps of the software item dependency analysis method in the above embodiment, for example Figure 2 The steps S101 to S105 and the extension of other extensions and related steps of the method. Alternatively, the computer program is executed by the processor to realize the functions of each module / unit of the software item dependency analysis device in the above embodiment, for example Figure 3 The functions of the modules 11 to 15. To avoid repetition, details are not described here.
[0084] A person of ordinary skill in the art can understand that all or part of the processes in the above embodiment method can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0085] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
[0086] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A software project dependency analysis method, characterized by, The method comprises the following steps: adding a pre-developed scanning plug-in to a pre-deployed pipeline; finding a network address of at least one target software project to be analyzed in the pipeline; creating a corresponding thread for each target software project and assigning an analysis task of the target software project to the corresponding thread; starting the thread, using the scanning plug-in to scan files of the target software project according to the network address, obtaining a target format file used to represent a type of the target software project, and obtaining the type of the target software project according to the obtained result; using the scanning plug-in to analyze the target format file according to the type of the target software project through the thread, and obtaining dependency information of the target software project according to the analysis result; wherein the step of using the scanning plug-in to analyze the target format file according to the type of the target software project through the thread comprises the following steps: reading each text content of the target format file through the thread using the scanning plug-in; analyzing the text content according to a coding rule of the target format file; if the text content of a dependency in the target format file conforms to the coding rule of the target format file, the text content is identified as a correct dependency; if the text content of a dependency in the target format file does not conform to the coding rule of the target format file, the text content is identified as an incorrect dependency.
2. The software project dependency analysis method of claim 1, wherein, Before the step of starting the thread, using the scanning plug-in to scan files of the target software project according to the network address, the method further comprises the following steps: executing a download command of a node package executor NPX through the scanning plug-in to download a pre-developed node package manager NPM software package; executing a running command of the node package executor NPX through the scanning plug-in to run the node package manager NPM software package, wherein the running command comprises the network address.
3. The software project dependency analysis method of claim 1, wherein, The step of obtaining a target format file used to represent a type of the target software project and obtaining the type of the target software project according to the obtained result comprises the following steps: obtaining a file type of each file in the target software project, matching the file type in a pre-set project dependency file type set, adding the file that matches successfully to a target dependency file set as the target format file; if the target dependency file set is empty, returning an analysis failure result and receiving a project type selected manually according to a pre-set project type set; if there is only one target format file in the target dependency file set, the type of the target software project is the type corresponding to the target format file; if there are at least two target dependency files in the target dependency file set, returning an analysis failure result and the target dependency files and receiving a project type analyzed manually according to the target dependency files.
4. The software project dependency analysis method of claim 3, wherein, Before the step of receiving a project type selected manually according to a pre-set project type set, the method further comprises the following steps: scanning, using the scanning plug-in, a file type corresponding to each file in the target software project, and obtaining, according to a scanning result, proportion data of each file type in the target software project; obtaining, according to the proportion data and a pre-set project type analysis rule and a historical project type analysis record, a prediction value corresponding to each project type in the project type set for the target software project.
5. The software project dependency analysis method of claim 3, wherein, Before the returning of the analysis failure result and the target dependent file, the method further comprises: sequentially obtaining file content of each target dependent file, and comparing the file content with a type text content coding rule of each target dependent file; if the file content does not conform to the type text content coding rule, removing the target dependent file from the target dependent file set.
6. The software project dependency analysis method of claim 1, wherein, After the obtaining of the target format file representing the project type corresponding to the target software project, the method further comprises: returning an analysis result of the project type corresponding to the target software to the pipeline; receiving a confirmation instruction of the project type of the target software or a manual designation result of the project type of the target software project.
7. A software project dependency analysis apparatus characterized by comprising: The method comprises: a scanning plug-in module, configured to add a pre-developed scanning plug-in into a pre-deployed pipeline; a network address module, configured to find a network address of at least one target software project to be analyzed in the pipeline; a thread module, configured to create a corresponding thread for each target software project, and assign an analysis task of the target software project to the corresponding thread; a type analysis module, configured to start the thread, use the scanning plug-in to scan files of the target software project corresponding to the network address, obtain a target format file representing a project type of the target software project, and obtain the project type of the target software project according to an obtaining result; a dependent analysis module, configured to use the scanning plug-in to analyze the target format file according to the project type through the thread, and obtain dependent information of the target software project according to an analysis result; wherein the dependent analysis module further comprises: a content reading submodule, configured to read each text content of the target format file through the thread using the scanning plug-in; a second content comparison submodule, configured to analyze the text content according to an encoding rule of the target format file; a correct dependency submodule, configured to identify the text content as correct dependency if the text content of one dependency in the target format file conforms to the encoding rule of the target format file; and an error dependency submodule, configured to identify the text content as error dependency if the text content of one dependency in the target format file does not conform to the encoding rule corresponding to the target format file.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the software project dependent analysis method in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 8. The computer program is executed by the processor to implement the steps of the software project dependent analysis method in any one of claims 1 to 6.
Citation Information
Patent Citations
Management method and device of iOS component, electronic equipment and storage medium
CN112363754A
Method for deploying pipeline engine system, method and device for continuous integration
CN112527382A