Resource analysis method, device, electronic device and storage medium
Static feature analysis is performed through preset call function call resource analysis tools, which solves the problem of low efficiency and accuracy of resource compliance inspection in the existing technology, and achieves efficient and accurate resource analysis, reducing manual intervention.
Patent Information
- Application Number
- CN202111304338.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-05
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-11-05
AI Technical Summary
In the existing technology, resource compliance inspection is low efficiency and accuracy, and manual intervention is required to investigate problems, resulting in low resource inspection efficiency and accuracy.
Provide a resource analysis method, which determines the storage path of the resource to be analyzed and the storage path of the resource analysis tool through a preset call function, and calls the resource analysis tool for static feature analysis to obtain static analysis results to avoid submission of resources that do not meet the submission target. Version library.
It improves the efficiency and accuracy of resource analysis, avoids the occurrence of resource problems, ensures that resources meet the submission goals from the source, and reduces manual intervention.
Smart Images

Figure CN114064467B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource analysis method, device, electronic device and storage medium. Background Art
[0002] In the prior art, for resource compliance inspection, most of them adopt two methods: manual post-check and post-processing resource inspection. That is, after the performance is incorrect, the function is abnormal, the installation package is built incorrectly, the installation package size is abnormal, etc., manual and post-processing resource inspections are used to find the problematic resources and repair the resources. Therefore, the post-processing resource inspection method cannot prevent problems before they occur, and manual intervention is required to check the problems. The efficiency and accuracy of resource inspection are low. Summary of the invention
[0003] The technical problem to be solved by the present application is to provide a resource analysis method, device, electronic device and storage medium, which can improve the efficiency and accuracy of resource analysis.
[0004] In order to solve the above technical problems, on the one hand, the present application provides a resource analysis method, including:
[0005] When submitting a resource to be analyzed, determining a preset calling function corresponding to the resource to be analyzed; the preset calling function includes a first storage path where the resource to be analyzed is located and a second storage path where a resource analysis tool is located;
[0006] Calling the resource analysis tool under the second storage path based on the preset calling function, and passing the first storage path to the resource analysis tool based on the preset calling function;
[0007] Based on the resource analysis tool, static characteristics of the resources to be analyzed under the first storage path are analyzed to obtain static analysis results of the resources to be analyzed.
[0008] On the other hand, an embodiment of the present application provides a resource analysis device, including:
[0009] A preset calling function determination module, used to determine a preset calling function corresponding to the resource to be analyzed when submitting the resource to be analyzed; the preset calling function includes a first storage path where the resource to be analyzed is located and a second storage path where the resource analysis tool is located;
[0010] A resource analysis tool calling module, configured to call the resource analysis tool under the second storage path based on the preset calling function, and to transfer the first storage path to the resource analysis tool based on the preset calling function;
[0011] The static analysis module is used to analyze the static characteristics of the resources to be analyzed under the first storage path based on the resource analysis tool to obtain static analysis results of the resources to be analyzed.
[0012] On the other hand, the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the resource analysis method as described above.
[0013] On the other hand, the present application provides a computer storage medium, wherein the storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded by a processor and executes the resource analysis method as described above.
[0014] Implementing the embodiments of the present application has the following beneficial effects:
[0015] When submitting a resource to be analyzed, the present application first determines a preset call function corresponding to the resource to be analyzed; based on the preset call function, the resource analysis tool under the second storage path is called, and the first storage path is passed to the resource analysis tool; based on the resource analysis tool, the static analysis features of the resource to be analyzed under the first storage path are analyzed to obtain a static analysis result of the resource to be analyzed. Before submitting the resource to be analyzed to the version library, the present application first analyzes the static features of the resource to be analyzed, thereby avoiding submitting resources that do not meet the submission target to the version library and avoiding the occurrence of problems at the source; in addition, by calling the resource analysis tool through the preset call function corresponding to the resource to be analyzed to realize the analysis of the static features of the resource to be analyzed, the efficiency and accuracy of resource analysis can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 It is a schematic diagram of the implementation environment provided by the embodiment of the present application;
[0018] Figure 2 is a flow chart of a resource analysis method provided in an embodiment of the present application;
[0019] Figure 3 This is a flow chart of a preset calling function registration method provided by an embodiment of the present application;
[0020] Figure 4 It is a flow chart of a method for generating a preset calling function provided in an embodiment of the present application;
[0021] Figure 5 This is a flow chart of a resource file update amount analysis method provided in an embodiment of the present application;
[0022] Figure 6 It is a flow chart of a globally unique identifier analysis method provided in an embodiment of the present application;
[0023] Figure 7 It is a resource analysis flow chart provided in an embodiment of the present application;
[0024] Figure 8 It is an execution flow chart of the resource pre-analysis item provided in the embodiment of the present application;
[0025] Fig. 9 This is a schematic diagram of a code compilation error prompt interface provided in an embodiment of the present application;
[0026] Fig.10 This is a schematic diagram of the automatic hook adding interface provided in an embodiment of the present application;
[0027] Fig.11 This is a first log diagram provided in an embodiment of the present application;
[0028] Fig.12 This is a second log diagram provided in an embodiment of the present application;
[0029] Fig.13 It is a schematic diagram of a GUID path provided in an embodiment of the present application;
[0030] Fig.14 is a schematic diagram of a resource analysis device provided in an embodiment of the present application;
[0031] Fig.15 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] To make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] First, the relevant terms involved in the embodiments of this specification are explained as follows:
[0035] Pre-check: Most of the check items are pre-checks, which are performed immediately when users submit resources through SVN tools. They rely on the submitter's local resource analysis tool to assign the calculation work of the check to the user terminal and obtain the results of resource analysis in real time. If there is a problem with the resource, the submission will be blocked and the user will be informed how to solve the resource problem.
[0036] Post-check: A few check items belong to post-check, which are checked after the user submits the resources and use public machines for automated calculations, such as code compilation error checking. If there is a problem with the submitted resources, the user will be notified to make modifications.
[0037] See also Figure 1 , which shows a schematic diagram of an implementation environment provided by an embodiment of the present application, the implementation environment may include: at least one front-end analysis terminal 110 and a post-analysis terminal 120, and the front-end analysis terminal 110 and the post-analysis terminal 120 can communicate data through a network.
[0038] Specifically, when the front-end analysis end 110 receives a submission request for a resource to be analyzed, the resource analysis tool in the front-end analysis end 110 is called to perform a static feature analysis on the resource to be analyzed to obtain a static analysis result; when the static analysis result meets the submission target, the front-end analysis end 110 submits the resource to be analyzed to the back-end analysis end 120; the back-end analysis end 120 performs a dynamic feature analysis on the received resource to be analyzed to obtain a dynamic analysis result of the resource to be analyzed.
[0039] The front-end analysis terminal 110 can communicate with the back-end analysis terminal 120 based on the browser / server mode (B / S) or the client / server mode (C / S). The front-end analysis terminal 110 may include: physical devices such as smart phones, tablet computers, laptops, digital assistants, smart wearable devices, vehicle terminals, servers, etc., and may also include software running in physical devices, such as applications, etc. The operating system running on the front-end analysis terminal 110 in the embodiment of the present application may include but is not limited to Android system, IOS system, Linux, Windows, etc.
[0040] The post-analysis end 120 may establish a communication connection with the pre-analysis end 110 via wired or wireless communication. The post-analysis end 120 may include an independently operated server, or a distributed server, or a server cluster consisting of multiple servers, wherein the server may be a cloud server.
[0041] In order to solve the problems of low efficiency and low accuracy in resource checking in the prior art, the present application embodiment provides a resource analysis method, the execution subject of which can be the above-mentioned front-end analysis end, see Figure 2 , the method may include:
[0042] S210. When submitting a resource to be analyzed, determining a preset calling function corresponding to the resource to be analyzed; the preset calling function includes a first storage path where the resource to be analyzed is located and a second storage path where a resource analysis tool is located.
[0043] In the embodiment of the present application, the resource to be analyzed can be submitted through the resource management platform, wherein the resource management platform is a platform for performing operations such as resource processing, resource monitoring, and resource submission. The preset call function corresponding to the resource to be analyzed can be obtained by registering on the resource management platform, so that when the resource to be analyzed is submitted through the resource management platform, the resource analysis tool is called based on the preset call function corresponding to the resource to be analyzed to perform resource analysis. The resource analysis tool integrates resource analysis items corresponding to multiple static features of the resource to be analyzed.
[0044] The resource to be analyzed may correspond to a project, and a resource file in a project may be regarded as a resource to be analyzed, that is, the resource to be analyzed may include resource files of various forms. Accordingly, the resource analysis tool further includes resource analysis items for resource files of different formats.
[0045] Furthermore, the first storage path and the second storage path can both be storage paths under the front-end analysis end, so that the process of calling the resource analysis tool to perform static analysis on the resources to be analyzed can be implemented at the front-end analysis end, thereby reducing the processing pressure at the back-end analysis end.
[0046] S220. Call the resource analysis tool under the second storage path based on the preset calling function, and pass the first storage path to the resource analysis tool based on the preset calling function.
[0047] In this embodiment, the function of the preset calling function may include calling the resource analysis tool under the second storage path, and passing the first storage path to the resource analysis tool, so that the resource analysis tool analyzes the resources to be analyzed under the first storage path. Specifically, the resource analysis tool analyzes the resources to be analyzed under the first storage path by reading the resources to be analyzed from the first storage path and placing them in the work area preset by the resource analysis tool, so that the resource analysis tool can analyze the resources to be analyzed in the work area; or the resource analysis tool directly analyzes the resources to be analyzed under the first storage path without reading them out.
[0048] S230. Analyze the static characteristics of the resources to be analyzed under the first storage path based on the resource analysis tool to obtain static analysis results of the resources to be analyzed.
[0049] Static features may be features of the resource to be analyzed in a non-compiled state or a non-running state. The static analysis results of the resource to be analyzed may be obtained through the resource analysis items corresponding to the static analysis in the resource analysis tool.
[0050] When submitting a resource to be analyzed, the present application first determines a preset call function corresponding to the resource to be analyzed; based on the preset call function, the resource analysis tool under the second storage path is called, and the first storage path is passed to the resource analysis tool; based on the resource analysis tool, the static analysis features of the resource to be analyzed under the first storage path are analyzed to obtain a static analysis result of the resource to be analyzed. Before submitting the resource to be analyzed to the version library, the present application first analyzes the static features of the resource to be analyzed, thereby avoiding submitting resources that do not meet the submission target to the version library and avoiding the occurrence of problems at the source; in addition, by calling the resource analysis tool through the preset call function corresponding to the resource to be analyzed to realize the analysis of the static features of the resource to be analyzed, the efficiency and accuracy of resource analysis can be improved.
[0051] Furthermore, the preset calling function corresponding to the resource to be analyzed can be obtained by registration. For details, please refer to Figure 3, which shows a method for registering a preset calling function, which may include:
[0052] S310. Determine the first storage path where the resources to be analyzed are located, and the second storage path where the resource analysis tool is located.
[0053] S320. Based on the first storage path and the second storage path, register the preset calling function corresponding to the resource to be analyzed in the resource management platform.
[0054] When registering the preset calling function corresponding to each resource to be analyzed, it is necessary to determine the first storage path where the resource to be analyzed is located, so that the resource analysis tool can clearly find the path of the resource to be analyzed; it is also necessary to determine the second storage path where the resource analysis tool is located, so that the preset calling function can clearly find the path of the resource analysis tool.
[0055] Therefore, by pre-registering the preset calling function corresponding to the resource to be analyzed, when submitting the resource to be analyzed, the resource analysis tool is first called through the preset calling function; and once the preset calling function is successfully registered, it can be used multiple times, thereby improving the flexibility and convenience of calling the resource analysis tool.
[0056] For the generation of preset call functions, it can be implemented in the resource management platform. Figure 4 , which shows a method for generating a preset calling function, which may include:
[0057] S410. Obtain a preset calling function creation template corresponding to the resource to be analyzed.
[0058] S420. Based on the first storage path and the second storage path, configure the preset calling function creation template to obtain configured calling function information.
[0059] S430. Based on the configured calling function information, generate a preset calling function corresponding to the resource to be analyzed.
[0060] When it is necessary to create a preset call function corresponding to the resource to be analyzed, a preset call function creation instruction can be executed on the resource management platform, so that a preset call function creation template can be obtained. The preset call function creation template includes multiple configurable items, including the storage path where the resource to be analyzed is located, the path where the resource analysis tool is located, etc. Specifically, the corresponding configurable items can be configured based on the first storage path and the second storage path, so as to obtain the preset call function corresponding to the resource to be analyzed.
[0061] Since templates are generally universal, in order to obtain the preset calling function corresponding to the resource to be analyzed, it can be achieved by configuring the preset calling function creation template; the configurable items in the preset calling function creation template can be flexibly modified, so when the path where the resource to be analyzed is changed, or the path where the resource analysis tool is located changes, the corresponding configurable items can be adaptively modified to generate the changed preset calling function, thereby improving the flexibility of preset calling function creation.
[0062] The static analysis features of the resources to be analyzed may include the update amount of the resource files in the resources to be analyzed. The update amount of the resource files is used to represent the sum of the number of bytes of the resource files and the number of bytes of the associated files that reference the resource files. For example, for resource file A, it is referenced by resource files B, C, and D. Therefore, the update amount of resource file A is the sum of the size of resource file A, the size of resource file B, the size of resource file C, and the size of resource file D. For details, please refer to Figure 5 , which shows a resource file update amount analysis method, the method may include:
[0063] S510. Obtain a target update amount for each resource file in the resource to be analyzed based on the resource analysis tool; the target update amount is obtained based on the number of bytes of each resource file and the reference relationship between the resource files.
[0064] S520. Analyze the target update amount of each resource file to obtain an update amount analysis result of the resource to be analyzed.
[0065] S530. Determine the static analysis result based on the update amount analysis result.
[0066] The target update amount for each resource file can be recorded in an update amount log file, which includes multiple file update amount entries, each entry corresponding to a resource file; the update amount log file can be included in the resource to be analyzed, so that when the resource analysis tool is called to update the resource file in the resource to be analyzed, the resource analysis tool can obtain the update amount log file, thereby traversing the file update amount entries in the update amount log file, and determining the resource file whose target update amount is greater than the preset update amount as the resource file to be confirmed, and the corresponding resource to be analyzed is determined to be non-compliant with the submission requirements. That is, the update amount analysis result can be that the resource to be analyzed meets the submission requirements; or the update amount analysis result can include a prompt that the resource to be analyzed does not meet the submission requirements, and relevant information of the resource file whose update amount is greater than the preset update amount, and the relevant information can be information such as the file name, file identifier, or file path. The above update amount analysis result can be included in the static analysis result.
[0067] By analyzing the update volume of resource files, it is possible to avoid resource files with large update volumes being released to users, thereby preventing the problem of large resource update volumes for users, and improve the speed and efficiency of users loading and using corresponding resources.
[0068] Static features can also include globally unique identifiers; see Figure 6 , which shows a globally unique identifier analysis method, which may include:
[0069] S610. Determine, based on the resource analysis tool, an existing globally unique identifier corresponding to each resource file in the resource to be analyzed.
[0070] S620. Perform path resolution on the existing globally unique identifier to obtain resolution paths corresponding to the resource files.
[0071] S630. Perform consistency comparison on the parsing paths corresponding to the resource files and the target paths where the resource files are located, to obtain a globally unique identifier analysis result for the resource to be analyzed.
[0072] S640. Determine the static analysis result based on the globally unique identifier analysis result.
[0073] In general, each globally unique identifier GUID corresponds to the path where the resource file is located. If they do not correspond, it means that the globally unique identifier GUID has a conflict. In this embodiment, the existing globally unique identifier here can be a globally unique identifier corresponding to each resource file marked in the system, which may be accurate or inaccurate; the existing globally unique identifier identified by each resource file is path parsed by the resource analysis tool to obtain the parsed path corresponding to each resource file. The target path where each resource file is located can be the actual storage path where each resource file is located; the parsed path is compared with the target path where the resource file is located for consistency, and it can be determined whether each resource file has a globally unique identifier conflict according to the consistency comparison result. Thus, the globally unique identifier analysis result can include prompt information that the resource to be analyzed has passed the globally unique identifier analysis; or the globally unique identifier analysis result can be prompt information that the resource to be analyzed has not passed the globally unique identifier analysis, and relevant information of the resource file with a GUID conflict, and the relevant information can be information such as the file name, file identifier or the path where the file is located. The above-mentioned globally unique identifier analysis result can be included in the static analysis result. By analyzing the globally unique identifier of the resource to be analyzed, the problem of GUID conflict in the published resource information can be avoided, and the stability of the operation of the resource to be analyzed can be enhanced.
[0074] In an embodiment of the present application, when the static analysis result indicates that the resource to be analyzed does not meet the submission target, the resource to be analyzed is automatically repaired based on the resource analysis tool to obtain a repaired resource; for example, when the static feature includes the encoding format of the resource script, the encoding format of the resource script can be analyzed by the resource analysis tool; specifically, it may include: when the encoding format of the resource script is not the target format, the encoding format of the resource script is converted to the target format based on the resource analysis tool; based on the resource script in the target format, the repaired resource is obtained. If the encoding format of the C# and Lua scripts submitted by the user is UTF8-WithBOM, which does not meet the pre-established script specifications, the resource analysis tool will automatically convert the encoding format of the script to UTF8-WithoutBOM, that is, the repair of the resource to be analyzed is achieved, and the repaired resource is submitted.
[0075] In addition, when the static analysis result indicates that the resource to be analyzed meets the submission target, the resource to be analyzed is submitted to the post-analysis end; the post-analysis end is used to analyze the dynamic characteristics of the resource to be analyzed to obtain the dynamic analysis result of the resource to be analyzed; the dynamic characteristics are used to characterize the characteristics of the resource to be analyzed during compilation or operation. The post-analysis end compiles the resource to be analyzed, and the situations that cause compilation errors in its analysis may include: incomplete submission of resource code files modified by developers, direct submission without local compilation and modification, etc. These situations will cause local errors and inability to run after the resources are downloaded and updated after release, and the corresponding built installation package will also fail.
[0076] The reason why the compilation analysis of the resources to be analyzed is placed on the post-analysis end in this embodiment is that code compilation errors can only be discovered by compiling the code, and it takes a while to compile the code once. If it is placed on the pre-analysis end for analysis, the developer will have to wait for a while each time he submits the code, which leads to a long code submission process. When the compilation analysis is performed on the post-analysis end, the back-end public resources can be fully utilized to improve the efficiency of the entire analysis process. Pre-analysis is the analysis during the submission process. When the resources to be analyzed pass the pre-analysis, they are submitted to the post-analysis end.
[0077] The following is a specific example to illustrate the implementation process of this application. Figure 7 , which shows a resource analysis flow chart, including:
[0078] 1. The submitter submits resources;
[0079] 2. Perform a pre-submission check on the submitted resources through the resource analysis tool to determine whether the submitted resources are normal;
[0080] 3. When the resources are normal, submit the submitted resources to the version library;
[0081] 4. When a resource is abnormal, repair the resource through the resource analysis tool to obtain the repaired resource, and submit the repaired resource to the version library; for resources that cannot be repaired through the resource analysis tool, the submission fails and an error is reported;
[0082] 5. Check the successfully submitted resources through the post-analysis end; when the resources are normal, end the resource check; when the resources are abnormal, send an error message.
[0083] The static feature analysis items integrated in the resource analysis tool may specifically include:
[0084] 1. Submission description specification check: Enter a meaningful and detailed submission description, and include a link to the requirement / bug ticket.
[0085] 2. It is forbidden to submit certain types of files: such as .dds, because .dds will cause packaging failure.
[0086] 3. Atlas submission check: The .prefab of the atlas can only be submitted to the / Assets / Resources / directory, and the .png and .mat of the atlas can only be submitted to the / Assets / Common / directory.
[0087] 4. Image format check: Check the maxTextureSize, textureFormat, overridden and other fields of the .meta file corresponding to the scattered image, and automatically standardize the image format for images with incorrect formats.
[0088] 5. Check if the length and width of the image are multiples of 4: After compression, images whose length and width are multiples of 4 will be reduced by 75% on average.
[0089] 6. Check the .meta submission of the newly added files: The newly added files must be submitted together with the corresponding .meta files. The function of automatically submitting .meta is also provided.
[0090] 7. Material .mat check: When adding .fbx, avoid missing the newly added .mat. If the submitter misses to submit .mat, it will automatically help to submit .mat.
[0091] 8. Check the m_Name field in the material .mat: The copied .mat only has its name changed and cannot be submitted directly. It must be saved in Unity and the m_Name field must be automatically modified before it can be submitted. Otherwise, the material will not perform properly.
[0092] 9. Prohibit conflicting file submission check: resolve the conflict before submitting.
[0093] 10. Check the impact of file modification on update size: If the submitted file will cause an update size greater than 50 MB, submission will be prohibited! If the submitted file will cause an update size greater than 25 MB and less than 50 MB, a second pop-up window will be displayed to prompt confirmation. In addition, if it is a .cs file, only a second pop-up window will be displayed to prompt the developer to confirm whether there are any serialization-related changes, and submission will not be prohibited.
[0094] 11. GUID global duplication check: GUIDs in .meta are duplicated.
[0095] 12. Check the consistency of .meta files of the trunk and branches: to avoid abnormal performance caused by .meta errors during merging.
[0096] 13. Video format check: The video encoding format must be h264, the frame rate must be 24 frames, and there are also requirements for the bit rate.
[0097] 14. Video size check: Videos under 10 seconds should be smaller than 10M, videos between 10 and 25 seconds should be smaller than 20M, and videos longer than 25 seconds should be smaller than 25M.
[0098] 15. Check that the file path and file name cannot contain Chinese characters: to avoid abnormalities in some tools and functions.
[0099] 16. UTF8-WithoutBOM format check for C# and Lua scripts: C# and Lua scripts have unified encoding formats and must be in UTF8-WithOutBOM format, otherwise they will be automatically changed to UTF8-WithOutBOM format when submitted.
[0100] 17. Code standard check: For example, C# scripts that are not in the Editor directory cannot have usingUnityEditor to avoid packaging errors caused by common misuse of UnityEditor.
[0101] The execution flow chart of the corresponding resource pre-analysis items can be found in Figure 8 .
[0102] For the code compilation error analysis items included in the post-analysis end: the public machine automatically compiles the code. If there is a compilation error, the compilation error is pushed to the submitter through the relevant communication software to prompt the resource to be repaired. For example, see Fig. 9 , which shows a schematic diagram of a code compilation error prompt interface.
[0103] As for the resource analysis tool CommitChecker, the tool is located in the Unity project directory. It has a corresponding registration mechanism and update mechanism. The above-mentioned preset calling function can be specifically a hook. When executing CommitChecker.exe, if no parameter is passed or the parameter passed is "Register", it indicates that SvnHook is registered; if the parameter passed is "Unregister", it indicates that SvnHook is unregistered. Registering SvnHook means turning on the commit check switch; unregistering SvnHook means turning off the commit check switch. The reason for unregistration is that there are very few commits that cannot pass the check of the commit check tool, but these commits have to be submitted, so it is necessary to unregister and turn off the commit check tool before submitting. Of course, you can also manually register and unregister SvnHook. This function has been added to the Tools toolbar of Unity.
[0104] Every time the user starts Unity or the compilation is finished, it will automatically check whether the hook of the project is registered. If it is not registered, it will automatically register SVNHook. It will also check whether the CommitChecker tool is the latest version. If it is not the latest version, it will automatically update the tool directory. This ensures that everyone's submission is checked and everyone's submission check tool is the latest. In addition, if the submitter deliberately deletes the folder where the CommitChecker tool is located, causing the check tool to become invalid, the background will block the submission that has not been pre-checked by the client, and prompt the submitter to update the CommitChecker tool back to the project directory.
[0105] The resource management platform mentioned above can be TortoiseSVN (TortoiseSubversion) or SVN (Subversion, an open source version control system). Taking TortoiseSVN as an example, we can first read the existing key-value pairs of TortoiseSVN from the registry, and then rewrite all the newly added hooks and existing hooks into the registry. The newly added hook refers to the newly created project that needs to add a new hook corresponding to the project; the existing hook refers to the hook corresponding to the original existing project. The key of each key-value pair is a string concatenated by HookType, WorkingCopyPath, and CommandLine, where HookType is the type of the hook. This check is a pre-commit check, so HookType is pre_commit_hook; this field can be the same in each hook; WorkingCopyPath is the project path corresponding to the hook. Since each hook corresponds to a project, the paths of different projects are different, so this field is different in each hook; CommandLine is the path where the CommitChecker tool is located, and this field can be the same in each hook.
[0106] The performance after automatically adding the hook is as follows Fig.10 As shown. Similarly, unregistering a hook is to delete the hook in the registry. Among them, one hook corresponds to a TortoiseSVN key-value pair, and the key-value pair exists in the TortoiseSVN registry of the Windows system. One project corresponds to one hook. There are multiple projects in the terminal, so there will be multiple hooks at the same time.
[0107] After the Hook is successfully registered, when the submitter submits, SVN will execute the check tool CommitChecker.exe and pass parameters. Two of the parameters are critical, which are the paths of two temporary files; examples of temporary file paths:
[0108] C:\Users\UsersA\AppData\Local\Temp\svnD16C.tmp.
[0109] The content of the first temporary file is the submission description of this submission, which can be used to check the submission description specification; the content of the second temporary file is the path of all files submitted this time. With the path of all files submitted this time, the SVN status of each file to be submitted can be queried, such as: add, delete.
[0110] To query the Svn status of a file based on the file path, you need to use svn.exe. You can find the installation directory of TortoiseSVN according to "SOFTWARE\\TortoiseSVN" in the Windows registry, and then find the path where svn.exe is located. However, if the user does not check the commandlineclienttools item when installing TortoiseSVN, there will be no svn.exe in the installation directory of TortoiseSVN, and the SVN command cannot be executed. Therefore, the CommitChecker tool itself also integrates svn.exe to solve this problem. Using Parallel.ForEach to process data in parallel can quickly get the Svn status of each file. By querying the Svn status of the file, you can distinguish which files are newly added, which files are modified, and which files are deleted.
[0111] The implementation process of updating the resource files mentioned above is described below. By automatically building a full bundle, a full log file bundleBuildInfo.log is generated, such as Fig.11 As shown in the figure, the log file records the files referenced by each bundle and the file size information. Fig.11 The information in the text can be used to analyze the update amount caused by each file, such as Fig.12 shown.
[0112] In addition, the resource analysis tool will automatically update the assetsChangeBundleList.log file once a day to ensure the real-time impact of file modifications on bundle size.
[0113] In this way, the resource analysis tool can use the assetsChangeBundleList.log file to check the "impact of file modification on update size". The current check rules are as follows: If the submitted file will cause an update size greater than 50 megabytes, submission is prohibited! If the submitted file will cause an update size greater than 25 megabytes and less than 50 megabytes, a second pop-up window will be displayed to prompt confirmation. In addition, if it is a .cs file, only a second pop-up window will be displayed to prompt the developer to confirm whether there are any serialization-related changes, and submission will not be prohibited.
[0114] The implementation process of the above GUID global duplicate check is explained. Each GUID corresponds to the path where the Unity resource file is located. If it does not correspond, it means that there is a problem with the GUID and you need to open Unity to regenerate a new GUID. There are two ways to determine whether the GUID conflicts:
[0115] The first method is to pass in the GUID of the resource to be submitted. The tool will parse the path and then compare the parsed path with the actual path of the resource to be submitted. If they are consistent, it means that there is no GUID conflict in the file. Otherwise, it means that there is a GUID conflict in the file.
[0116] The second method assumes that the GUID is 3f00c7a036e1d4b47a173fc87e4ce828. Find the file named 3f00c7a036e1d4b47a173fc87e4ce828 in / Library / metadata / under the Unity project directory, that is, / Library / metadata / 3f / 3f00c7a036e1d4b47a173fc87e4ce828, as follows Fig.13 As shown in the figure, the text in the file matches whether the directory where the file corresponding to the GUID is located exists. If it does not exist, it means that the GUID has been used by other files, that is, there is a GUID conflict.
[0117] Therefore, when submitting resources, this application provides a solution for automated resource checking through tools, making the resource checking work more tool-based and process-based, avoiding waste of manpower and possible omissions, making resources more standardized, making developers more efficient, and providing guarantees for the stability of the project.
[0118] This embodiment also provides a resource analysis device, see Fig.14 , the device may include:
[0119] The preset calling function determining module 1410 is used to determine the preset calling function corresponding to the resource to be analyzed when the resource to be analyzed is submitted; the preset calling function includes the first storage path where the resource to be analyzed is located and the second storage path where the resource analysis tool is located;
[0120] A resource analysis tool calling module 1420, configured to call the resource analysis tool under the second storage path based on the preset calling function, and to transfer the first storage path to the resource analysis tool based on the preset calling function;
[0121] The static analysis module 1430 is used to analyze the static characteristics of the resources to be analyzed under the first storage path based on the resource analysis tool to obtain static analysis results of the resources to be analyzed.
[0122] Furthermore, the device also includes:
[0123] A first determining module, used to determine the first storage path where the resource to be analyzed is located, and the second storage path where the resource analysis tool is located;
[0124] A registration module is used to register the preset calling function corresponding to the resource to be analyzed in a resource management platform based on the first storage path and the second storage path.
[0125] Furthermore, the registration module includes:
[0126] A template acquisition module, used to acquire a preset calling function creation template corresponding to the resource to be analyzed;
[0127] An information configuration module, configured to configure the preset calling function creation template based on the first storage path and the second storage path to obtain configured calling function information;
[0128] A generation module is used to generate a preset calling function corresponding to the resource to be analyzed based on the configured calling function information.
[0129] Furthermore, the static feature includes the update amount of the resource file in the resource to be analyzed; the update amount of the resource file is used to represent the sum of the number of bytes of the resource file and the number of bytes of the associated file that references the resource file;
[0130] The static analysis module 1430 includes:
[0131] An update amount acquisition module, used to acquire a target update amount of each resource file in the resource to be analyzed based on the resource analysis tool; the target update amount is obtained based on the number of bytes of each resource file and the reference relationship between the resource files;
[0132] An update amount analysis module, used to analyze the target update amount of each resource file to obtain an update amount analysis result of the resource to be analyzed;
[0133] The second determination module is used to determine the static analysis result based on the update amount analysis result.
[0134] Further, the static feature includes a globally unique identifier;
[0135] The static analysis module 1430 includes:
[0136] A third determination module, configured to determine, based on the resource analysis tool, an existing globally unique identifier corresponding to each resource file in the resource to be analyzed;
[0137] A path resolution module, used to perform path resolution on the existing globally unique identifier to obtain a resolution path corresponding to each resource file;
[0138] A consistency comparison module, used to compare the parsing path corresponding to each resource file with the target path where each resource file is located, to obtain a globally unique identifier analysis result of the resource to be analyzed;
[0139] The fourth determination module is used to determine the static analysis result based on the global unique identifier analysis result.
[0140] Furthermore, the device also includes:
[0141] The resource repair module is used to automatically repair the resource to be analyzed based on the resource analysis tool to obtain a repaired resource when the static analysis result indicates that the resource to be analyzed does not meet the submission target.
[0142] Further, the static features include the encoding format of the resource script;
[0143] The resource repair module includes:
[0144] a format conversion module, configured to convert the encoding format of the resource script into the target format based on the resource analysis tool when the encoding format of the resource script is not the target format;
[0145] The repaired resource determination module is used to obtain the repaired resource based on the resource script in the target format.
[0146] Furthermore, the device also includes:
[0147] A dynamic analysis module, configured to submit the resource to be analyzed to a post-analysis end when the static analysis result indicates that the resource to be analyzed meets the submission target;
[0148] The post-analysis end is used to analyze the dynamic characteristics of the resource to be analyzed to obtain the dynamic analysis results of the resource to be analyzed; the dynamic characteristics are used to characterize the characteristics exhibited by the resource to be analyzed during compilation or operation.
[0149] The device provided in the above embodiment can execute the method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects of executing the method. For technical details not described in detail in the above embodiment, please refer to the method provided in any embodiment of the present application.
[0150] This embodiment further provides a computer-readable storage medium, in which at least one instruction or at least one program is stored. The at least one instruction or at least one program is loaded by a processor and executed as any of the above methods of this embodiment.
[0151] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes any of the methods in the above embodiments.
[0152] Further, Fig.15 A schematic diagram of the hardware structure of a device for implementing the method provided in the embodiment of the present application is shown, and the device may participate in constituting or include the apparatus provided in the embodiment of the present application. Fig.15 As shown, the device 10 may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Fig.15 The structure shown is for illustration only and does not limit the structure of the electronic device. Fig.15 More or fewer components as shown, or with Fig.15 Different configurations are shown.
[0153] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the device 10 (or mobile device). As involved in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0154] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the methods described in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, to implement the above-mentioned player preloading method or player operation method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the device 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0155] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the device 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0156] The display may be, for example, a touch screen liquid crystal display (LCD) that may enable a user to interact with a user interface of device 10 (or mobile device).
[0157] Any of the above methods in this embodiment can be based on Fig.15 The device shown is implemented.
[0158] This specification provides method operation steps as described in the embodiments or flow charts, but more or fewer operation steps may be included based on conventional or non-creative labor. The steps and sequence listed in the embodiments are only one way of executing the sequence of many steps and do not represent the only execution sequence. When the actual system or interrupt product is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, in a parallel processor or multi-threaded processing environment).
[0159] The structure shown in this embodiment is only a partial structure related to the scheme of the present application, and does not constitute a limitation on the device to which the scheme of the present application is applied. The specific device may include more or fewer components than shown, or combine certain components, or have different arrangements of components. It should be understood that the method, device, etc. disclosed in this embodiment can be implemented in other ways. For example, the device embodiment described above is only schematic. For example, the division of the modules is only a division of a logical function. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or unit modules.
[0160] Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the whole or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., various media that can store program codes.
[0161] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0162] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A resource analysis method, characterized in that: include: Determine a first storage path where the resource to be analyzed is located, and a second storage path where the resource analysis tool is located; Based on the first storage path and the second storage path, registering a preset calling function corresponding to the resource to be analyzed in a resource management platform; The registering of the preset calling function corresponding to the resource to be analyzed on the resource management platform comprises: Obtaining a preset calling function creation template corresponding to the resource to be analyzed; Based on the first storage path and the second storage path, configuring the preset calling function creation template to obtain configured calling function information; Based on the configured calling function information, generating a preset calling function corresponding to the resource to be analyzed; When the resource to be analyzed is submitted, a preset calling function corresponding to the resource to be analyzed is determined; the preset calling function includes a first storage path where the resource to be analyzed is located and a second storage path where the resource analysis tool is located; Calling the resource analysis tool under the second storage path based on the preset calling function, and passing the first storage path to the resource analysis tool based on the preset calling function; Based on the resource analysis tool, static characteristics of the resources to be analyzed under the first storage path are analyzed to obtain static analysis results of the resources to be analyzed.
2. The method according to claim 1, characterized in that The static feature includes the update amount of the resource file in the resource to be analyzed; the update amount of the resource file is used to represent the sum of the number of bytes of the resource file and the number of bytes of the associated file that references the resource file; The step of analyzing the static characteristics of the resource to be analyzed under the first storage path based on the resource analysis tool to obtain a static analysis result of the resource to be analyzed includes: Based on the resource analysis tool, a target update amount of each resource file in the resource to be analyzed is obtained; the target update amount is obtained based on the number of bytes of each resource file and the reference relationship between the resource files; Analyze the target update amount of each resource file to obtain an update amount analysis result of the resource to be analyzed; Based on the update amount analysis result, the static analysis result is determined.
3. The method according to claim 1, characterized in that: The static features include a globally unique identifier; The step of analyzing the static characteristics of the resource to be analyzed under the first storage path based on the resource analysis tool to obtain a static analysis result of the resource to be analyzed includes: Determine, based on the resource analysis tool, an existing globally unique identifier corresponding to each resource file in the resource to be analyzed; Performing path resolution on the existing globally unique identifier to obtain resolution paths corresponding to the resource files; Comparing the parsing paths corresponding to the resource files with the target paths where the resource files are located for consistency, to obtain a globally unique identifier analysis result for the resource to be analyzed; Based on the globally unique identifier analysis result, the static analysis result is determined.
4. The method according to claim 1, characterized in that: The method further comprises: When the static analysis result indicates that the resource to be analyzed does not meet the submission target, the resource to be analyzed is automatically repaired based on the resource analysis tool to obtain a repaired resource.
5. The method according to claim 4, characterized in that The static features include the encoding format of the resource script; When the static analysis result indicates that the resource to be analyzed does not meet the submission target, automatically repairing the resource to be analyzed based on the resource analysis tool to obtain the repaired resource includes: When the encoding format of the resource script is not the target format, converting the encoding format of the resource script into the target format based on the resource analysis tool; The repaired resource is obtained based on the resource script in the target format.
6. The method according to claim 1, characterized in that The method further comprises: When the static analysis result indicates that the resource to be analyzed meets the submission target, submitting the resource to be analyzed to the post-analysis end; The post-analysis end is used to analyze the dynamic characteristics of the resource to be analyzed to obtain the dynamic analysis results of the resource to be analyzed; the dynamic characteristics are used to characterize the characteristics exhibited by the resource to be analyzed during compilation or operation.
7. A resource analysis device, characterized in that: include: A first determination module, used to determine a first storage path where the resource to be analyzed is located, and a second storage path where the resource analysis tool is located; A registration module, configured to register a preset calling function corresponding to the resource to be analyzed in a resource management platform based on the first storage path and the second storage path; The registration module includes: A template acquisition module, used to acquire a preset calling function creation template corresponding to the resource to be analyzed; An information configuration module, configured to configure the preset calling function creation template based on the first storage path and the second storage path to obtain configured calling function information; A generating module, configured to generate a preset calling function corresponding to the resource to be analyzed based on the configured calling function information; A preset calling function determination module, used to determine a preset calling function corresponding to the resource to be analyzed when the resource to be analyzed is submitted; the preset calling function includes a first storage path where the resource to be analyzed is located and a second storage path where the resource analysis tool is located; A resource analysis tool calling module, configured to call the resource analysis tool under the second storage path based on the preset calling function, and to transfer the first storage path to the resource analysis tool based on the preset calling function; The static analysis module is used to analyze the static characteristics of the resources to be analyzed under the first storage path based on the resource analysis tool to obtain static analysis results of the resources to be analyzed.
8. The device according to claim 7, characterized in that The static feature includes the update amount of the resource file in the resource to be analyzed; the update amount of the resource file is used to represent the sum of the number of bytes of the resource file and the number of bytes of the associated file that references the resource file; The static analysis module includes: An update amount acquisition module, used to acquire a target update amount of each resource file in the resource to be analyzed based on the resource analysis tool; the target update amount is obtained based on the number of bytes of each resource file and the reference relationship between the resource files; An update amount analysis module, used to analyze the target update amount of each resource file to obtain an update amount analysis result of the resource to be analyzed; The second determination module is used to determine the static analysis result based on the update amount analysis result.
9. The device according to claim 7, characterized in that The static features include a globally unique identifier; The static analysis module includes: A third determination module, configured to determine, based on the resource analysis tool, an existing globally unique identifier corresponding to each resource file in the resource to be analyzed; A path resolution module, used to perform path resolution on the existing globally unique identifier to obtain a resolution path corresponding to each resource file; A consistency comparison module, used to compare the parsing path corresponding to each resource file with the target path where each resource file is located, to obtain a globally unique identifier analysis result of the resource to be analyzed; The fourth determination module is used to determine the static analysis result based on the global unique identifier analysis result.
10. The device according to claim 7, characterized in that The device also includes: The resource repair module is used to automatically repair the resource to be analyzed based on the resource analysis tool to obtain a repaired resource when the static analysis result indicates that the resource to be analyzed does not meet the submission target.
11. The device according to claim 10, characterized in that The static features include the encoding format of the resource script; The resource repair module includes: a format conversion module, configured to convert the encoding format of the resource script into the target format based on the resource analysis tool when the encoding format of the resource script is not the target format; The repaired resource determination module is used to obtain the repaired resource based on the resource script in the target format.
12. The device according to claim 7, characterized in that The device also includes: A dynamic analysis module, configured to submit the resource to be analyzed to a post-analysis end when the static analysis result indicates that the resource to be analyzed meets the submission target; The post-analysis end is used to analyze the dynamic characteristics of the resource to be analyzed to obtain the dynamic analysis results of the resource to be analyzed; the dynamic characteristics are used to characterize the characteristics exhibited by the resource to be analyzed during compilation or operation.
13. An electronic device, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the resource analysis method as described in any one of claims 1 to 6.
14. A computer storage medium, characterized in that: The storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded by the processor and executed by the resource analysis method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Resource acquisition method, apparatus and device, and storage medium
CN111552666A
Distributed processing system and computer readable recording medium recording distributed processing program
JP1999265359A