A file-dependent cache detection method and related apparatus

CN117555543BActive Publication Date: 2026-10-30TENCENT TECH (BEIJING) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210928238.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-03
Publication Date
2026-10-30
Estimated Expiration
2042-08-03

AI Technical Summary

Technical Problem

[0002]在项目的编译构建过程中,本地没有所需要的依赖文件缓存时,一般都会从外部依赖源拉取依赖文件,这种方式虽然能够获取到对应的依赖文件,但是依赖文件的下载时长成为了编译构建效率的瓶颈,从外部依赖源下载所需的依赖文件的时间越长,则导致编译构建项目的耗时越长,编译构建效率越低

Benefits of technology

[0021]由上述技术方案可以看出,确定与待检测项目相关的缓存空间,缓存空间存储有执行待检测项目所需的依赖文件,正常情况下,基于待检测项目的依赖配置信息获取待检测项目对应的依赖文件时,可以基于依赖配置信息从缓存空间中匹配到相应的依赖文件,在基于依赖配置信息不能有效匹配缓存空间中的依赖文件时,通常会根据依赖配置信息生成依赖请求,因此可以监测在获取依赖文件的过程中产生的目标依赖请求,目标依赖请求与依赖配置信息中的子配置信息对应,目标依赖请求在缓存空间中未命中子配置信息对应的依赖文件时生成,用于向服务器请求与该子配置信息对应的依赖文件,若检测到目标依赖请求,则说明执行待检测项目所需的依赖文件并不能完全在缓存空间中命中,即该待检测项目的依赖配置信息并不能有效匹配缓存空间中的依赖文件,此时,可以获取目标依赖请求的请求信息,以根据请求信息对依赖配置信息进行调整,这样,可以在对待检测项目进行打包从而将其代码合入稳定分支之前,对待检测项目进行依赖文件的缓存检测,监测得到的目标依赖请求可以作为修改依赖配置信息的依据,使修改后的依赖配置信息能有效匹配缓存空间中的依赖文件,从而提高依赖文件的命中率,减少后续阶段(如sync阶段)中在获取依赖文件的过程中产生的依赖请求,降低依赖请求产生的网络耗时,提高编译构建的效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117555543B_ABST
    Figure CN117555543B_ABST
Patent Text Reader

Abstract

The application discloses a dependency file cache detection method and related device, determines a cache space related to a to-be-detected item, the cache space stores a dependency file required for executing the to-be-detected item, obtains a dependency file corresponding to the to-be-detected item based on dependency configuration information of the to-be-detected item, monitors a target dependency request generated in the process of obtaining the dependency file, the target dependency request corresponds to sub-configuration information in the dependency configuration information, the target dependency request is generated when the sub-configuration information corresponding dependency file in the cache space is not hit, is used for requesting the server to request the dependency file corresponding to the sub-configuration information, obtains request information of the target dependency request, adjusts the dependency configuration information according to the request information, the target dependency request is used as a basis for modifying the dependency configuration information, the modified dependency configuration information can effectively match the dependency file in the cache space, the hit rate of the dependency file is improved, and the network time consumed by the dependency request is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular to a method and apparatus for detecting cached files that depend on other files. Background Technology

[0002] During the compilation and build process of a project, if the required dependency files are not cached locally, the dependency files are usually pulled from an external dependency source. Although this method can obtain the corresponding dependency files, the download time of the dependency files becomes a bottleneck for compilation and build efficiency. The longer it takes to download the required dependency files from the external dependency source, the longer it takes to compile and build the project, and the lower the compilation and build efficiency. Summary of the Invention

[0003] To address the aforementioned technical issues, this application provides a method and apparatus for detecting the cache of dependency files, thereby improving the hit rate of dependency files, reducing network latency caused by dependency requests, and increasing the efficiency of compilation and building.

[0004] The embodiments of this application disclose the following technical solutions:

[0005] On the one hand, this application provides a method for detecting the cache of dependent files, the method comprising:

[0006] Identify a cache space associated with the item to be tested, wherein the cache space stores the dependency files required to execute the item to be tested;

[0007] Based on the dependency configuration information of the project to be detected, the dependency file corresponding to the project to be detected is obtained, and the target dependency request generated in the process of obtaining the dependency file is monitored. The target dependency request corresponds to the sub-configuration information in the dependency configuration information. The target dependency request is generated when the dependency file corresponding to the sub-configuration information is not found in the cache space, and is used to request the dependency file corresponding to the sub-configuration information from the server.

[0008] Obtain the request information of the target dependency request, and adjust the dependency configuration information according to the request information.

[0009] Optionally, determining the cache space associated with the item to be detected includes:

[0010] During the simulation synchronization phase, based on the dependency configuration information of the project to be tested, the dependency files required to execute the project to be tested are obtained from the server, and the dependency files are stored in the cache space related to the project to be tested.

[0011] On the other hand, this application provides a cache detection device for dependent files, the device comprising:

[0012] A cache determination unit is used to determine a cache space related to the item to be detected, wherein the cache space stores the dependency files required to execute the item to be detected;

[0013] The file acquisition unit is used to acquire the dependency files corresponding to the project to be tested based on the dependency configuration information of the project to be tested;

[0014] The monitoring unit is used to monitor the target dependency request generated during the process of obtaining the dependency file. The target dependency request corresponds to the sub-configuration information in the dependency configuration information. The target dependency request is generated when the dependency file corresponding to the sub-configuration information is not found in the cache space. It is used to request the dependency file corresponding to the sub-configuration information from the server.

[0015] The request information acquisition unit is used to acquire the request information of the target dependency request, so as to adjust the dependency configuration information according to the request information.

[0016] On the other hand, this application provides a computer device, the device including a processor and a memory:

[0017] The memory is used to store computer programs and to transfer the computer programs to the processor;

[0018] The processor is configured to execute the dependency file cache detection method described above, according to instructions in the computer program.

[0019] On the other hand, embodiments of this application provide a computer-readable storage medium for storing a computer program for executing the dependency file cache detection method described above.

[0020] On the other hand, embodiments of this application provide a computer program product including a computer program, which, when run on a computer device, causes the computer device to execute the cache detection method for dependent files.

[0021] As can be seen from the above technical solution, a cache space related to the project to be tested is determined. This cache space stores the dependency files required to execute the project. Normally, when retrieving the dependency files corresponding to the project based on its dependency configuration information, the corresponding dependency files can be matched from the cache space. When the dependency configuration information cannot effectively match the dependency files in the cache space, a dependency request is usually generated based on the dependency configuration information. Therefore, the target dependency request generated during the process of retrieving dependency files can be monitored. The target dependency request corresponds to the sub-configuration information in the dependency configuration information. The target dependency request is generated when the cache space does not find the dependency file corresponding to the sub-configuration information, and is used to request the dependency file corresponding to that sub-configuration information from the server. If a target dependency request is detected, then... This indicates that the dependency files required for the project under test cannot be fully found in the cache space. In other words, the dependency configuration information of the project under test cannot effectively match the dependency files in the cache space. In this case, the request information of the target dependency request can be obtained, and the dependency configuration information can be adjusted according to the request information. In this way, the cache detection of dependency files of the project under test can be performed before packaging the project under test and merging its code into the stable branch. The detected target dependency request can be used as the basis for modifying the dependency configuration information, so that the modified dependency configuration information can effectively match the dependency files in the cache space, thereby improving the dependency file hit rate, reducing the dependency requests generated in subsequent stages (such as the sync stage) during the process of obtaining dependency files, reducing the network time generated by dependency requests, and improving the efficiency of compilation and build. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a schematic diagram illustrating an application scenario of a dependency file cache detection method provided in an embodiment of this application.

[0024] Figure 2 Signaling diagram of a cache detection method for dependent files provided in an embodiment of this application;

[0025] Figure 3 A schematic diagram of a pipeline node provided in an embodiment of this application;

[0026] Figure 4 This application provides a schematic diagram of a request monitoring process.

[0027] Figure 5 This application provides another schematic diagram of a request monitoring process.

