CN113268221A - File matching method and device, storage medium and computer equipment - Google Patents

File matching method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN113268221A
CN113268221A CN202110606682.0A CN202110606682A CN113268221A CN 113268221 A CN113268221 A CN 113268221A CN 202110606682 A CN202110606682 A CN 202110606682A CN 113268221 A CN113268221 A CN 113268221A
Authority
CN
China
Prior art keywords
file
diff
dependent
files
webpack
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110606682.0A
Other languages
Chinese (zh)
Inventor
赵亮
杨昌伟
邵玥
刘书伶
雷陈灵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dami Technology Co Ltd
Original Assignee
Beijing Dami Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dami Technology Co Ltd filed Critical Beijing Dami Technology Co Ltd
Priority to CN202110606682.0A priority Critical patent/CN113268221A/en
Publication of CN113268221A publication Critical patent/CN113268221A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a file matching method, a file matching device, a storage medium and computer equipment, wherein the method comprises the following steps: js reads the modified diff file based on node, then records the file directory information of the file matched with the diff file in the process of constructing the project source code by Webpack, and finally writes the file directory information into the target file. By adopting the method and the device, the file path influenced by the diff file can be found out in the process of constructing the project source code by using the Webpack based on the modified diff file, so that a tester can quickly determine the influenced page through the file path.

Description

