Data processing methods, apparatus, computer equipment and storage media
Patent Information
- Application Number
- CN202211135875.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-19
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2042-09-19
AI Technical Summary
然而,在传统方法中,利用人工来对构件清单中的内容进行更新,存在构件清单更新不及时以及更新错误等问题
[0065]上述数据处理方法、装置、计算机设备、存储介质和计算机程序产品,对目标工程代码进行打包,得到目标工程,在打包成功后,对目标工程的目标根目录进行扫描处理,得到目标工程所引用的目标构件的构件信息,构件信息包括目标构件的构件名称和目标构件的版本号,并根据目标工程和目标构件的构件信息,构建得到目标映射关系,目标映射关系用于表征目标工程与其所引用的目标构件的对应关系。基于上述数据处理方法、装置、计算机设备、存储介质和计算机程序产品,在打包成功后,自动对目标工程的目标根目录进行扫描,得到目标工程所引用的目标构件的构件信息,进而构建出目标映射关系,也即,目标工程每进行一次更新,则可以通过扫描自动得到该目标工程的目标映射关系,进而实现了对目标工程所引用的目标构件的实时更新,可以及时更新目标构件的构件信息,提高了构件信息的更新效率以及更新的准确度。
Smart Images

Figure CN115454476B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data processing method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the development of the computer field, the speed of application (i.e. software) updates and iterations has greatly increased. In particular, when an application project is running normally, it needs to reference multiple components to achieve different functions, and the components or component versions referenced by different versions of the application project are also different.
[0003] In traditional methods, after developers update components referenced in a project, they add the component name and version number of the new version of the component to the component inventory, which is essentially manual component management. However, this traditional method of manually updating the component inventory suffers from problems such as untimely updates and errors. Summary of the Invention
[0004] Therefore, it is necessary to provide a data processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can automatically update component information to address the aforementioned technical problems.
[0005] Firstly, this application provides a data processing method. The method includes:
[0006] The target project code is packaged using a packaging script to obtain the target project.
[0007] After successful packaging, the target root directory of the target project is scanned to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0008] Based on the component information of the target project and the target component, a target mapping relationship is constructed, which is used to characterize the correspondence between the target project and the target component it references.
[0009] In one embodiment, the target component includes a first target component, which is a local component. The step of scanning the target root directory of the target project to obtain component information of the target components referenced by the target project includes:
[0010] Based on the file extension name corresponding to the local component, the target root directory of the target project is scanned to obtain the target folder corresponding to the first target component. The target folder includes target files, and the file name of the target file is composed of the first component name of the first target component and the file extension name corresponding to the first target component.
[0011] The first component name of the first target component is obtained from the file name of the target file.
[0012] In one embodiment, the step of scanning the target root directory of the target project to obtain the component information of the target components referenced by the target project further includes:
[0013] Determine the path of the first file to be accessed within each of the target folders;
[0014] For any first target component, traverse each first file path in the target folder corresponding to the first target component to obtain the first version number of the first target component.
[0015] In one embodiment, the target component further includes a second target component, which is a third-party component. The step of scanning the target root directory of the target project to obtain component information of the target components referenced by the target project includes:
[0016] Based on the preset filenames of various version management files, the target root directory is scanned to obtain the version management files of the second target component;
[0017] Obtain the second component name and the second version number of the second target component from the version management file of the second target component.
[0018] In one embodiment, the step of traversing each of the first file paths within the target folder corresponding to the first target component to obtain the first version number of the first target component includes:
[0019] Scan the files corresponding to each of the first file paths;
[0020] If the filename of the scanned file matches the name of the first component, the first version number of the first target component is read from the file.
[0021] In one embodiment, reading the first version number of the first target component from the file includes:
[0022] The version number storage rule is determined based on the file extension name corresponding to the first target component;
[0023] According to the version number storage rules, the first version number of the first target component is read from the file.
[0024] In one embodiment, the method further includes:
[0025] In the continuous integration pipeline, code inspection is performed on the code of the target project to obtain an inspection report of the target project;
[0026] Obtain a safe component registration form, which describes at least one component in a safe reference state;
[0027] Based on the target mapping relationship and the safety component registration table, the safety status of the target component referenced by the target project is determined;
[0028] The safety status of the target component referenced in the target project is added to the inspection report to obtain the quality report of the target project.
[0029] Secondly, this application also provides a data processing apparatus. The apparatus includes:
[0030] The packaging module is used to package the target project code using a packaging script to obtain the target project.
[0031] The scanning module is used to scan the target root directory of the target project after successful packaging to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0032] A construction module is used to construct a target mapping relationship based on the component information of the target project and the target component. The target mapping relationship is used to characterize the correspondence between the target project and the target component it references.
[0033] In one embodiment, the target component includes a first target component, which is a local component, and the scanning module is further configured to:
[0034] Based on the file extension name corresponding to the local component, the target root directory of the target project is scanned to obtain the target folder corresponding to the first target component. The target folder includes target files, and the file name of the target file is composed of the first component name of the first target component and the file extension name corresponding to the first target component.
[0035] The first component name of the first target component is obtained from the file name of the target file.
[0036] In one embodiment, the scanning module is further configured to:
[0037] Determine the path of the first file to be accessed within each of the target folders;
[0038] For any first target component, traverse each first file path in the target folder corresponding to the first target component to obtain the first version number of the first target component.
[0039] In one embodiment, the target component further includes a second target component, which is a third-party component, and the scanning module is further configured to:
[0040] Based on the preset filenames of various version management files, the target root directory is scanned to obtain the version management files of the second target component;
[0041] Obtain the second component name and the second version number of the second target component from the version management file of the second target component.
[0042] In one embodiment, the scanning module is further configured to:
[0043] Scan the files corresponding to each of the first file paths;
[0044] If the filename of the scanned file matches the name of the first component, the first version number of the first target component is read from the file.
[0045] In one embodiment, the scanning module is further configured to:
[0046] The version number storage rule is determined based on the file extension name corresponding to the first target component;
[0047] According to the version number storage rules, the first version number of the first target component is read from the file.
[0048] In one embodiment, the device further includes:
[0049] The detection module is used to perform code detection on the code of the target project in the continuous integration pipeline and obtain a detection report of the target project.
[0050] An acquisition module is used to acquire a security component registration form, which describes at least one component in a secure reference state;
[0051] The determination module is used to determine the safety status of the target component referenced by the target project based on the target mapping relationship and the safety component registration table;
[0052] An addition module is used to add the safety status of the target component referenced by the target project to the inspection report, thereby obtaining a quality report for the target project.
[0053] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0054] The target project code is packaged using a packaging script to obtain the target project.
[0055] After successful packaging, the target root directory of the target project is scanned to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0056] Based on the component information of the target project and the target component, a target mapping relationship is constructed, which is used to characterize the correspondence between the target project and the target component it references.
[0057] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0058] The target project code is packaged using a packaging script to obtain the target project.
[0059] After successful packaging, the target root directory of the target project is scanned to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0060] Based on the component information of the target project and the target component, a target mapping relationship is constructed, which is used to characterize the correspondence between the target project and the target component it references.
[0061] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0062] The target project code is packaged using a packaging script to obtain the target project.
[0063] After successful packaging, the target root directory of the target project is scanned to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0064] Based on the component information of the target project and the target component, a target mapping relationship is constructed, which is used to characterize the correspondence between the target project and the target component it references.
[0065] The aforementioned data processing method, apparatus, computer equipment, storage medium, and computer program product package the target project code to obtain the target project. After successful packaging, the target root directory of the target project is scanned to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component. Based on the component information of the target project and the target components, a target mapping relationship is constructed. The target mapping relationship is used to represent the correspondence between the target project and the target components it references. Based on the aforementioned data processing method, apparatus, computer equipment, storage medium, and computer program product, after successful packaging, the target root directory of the target project is automatically scanned to obtain the component information of the target components referenced by the target project, and then a target mapping relationship is constructed. That is, every time the target project is updated, the target mapping relationship of the target project can be automatically obtained through scanning, thereby realizing real-time updates of the target components referenced by the target project. This allows for timely updates of the component information of the target components, improving the efficiency and accuracy of component information updates. Attached Figure Description
[0066] Figure 1 This is a flowchart illustrating a data processing method in one embodiment;
[0067] Figure 2 This is a flowchart illustrating the data processing method in another embodiment;
[0068] Figure 3 This is a flowchart illustrating the data processing method in another embodiment;
[0069] Figure 4 This is a flowchart illustrating the data processing method in another embodiment;
[0070] Figure 5 This is a flowchart illustrating the data processing method in another embodiment;
[0071] Figure 6 This is a flowchart illustrating the data processing method in another embodiment;
[0072] Figure 7This is a flowchart illustrating the data processing method in another embodiment;
[0073] Figure 8 This is a schematic diagram of the target root directory in one embodiment;
[0074] Figure 9 This is a structural block diagram of a data processing device in one embodiment;
[0075] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0076] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0077] In one embodiment, such as Figure 1 As shown, a data processing method is provided. This embodiment illustrates the method applied to a terminal, but it is understood that the method can also be applied to a server, or to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0078] Step 102: Package the target project code using a packaging script to obtain the target project.
[0079] In the field of application engineering development, when developing a new version of an application project, in order to enable the application project to implement new functions or optimize the functions of the application project, the developers will modify the components or component versions referenced by the application project by modifying the project code to obtain the project code corresponding to the new version of the application project. After that, the project code needs to be compiled, packaged and other operations to obtain the application project that users can use.
[0080] In this embodiment, the packaging script is an executable file used to perform packaging operations on the target project code. When the packaging script starts running, it begins packaging the target project code. The target project code can be compiled into an executable file, and then the packaging script packages the executable file to obtain the target project.
[0081] Step 104: After successful packaging, scan the target root directory of the target project to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0082] In this embodiment of the application, the target root directory can represent the storage relationship between various files and folders in the target project. The component information of the components referenced by the target project is stored in the files in the target root directory. After successful packaging, the target root directory of the target project can be scanned to obtain the component name and version number of the target component referenced by the target project.
[0083] For example, taking Project 1 as an example, the target root directory of Project 1 includes a folder named "LibA", and the component information of component A is stored in the "LibA" folder; or, the target root directory of Project 1 includes a file named "podfile.lock", and the component information of component B is stored in the "podfile.lock" file.
[0084] Step 106: Based on the component information of the target project and the target component, construct the target mapping relationship. The target mapping relationship is used to characterize the correspondence between the target project and the target component it references.
[0085] In this embodiment of the application, firstly, the target project and the component name of the target component it references can be mapped together. Then, the version number of each target component is mapped one by one with the component name of the target component to construct a target mapping relationship. The target mapping relationship can be used to characterize the correspondence between the target project and the target component it references. That is, the target mapping relationship can indicate which version of the component the target project specifically references.
[0086] In the above data processing method, after successful packaging, the target root directory of the target project is automatically scanned to obtain the component information of the target components referenced by the target project, and then a target mapping relationship is constructed. That is, every time the target project is updated, the target mapping relationship of the target project can be automatically obtained through scanning, thereby realizing the real-time update of the target components referenced by the target project. The component information of the target components can be updated in a timely manner, improving the efficiency and accuracy of component information updates.
[0087] In one embodiment, such as Figure 2 As shown, the target component includes a first target component, which is a local component. Step 104 involves scanning the target root directory of the target project to obtain the component information of the target component referenced by the target project, including:
[0088] Step 202: Based on the file extension name corresponding to the local component, scan the target root directory of the target project to obtain the target folder corresponding to the first target component. The target folder contains target files, and the file name of the target file consists of the first component name of the first target component and the file extension name corresponding to the first target component.
[0089] In this embodiment, the target project references two types of target components: local components and third-party components. Local components are stored on the local system and can be directly referenced during the target project's runtime. However, when the target project references a third-party component, it needs to download the third-party component from the network before it can be referenced. Furthermore, the storage formats of local and third-party components within the target project differ; therefore, the scanning and processing methods for local and third-party components also differ.
[0090] The target component includes a first target component. If the first target component is a local component, the target root directory is scanned based on the file extension of the local component to identify target files whose file extensions match those of the local component. The folder containing these target files is then identified as the target folder corresponding to the first target component. This target folder contains all files storing information about the first target component. The filenames of these target files consist of the first component's name and its corresponding file extension.
[0091] In this embodiment of the application, there is a file with a special file extension in the folder storing information of the local component. This file is unique to the local component. Therefore, the files in the target root directory can be scanned. When a file with this file extension is found, the folder containing this file can be determined as the target folder corresponding to the first target component.
[0092] For example, taking component A as an example, if the file extensions corresponding to the local component are known to include ".a" and ".framework", then the target root directory is scanned. When the file "Aa" is found, the file "Aa" is determined to be the target file, and the folder "LibA" containing the file "Aa" is determined to be the target folder.
[0093] Step 204: Obtain the first component name of the first target component from the file name of the target file.
[0094] In this embodiment, the filename of the target file can be read. The filename includes the component name and the file extension. By deleting the file extension from the filename, the first component name of the first target component can be obtained. For example, taking the above example again, the filename of the target file "Aa" is Aa, and the file extension is .a. Therefore, the component name of the component can be obtained as A.
[0095] In this embodiment, the first component name of the first target component is obtained by scanning, thereby realizing real-time automatic updating of the local components referenced by the target project. This allows for timely updating of component information, improving component update efficiency and accuracy.
[0096] In one embodiment, such as Figure 3 As shown, step 104 involves scanning the target root directory of the target project to obtain the component information of the target components referenced by the target project, including:
[0097] Step 302: Determine the path of the first file to be accessed in each target folder;
[0098] In this embodiment of the application, each file in the target folder has its corresponding access path. The access path for accessing the top-level file starting from the target folder (bottom-level file) is the first file path. The first file paths to be accessed in the target folder are determined. The first file paths can be used to represent the paths for accessing each file in the target folder starting from the target folder.
[0099] Step 304: For any first target component, traverse the paths of each first file in the target folder corresponding to the first target component to obtain the first version number of the first target component.
[0100] In this embodiment of the application, for any first target component, the files in each first file path in the target folder corresponding to the first target component are scanned one by one to determine which file the first version number of the first target component is stored in, and then the first version number of the first target component can be read from that file.
[0101] In this embodiment, by scanning the target folder to determine the first version number of the first target component, the component information of the local component referenced by the target project can be determined, realizing real-time automatic updating of the local component referenced by the target project. This allows for timely updating of component information, improving component update efficiency and accuracy.
[0102] In one embodiment, such as Figure 4 As shown, the target component also includes a second target component, which is a third-party component. Step 104 involves scanning the target root directory of the target project to obtain the component information of the target components referenced by the target project, including:
[0103] Step 402: Scan the target root directory according to the preset file names of various version management files to obtain the version management files of the second target component.
[0104] In this embodiment, the third-party component management tool stores the component information of all third-party components referenced by the target project in a single file within the target project. This file is the version management file of the target project, and different management tools will correspond to different version management files. For example, if the CocoaPods management tool is used to store the component information of third-party components, the version management file is podfile.lock; if the Carthage management tool is used to store the component information of third-party components, the version management file is Cartfile.resolved.
[0105] In this embodiment, the filenames corresponding to various version management files can be input into the terminal or server. Based on the preset filenames of these version management files, the target root directory is scanned; that is, based on the known filenames of the version management files, a search is performed in the target root directory to obtain the version management file for the second target component. For example, taking the version management file names for storing component information of a third-party component as "podfile.lock" and "Cartfile.resolved", the system searches the target root directory to see if files named "podfile.lock" and "Cartfile.resolved" exist. If they do, then these files are the version management files for the second target component.
[0106] Step 404: Obtain the second component name and the second version number of the second target component from the version management file of the second target component.
[0107] In this embodiment of the application, the version management file stores the component name of each second target component referenced by the target project, as well as the version number of each second target component. Therefore, the second component name and the second version number of the second target component can be directly read from the version management file of the second target component.
[0108] In this embodiment, by scanning the target root directory, the version management file of the second target component is obtained. Then, the component information of the second target component can be read directly from the version management file, thereby realizing real-time updates of the third-party components referenced by the target project and improving the component update frequency.
[0109] In one embodiment, such as Figure 5 As shown, in step 304, the first file paths within the target folder corresponding to the first target component are traversed to obtain the first version number of the first target component, including:
[0110] Step 502: Scan the corresponding files in each of the first file paths.
[0111] In this embodiment of the application, after obtaining all the first file paths of the target folder when determining the version number of the first target component, each file in each first file path can be scanned.
[0112] Step 504: If the filename of the scanned file matches the name of the first component, read the first version number of the first target component from the file.
[0113] When scanning the files corresponding to each first file path, if the scanned file is a header file (i.e., the file extension is .H) and the filename of the header file matches the name of the first component (i.e., the filename includes the name of the first component), it can be determined that the first version number of the first target component is stored in the file, and the first version number of the first target component can be read directly from the file.
[0114] For example, taking the first target component of target project 1 as component A, the paths of each first file in the target folder corresponding to component A are scanned. When the header file with the same name "AH" is scanned, the first version number of the first target component is read from the file.
[0115] In this embodiment, by scanning each file in each first file path, if the file matches the name of the first component, the first version number of the first target component can be read from the file. The first version number of the first target component can be determined automatically without manual determination, which improves the efficiency of component updates and greatly saves labor costs. At the same time, it avoids the phenomenon of incorrect target mapping relationship caused by untimely manual component updates.
[0116] In one embodiment, such as Figure 6 As shown, step 504, reading the first version number of the first target component from the folder, includes:
[0117] Step 602: Determine the version number storage rule based on the file extension name corresponding to the first target component.
[0118] In this embodiment, the file extension of a local component can indicate its type. Different types of local components have different version number storage rules. Therefore, the version number storage rule can be determined based on the file extension of the first target component.
[0119] For example, taking the file extension name of the first target component as ".framework", the storage rule for the version number of the first target component is determined as #define A_VERSION(version number).
[0120] Step 604: Read the first version number of the first target component from the file according to the version number storage rules.
[0121] In this embodiment of the application, the first version number of the first target component can be directly read from the file according to the version number storage rule. For example, taking the above example, the version number storage rule is #define A_VERSION(version number), and the content stored in the file is #define A_VERSION(1.0.0). According to the version number storage rule, the first version number of the first target component can be directly read as 1.0.0.
[0122] In this embodiment, the version number storage rule is determined based on the file extension name corresponding to the first target component. Then, the version number can be read directly according to the version number storage rule. Through the above steps, the version number can be quickly located in the file, which improves the reading speed.
[0123] In one embodiment, such as Figure 7 As shown, the method further includes:
[0124] Step 702: In the continuous integration pipeline, perform code inspection on the target project code to obtain the target project inspection report.
[0125] In this embodiment of the application, the continuous integration pipeline is a software production pipeline in which different versions of the application project are produced one after another. The continuous integration pipeline can complete operations such as compiling, packaging, releasing and automating testing of the target project code.
[0126] In the continuous integration pipeline, code inspection can be performed on the target project code to obtain an inspection report, which includes information such as vulnerabilities, security, and runtime performance of the target project code.
[0127] Step 704: Obtain the safety component registration form, which describes at least one component in a safe reference state.
[0128] In this embodiment of the application, a safety component registration form is obtained. The safety component registration form is constructed by staff and is used to describe at least one component that is in a safe reference state. All components in the safety component registration form have been safety tested by staff and can be safely referenced by the application project.
[0129] Step 706: Determine the safety status of the target components referenced by the target project based on the target mapping relationship and the safety component registration table.
[0130] In this embodiment of the application, the target component in the target mapping relationship is compared one by one with the components in the safety component registration table. When there is a component in the safety component registration table with the same component name and version number as the target component, the safety status of the target component referenced by the target project is determined to be safe. If there is no component in the safety component registration table with the same component name and version number as the target component, the safety status of the target component is dangerous.
[0131] When the safety status of a target component is dangerous, the staff needs to conduct a safety inspection on the target component. If the target component is safe, it is added to the safe component register. If the target component is dangerous, the developers are instructed to modify the target project code so that the target project can reference other components with a safe safety status.
[0132] For example, taking the target mapping relationship as target project 1->{A:1.0.0,B:2.0.0,C:3.0.0,D:4.9.2}, and the safety component registration table including component A:1.0.0, component B:2.0.0, and component D:4.9.0 as an example, by comparing the target mapping relationship and the safety component registration table, we find that the safety status of components A and B is safe. Component C does not exist in the safety component registration table, so the safety status of component C is dangerous. The version number 4.9.0 of component D in the safety component registration table is different from the version number 4.9.2 of component D in the target mapping relationship, so the safety status of component D is dangerous.
[0133] Step 708: Add the safety status of the target components referenced in the target project to the inspection report to obtain the quality report of the target project.
[0134] In this embodiment, the safety status of the target components referenced by the target project can be added to the inspection report to obtain a quality report for the target project. Staff can then use this quality report to perform subsequent processing on the target project. In other words, a new function is added to the continuous integration pipeline: detecting the safety status of the target components referenced by the target project. Afterwards, staff can not only see the inspection results of the target project's code in the quality report, but also whether the components referenced by the target project are safe.
[0135] In this embodiment, the safety status of the target component is determined by comparing the safety component registration form with the target mapping relationship, and the above information is added to the target project's inspection report so that staff can intuitively see the safety status of each target component and then perform subsequent processing on the target component. The safety detection function of the component is added to the continuous integration pipeline, which can improve the work efficiency of the staff and enable them to know the safety of the target component in a timely manner, thereby improving the safety of the target project's update and iteration.
[0136] In a specific embodiment, taking the application project Project as the target project as an example, the target project code of the application project Project is first compiled to obtain executable files, and then each executable file is packaged to obtain the application project Project. The target root directory of the application project Project is as follows: Figure 8 As shown, the application project references both local components and third-party components at runtime. That is, the target components referenced by the application project include the first target component and the second target component.
[0137] In the current application development field, components are divided into two categories, with file extensions .framework and .a respectively. Therefore, the target root directory can be scanned, and target files with either .framework or .a extensions can be found based on these file extensions. The folder containing these target files is then designated as the target folder for the first target component. In this embodiment, the target folder LibA corresponding to the first target component 1 and the target folder LibB corresponding to the first target component 2 can be determined based on the above steps. The filename of the target file consists of the first component name of the first target component and the corresponding file extension. Therefore, the first component name of the first target component can be determined based on the filename. Thus, the first component names of the first target components referenced by the application project Project include A and B.
[0138] Next, for any one of the two target folders mentioned above, determine the first file path. For target folder LibA, the first file paths include: path 1, LibA->A.framework->A; path 2, LibA->A.framework->AHeaders->AH; path 3, LibA->A.framework->AHeaders->... For target folder LibB, the first file paths include: path 1, LibB->Ba; path 2, LibB->BHeaders->BH; path 3, LibB->BHeaders->...
[0139] For component A, the files in each of the first file paths are scanned. According to the component version number acquisition rule: the version number is obtained from the header file with the same name as the component. If the scanned file is a header file with the same name as component A, then the version number of component A is stored in that file (file AH). Then, based on the file extension .framework corresponding to component A, the version number storage rule is determined to be #define A_VERSION(version number). According to the above version number storage rule, the version number of component A is read as 1.0.0 from the content #define A_VERSION(1.0.0) stored in file AH. Based on the above steps, the version number of component B can be determined to be 2.0.0.
[0140] When determining the component information of the third-party component (i.e., the second target component) referenced by the application project Project, the target root directory can be scanned according to the file name (Podfile.lock, Cartfile.resolved) of the version management file corresponding to different third-party component management tools to obtain the version management file of the second target component. In this embodiment, the version management file Podfile.lock is obtained by scanning, and then the component information of the second target component is directly read from the version management file Podfile.lock. The second target components referenced by the application project Project include: component C and component D. The version number of component C is 3.0.0 and the version number of component D is 4.9.2.
[0141] Finally, based on the component names and version numbers of the target components obtained above, the target mapping relationship of the application project Project is constructed as Project->{A:1.0.0,B:2.0.0,C:3.0.0,D:4.9.2}.
[0142] In a continuous integration pipeline, after a version update of an application project is completed, code inspection is performed on the application project's code to check for vulnerabilities, code execution effects, etc., and an inspection report for the application project is generated.
[0143] In this embodiment, a function is added to the continuous integration pipeline: obtaining a safety component register. The component names and version numbers in the safety component register are compared with the target component names and version numbers in the target mapping relationship. If the target component name and version number match those in the safety component register, the target component is considered safe; otherwise, it is considered dangerous, and personnel need to perform a safety inspection on the target component for further processing. Finally, the safety status of each target component is added to the inspection report, resulting in the application engineering quality report.
[0144] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0145] Based on the same inventive concept, this application also provides a data processing apparatus for implementing the data processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data processing apparatus embodiments provided below can be found in the limitations of the data processing method described above, and will not be repeated here.
[0146] In one embodiment, such as Figure 9 As shown, a data processing apparatus 900 is provided, including: a packaging module 902, a scanning module 904, and a building module 906, wherein:
[0147] The packaging module 902 is used to package the target project code using a packaging script to obtain the target project.
[0148] The scanning module 904 is used to scan the target root directory of the target project after successful packaging to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0149] Module 906 is used to construct a target mapping relationship based on the component information of the target project and the target component. The target mapping relationship is used to characterize the correspondence between the target project and the target component it references.
[0150] In this embodiment of the application, after successful packaging, the target root directory of the target project is automatically scanned to obtain the component information of the target components referenced by the target project, and then a target mapping relationship is constructed. That is, every time the target project is updated, the target mapping relationship of the target project can be automatically obtained by scanning, thereby realizing the real-time update of the target components referenced by the target project. The component information of the target components can be updated in a timely manner, improving the efficiency and accuracy of component information updates.
[0151] In one embodiment, the target component includes a first target component, which is a local component, and the scanning module 904 is further configured to:
[0152] Based on the file extension name corresponding to the local component, scan the target root directory of the target project to obtain the target folder corresponding to the first target component. The target folder contains target files, and the file name of the target file consists of the first component name of the first target component and the file extension name corresponding to the first target component.
[0153] Obtain the first component name of the first target component from the file name of the target file.
[0154] In one embodiment, the scanning module 904 is further configured to:
[0155] Determine the path of the first file to be accessed within each target folder;
[0156] For any first target component, traverse the paths of each first file in the target folder corresponding to the first target component to obtain the first version number of the first target component.
[0157] In one embodiment, the target component further includes a second target component, which is a third-party component, and the scanning module 904 is further configured to:
[0158] Based on the preset filenames of various version management files, the target root directory is scanned to obtain the version management files of the second target component;
[0159] Obtain the second component name and the second version number of the second target component from the version management file of the second target component.
[0160] In one embodiment, the scanning module 904 is further configured to:
[0161] Scan the files corresponding to each of the first file paths;
[0162] If the filename of the scanned file matches the name of the first component, read the first version number of the first target component from the file.
[0163] In one embodiment, the scanning module 904 is further configured to:
[0164] The version number storage rules are determined based on the file extension name corresponding to the first target component;
[0165] According to the version number storage rules, read the first version number of the first target component from the file.
[0166] In one embodiment, the apparatus further includes:
[0167] The detection module is used to perform code inspection on the target project's code in the continuous integration pipeline and obtain a detection report for the target project.
[0168] The acquisition module is used to acquire the safe component registration form, which describes at least one component that is in a safe reference state;
[0169] The determination module is used to determine the safety status of the target components referenced by the target project based on the target mapping relationship and the safety component registration table;
[0170] Add a module to incorporate the safety status of the target components referenced in the target project into the inspection report to obtain the quality report of the target project.
[0171] Each module in the aforementioned data processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0172] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 10As shown, the computer device includes a processor, memory, and a communication interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium 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 medium. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a data processing method.
[0173] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0174] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0175] The target project code is packaged using a packaging script to obtain the target project.
[0176] After successful packaging, the target root directory of the target project is scanned to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0177] Based on the component information of the target project and the target component, a target mapping relationship is constructed. The target mapping relationship is used to characterize the correspondence between the target project and the target component it references.
[0178] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0179] The target project code is packaged using a packaging script to obtain the target project.
[0180] After successful packaging, the target root directory of the target project is scanned to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0181] Based on the component information of the target project and the target component, a target mapping relationship is constructed. The target mapping relationship is used to characterize the correspondence between the target project and the target component it references.
[0182] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0183] The target project code is packaged using a packaging script to obtain the target project.
[0184] After successful packaging, the target root directory of the target project is scanned to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component.
[0185] Based on the component information of the target project and the target component, a target mapping relationship is constructed. The target mapping relationship is used to characterize the correspondence between the target project and the target component it references.
[0186] It should be noted that the data processing method and apparatus provided in this application can be used in the field of computer technology in the financial field, or in any field other than the financial field. This application does not limit the application field of the data processing method and apparatus.
[0187] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0188] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0189] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0190] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data processing method, characterized in that, The method includes: The target project code is packaged using a packaging script to obtain the target project. After successful packaging, the target root directory of the target project is scanned to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component. The target components include local components and third-party components. For local components, the target root directory of the target project is scanned according to the file extension of the local component to obtain the target folder corresponding to the local component. The target folder contains target files, and the filename of the target file consists of the component name of the local component and the file extension. The component name of the local component is obtained from the filename of the target file. The file paths within the target folder are traversed, and if the filename matches the component name of the local component, the version number storage rule is determined according to the file extension, and the version number of the local component is read accordingly. For third-party components, the target root directory is scanned according to the preset filenames of various version management files to obtain the version management files of the third-party component. The component name and version number of the third-party component are obtained from the version management files. Based on the component information of the target project and the target component, a target mapping relationship is constructed, which is used to characterize the correspondence between the target project and the target component it references; The method further includes: In the continuous integration pipeline, code inspection is performed on the code of the target project to obtain an inspection report of the target project; Obtain a safe component registration form, which describes at least one component in a safe reference state; Based on the target mapping relationship and the safety component registration table, the safety status of the target component referenced by the target project is determined; The safety status of the target component referenced in the target project is added to the inspection report to obtain the quality report of the target project.
2. The method according to claim 1, characterized in that, The target component includes a first target component, which is a local component. The step of scanning the target root directory of the target project to obtain component information of the target components referenced by the target project includes: Based on the file extension name corresponding to the local component, the target root directory of the target project is scanned to obtain the target folder corresponding to the first target component. The target folder includes target files, and the file name of the target file is composed of the first component name of the first target component and the file extension name corresponding to the first target component. The first component name of the first target component is obtained from the file name of the target file.
3. The method according to claim 2, characterized in that, The step of scanning the target root directory of the target project to obtain the component information of the target components referenced by the target project also includes: Determine the path of the first file to be accessed within each of the target folders; For any first target component, traverse each first file path in the target folder corresponding to the first target component to obtain the first version number of the first target component.
4. The method according to claim 1, characterized in that, The target component also includes a second target component, which is a third-party component. The step of scanning the target root directory of the target project to obtain the component information of the target components referenced by the target project includes: Based on the preset filenames of various version management files, the target root directory is scanned to obtain the version management files of the second target component; Obtain the second component name and the second version number of the second target component from the version management file of the second target component.
5. The method according to claim 3, characterized in that, The step of traversing each of the first file paths within the target folder corresponding to the first target component to obtain the first version number of the first target component includes: Scan the files corresponding to each of the first file paths; If the filename of the scanned file matches the name of the first component, the first version number of the first target component is read from the file.
6. The method according to claim 5, characterized in that, The step of reading the first version number of the first target component from the file includes: The version number storage rule is determined based on the file extension name corresponding to the first target component; According to the version number storage rules, the first version number of the first target component is read from the file.
7. A data processing apparatus, characterized in that, The apparatus is used to implement the data processing method according to any one of claims 1-6, and the apparatus comprises: The packaging module is used to package the target project code using a packaging script to obtain the target project. The scanning module is used to scan the target root directory of the target project after successful packaging to obtain the component information of the target components referenced by the target project. The component information includes the component name and version number of the target component. A construction module is used to construct a target mapping relationship based on the component information of the target project and the target component. The target mapping relationship is used to characterize the correspondence between the target project and the target component it references.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Application component identification method and device
CN112099802A