[0028] Figure 6 A schematic diagram of a monitoring process provided in an embodiment of this application;

[0029] Figure 7 A structural block diagram of a dependency file cache detection device provided in an embodiment of this application;

[0030] Figure 8 A structural diagram of a terminal device provided in an embodiment of this application;

[0031] Figure 9 This is a structural diagram of a server provided in an embodiment of this application. Detailed Implementation

[0032] The embodiments of this application will now be described with reference to the accompanying drawings.

[0033] During the project's compilation and build process, the download time of dependency files becomes a bottleneck for compilation and build efficiency. The longer it takes to download the required dependency files from external dependency sources, the longer the compilation and build process takes, and the lower the compilation and build efficiency. The project's dependency configuration information is used to match dependency files from external dependency sources or caches. If the project's dependency configuration information cannot effectively match dependency files already existing in the cache, it will increase redundant dependency file download requests, further reducing compilation and build efficiency.

[0034] Based on the above technical problems, this application provides a method and related apparatus for cache detection of dependency files. Before packaging the project to be detected and merging its code into a stable branch, cache detection of dependency files is performed based on the dependency configuration information of the project to be detected. The detected target dependency requests can be used as the basis for modifying the dependency configuration information, so that the modified dependency configuration information can effectively match the dependency files in the cache space, improve the hit rate of dependency files, reduce the dependency requests generated in the subsequent process of obtaining dependency files, reduce the network time generated by dependency requests, and improve the efficiency of compilation and building.

[0035] The dependency file caching detection method provided in this application can be implemented using a computer device, which can be a terminal device or a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Terminal devices include, but are not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. Terminal devices and servers can be directly or indirectly connected via wired or wireless communication, and this application does not impose any limitations on this connection.

[0036] To facilitate understanding of the technical solutions provided in this application, the following section will introduce a method for detecting cached dependent files provided in an embodiment of this application, using a practical application scenario as an example.

[0037] See Figure 1 , Figure 1 This is a schematic diagram illustrating an application scenario of a dependency file cache detection method provided in an embodiment of this application. Figure 1 The application scenario shown includes a terminal device 10 and a server 20. The terminal device 10 and the server 20 are connected via a network. The terminal device 10 can be configured with an application that communicates with the server 20. The terminal device 10 is used to execute a cache detection method for dependency files. The server 20 can be an external dependency source for the terminal device 10. The terminal device 10 can send a dependency request to the server 20 to request dependency files.

[0038] Terminal device 10 determines a cache space 102 related to the item to be tested. The cache space 102 contains the dependency files required to execute the item to be tested. Under normal circumstances, when obtaining the dependency files corresponding to the item to be tested based on the dependency configuration information 101 of the item to be tested, the dependency files corresponding to the sub-configuration information in the cache space 102 can be matched based on the sub-configuration information in the dependency configuration information 101. If a dependency file cannot be effectively matched in the cache space 102 based on a certain sub-configuration information in the dependency configuration information 101, it is determined that the dependency file is not found in the cache space 102. Then, a corresponding target dependency request can be generated based on the sub-configuration information in the dependency configuration information 101, and the target dependency request can be sent to the server 20 to request the dependency files corresponding to the sub-configuration information from the server 20.

[0039] Terminal device 10 can monitor target dependency requests generated during the process of obtaining dependency files. If a target dependency request is detected, it means that the dependency files required to execute the project under test cannot be completely hit in the cache space 102, that is, the dependency configuration information 101 of the project under test cannot effectively match the dependency files in the cache space 102.

[0040] If the terminal device 10 detects a target dependency request, it can obtain the request information of the target dependency request and adjust the dependency configuration information 101 according to the request information. In this way, the cache detection of dependency files of the project to be tested can be performed before the project to be tested is packaged and its code is merged into the stable branch. The detected target dependency request can be used as the basis for modifying the dependency configuration information 101, so that the modified dependency configuration information 101 can effectively match the dependency files in the cache space 102, thereby improving the hit rate of dependency files, reducing the dependency requests generated in subsequent stages (such as the sync stage) during the process of obtaining dependency files, reducing the network time generated by dependency requests, and improving the efficiency of compilation and building.

[0041] Next, with reference to the accompanying drawings, we will introduce a method and related apparatus for detecting cached dependent files provided in the embodiments of this application.

[0042] This application also provides a method for detecting cached dependencies, see [link to relevant documentation]. Figure 2 The flowchart below illustrates a method for detecting the cache of dependent files provided in an embodiment of this application. The method may include:

[0043] S201, Determine the cache space associated with the item to be tested. The cache space stores the dependency files required to execute the item to be tested.

[0044] In this embodiment, the terminal device can compile the code of the project to be tested. Specifically, the terminal device can pull the project code of the project to be tested, compile the project code to obtain code files, and then package the code files to generate an image file. It can also push the image file, thereby merging the code of the project to be tested into a stable branch. The image file can be an application container engine (Docker) image file. The compilation of the code of the project to be tested can be automated through a pipeline. The compilation of the code of the project to be tested can be performed in a Linux environment, reducing the manual cost of code compilation and improving the project compilation efficiency.

[0045] Afterwards, the terminal device can further compile the project to be tested by processing the image file to obtain the application installation file. For easy distinction, the terminal device that compiles the code of the project to be tested to obtain the code file can be referred to as the first terminal device, and the terminal device that compiles the project to be tested to obtain the application installation file can be referred to as the second terminal device. The first terminal device and the second terminal device can be the same device or different devices. The aforementioned terminal device 10 is the first terminal device.

[0046] Further compilation of the project to be tested on the second terminal device can be performed in an Integrated Development Environment (IDE). Android Studio is the official IDE tool for compiling Android projects, while Gradle is an open-source build tool and a mainstream compiler for Android projects. As an Android project, the project to be tested needs to be configured before execution in Android Studio. This requires code synchronization (syncing) of the project. The IDE uses this synchronization process to parse the project's information, enabling code completion and compilation.

[0047] The project to be tested may have dependency configuration information, indicating the dependency relationship between the project and its dependent files. Dependency files are also called dependencies, a technical term in software development, also known as "dependencies," "dependency libraries," or "dependency packages." The second terminal further compiles the project to be tested, including packaging the project files and dependency files to obtain a project package. The project package can be part of the application installation files. The project files may include the code files and documentation files of the project to be tested. Dependency files enable the reuse and extension of the functionality of the project to be tested.

[0048] Dependency configuration information can include the address of the dependency source and the file identifier of the dependency file. The file identifier of the dependency file can include the dependency source group, dependency source module, version number, etc. The dependency configuration information includes multiple sub-configuration information, each indicating multiple dependency files. Dependency files can be temporarily stored in the cache space. The dependency configuration information can also include the cache validity period of the dependency files. Dependency files in the cache space can be hit within the cache validity period; after the cache validity period, they will expire and will not be hit.

[0049] The dependency files of the project to be tested can be files in a Maven dependency repository. Maven is a software project management tool based on the Project Object Model (POM) and manages the building, reporting, and documentation of projects through descriptive information. Maven dependency repositories can be stored in Maven repository servers. That is, the server that provides dependency files can be a Maven repository server. Maven repository servers are used to provide storage and download services for various Maven dependency repositories. The file format of dependency files can be jar or aar, etc. The dependency files can enable the reuse and extension of the functionality of the project to be tested.

[0050] During the synchronization phase of the project to be tested, the second terminal device can obtain the corresponding dependency files through the dependency configuration information, thereby parsing the project. If the corresponding dependency file is found in the cache space of the second terminal device according to the dependency configuration information, it can be directly obtained from the cache space. If the corresponding dependency file is not found in the cache space of the second terminal device according to the dependency configuration information, a dependency request is generated based on the dependency configuration information, and the dependency file is obtained from the server through the dependency request. Obtaining the dependency file from the server through the dependency request requires network download. The project to be tested usually configures a list of dependency source addresses, which includes a number of dependency source addresses. When downloading the dependency file, the dependency source address list is traversed, and dependency requests are sent to each dependency source address in turn to search for the required dependency file in the dependency source until the dependency file is obtained from the dependency source.