File matching method and device, storage medium and computer equipment
Technical Field
The present application relates to the field of computer application technologies, and in particular, to a file matching method, an apparatus, a storage medium, and a computer device.
Background
At present, a Web front-end development project is mainly a componentized and modularized development mode, components or modules used by multiple pages can be changed according to certain requirements more or less in the development process, for each change, in order to ensure the stability of a page, a tester needs to find pages which are possibly affected by the change of a certain component and test the pages, the existing implementation mode generally finds the affected pages in a guessing mode through the experience or subjective judgment of the tester, scientific basis is not provided, and uncertainty exists.
Disclosure of Invention
The embodiment of the application provides a file matching method, a file matching device, a storage medium and computer equipment, which can determine file directory information of files influenced by diff files.
The technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a file matching method, where the method includes:
reading the modified diff file based on node.js;
recording file directory information of a file matched with the diff file in the process of constructing a project source code by the Webpack;
and writing the file directory information into a target file.
In a second aspect, an embodiment of the present application provides a file matching apparatus, where the file matching apparatus includes:
a diff file acquisition module for reading the modified diff file based on node.
The file information recording module is used for recording file directory information of files matched with the diff files in the process of constructing the project source codes by the Webpack;
and the file information storage module is used for writing the file directory information into the target file.
In a third aspect, embodiments of the present application provide a storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the above-mentioned method steps.
In a fourth aspect, an embodiment of the present application provides a computer device, which may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
The beneficial effects brought by the technical scheme provided by some embodiments of the application at least comprise:
in the embodiment of the application, the modified diff file is read based on node. js, then the file directory information of the file matched with the diff file is recorded in the process of building the project source code by Webpack, and finally the file directory information is written into the target file. By adopting the method and the device, the file path influenced by the diff file can be found out in the process of constructing the project source code by using the Webpack based on the modified diff file, so that a tester can quickly determine the influenced page through the file path.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a file matching method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a file matching method according to an embodiment of the present application;
FIG. 3 is a diagram illustrating an example of matching diff files according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a document matching apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a file information recording module 12 according to an embodiment of the present application;
FIG. 6 is a schematic structural diagram of a computer device according to an embodiment of the present application;
FIG. 7 is a block diagram illustrating an operating system and a user space according to an embodiment of the present disclosure;
FIG. 8 is an architectural diagram of the android operating system of FIG. 6;
FIG. 9 is an architecture diagram of the IOS operating system of FIG. 6.
Detailed Description
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, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present application, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In the description of the present application, it is noted that, unless explicitly stated or limited otherwise, "including" and "having" and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art. Further, in the description of the present application, "a plurality" means two or more unless otherwise specified. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Before describing the embodiments of the present invention more clearly, some concepts of the present invention will be described in detail to better understand the present invention.
At present, the technology of HTML5 in Web front-end development is becoming mature, HTML5 is the mainstream development language of the front end of the mobile internet, HTML5 is actually a set of technologies, and three important parts, namely HTML5, CSS3 and JavaScript (js for short), are the general names of applications running on a browser. Wherein, JavaScript is the core of front-end development. Because the browser has low compatibility with a high-level JavaScript language, the compiled front-end resources (including Javascript, images, fonts, CSS and the like) need to be modularly packaged by using Webpack and then placed in a dependency relationship, and the resources can be used by referring to the dependency as required. Webpack is a packaging tool for constructing project source codes by using front-end resources, and can package js, image, css and other resources as a module, wherein the module refers to different css files, different js files can be regarded as different modules, different modules have respective functions, and packaging refers to writing a plurality of css files, js files, images and other files into one js file. The Webpack can reload and compile various front-end resources, compile grammars unknown to the browser into grammars known to the browser, and package the resources, so that i/o requests can be reduced.
The file matching method is mainly used for finding out all pages possibly affected by diff files in the process of building project source codes of Webpack when the diff files quoted by multiple pages are changed according to certain requirements in the front-end development process, and testing is convenient for testers.
Referring to fig. 1, a flowchart of a file matching method is provided in an embodiment of the present application. As shown in fig. 1, the file matching method may include the following steps S101 to S104.
S101, reading the modified diff file based on node.js;
js is a development platform for enabling a JavaScript language to run on a server, and the diff file is obtained by diff of a file before modification and a file after modification through a diff command.
In particular, diff commands are used for diff of the files before modification and the files after modification on the node.js platform to obtain diff files, and code data in the diff files are read.
S102, recording file directory information of a file matched with the diff file in the process of constructing a project source code by the Webpack;
specifically, in the process of constructing the project source code by the Webpack, files matched with the diff files are found out from all front-end resource files, and file directory information of the files matched with the diff files is recorded.
The finding out the file matched with the diff file from all the front-end resource files may be code matching of all the front-end resource files with the diff file respectively according to a code block matching manner.
The file directory information refers to a file path of a file matched with the diff file in a memory, and a tester can quickly determine a Web page pointed by the file directory information according to the file directory information.
S103, writing the file directory information into a target file.
Specifically, the file directory information is sorted and written into a specified target file, and the sorted file directory information may be separately stored according to different Web pages pointed by the file directory information.
In the embodiment of the application, a modified diff file is read based on node. js, then file directory information of a file matched with the diff file is recorded in the process of building a project source code by Webpack, and finally the file directory information is written into a target file, wherein the file directory information can point to a Web page, so that a tester can quickly determine the Web page which is possibly influenced by code modification according to the file directory information in the target file, and the test efficiency and the test accuracy are improved.
Referring to fig. 2, a flowchart of a file matching method is provided in an embodiment of the present application. As shown in fig. 2, the file matching method may include the following steps S201 to S206.
S201, reading the modified diff file based on node. js;
specifically, please refer to step S201 and the description of step S101 in another embodiment, which are not repeated herein.
S202, acquiring Hook of the Webpack, and monitoring event information in the Webpack based on the Hook;
the Hook function is also called a Hook function, and is a platform for processing messages, and can monitor a certain message of a specified window, when a specific message is sent out, before the specific message does not reach a target window, the Hook function can capture the message first, namely, before the target window processing function processes the message, the Hook function acquires control right, the message can be processed, the message can be continuously transmitted without processing, and the transmission of the message can be forcibly ended.
Specifically, Hook of the Webpack is obtained, and relevant event information of a source code of a Webpack construction project is monitored.
S203, inserting a plug-in when the Webpack starts to compile files based on event information in the Webpack, and detecting whether an entry file is matched with the diff file or not based on the plug-in;
specifically, the event information may indicate a process of constructing the project source code by the Webpack, insert an add-in when starting to compile a file according to the process of constructing the project source code by the Webpack, and detect whether the file code of each entry file includes a code block related to the diff file based on the add-in.
The plug-in is used for detecting all front-end resource files, matching the front-end resource files with diff files and recording file directory information according to matching results.
The entry file refers to a JS file which can be directly referred by HTML, and other non-entry files are directly or indirectly depended on by the entry file and are mutually called and executed by the entry file. A Web page includes at least one portal file.
See the following examples for portal files and non-portal files:
index.html:
<html>
<head>
<script src="main.js"></script>
</head>
<body>
</body>
</html>
main.js
var a=require('./a');
var b=require('./b');
wherein,
a.doSth();
b.doSth().
as can be seen from the above example, main.js is directly referenced by HTML, is where the whole program logic starts and is therefore an entry file, whereas referenced a and b are imported and called by main.js and are therefore not entry files, a and b can be dependent files of main.js.
S204, if the entry file is matched with the diff file, recording file directory information of the entry file;
specifically, if the entry file has the same code block as the diff file, the file directory information of the entry file is recorded.
It is understood that if a code block identical to the diff file exists in the entry file, it indicates that the Web page corresponding to the entry file may be affected by the modified code, and records file directory information of the entry file, where the file directory information points to the Web page corresponding to the entry file.
S205, if the entry file is not matched with the diff file, determining a first dependent file matched with the diff file in the dependent files of the entry file, and recording file directory information of the first dependent file.
Specifically, if the entry file does not have a code block identical to the diff file, searching for a dependent file of the entry file in an AST syntax tree created based on Webpack, screening out a first dependent file matched with the diff file from the dependent file in a recursive manner, and recording file directory information of the first dependent file.
The AST syntax tree is used for representing the dependency relationship among files and expresses the syntax structure of a programming language in a tree form.
The dependent file refers to a file which has a reference relationship with the entry file, such as import or require.
Further, the screening out of the dependency files of the first dependency file matching with the diff file may be that determining, in the dependency file, that the dependency file matching with the code of the diff file is the first dependency file, that is, detecting whether the same code block as the diff file exists in all the dependency files of the entry, and using the dependency file in which the same code block as the diff file exists as the first dependency file. The recursive mode is that a first-level dependent file and a diff file are matched, if the first-level dependent file does not have a dependent file matched with the diff file, the dependent file and the diff file of the first-level dependent file are matched, namely a second-level dependent file and the diff file are matched, and the recursive matching is carried out in such a way until all the dependent files are matched.
Referring to fig. 3 together with step S204 and step S205, an exemplary schematic diagram of matching diff files is provided for the embodiment of the present application.
As shown in fig. 3, there are five entry files, entry file 1, entry file 2, entry file 3, entry file 4, and entry file 5, and the entry file and the diff file are first matched, if there is a code block identical to the diff file in the entry file, the matching is successful, otherwise, the matching is failed. And if the matching of the entry files is successful, the entry files 1, 3, 5 and diff files are obtained, the file directory information of the entry files 1, 3 and 5 is recorded, and the dependent files of the entry files 2 and 4 are searched. Entry file 2 the first level dependent files include dependent file 1 and dependent file 2, the second level dependent files include dependent file 11, dependent file 21, dependent file 22, entry file 4 the first level dependent files include dependent file 3 dependent file 4 the second level dependent files include dependent file 31, dependent file 32, dependent file 41. Matching a first-level dependent file and a diff file according to a recursive mode, recording file directory information of the first-level dependent file matched with the diff file, determining that a second-level dependent file of the first-level dependent file matched with the diff file does not exist in the first-level dependent file, matching the second-level dependent file and the diff file, and recording file directory information of the second-level dependent file matched with the diff file, wherein the first-level dependent file matched with the diff file and the second-level dependent file matched with the diff file are both the first dependent file in the step S205.
S206, writing the file directory information into the target file.
Specifically, the file directory information is written into a target file, and the target file can represent the page direction of the Web page of each file directory information.
In the embodiment of the application, modified diff files are read based on node. js, then hooks of Webpack are obtained, event information in the Webpack is monitored based on the hooks, plug-ins are inserted when the Webpack starts compiling files according to the event information in the Webpack, whether an entry file is matched with the diff files is detected based on the plug-ins, if the entry file is matched with the diff files, file directory information of the entry file is recorded, if the entry file is not matched with the diff files, a first dependent file matched with the diff files is determined in dependent files of the entry file, file directory information of the first dependent file is recorded, the file directory information can point to a Web page, and finally the file directory information is written into a target file, so that a tester can quickly determine the Web page which is possibly affected by modifying codes according to the file directory information in the target file, the test efficiency and the test accuracy are improved.
Please refer to fig. 4, which provides a schematic structural diagram of a file matching apparatus according to an embodiment of the present application. As shown in fig. 4, the file matching apparatus 1 may be implemented by software, hardware, or a combination of both as all or a part of a terminal device. According to some embodiments, the file matching apparatus 1 includes a diff file obtaining module 11, a file information recording module 12, and a file information saving module 13, and specifically includes:
a diff file obtaining module 11, configured to read the modified diff file based on node.
The file information recording module 12 is used for recording file directory information of a file matched with the diff file in the process of constructing the project source code by the Webpack;
and a file information storage module 13, configured to write the file directory information into the target file.
Optionally, as shown in fig. 5, a schematic structural diagram of a diff file obtaining module 11 is provided for the embodiment of the present application.
The file information recording module 12 includes:
a Hook obtaining unit 121, configured to obtain a Hook of the Webpack, and monitor event information in the Webpack based on the Hook;
a plug-in detection unit 122, configured to insert a plug-in when the Webpack starts compiling the file based on the event information in the Webpack, and detect whether the entry file matches the diff file based on the plug-in;
a first information recording unit 123, configured to record file directory information of the entry file if the entry file matches the diff file;
a second information recording unit 124, configured to determine, if the entry file does not match the diff file, a first dependent file that matches the diff file in the dependent files of the entry file, and record file directory information of the first dependent file.
Optionally, the second information recording unit 124 is specifically configured to:
searching a dependent file of the entry file based on the AST syntax tree created by the Webpack;
and screening out a first dependent file matched with the diff file from the dependent files in a recursive mode.
It should be noted that, when the file matching apparatus provided in the foregoing embodiment executes the file matching method, only the division of the functional modules is illustrated, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the above described functions. In addition, the file matching device and the file matching method provided by the above embodiments belong to the same concept, and details of implementation processes thereof are referred to in the method embodiments and are not described herein again.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
In the embodiment of the application, a modified diff file is read based on node. js, then file directory information of a file matched with the diff file is recorded in the process of building a project source code by Webpack, and finally the file directory information is written into a target file, wherein the file directory information can point to a Web page, so that a tester can quickly determine the Web page which is possibly influenced by code modification according to the file directory information in the target file, and the test efficiency and the test accuracy are improved.
An embodiment of the present application further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the file matching method according to the embodiment shown in fig. 1 to 3, and a specific execution process may refer to specific descriptions of the embodiment shown in fig. 1 to 3, which is not described herein again.
The present application further provides a computer program product, where at least one instruction is stored, and the at least one instruction is loaded by the processor and executes the file matching method according to the embodiment shown in fig. 1 to 3, where a specific execution process may refer to specific descriptions of the embodiment shown in fig. 1 to 3, and is not described herein again.
Referring to fig. 6, a block diagram of a computer device according to an exemplary embodiment of the present application is shown. The computer device in the present application may comprise one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, memory 120, input device 130, and output device 140 may be connected by a bus 150.
Processor 110 may include one or more processing cores. The processor 110 connects various parts within the overall computer device using various interfaces and lines, and performs various functions of the computer device 100 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 120 and calling data stored in the memory 120. Alternatively, the processor 110 may be implemented in hardware using at least one of Digital Signal Processing (DSP), field-programmable gate Array (FPGA), and Programmable Logic Array (PLA). The processor 110 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 110, but may be implemented by a communication chip.
The Memory 120 may include a Random Access Memory (RAM) or a read-only Memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable medium. The memory 120 may be used to store instructions, programs, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like, and the operating system may be an Android (Android) system, including a system based on Android system depth development, an IOS system developed by apple, including a system based on IOS system depth development, or other systems. The data storage area may also store data created by the computer device during use, such as phone books, audio and video data, chat log data, and the like.
Referring to fig. 7, the memory 120 may be divided into an operating system space, in which an operating system runs, and a user space, in which native and third-party applications run. In order to ensure that different third-party application programs can achieve a better operation effect, the operating system allocates corresponding system resources for the different third-party application programs. However, the requirements of different application scenarios in the same third-party application program on system resources are different, for example, in a local resource loading scenario, the third-party application program has a higher requirement on the disk reading speed; in the animation rendering scene, the third-party application program has a high requirement on the performance of the GPU. The operating system and the third-party application program are independent from each other, and the operating system cannot sense the current application scene of the third-party application program in time, so that the operating system cannot perform targeted system resource adaptation according to the specific application scene of the third-party application program.
In order to enable the operating system to distinguish a specific application scenario of the third-party application program, data communication between the third-party application program and the operating system needs to be opened, so that the operating system can acquire current scenario information of the third-party application program at any time, and further perform targeted system resource adaptation based on the current scenario.
Taking an operating system as an Android system as an example, programs and data stored in the memory 120 are as shown in fig. 8, and a Linux kernel layer 320, a system runtime library layer 340, an application framework layer 360, and an application layer 380 may be stored in the memory 120, where the Linux kernel layer 320, the system runtime library layer 340, and the application framework layer 360 belong to an operating system space, and the application layer 380 belongs to a user space. The Linux kernel layer 320 provides underlying drivers for various hardware of the computer device, such as a display driver, an audio driver, a camera driver, a bluetooth driver, a Wi-Fi driver, power management, and the like. The system runtime library layer 340 provides a main feature support for the Android system through some C/C + + libraries. For example, the SQLite library provides support for a database, the OpenGL/ES library provides support for 3D drawing, the Webkit library provides support for a browser kernel, and the like. Also provided in the system runtime library layer 340 is an Android runtime library (Android runtime), which mainly provides some core libraries that can allow developers to write Android applications using the Java language. The application framework layer 360 provides various APIs that may be used in building an application, and developers may build their own applications by using these APIs, such as activity management, window management, view management, notification management, content provider, package management, session management, resource management, and location management. At least one application program runs in the application layer 380, and the application programs may be native application programs carried by the operating system, such as a contact program, a short message program, a clock program, a camera application, and the like; or a third-party application developed by a third-party developer, such as a game application, an instant messaging program, a photo beautification program, a file matching program, and the like.
Taking an operating system as an IOS system as an example, programs and data stored in the memory 120 are shown in fig. 9, and the IOS system includes: a Core operating system Layer 420(Core OS Layer), a Core Services Layer 440(Core Services Layer), a Media Layer 460(Media Layer), and a touchable Layer 480(Cocoa Touch Layer). The kernel operating system layer 420 includes an operating system kernel, drivers, and underlying program frameworks that provide functionality closer to hardware for use by program frameworks located in the core services layer 440. The core services layer 440 provides system services and/or program frameworks, such as a Foundation framework, an account framework, an advertisement framework, a data storage framework, a network connection framework, a geographic location framework, a motion framework, and so forth, as required by the application. The media layer 460 provides audiovisual related interfaces for applications, such as graphics image related interfaces, audio technology related interfaces, video technology related interfaces, audio video transmission technology wireless playback (AirPlay) interfaces, and the like. Touchable layer 480 provides various common interface-related frameworks for application development, and touchable layer 480 is responsible for user touch interaction operations on the computer device. Such as a local notification service, a remote push service, an advertising framework, a game tool framework, a messaging User Interface (UI) framework, a User Interface UIKit framework, a map framework, and so forth.
In the framework illustrated in FIG. 9, the framework associated with most applications includes, but is not limited to: a base framework in the core services layer 440 and a UIKit framework in the touchable layer 480. The base framework provides many basic object classes and data types, provides the most basic system services for all applications, and is UI independent. While the class provided by the UIKit framework is a basic library of UI classes for creating touch-based user interfaces, iOS applications can provide UIs based on the UIKit framework, so it provides an infrastructure for applications for building user interfaces, drawing, processing and user interaction events, responding to gestures, and the like.
The Android system can be referred to as a mode and a principle for realizing data communication between the third-party application program and the operating system in the IOS system, and details are not repeated herein.
The input device 130 is used for receiving input instructions or data, and the input device 130 includes, but is not limited to, a keyboard, a mouse, a camera, a microphone, or a touch device. The output device 140 is used for outputting instructions or data, and the output device 140 includes, but is not limited to, a display device, a speaker, and the like. In one example, the input device 130 and the output device 140 may be combined, and the input device 130 and the output device 140 are touch display screens for receiving touch operations of a user on or near the touch display screens by using any suitable object such as a finger, a touch pen, and the like, and displaying user interfaces of various applications. Touch screens are typically provided on the front panel of a computer device. The touch display screen may be designed as a full-face screen, a curved screen, or a profiled screen. The touch display screen can also be designed to be a combination of a full-face screen and a curved-face screen, and a combination of a special-shaped screen and a curved-face screen, which is not limited in the embodiment of the present application.
In addition, those skilled in the art will appreciate that the configurations of the computer apparatus shown in the above-described figures do not constitute limitations on the computer apparatus, and that a computer apparatus may include more or less components than those shown, or some of the components may be combined, or a different arrangement of components. For example, the computer device further includes a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WiFi) module, a power supply, a bluetooth module, and other components, which are not described herein again.
In the embodiment of the present application, the execution subject of each step may be the computer device described above. Optionally, the execution subject of each step is an operating system of the computer device. The operating system may be an android system, an IOS system, or another operating system, which is not limited in this embodiment of the present application.
The computer device of the embodiment of the application can also be provided with a display device, and the display device can be various devices capable of realizing display functions, for example: a cathode ray tube display (CR), a light-emitting diode display (LED), an electronic ink panel, a Liquid Crystal Display (LCD), a Plasma Display Panel (PDP), and the like. A user may utilize a display device on computer device 101 to view information such as displayed text, images, video, etc. The computer device may be a smartphone, a tablet, a gaming device, an AR (Augmented Reality) device, an automobile, a data storage device, an audio playback device, a video playback device, a notebook, a desktop computing device, a wearable device such as an electronic watch, an electronic glasses, an electronic helmet, an electronic bracelet, an electronic necklace, an electronic garment, or the like.
In the computer device shown in fig. 6, the processor 110 may be configured to call the file matching program stored in the memory 120, and specifically perform the following operations:
reading the modified diff file based on node.js;
recording file directory information of a file matched with the diff file in the process of constructing a project source code by the Webpack;
and writing the file directory information into a target file.
In an embodiment, when the processor 110 records the file directory information of the file matched with the diff file in the process of constructing the project source code by the Webpack, the following operations are specifically performed:
inserting a plug-in when the Webpack starts to compile files based on event information in the Webpack, and detecting whether an entry file is matched with the diff file or not based on the plug-in;
if the entry file is matched with the diff file, recording file directory information of the entry file;
and if the entry file is not matched with the diff file, determining a first dependent file matched with the diff file in the dependent files of the entry file, and recording file directory information of the first dependent file.
In one embodiment, before executing the plug-in based on the event information in the Webpack and inserting the plug-in when the Webpack starts to compile the file, and detecting whether the entry file matches the diff file based on the plug-in, the processor 110 further performs the following operations:
and acquiring Hook of the Webpack, and monitoring event information in the Webpack based on the Hook.
In one embodiment, the processor 110 specifically performs the following operations when determining, in the dependency files of the entry file, that the first dependency file matches the diff file:
searching a dependent file of the entry file based on the AST syntax tree created by the Webpack;
and screening out a first dependent file matched with the diff file from the dependent files in a recursive mode.
In one embodiment, when the processor 110 performs the step of screening out the first dependent file matching with the diff file from the dependent files, the following operations are specifically performed:
determining a dependent file in the dependent file that matches the code of the diff file as the first dependent file.
In the embodiment of the application, modified diff files are read based on node. js, then hooks of Webpack are obtained, event information in the Webpack is monitored based on the hooks, plug-ins are inserted when the Webpack starts compiling files according to the event information in the Webpack, whether an entry file is matched with the diff files is detected based on the plug-ins, if the entry file is matched with the diff files, file directory information of the entry file is recorded, if the entry file is not matched with the diff files, a first dependent file matched with the diff files is determined in dependent files of the entry file, file directory information of the first dependent file is recorded, the file directory information can point to a Web page, and finally the file directory information is written into a target file, so that a tester can quickly determine the Web page which is possibly affected by modifying codes according to the file directory information in the target file, the test efficiency and the test accuracy are improved.
It is clear to a person skilled in the art that the solution of the present application can be implemented by means of software and/or hardware. The "unit" and "module" in this specification refer to software and/or hardware that can perform a specific function independently or in cooperation with other components, where the hardware may be, for example, a Field-ProgrammaBLE Gate Array (FPGA), an Integrated Circuit (IC), or the like.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some service interfaces, devices or units, and may be an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a memory, and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned memory comprises: various media capable of storing program codes, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program, which is stored in a computer-readable memory, and the memory may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above description is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure should not be limited thereby. That is, all equivalent changes and modifications made in accordance with the teachings of the present disclosure are intended to be included within the scope of the present disclosure. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. A method of file matching, the method comprising:
reading the modified diff file based on node.js;
recording file directory information of a file matched with the diff file in the process of constructing a project source code by the Webpack;
and writing the file directory information into a target file.
2. The method of claim 1, wherein the recording file directory information of the file matched with the diff file in the process of building project source code by Webpack comprises:
inserting a plug-in when the Webpack starts to compile files based on event information in the Webpack, and detecting whether an entry file is matched with the diff file or not based on the plug-in;
if the entry file is matched with the diff file, recording file directory information of the entry file;
and if the entry file is not matched with the diff file, determining a first dependent file matched with the diff file in the dependent files of the entry file, and recording file directory information of the first dependent file.
3. The method of claim 2, wherein determining a first dependent file in the dependent files of the entry file that matches the diff file comprises:
searching a dependent file of the entry file based on the AST syntax tree created by the Webpack;
and screening out a first dependent file matched with the diff file from the dependent files in a recursive mode.
4. The method of claim 3, wherein the screening out the first dependent file matching the diff file from the dependent files comprises:
determining a dependent file in the dependent file that matches the code of the diff file as the first dependent file.
5. The method of claim 2, wherein before inserting the plug-in when Webpack starts compiling the file, the method comprises:
and acquiring Hook of the Webpack, and monitoring event information in the Webpack based on the Hook.
6. A document matching apparatus, comprising:
a diff file acquisition module for reading the modified diff file based on node.
The file information recording module is used for recording file directory information of files matched with the diff files in the process of constructing the project source codes by the Webpack;
and the file information storage module is used for writing the file directory information into the target file.
7. The file matching apparatus according to claim 6, wherein the file information recording module includes:
the plug-in detection unit is used for inserting a plug-in when the Webpack starts to compile files and detecting whether the entry files are matched with the diff files or not based on the plug-in;
a first information recording unit, configured to record file directory information of the entry file if the entry file matches the diff file;
and the second information recording unit is used for determining a first dependent file matched with the diff file in the dependent files of the entry file and recording the file directory information of the first dependent file if the entry file is not matched with the diff file.
8. The file matching apparatus according to claim 7, wherein the file information recording module further comprises:
and the Hook acquisition unit is used for acquiring a Hook of the Webpack and monitoring the event information in the Webpack based on the Hook.
9. A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method of any of claims 1 to 5.
10. A computer device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the steps of the method according to any of claims 1-5.
CN202110606682.0A 2021-05-30 2021-05-30 File matching method and device, storage medium and computer equipment Pending CN113268221A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110606682.0A CN113268221A (en) 2021-05-30 2021-05-30 File matching method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110606682.0A CN113268221A (en) 2021-05-30 2021-05-30 File matching method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN113268221A true CN113268221A (en) 2021-08-17