[0051] Therefore, even if only one dependency file is missed, multiple dependency requests may be generated. For projects with many configured dependency source addresses, this process takes even longer. This results in network download time accounting for a significant portion of the total sync phase time for the project under test. In real-world applications, network download time can degrade by tens of seconds or even tens of minutes. Excessive sync phase time impacts development efficiency. Reducing dependency requests and shortening network download time can improve development efficiency. Improving the cache hit rate of dependency files, allowing the second terminal device to retrieve dependency files from the cache as much as possible, can reduce the number of dependency requests.

[0052] In this embodiment, optimization can be performed to address the low cache hit rate caused by cache invalidation of dependency files. Cache invalidation refers to a situation where a dependency file exists in the cache space, but because the dependency file indicated by the dependency configuration information of the project under test does not match the dependency file in the cache space, the dependency file still needs to be downloaded via the network. Therefore, cache invalidation leads to unnecessary network downloads. To address this problem, the dependency configuration information causing the low cache hit rate can be adjusted to effectively match the dependency file in the cache space, thereby improving the cache hit rate of dependency files, reducing the generation of dependency requests, and shortening network download time. This embodiment can identify the dependency configuration information causing the low cache hit rate by monitoring network download information.

[0053] In this embodiment, cache failure detection can be performed on the project to be tested. Cache failure detection can also be called dependency file cache detection. This screens out dependency configuration information that leads to a low cache hit rate of dependency files. During the code compilation of the project to be tested, the dependency configuration information is modified through the first terminal device. In the later compilation stage, such as the sync stage, the second terminal device uses the modified dependency configuration information, which can achieve a high dependency file cache hit rate and generate fewer dependency requests, thereby achieving a shorter network download time.

[0054] Specifically, dependency cache detection for the project under test can be performed before packaging the project and merging its code into a stable branch. This process belongs to the code compilation stage of the project on the first terminal device, which is different from compilation in the Android Studio environment. Since it needs to be done outside the Android Studio environment, it can enter the simulated synchronization stage of the project under test. The simulated synchronization stage can simulate the acquisition of dependency files in the real sync stage. If the code compilation of the project under test is executed through a pipeline, the dependency cache detection can also be executed through a pipeline, that is, by entering the simulated synchronization stage of the project under test through the pipeline, so as to perform dependency cache detection during the simulated synchronization stage.

[0055] See Figure 3 This diagram illustrates a pipeline node provided in an embodiment of this application. The pipeline node executes within a build environment, which can be a Linux environment. It pulls the project code of the project to be tested and obtains a script for cache detection of dependency files via command line. This script then initiates a simulated synchronization phase for the project under test. The code of the project to be tested can be pulled from a distributed version control system (Git) repository. The script for cache detection of dependency files is a Gradle plugin configured in the pipeline. With a cache space pre-configured for the project to be tested, the container cache can be checked before pulling the code, allowing the container cache to be used to compile the code of the project under test.

[0056] Regarding the `sync` operation, printing the `sync` task requests (specifically, printing the result of the script `getGradle().getStartParameter().getTaskRequests().args`) reveals that the `sync` task requests are empty. This means that `sync` is not a specific task, but rather a request initiated through Gradle's tooling API. Therefore, when using the script that performs dependency file cache checks to enter the simulated synchronization phase of the project under test, there are two possible implementation methods:

[0057] In the first method, a simulated process can be created to enter the simulated synchronization phase. Then, the Tooling API is used to simulate the parsing of the project under test in the sync phase according to the logic and order of Android Studio. The simulated process can be a Java process or an integrated development environment tool for the Java programming language, such as IntelliJ IDEA. In this method, the Tooling API is used to follow the logic and order of Android Studio. Programmers do not need to learn other technologies, which lowers the technical threshold.

[0058] In this approach, the simulation synchronization phase includes the following process:

[0059] 1) Use the project execution to simulate the process. After clicking the sync button in the IDE tool, the IDE will initiate a simulated Sync through the project synchronization request. The IDE tool is such as Android Studio or IntelliJ IDEA. The project synchronization request can be GradleSyncInvoker.getInstance().requestProjectSync.

[0060] 2) Add an initialization script (init-script) to the Gradle command line to inject the plugin scripts required by the Tooling API. The plugin scripts will add the following three files by default: ijmapper.gradle, ijinit1.gradle, and sync.studio.tooling3665.gradle. These three files can be verified by printing getGradle().getStartParameter().initScripts. Examining these three files, we can see that the first one encapsulates the mapPath function, the second one injects the plugin for the IntelliJ IDEA Tooling API, and the third one injects the plugin for the Android Studio Tooling API.

[0061] 3) In the Android Studio process, a project dependency (ProjectConnection) is created through GradleConnector. Then, the ToolingApi is used to obtain various model information of each project, such as AndroidExtensionsGradleModel, ParcelizeGradleModel, GradleExtensions, Variant, AdditionalClassifierArtifactsModel, etc. By obtaining these models, information such as the task, variant, and dependency list of each project is parsed out. Based on these models, the IDE properties are configured or displayed on the IDE interface.

[0062] 4) In the Gradle process, initScripts.gradle, settings.gradle, and the build.gradle files of each project are parsed in sequence to execute the initialization (init) and configuration (configuration) phases of Gradle, and then the parsing tasks of various models in ToolingApi are executed.

[0063] In the second method, a simulated synchronization phase can be entered through the project creation and execution command, which can be `gradle build --dry-run`. This simulated synchronization phase approximates the sync process. During this phase, executing `build` parses all projects, including the project to be tested, triggering the dependency file parsing process. `--dry-run` skips the task execution process, meaning only the `init` and `configuration` phases of Gradle are executed, and dependency file parsing is triggered. The parsing process is roughly the same as the work done by the Gradle process during sync. This method has a simpler process and requires fewer build parameters, which helps reduce resource waste.

[0064] After entering the simulation synchronization phase, dependency file cache detection begins. First, the cache space associated with the project under test is determined. This cache space stores the dependency files required to execute the project. Since the first terminal device performs dependency file cache detection, the cache space associated with the project under test is the cache space within the first terminal device. Normally, during dependency file cache detection, when retrieving the dependency files corresponding to the project under test based on its dependency configuration information, the corresponding dependency files can be matched from the cache space. If the dependency configuration information cannot effectively match the dependency files in the cache space, a dependency request can be generated based on the dependency configuration information, and the dependency files can be retrieved from the server using this request.

[0065] In this embodiment, dependency files in the cache space can be obtained and stored in the cache space by means of a script that executes dependency file cache detection via a pipeline, or by means of other means. Specifically, determining the cache space associated with the project to be detected can be achieved by obtaining the dependency files required for the project to be detected from the server during the simulation synchronization phase, based on the dependency configuration information of the project to be detected, and storing the dependency files in the cache space associated with the project to be detected. The simulation synchronization phase can be entered using the aforementioned two methods, which is simpler than storing dependency files in the cache space through other methods. The dependency files obtained from the server that are required for the project to be detected are those that match the dependency configuration information of the project to be detected. The version number of the dependency file may not be exactly the same as the version number indicated by the dependency configuration information. For example, if the server does not have the version number of the dependency file indicated by the dependency configuration information, the latest version of the dependency file can be returned as the dependency file required for the project to be detected.

[0066] In practice, a simulated synchronization phase can be initiated to retrieve dependency files from the server and store them in the cache space. For example, the project creation and run command `. / gradlew build --dry-run` can be executed to enter the simulated synchronization phase. Each execution of this command retrieves the required dependency files. After storing the dependency files in the cache space, if the dependency configuration information is not set correctly, it will not match the dependency files in the cache space, thus requiring another dependency request to be sent to the server.

[0067] Improper dependency configuration settings can lead to several issues. For example, if the cache validity period for a dependency file specified in the dependency configuration is too short (e.g., the cache validity period is less than a preset threshold), the cached dependency files in the cache space will easily expire, preventing them from being retrieved. Another issue is that the version information of a dependency file specified in a sub-configuration information does not meet the preset version information specification. In this case, dependency files in the cache space whose version information matches the preset version information specification will not be retrieved based on that sub-configuration information.

[0068] S202, based on the dependency configuration information of the project to be tested, obtain the dependency files corresponding to the project to be tested, and monitor the target dependency requests generated during the process of obtaining the dependency files.

[0069] After determining the cache space related to the project to be tested, the dependency files corresponding to the project can be obtained based on the project's dependency configuration information. Specifically, for sub-configuration information within the dependency configuration information, if the dependency file corresponding to the sub-configuration information is found in the cache space, it can be retrieved from the cache space. If the dependency file corresponding to the sub-configuration information is not found in the cache space, a dependency request corresponding to that sub-configuration information is generated. This dependency request is used to request the dependency file corresponding to that sub-configuration information from the server. In other words, a dependency request is generated when it corresponds to a sub-configuration information in the dependency configuration information and the dependency file corresponding to that sub-configuration information is not found in the cache space. The target dependency request can be all detected dependency requests or only a portion of the detected dependency requests.

[0070] In this embodiment of the application, the target dependency request generated during the process of obtaining the dependency file can be monitored. If the target dependency request is detected, it means that the dependency file required to execute the project to be tested cannot be completely hit in the cache space. That is, the dependency configuration information of the project to be tested cannot effectively match the dependency file in the cache space.

[0071] By creating a project execution simulation process to enter the simulation synchronization phase, this process can be used to retrieve the dependency files of the project under test based on its dependency configuration information via a tool call interface. The process can also monitor the target dependency requests generated during this retrieval. Subsequently, during the simulation synchronization phase, the project execution simulation process can be used to execute the project under test via the tool call interface. The project execution simulation process can be a Java process, and the tool call interface can be the ToolingApi. This approach is similar to the actual synchronization phase and is easy to operate.

[0072] When dependency files in the cache space of S201 are also obtained and stored through the simulation synchronization phase, dependency files can be obtained twice through the same simulation synchronization phase. That is, a project execution simulation process can be created once, and two dependency file acquisition operations can be performed using the project execution simulation process. When dependency files in the cache space of S201 are also obtained and stored through the simulation synchronization phase, dependency files can also be obtained twice through two simulation synchronization phases. That is, a project execution simulation process can be created twice, and two dependency file acquisition operations can be performed using two different project execution simulation processes.

[0073] When entering the simulated synchronization phase via the project creation and run command, the dependency files corresponding to the project under test can be obtained based on the dependency configuration information of the project under test during this phase, and the target dependency requests generated during the dependency file retrieval process can be monitored. The project creation and run command can be the `gradle build --dry-run` command, which has a relatively simple process and does not require many build parameters, thus reducing resource waste. When the dependency files in the S201 cache space are also obtained and stored through the simulated synchronization phase, the dependency files can be retrieved twice based on the two project creation and run commands.

[0074] Monitoring of target dependency requests can be performed through a project creation monitoring program. Specifically, a pre-registered project creation monitoring program can monitor project creation details. These details indicate the types of dependency requests generated during the process of retrieving the dependency files corresponding to the project under test. Based on the preset types of dependency requests indicated by the project creation details, the target dependency request is retrieved. These preset types include at least one of metadata retrieval (HEAD) requests and file download (GET) requests. Using a creation monitoring program, target dependency requests can be monitored automatically, improving monitoring efficiency. Specifically, the metadata retrieval request is used to request the metadata of the dependency file, and the file download request is used to request the download of the dependency file. Based on the response message to the metadata retrieval request, it can be determined whether the dependency file indicated by the dependency request exists in the dependency source indicated by the dependency request on the server. Based on the response message to the file download request, the dependency file indicated by the dependency request can be retrieved.

[0075] The project creation monitoring program can be started by compiling the Gradle plugin in Application Performance Management & Monitoring (APM). The program can be a BuildOperationListener, which, through pre-registered callbacks, can obtain execution information for various transactions in the Gradle process, such as task status and duration, project status and dependencies, and cache information. In the finished callback of the project creation monitoring program, the project creation (buildOperation) details indicate the type of dependency request. If the project creation details indicate a metadata request type, it means the dependency request is a Hypertext Transfer Protocol (HTTP) HEAD request, denoted as ExternalResourceReadMetadataBuildOperationType. If the project creation details indicate a file download request type, it means the dependency request is an HTTP GET request, denoted as ExternalResourceReadBuildOperationType.

[0076] See Figure 4 This is a schematic diagram of a request monitoring process provided in an embodiment of this application. According to the project creation (buildOperation) details, it can be determined whether the type of the generated dependency request is a HEAD request type (ExternalResourceReadMetadataBuildOperationType). If so, the dependency request is determined to be a HEAD request. Alternatively, it can be determined whether the type of the generated dependency request is a GET request type (ExternalResourceReadBuildOperationType). If so, the dependency request is determined to be a GET request. A request list (RequestList) can be generated based on the generated dependency requests. Then, the target dependency request can be determined based on the generated dependency requests.

[0077] In practice, there are situations where network downloads are indeed necessary. If the dependent files downloaded via the network cannot be stored in the cache, these network downloads can be excluded from the monitoring scope. This can be achieved by setting an allowed request list, which includes dependent files that do not need to be monitored or dependency sources that store dependent files. Based on the preset types of dependency requests indicated in the project creation details, the target dependency request is identified. Specifically, requests from the preset types of dependency requests that do not correspond to dependent files or sources in the allowed request list are identified as target dependency requests. Network requests corresponding to dependent files or sources in the allowed request list are excluded from the monitoring scope, reducing interference when processing dependency requests and reducing the workload of subsequent analysis of target dependency requests. The Gradle plugin can configure the allowed request list, thereby automatically skipping requests corresponding to dependent files or sources in the allowed request list. The allowed request list supports regular expressions, allowing for skipping requests corresponding to dependent files or sources in the allowed request list through regular expression matching.

[0078] See Figure 5 This is a schematic diagram of another request monitoring process provided in an embodiment of this application. From the request list including generated dependency requests, it is determined in sequence whether each dependency request is a request corresponding to a dependency file in the allowed request list or a dependency source that stores a dependency file. If not, the dependency request is determined as the target dependency request, and the target dependency request can be determined from the request list.

[0079] S203, Obtain the request information of the target dependency request, so as to adjust the dependency configuration information according to the request information.

[0080] After detecting a target dependency request, the request information can be obtained to adjust the dependency configuration information. This allows for dependency file cache detection of the project before it's packaged and merged into a stable branch. The detected target dependency request information serves as the basis for modifying the dependency configuration, ensuring the modified configuration effectively matches the cached dependency files. Subsequent dependency file retrieval will then be based on the modified configuration, improving the dependency hit rate and reducing dependency requests in later stages (such as the sync stage). This reduces network latency and improves compilation and build efficiency. Furthermore, dependency file cache detection can be performed within the project's daily merging pipeline. The integration steps are simple and convenient, the check process is short, and it effectively prevents dependency file cache invalidation and degradation.

[0081] The request information for a target dependency request can be obtained based on its request type. When the target dependency request type is a metadata retrieval request, the request information is obtained based on the composition of the metadata retrieval request. When the target dependency request type is a file download request, the request information is obtained based on the composition of the file download request. The request information for the target dependency request may include the dependency source address corresponding to the target dependency request and the file identifier of the dependency file corresponding to the target dependency request. The dependency source address corresponding to the target dependency request and the file identifier of the dependency file corresponding to the target dependency request can be represented by the uniform resource locator (URL) of the target dependency request. For example, if the URL of the target dependency request is "https: / / mirrors.aaa.com / repository / maven / bbb / com / ccc / mm / opensdk / ddd-sdk-android-without-mta / 6.7.6 / ddd--sdk-android-without-mta-6.7.6.pom", then the URL of the target dependency request can be interpreted as follows: the address of the dependency source corresponding to the target dependency request is "https: / / mirrors.aaa.com / repository / maven / bbb", the dependency source group of the dependency file is "com / ccc / mm / opensdk", the dependency source module is "ddd-sdk-android-without-mta", and the version number of the dependency file is "6.7.6".