Family

ID=77233891

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110606682.0A Pending CN113268221A (en) 2021-05-30 2021-05-30 File matching method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN113268221A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113791925A (en) * 2021-08-24 2021-12-14 杭州迪普科技股份有限公司 Memory mapping file storage method and device
CN114090059A (en) * 2021-11-29 2022-02-25 北京字节跳动网络技术有限公司 File construction method and device, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110704096A (en) * 2019-09-12 2020-01-17 北京达佳互联信息技术有限公司 Packaging method and device of front-end item, storage medium and electronic equipment
CN110825385A (en) * 2019-10-29 2020-02-21 福建天泉教育科技有限公司 Method for constructing read Native offline package and storage medium
US10769103B1 (en) * 2017-10-06 2020-09-08 EMC IP Holding Company LLC Efficient content indexing of incremental block-based backups
CN111813682A (en) * 2020-07-14 2020-10-23 北京达佳互联信息技术有限公司 File modification method and device, server, intelligent terminal and storage medium
CN112596738A (en) * 2020-12-28 2021-04-02 北京字跳网络技术有限公司 Method and device for determining front-end page to be tested, storage medium and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10769103B1 (en) * 2017-10-06 2020-09-08 EMC IP Holding Company LLC Efficient content indexing of incremental block-based backups
CN110704096A (en) * 2019-09-12 2020-01-17 北京达佳互联信息技术有限公司 Packaging method and device of front-end item, storage medium and electronic equipment
CN110825385A (en) * 2019-10-29 2020-02-21 福建天泉教育科技有限公司 Method for constructing read Native offline package and storage medium
CN111813682A (en) * 2020-07-14 2020-10-23 北京达佳互联信息技术有限公司 File modification method and device, server, intelligent terminal and storage medium
CN112596738A (en) * 2020-12-28 2021-04-02 北京字跳网络技术有限公司 Method and device for determining front-end page to be tested, storage medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113791925A (en) * 2021-08-24 2021-12-14 杭州迪普科技股份有限公司 Memory mapping file storage method and device
CN114090059A (en) * 2021-11-29 2022-02-25 北京字节跳动网络技术有限公司 File construction method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108228188B (en) View component processing method, electronic device and readable storage medium
CN107889070B (en) Picture processing method, device, terminal and computer readable storage medium
US11379943B2 (en) Optimizing compilation of shaders
US9436449B1 (en) Scenario-based code trimming and code reduction
CN111459586B (en) Remote assistance method, device, storage medium and terminal
CN105335132B (en) Method, device and system for customizing application program function
CN110737589A (en) automatic point burying method, device, medium and electronic equipment
CN113268221A (en) File matching method and device, storage medium and computer equipment
CN110413347A (en) The processing method of advertisement, device, storage medium and terminal in application program
CN114547604A (en) Application detection method and device, storage medium and electronic equipment
CN114186527A (en) Method and device for realizing automatic wiring of integrated circuit independent of grid point
CN109558186B (en) Page display method and device
CN116756016A (en) Multi-browser testing method, device, equipment, medium and program product
CN110737588A (en) automatic point burying method, device, medium and electronic equipment
CN113825022B (en) Method and device for detecting play control state, storage medium and electronic equipment
CN113378895B (en) Classification model generation method and device, storage medium and electronic equipment
CN113450762B (en) Text reading method, text reading device, terminal and storage medium
CN113282237B (en) Partition creation method, partition creation device, storage medium and computer equipment
CN113098859B (en) Webpage page rollback method, device, terminal and storage medium
CN113312257A (en) Version identification method and device, storage medium and computer equipment
CN114186526A (en) Automatic punching method and device for integrated circuit based on R tree MBR algorithm
CN113885996A (en) User interface generation method and device
CN112612633A (en) Inter-process communication method, device, storage medium and terminal
CN112148318A (en) Application package issuing method, application method, device, medium, server and equipment
CN113778386B (en) Component generation method and device, storage medium and electronic equipment

Legal Events

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