[0082] Specifically, when the target dependency request is a metadata retrieval request, the request information can also include the duration of the target dependency request. When the target dependency request is a file download request, the request information can also include the duration of the target dependency request and the amount of data downloaded. Therefore, obtaining the request information for a target dependency request can be specifically as follows: when the target dependency request is a metadata retrieval request, obtain the resource identifier and duration of the target dependency request; when the target dependency request is a file download request, obtain the resource identifier, duration of the target dependency request, and the amount of data downloaded. This allows for the acquisition of comprehensive request information, facilitating targeted adjustments to dependency configuration information based on the request information. For example, dependency files with longer processing times or larger data volumes can be configured in the code files of the project to be tested to reduce network latency.

[0083] In this embodiment of the application, the request information of the target dependency request can be obtained during the process of obtaining the dependency file corresponding to the project to be detected. Each time a target dependency request is detected, the operation of S202 can be paused to obtain the request information of the target dependency request detected this time, so as to adjust the dependency configuration information according to the request information. Afterwards, the operation of S202 can be continued according to the restart command.

[0084] After obtaining the request information of the target dependency requests detected this time, the request information can be displayed. The request information of the target dependency requests can be displayed in the monitoring log. The monitoring log can indicate a build failure (Failure) because the network synchronization check failed (check sync network failed!). The monitoring log can also contain network activity (Networkacticity) to reflect network usage. Network usage can include request information (RequestInfo). Each request information represents a network request executed. The request information includes the URL of the target dependency request, type information (HEAD type or Download type), time consumed (cost) (in milliseconds), and file size (in bytes, non-zero value when the type is Download).

[0085] In this embodiment, the request information for the target dependency requests can be obtained after acquiring the dependency files corresponding to the project to be detected. This allows for the sorting of all target dependency requests and their respective request information after acquisition, resulting in a dependency request list. This list can include the request information for each target dependency request. Specifically, the target dependency requests can be sorted in descending order of their respective execution time to obtain the dependency request list.

[0086] Specifically, the generated dependency requests can be sorted to obtain a new request list, and then the aforementioned dependency request list can be determined based on the new request list. The target dependency requests in the dependency request list are also sorted. See also Figure 4 After obtaining the request information of the generated dependency requests, a request list can be generated based on the generated dependency requests and their corresponding request information; see also Figure 5The generated dependency requests form a request list. The dependency requests in the dependency request list are sorted in descending order of their respective execution time to obtain a new request list. Then, from the new request list, requests corresponding to dependency files that are not in the allowed request list or dependency sources that store dependency files are identified in turn as target dependency requests. The target dependency requests are added to the dependency request list in descending order of their respective execution time.

[0087] Furthermore, dependency request statistics can be generated based on the resource identifier and duration of the metadata retrieval request, as well as the resource identifier, duration, and downloaded data volume of the file download request. Dependency request statistics can include the total time spent on metadata retrieval requests, the number of metadata retrieval requests, the total time spent on file download requests, the number of file download requests, the total downloaded data volume, and the number of downloaded files. Specifically, in scenarios where target dependency requests are determined sequentially based on the allowed request list, the dependency request statistics can be updated sequentially based on the request information of the determined target dependency requests. See [link to relevant documentation]. Figure 5 When the target dependency request is determined to be a metadata retrieval request, the total time spent on the metadata retrieval request and the number of metadata retrieval requests can be updated based on the target dependency request. When the target dependency request is determined to be a file download request, the total time spent on the file download request, the number of file download requests, and the total amount of file downloaded data can be updated based on the target dependency request.

[0088] The dependency request list and dependency request statistics can be displayed in the monitoring log. The monitoring log can include network activity to reflect network usage. Network usage information can be located at the end of the monitoring log. Network usage information can include request information (RequestInfo). Each request information represents a network request executed. Request information includes the URL of the target dependency request, type information (HEAD type or Download type), time spent (cost) (in milliseconds), and file size (in bytes, a non-zero value when the type is Download). The number of file download requests (Http HEAD counts) represents the number of HTTP HEAD requests executed. The number of file downloads (Files downloaded) represents the number of file downloads executed. The amount of data downloaded (Data downloaded) represents the total amount of data downloaded, in bytes. The time spent on downloads (Time spent on downloads) represents the total time spent on all network requests, in milliseconds.

[0089] Whether to display the target dependency request information once after obtaining the target dependency requests detected this time, or to display the target dependency request information after all target dependency requests are detected, can be set through the monitoring fields.

[0090] In this embodiment, if a target dependency request is detected, it indicates that the dependency file has a cache invalidation issue. This can prevent the project under test from being packaged. Specifically, when performing cache invalidation detection through the pipeline, pipeline interception can be triggered to prevent the project under test from being packaged and thus prevent its code from being merged into the stable branch. In this way, the cache invalidation issue of the dependency file can be detected before the project under test is packaged and its code is merged into the stable branch. Non-standard dependency configuration information can be checked and intercepted, thereby modifying the dependency configuration information in a timely manner and preventing the degradation of the cache problem of dependency files in the sync stage.

[0091] In dependency file cache detection, it can be determined whether the interception field is a preset value. If so, after detecting a target dependency request, the dependency file cache detection is considered a failure, preventing the project under test from being packaged and thus preventing its code from being merged into the stable branch. After obtaining all dependency files and no target dependency request is detected, the dependency file cache detection is considered a success, allowing the project under test to be packaged and thus allowing its code to be merged into the stable branch. The interception field can be -PcheckSyncNetwork, and its preset value can be true.

[0092] See Figure 6 This is a schematic diagram of a monitoring process provided in an embodiment of this application. After entering the simulated synchronization phase using the command project creation and run command (. / gradlew build--dry-run), the intercept field of the simulated synchronization phase can be set to determine that the cache detection of the dependency file fails after the target dependency request is detected, thereby preventing the project to be detected from being packaged and thus preventing its code from being merged into the stable branch. In addition, the request information of the target dependency request and dependency request statistics can be output. After obtaining all dependency files and no target dependency request is detected, the cache detection of the dependency file is determined to be successful.

[0093] In this embodiment, the request information of the monitored target dependency request can be used as the basis for modifying the dependency configuration information, that is, the dependency configuration information can be adjusted according to the request information. In specific implementation, staff can analyze the request information and adjust the relevant dependency configuration information; or the first terminal device can automatically adjust the dependency configuration information according to a preset adjustment method, and the automatic adjustment of the dependency configuration information can be implemented by a script.

[0094] In scenarios where dependency configuration information is adjusted according to a preset adjustment method, adjusting dependency configuration information based on request information can specifically involve determining the dependency configuration information of the project to be tested and the corresponding sub-configuration information based on the request information of the target dependency request, as well as the adjustment method for the sub-configuration information. This adjustment method is then used to adjust the sub-configuration information within the dependency configuration information. The request information includes the dependency source address corresponding to the target dependency request and the file identifier of the dependency file corresponding to the target dependency request. This allows the first terminal device to automatically adjust the dependency configuration information, reducing labor costs and improving adjustment efficiency.

[0095] Specifically, adjusting the sub-configuration information in the dependency configuration information can be done in the following ways: if the cache validity period of the dependency file indicated by the sub-configuration information is less than the preset validity period threshold, then the cache validity period of the dependency file indicated by the sub-configuration information is adjusted to the target validity period; if the version information of the dependency file indicated by the sub-configuration information does not meet the preset version information specification, then the sub-configuration information is deleted (excluded), or the version information of the dependency file indicated by the sub-configuration information is modified.

[0096] In some possible implementations, if the dependency configuration information is set improperly, such as the cache validity period of the dependency files in the dependency configuration information being too short, the cache validity period of the dependency files indicated by the sub-configuration information can be adjusted to the target duration, such as 24h or 48h.

[0097] For example, in scenarios where cache invalidation occurs due to version changes, this typically refers to SNAPSHOT dependencies. Even if the version number hasn't changed, the dependency files can still be updated. In this scenario, the actual content of the dependency files hasn't changed, and the version number is cached for 24 hours by default. This means the cache validity period for dependency files in the cache space is also 24 hours. Within this validity period, cached dependency files can be retrieved without generating a dependency request. The cache validity period can be defined as follows: `resolutionStrategy.cacheChangingModulesFor 10, 'hours'`. If the cache validity period is configured to 0 in the project being checked or a third-party plugin, all SNAPSHOT dependency caches will become invalid, and they will be downloaded again each time. In this cache invalidation scenario, the cache validity period can be configured to a target duration, such as 48 hours.

[0098] For example, in a cache invalidation scenario caused by dynamic versions, the version number changes dynamically. For instance, if the version number is configured as '1.0.0+', a newer version will be dynamically adopted if a new version is released. The version number is cached for 24 hours by default, meaning the cache validity period for dependency files in the cache space is also 24 hours. Within this validity period, cached dependency files can be hit without generating dependency requests. The cache validity period can be defined as follows: `resolutionStrategy.cacheDynamicVersionsFor 10, 'minutes'`. If the cache validity period is configured to 0, all dynamic version dependency caches will become invalid. In this case of invalidation, the accessed URL has a characteristic: the request URL ends with `maven-metadata.xml`. Therefore, the `maven-metadata.xml` can be identified based on the URL, and the cache validity period can be adjusted accordingly. In this cache invalidation scenario, the cache validity period can be configured to a target duration, such as 48 hours.

[0099] In other possible implementations, if the dependency configuration information is not set properly, it may be that the dependency file version information indicated by the sub-configuration information in the dependency configuration information does not meet the preset version information specification. In such cases, the sub-configuration information can be deleted or the dependency file version information indicated by the sub-configuration information can be modified.

[0100] For example, if the version number of the dependency file version information indicated in the sub-configuration information does not meet the preset version information specification, it may cause the cache to fail. For example, if the version number changes from 4 digits to 3 digits, the sub-configuration information can be deleted.

[0101] For example, if there is an incorrect version number in the pom file of the sub-configuration information, such as an extra quotation mark in the version number of a dependency file in the project to be tested, causing the cache to fail when handling dependency conflicts, you can delete the sub-configuration information or force the version number to be set (resolutionStrategy.force), for example, by removing the extra quotation mark.

[0102] For example, if the version number in the sub-configuration information contains a "+", such as the version number being named "0.9.0-beta2-c++_shared", the "+" here conflicts with the dynamic version number in the dependency file version, causing the cache to fail. In this case, the version number can be forcibly set.

[0103] In this embodiment of the application, the dependent files corresponding to the project to be tested can also be parsed to obtain the parsing status of the dependent files corresponding to the project to be tested. If the parsing of the target file in the dependent file corresponding to the project to be tested fails, a prompt message is generated to indicate that the corresponding dependency source address in the sub-configuration information of the target file is incorrect, or the sub-configuration information corresponding to the target file is deleted.

[0104] For example, if a dependency file parsing error also causes cache invalidation, it can be determined whether the dependency file is actually needed by the project under test. If it is not needed, the dependency file can be deleted. If it is needed, the correct dependency source address needs to be added. A prompt message can be generated to prompt manual modification of the dependency source address.

[0105] In this embodiment, the request information for the target dependency request can be obtained during the process of acquiring the dependency files corresponding to the project to be detected. Each time a target dependency request is detected, operation S202 can be paused, and a configuration information adjustment operation can be performed. After completing this configuration information adjustment operation, operation S202 continues until all dependency files corresponding to the dependency configuration information are acquired. The configuration information adjustment operation includes acquiring the request information of the currently detected target dependency request, and adjusting the sub-configuration information corresponding to the currently detected target dependency request based on the request information. This adjustment can be optimized for each sub-configuration information, which helps improve the cache hit rate of dependency files. The adjustment method is described above and will not be repeated here.

[0106] In this embodiment of the application, the request information of the target dependency request can be obtained after the dependency files corresponding to the project to be detected are obtained. In this way, after all the target dependency requests are obtained and the request information of each target dependency request is obtained, the sub-configuration information corresponding to the target dependency request detected this time can be adjusted according to the request information. The adjustment method is described above and will not be repeated here.

[0107] The adjusted dependency configuration information can achieve a high cache hit rate in later use. After testing, the test items that have undergone cache detection and whose dependency configuration information has been modified will not generate new network requests without modifying the version number of the dependency file during the sync phase. The cache hit rate remains at 100%, and the average time spent during the sync phase has been reduced from 6 minutes to 1 minute and 30 seconds. Moreover, the above optimization results can be guaranteed not to deteriorate in the long term, and the low sync time can be maintained in the long term, saving developers the time spent synchronizing code through Android Studio and improving development efficiency.

[0108] Based on the dependency file cache detection method provided in the above embodiments, this application also provides a dependency file cache detection device, see [link to relevant documentation]. Figure 7 The above is a structural block diagram of a dependency file cache detection device 1300 provided in an embodiment of this application. The device may include:

[0109] The cache determination unit 1301 is used to determine a cache space related to the item to be detected, wherein the cache space stores the dependency files required to execute the item to be detected.

[0110] The file acquisition unit 1302 is used to acquire the dependency files corresponding to the project to be tested based on the dependency configuration information of the project to be tested;

[0111] Monitoring unit 1303 is used to monitor target dependency requests generated during the process of obtaining the dependency file. The target dependency request corresponds to sub-configuration information in the dependency configuration information. The target dependency request is generated when the dependency file corresponding to the sub-configuration information is not found in the cache space. It is used to request the dependency file corresponding to the sub-configuration information from the server.

[0112] The request information acquisition unit 1304 is used to acquire the request information of the target dependency request, so as to adjust the dependency configuration information according to the request information.

[0113] Optionally, the request information includes the dependency source address corresponding to the target dependency request and the file identifier of the dependency file corresponding to the target dependency request. The device further includes an adjustment unit for adjusting the dependency configuration information according to the request information.

[0114] The adjustment unit includes:

[0115] The adjustment information determination unit is used to determine, based on the request information of the target dependency request, the sub-configuration information corresponding to the target dependency request in the dependency configuration information of the project to be detected, and the adjustment method for the sub-configuration information;

[0116] The adjustment subunit is used to adjust the sub-configuration information in the dependency configuration information through the adjustment method.

[0117] Optionally, the adjustment subunit is specifically used for:

[0118] If the cache validity period of the dependent file indicated by the sub-configuration information is less than the preset duration threshold, then the cache validity period of the dependent file indicated by the sub-configuration information will be adjusted to the target duration.

[0119] If the dependency file version information indicated by the sub-configuration information does not meet the preset version information specification, then the sub-configuration information is deleted, or the dependency file version information indicated by the sub-configuration information is modified.

[0120] Optionally, the device further includes:

[0121] The parsing status acquisition unit is used to acquire the parsing status of the dependency files corresponding to the project to be detected after acquiring the dependency files corresponding to the project to be detected.

[0122] The processing unit is configured to generate a prompt message indicating that the dependency source address in the sub-configuration information corresponding to the target file is incorrect if the parsing of the target file in the dependency file corresponding to the project to be detected fails, or to delete the sub-configuration information corresponding to the target file.

[0123] Optionally, the monitoring unit 1303 includes:

[0124] The detailed information acquisition unit is used to monitor project creation detailed information through a pre-registered project creation monitoring program. The project creation detailed information is used to indicate the type of dependency request generated during the process of obtaining the dependency files corresponding to the project to be monitored.

[0125] The target dependency request acquisition unit is used to acquire the target dependency request according to the preset type of dependency request indicated by the project creation details information. The preset type of dependency request includes at least one of metadata acquisition request and file download request.

[0126] Optionally, the target dependency request acquisition unit is specifically used for:

[0127] The requests that do not belong to the allowed request list and are not the corresponding dependency files or dependency sources in the preset type of dependency requests are identified as the target dependency requests.

[0128] Optionally, the request information acquisition unit is specifically used for:

[0129] When the target dependency request is the metadata acquisition request, the resource identifier and duration of the target dependency request are obtained; when the target dependency request is the file download request, the resource identifier, duration, and download data volume of the target dependency request are obtained; the resource identifier of the target dependency request is used to indicate the dependency source address corresponding to the target dependency request and the file identifier of the dependency file corresponding to the target dependency request.

[0130] The device further includes:

[0131] The sorting unit is used to sort the target dependency requests in descending order of their respective time durations to obtain a dependency request list.

[0132] The statistics information generation unit is used to obtain the resource identifier and duration of the request, as well as the resource identifier, duration and download data volume of the file download request, based on the metadata, and generate dependency request statistics information;

[0133] The display unit is used to display the dependency request list and the dependency request statistics.

[0134] Optionally, the file acquisition unit 1302 is specifically used for:

[0135] The project is created and run to enter the simulation synchronization phase, and the dependency files corresponding to the project to be tested are obtained based on the dependency configuration information of the project to be tested during the simulation synchronization phase.

[0136] The monitoring unit 1303 is specifically used for:

[0137] During the simulation synchronization phase, target dependency requests generated during the acquisition of the dependency files are monitored.

[0138] Optionally, the file acquisition unit 1302 is specifically used for:

[0139] Create a project execution simulation process to enter the simulation synchronization phase;

[0140] During the simulation synchronization phase, the project executes a simulation process, and through the tool's interface call, the dependency files corresponding to the project to be tested are obtained based on the dependency configuration information of the project to be tested.

[0141] The monitoring unit 1303 is specifically used for:

[0142] During the simulation synchronization phase, the project is used to execute a simulation process, and the target dependency requests generated during the acquisition of the dependency files are monitored by calling the interface through the tool.

[0143] The device further includes:

[0144] The project execution unit is used to execute the simulation process using the project during the simulation synchronization phase, and to execute the project to be tested by calling the interface through the tool.

[0145] Optionally, the device further includes:

[0146] An interception unit is used to prevent the packaging of the item to be detected if the target dependency request is detected.

[0147] Optionally, the request information acquisition unit 1304 is specifically used for:

[0148] Each time a target dependency request is detected, the operation of obtaining the dependency file corresponding to the project to be detected, as well as the operation of monitoring the target dependency request generated during the process of obtaining the dependency file, is paused, and a configuration information adjustment operation is performed; after the configuration information adjustment operation is completed, the operation of obtaining the dependency file corresponding to the project to be detected, as well as the operation of monitoring the target dependency request generated during the process of obtaining the dependency file, continues until all dependency configuration information corresponding to the dependency files is obtained;

[0149] The configuration information adjustment operation includes: obtaining the request information of the target dependency request detected this time, and adjusting the sub-configuration information corresponding to the target dependency request detected this time according to the request information.

[0150] Optionally, the cache determination unit 1301 is specifically used for:

[0151] During the simulation synchronization phase, based on the dependency configuration information of the project to be tested, the dependency files required to execute the project to be tested are obtained from the server, and the dependency files are stored in the cache space related to the project to be tested.

[0152] This application also provides a computer device, which is the computer device described above, and may include a terminal device or a server. The aforementioned dependency file cache detection device may be configured in this computer device. The computer device will now be described in conjunction with the accompanying drawings.

[0153] If the computer device is a terminal device, please refer to Figure 8 As shown, this application provides a terminal device, taking a mobile phone as an example:

[0154] Figure 8 This diagram illustrates a partial structure of a mobile phone related to the terminal device provided in the embodiments of this application. (Reference) Figure 8The mobile phone includes components such as a radio frequency (RF) circuit 1410, a memory 1420, an input unit 1430, a display unit 1440, a sensor 1450, an audio circuit 1460, a Wi-Fi module 1470, a processor 1480, and a power supply 1490. Those skilled in the art will understand that... Figure 8 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0155] The following is combined with Figure 8 A detailed introduction to each component of a mobile phone:

[0156] The RF circuit 1410 can be used to receive and transmit signals during information transmission or calls. In particular, it receives downlink information from the base station and processes it with the processor 1480; in addition, it transmits uplink data to the base station.

[0157] The memory 1420 can be used to store software programs and modules. The processor 1480 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1420. The memory 1420 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0158] The input unit 1430 can be used to receive input numeric or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1430 may include a touch panel 1431 and other input devices 1432.

[0159] The display unit 1440 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1440 may include a display panel 1441.

[0160] The mobile phone may also include at least one sensor 1450, such as a light sensor, a motion sensor, and other sensors.

[0161] Audio circuitry 1460, speaker 1461, and microphone 1462 provide an audio interface between the user and the mobile phone.

[0162] WiFi is a short-range wireless transmission technology. Through the WiFi module 1470, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access.

[0163] The processor 1480 is the control center of the mobile phone. It connects to various parts of the mobile phone through various interfaces and lines. It performs various functions of the mobile phone and processes data by running or executing software programs and / or modules stored in the memory 1420 and calling data stored in the memory 1420.

[0164] The phone also includes a power supply 1490 (such as a battery) that powers the various components.

[0165] In this embodiment, the processor 1480 included in the terminal device also has the following functions:

[0166] Identify a cache space associated with the item to be tested, wherein the cache space stores the dependency files required to execute the item to be tested;

[0167] Based on the dependency configuration information of the project to be detected, the dependency file corresponding to the project to be detected is obtained, and the target dependency request generated in the process of obtaining the dependency file is monitored. The target dependency request corresponds to the sub-configuration information in the dependency configuration information. The target dependency request is generated when the dependency file corresponding to the sub-configuration information is not found in the cache space, and is used to request the dependency file corresponding to the sub-configuration information from the server.

[0168] Obtain the request information of the target dependency request, and adjust the dependency configuration information according to the request information.

[0169] If the computer device is a server, this application embodiment also provides a server; please refer to [link to relevant documentation]. Figure 9 As shown, Figure 9This is a structural diagram of a server 1500 provided in an embodiment of this application. The server 1500 can vary significantly due to different configurations or performance. It may include one or more processors 1522, such as a Central Processing Unit (CPU), a memory 1532, and one or more storage media 1530 (e.g., one or more mass storage devices) for storing application programs 1542 or data 1544. The memory 1532 and storage media 1530 can be temporary or persistent storage. The program stored in the storage media 1530 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the processor 1522 may be configured to communicate with the storage media 1530 and execute the series of instruction operations in the storage media 1530 on the server 1500.

[0170] Server 1500 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input / output interfaces 1558, and / or one or more operating systems 1541, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.

[0171] The steps performed by the server in the above embodiments can be based on Figure 9 The server structure shown.

[0172] In addition, this application embodiment also provides a storage medium for storing a computer program for executing the method provided in the above embodiment.

[0173] This application also provides a computer program product including instructions that, when run on a computer, cause the computer to perform the methods provided in the above embodiments.

[0174] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk, or optical disk, etc., and other media capable of storing program code.

[0175] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0176] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Moreover, based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for detecting cached dependencies, characterized in that, The method includes: Identify a cache space associated with the item to be tested, wherein the cache space stores the dependency files required to execute the item to be tested; Based on the dependency configuration information of the project to be detected, the dependency file corresponding to the project to be detected is obtained, and the target dependency request generated in the process of obtaining the dependency file is monitored. The target dependency request corresponds to the sub-configuration information in the dependency configuration information. The target dependency request is generated when the dependency file corresponding to the sub-configuration information is not found in the cache space, and is used to request the dependency file corresponding to the sub-configuration information from the server. Obtain the request information of the target dependency request, and adjust the dependency configuration information according to the request information; The monitoring of target dependency requests generated during the acquisition of the dependency files includes: The project creation monitoring program, which is pre-registered, monitors project creation details, which indicate the types of dependency requests generated during the process of obtaining the dependency files corresponding to the project to be monitored. Based on the dependency request of the preset type indicated by the project creation details information, obtain the target dependency request, wherein the preset type of dependency request includes at least one of metadata acquisition request and file download request; When the request information includes the dependency source address corresponding to the target dependency request and the file identifier of the dependency file corresponding to the target dependency request, adjusting the dependency configuration information according to the request information includes: Based on the request information of the target dependency request, determine the sub-configuration information corresponding to the target dependency request in the dependency configuration information of the project to be detected, and the adjustment method for the sub-configuration information; The sub-configuration information in the dependency configuration information is adjusted using the aforementioned adjustment method.

2. The method according to claim 1, characterized in that, The adjustment of the sub-configuration information in the dependency configuration information through the adjustment method includes: If the cache validity period of the dependent file indicated by the sub-configuration information is less than the preset duration threshold, then the cache validity period of the dependent file indicated by the sub-configuration information will be adjusted to the target duration. If the dependency file version information indicated by the sub-configuration information does not meet the preset version information specification, then the sub-configuration information is deleted, or the dependency file version information indicated by the sub-configuration information is modified.

3. The method according to claim 1, characterized in that, After obtaining the dependency files corresponding to the project to be detected, the method further includes: Obtain the parsing status of the dependency files corresponding to the project to be detected; If the target file in the dependency file corresponding to the project to be tested fails to be parsed, a prompt message is generated to indicate that there is an error in the dependency source address in the sub-configuration information corresponding to the target file, or the sub-configuration information corresponding to the target file is deleted.

4. The method according to claim 1, characterized in that, The step of obtaining the target dependency request based on the preset type of dependency request indicated by the project creation details information includes: The requests that do not belong to the allowed request list and are not the corresponding dependency files or dependency sources in the preset type of dependency requests are identified as the target dependency requests.

5. The method according to claim 1, characterized in that, The step of obtaining request information related to the target dependency request includes: When the target dependency request is the metadata acquisition request, the resource identifier and duration of the target dependency request are acquired; when the target dependency request is the file download request, the resource identifier, duration, and download data volume of the target dependency request are acquired; wherein, the resource identifier of the target dependency request is used to indicate the dependency source address corresponding to the target dependency request and the file identifier of the dependency file corresponding to the target dependency request; The method further includes: The target dependency requests are sorted in descending order of their respective time consumption to obtain a dependency request list; Based on the metadata, obtain the resource identifier and duration of the request, as well as the resource identifier, duration, and download data volume of the file download request, and generate dependency request statistics. Display the list of dependency requests and the statistics of the dependency requests.

6. The method according to any one of claims 1-5, characterized in that, The process of obtaining the dependency files corresponding to the project under test based on the dependency configuration information of the project under test, and monitoring the target dependency requests generated during the process of obtaining the dependency files, includes: The project is created and run to enter the simulation synchronization phase. During the simulation synchronization phase, the dependency files corresponding to the project to be tested are obtained based on the dependency configuration information of the project to be tested, and the target dependency requests generated during the process of obtaining the dependency files are monitored.

7. The method according to any one of claims 1-5, characterized in that, The process of obtaining the dependency files corresponding to the project under test based on the dependency configuration information of the project under test, and monitoring the target dependency requests generated during the process of obtaining the dependency files, includes: Create a project execution simulation process to enter the simulation synchronization phase; During the simulation synchronization phase, the project executes a simulation process, and through the tool's interface call, the dependency files corresponding to the project under test are obtained based on the dependency configuration information of the project under test, and the target dependency requests generated during the process of obtaining the dependency files are monitored. The method further includes: During the simulation synchronization phase, the simulation process is executed using the project, and the project to be tested is executed by calling the interface through the tool.

8. The method according to any one of claims 1-5, characterized in that, The method further includes: If the target dependency request is detected, prevent the packaging of the item to be detected.

9. The method according to any one of claims 1-3, characterized in that, The step of obtaining the request information of the target dependency request, and adjusting the dependency configuration information according to the request information, includes: Each time a target dependency request is detected, the operation of obtaining the dependency files corresponding to the project to be detected and the operation of monitoring the target dependency requests generated during the process of obtaining the dependency files are paused, and a configuration information adjustment operation is performed. After the configuration information adjustment operation is completed, the operation of obtaining the dependency files corresponding to the project to be detected and the operation of monitoring the target dependency requests generated during the process of obtaining the dependency files are resumed until all dependency files corresponding to the dependency configuration information are obtained. The configuration information adjustment operation includes: obtaining the request information of the target dependency request detected this time, and adjusting the sub-configuration information corresponding to the target dependency request detected this time according to the request information.

10. A cache detection device for dependent files, characterized in that, The device includes: A cache determination unit is used to determine a cache space related to the item to be detected, wherein the cache space stores the dependency files required to execute the item to be detected; The file acquisition unit is used to acquire the dependency files corresponding to the project to be tested based on the dependency configuration information of the project to be tested; The monitoring unit is used to monitor the target dependency request generated during the process of obtaining the dependency file. The target dependency request corresponds to the sub-configuration information in the dependency configuration information. The target dependency request is generated when the dependency file corresponding to the sub-configuration information is not found in the cache space. It is used to request the dependency file corresponding to the sub-configuration information from the server. A request information acquisition unit is used to acquire request information of the target dependency request, so as to adjust the dependency configuration information according to the request information; The monitoring unit includes: The detailed information acquisition unit is used to monitor project creation detailed information through a pre-registered project creation monitoring program. The project creation detailed information is used to indicate the type of dependency request generated during the process of obtaining the dependency files corresponding to the project to be monitored. The target dependency request acquisition unit is used to acquire the target dependency request according to a preset type of dependency request indicated by the project creation details information. The preset type of dependency request includes at least one of metadata acquisition request and file download request. The request information includes the dependency source address corresponding to the target dependency request and the file identifier of the dependency file corresponding to the target dependency request. The device also includes an adjustment unit for adjusting the dependency configuration information according to the request information. The adjustment unit includes: The adjustment information determination unit is used to determine, based on the request information of the target dependency request, the sub-configuration information corresponding to the target dependency request in the dependency configuration information of the project to be detected, and the adjustment method for the sub-configuration information; The adjustment subunit is used to adjust the sub-configuration information in the dependency configuration information through the adjustment method.

11. The apparatus according to claim 10, characterized in that, The adjustment subunit is specifically used for: If the cache validity period of the dependent file indicated by the sub-configuration information is less than the preset duration threshold, then the cache validity period of the dependent file indicated by the sub-configuration information will be adjusted to the target duration. If the dependency file version information indicated by the sub-configuration information does not meet the preset version information specification, then the sub-configuration information is deleted, or the dependency file version information indicated by the sub-configuration information is modified.

12. The apparatus according to claim 10, characterized in that, The device further includes: The parsing status acquisition unit is used to acquire the parsing status of the dependency files corresponding to the project to be detected after acquiring the dependency files corresponding to the project to be detected. The processing unit is configured to generate a prompt message indicating that the dependency source address in the sub-configuration information corresponding to the target file is incorrect if the parsing of the target file in the dependency file corresponding to the project to be detected fails, or to delete the sub-configuration information corresponding to the target file.

13. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store computer programs and to transfer the computer programs to the processor; The processor is configured to execute the dependency file cache detection method according to any one of claims 1-9 according to the instructions in the computer program.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for executing the dependency file cache detection method according to any one of claims 1-9.

15. A computer program product comprising a computer program, characterized in that, When it is run on a computer device, it causes the computer device to perform the dependency file cache detection method according to any one of claims 1-9.

Citation Information

Patent Citations

  • Multi-dependency-item file extraction method and device based on Maven plug-in

    CN111897570A

  • Dependence processing method and device

    CN113590144A

  • Dependent file cache updating method and device, computer equipment and storage medium

    CN114745439A