A method and device for monitoring installation package volume based on pipeline
By selecting the installation package with the highest priority in the pipeline for analysis, decompression, classification and statistics of files, and generating reports, the problem of low efficiency in installation package volume monitoring in the existing technology is solved, and efficient and flexible volume monitoring is achieved.
Patent Information
- Application Number
- CN202411632156.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2044-11-15
AI Technical Summary
The existing technology is inefficient in monitoring the volume of application installation packages and cannot flexibly grasp the reasons for volume changes, resulting in poor monitoring efficiency and flexibility.
The package size analysis is performed by selecting the highest priority installation package in the pipeline, decompressing the file list, classifying the files, determining the file format and size, generating an analysis report, and aggregating statistical package size data to show trends and changes.
It achieves efficient monitoring of the installation package volume, can understand the reasons and trends of volume growth and reduction, and improves the flexibility and efficiency of monitoring.
Smart Images

Figure CN119576692B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer development technology, and more specifically, to a pipeline-based installation package volume monitoring method and device. Background Art
[0002] Currently, the installation package of a mobile application (Application, APP) is an important part of the mobile phone's memory. The larger the installation package, the more mobile phone memory it occupies, and it will consume more data when downloading. It will also affect the running stability of the APP to a certain extent. Therefore, it is necessary to monitor the size of the APP installation package during the development process.
[0003] When monitoring the size of app installation packages, if a large number of temporary installation packages are generated, the size of all temporary installation packages must be monitored individually. Furthermore, this monitoring only monitors the size of the installation packages, but does not reveal the reasons for changes in the size of the installation packages. This results in poor efficiency and flexibility in monitoring the size of the installation packages.
[0004] Therefore, how to monitor the volume of the installation package in a flexible and efficient manner is an urgent problem to be solved in this application. Summary of the Invention
[0005] In view of this, the present application discloses a pipeline-based installation package volume monitoring method and device, which aims to realize package volume analysis of the target installation package in the machine where the target pipeline is executed, and can obtain the package volume growth, growth reasons, reduction reasons, growth trends, reduction trends, etc., so as to realize the monitoring of the installation package volume in a flexible and efficient manner.
[0006] In order to achieve the above purpose, the disclosed technical solutions are as follows:
[0007] In a first aspect, the present application discloses a pipeline-based installation package volume monitoring method, the method comprising:
[0008] During the process of running the target pipeline with volume analysis, selecting a target installation package produced by building the target pipeline; wherein the target installation package is the installation package with the highest priority;
[0009] Sending the target installation package to the machine where the target pipeline is executed;
[0010] Performing a package volume analysis on the target installation package in the machine to obtain an analysis report;
[0011] Obtaining volume data of each package in the analysis report;
[0012] Aggregate and count the volume data of each package to obtain the change data and package volume trend;
[0013] When a query instruction is received, the package volume change data and the package volume trend are queried and displayed according to the query instruction.
[0014] Preferably, during the process of running the target pipeline with volume analysis, selecting and constructing the target installation package produced by the target pipeline includes:
[0015] During the process of running the target pipeline with volume analysis, if there is a package analysis node in the target pipeline, a target installation package with the highest priority is selected from multiple installation packages generated by building the target pipeline.
[0016] Preferably, performing package volume analysis on the target installation package in the machine to obtain an analysis report includes:
[0017] Decompressing the target installation package in the machine to obtain a decompressed file list;
[0018] Traverse all files in the decompressed file list to obtain the suffix type of each file;
[0019] Classify all files in the file list according to the suffix type of each file to obtain the classified files;
[0020] Aggregate the classified files according to the preset aggregation method, and write the aggregated files into the corresponding data list;
[0021] For each file written into the corresponding data list after aggregation, determine the format of the file and whether the file meets the file standard;
[0022] If the file format is a picture format, determine whether the file is compressed, and calculate the unique identification codes of all pictures corresponding to the picture format;
[0023] If the file is compressed, the compressed pictures are stored in the compressed picture list until all compressed pictures in the aggregated files are written into the corresponding data list are stored in the compressed picture list;
[0024] Add all images with the same unique identification code to the same category, and output a list of duplicate images according to the same category;
[0025] If the file size of the file is larger than a preset threshold, it is determined that the file meets the file standard, and the file meeting the file standard is written into the large file data list;
[0026] Generate a compilation file list, an unused class check list, and an unused method check list based on the link map file of the target installation package;
[0027] An analysis report is obtained according to the duplicate picture list, the corresponding data list, the large file data list, the compressed picture list, the compiled file list, the unused class check list, and the unused method check list.
[0028] Preferably, obtaining the volume data of each package in the analysis report includes:
[0029] Downloading the analysis report stored in the file storage service to the corresponding aggregation machine environment;
[0030] In an aggregated machine environment, each package volume data in the analysis report is extracted through the pipeline corresponding to the package volume analysis report; wherein, each package volume data includes at least the total package volume size, version, build time, build ID and preset variables; the preset variables store a preset number of file entries that meet the preset task type.
[0031] Preferably, the aggregating and statistically analyzing the volume data of each packet to obtain the packet volume change data and the packet volume trend includes:
[0032] Aggregate and count the volume data of each package to determine whether there is a change in the volume of each package at different time points or between versions, and obtain statistical indicators for each package; wherein the statistical indicators include at least the average volume, median volume, maximum volume, and minimum volume;
[0033] If there is a change in the package size of each package at different time points, or a change in the package size between versions, obtain the package size change data;
[0034] Determine package volume trends based on statistical metrics for each package.
[0035] Preferably, when a query instruction is received, querying and displaying the package volume change data and the package volume trend according to the query instruction includes:
[0036] When a query instruction is received, the query instruction is parsed to obtain a query dimension of the query instruction; wherein the query dimension includes at least a version dimension, a time dimension and / or a build dimension;
[0037] The package volume change data and package volume trend are queried and displayed according to the query dimension.
[0038] Preferably, it also includes:
[0039] Through the analysis report, the package volume and content distribution are queried.
[0040] A second aspect of the present application discloses a pipeline-based installation package volume monitoring device, the device comprising:
[0041] A selection unit is configured to select, during the process of running a target pipeline with volume analysis, a target installation package produced by building the target pipeline; wherein the target installation package is the installation package with the highest priority;
[0042] A sending unit, configured to send the target installation package to a machine where the target pipeline is executed;
[0043] an analysis unit, configured to perform a package volume analysis on the target installation package in the machine to obtain an analysis report;
[0044] an acquiring unit, configured to acquire volume data of each package in the analysis report;
[0045] Aggregation statistics unit, used to aggregate and count the volume data of each package to obtain the change data and package volume trend;
[0046] The query and display unit is used to query and display the package volume change data and package volume trend according to the query instruction when a query instruction is received.
[0047] Preferably, the selection unit is specifically used to:
[0048] During the process of running the target pipeline with volume analysis, if there is a package analysis node in the target pipeline, a target installation package with the highest priority is selected from multiple installation packages generated by building the target pipeline.
[0049] Preferably, the analysis unit comprises:
[0050] A decompression module, configured to decompress the target installation package in the machine to obtain a decompressed file list;
[0051] The traversal module is used to traverse all files in the decompressed file list to obtain the suffix type of each file;
[0052] A classification module, configured to classify all files in the file list according to the suffix type of each file to obtain the classified files;
[0053] An aggregation module is used to aggregate the classified files according to a preset aggregation method and write the aggregated files into a corresponding data list;
[0054] A first judgment module is used to judge the format of each file written into the corresponding data list after aggregation, and to judge whether the file meets the file standard;
[0055] A second determination module is configured to determine, if the file format is a picture format, whether the file is compressed, and calculate unique identification codes for all pictures corresponding to the picture format;
[0056] a storage module, configured to store the compressed pictures in a compressed picture list if the file is compressed, until all compressed pictures in the corresponding data list of the aggregated files are written into the compressed picture list;
[0057] The output module is used to add all images with the same unique identification code to the same category and output a list of duplicate images according to the same category;
[0058] a first determining module, configured to determine that the file meets the file standard if the file size of the file is greater than a preset threshold, and write the file meeting the file standard into a large file data list;
[0059] A generation module is used to generate a compilation file list, an unused class check list and an unused method check list according to the link map file of the target installation package;
[0060] The first acquisition module is used to obtain an analysis report according to the duplicate image list, the corresponding data list, the large file data list, the compressed image list, the compiled file list, the unused class check list and the unused method check list.
[0061] It can be seen from the above technical solution that the present application discloses a pipeline-based installation package volume monitoring method and device. In the process of running a target pipeline with volume analysis, the target installation package produced by the target pipeline is selected, wherein the target installation package is the installation package with the highest priority. The target installation package is sent to the machine where the target pipeline is executed, and the package volume analysis is performed on the target installation package in the machine to obtain an analysis report. The volume data of each package in the analysis report is obtained, and the volume data of each package is aggregated and counted to obtain the package volume change data and package volume trend. When a query instruction is received, the package volume change data and package volume trend are queried and displayed according to the query instruction.
[0062] Through the above solution, a large number of temporary installation packages will be generated during the application development process. However, this solution does not need to monitor the volume of all temporary installation packages one by one. Instead, it only needs to select the target installation package produced by building the target pipeline, send the target installation package to the machine where the target pipeline is executed, and perform a package volume analysis on the target installation package on the machine to obtain an analysis report, thereby improving the efficiency of installation package volume monitoring. In addition, by performing a package volume analysis on the machine where the target pipeline is executed, it is possible to obtain the package volume growth, reasons for growth, reasons for reduction, growth trend, reduction trend, etc., thereby enabling flexible and efficient monitoring of installation package volume. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0064] Figure 1 A flow chart of a pipeline-based installation package volume monitoring method disclosed in an embodiment of the present application;
[0065] Figure 2 A schematic diagram of configuring and enabling packet analysis in a build pipeline disclosed in an embodiment of the present application;
[0066] Figure 3 This is a schematic diagram of comparing file differences within a package volume disclosed in an embodiment of the present application;
[0067] Figure 4 This is a schematic diagram of the volume floating trend disclosed in the embodiments of this application;
[0068] Figure 5 This is a schematic diagram of the ipa layer parsing disclosed in the embodiments of this application;
[0069] Figure 6 This is a schematic diagram of the linkmap layer parsing disclosed in the embodiments of this application;
[0070] Figure 7 A schematic diagram of obtaining an analysis report disclosed in an embodiment of the present application;
[0071] Figure 8 A schematic diagram showing that the analysis report disclosed in the embodiment of the present application is divided into several subtasks;
[0072] Figure 9 This is a schematic diagram of package volume data disclosed in an embodiment of the present application;
[0073] Figure 10 A schematic flow chart of another pipeline-based installation package volume monitoring method disclosed in an embodiment of the present application;
[0074] Figure 11 This is a schematic structural diagram of a pipeline-based installation package volume monitoring device disclosed in an embodiment of the present application;
[0075] Figure 12 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0076] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0077] In this application, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0078] As can be seen from the background technology, in the existing process of monitoring the volume of APP installation packages, if a large number of temporary installation packages are generated, the volumes of all temporary installation packages need to be monitored one by one. In addition, in the existing process of monitoring the volume of installation packages, only the size of the installation packages can be monitored, and the reasons for the changes in the volume of the installation packages cannot be known, resulting in poor efficiency and flexibility in monitoring the volume of installation packages. Therefore, how to achieve monitoring of the volume of installation packages in a flexible and efficient manner is a problem that needs to be solved in this application.
[0079] In order to solve the above problems, the present application discloses a method and device for monitoring the volume of an installation package based on an assembly line. During the application development process, a large number of temporary installation packages will be generated. However, this solution does not need to monitor the volume of all temporary installation packages one by one. It only needs to select the target installation package produced by the target assembly line, send the target installation package to the machine where the target assembly line is executed, and perform a package volume analysis on the target installation package in the machine to obtain an analysis report, thereby improving the efficiency of monitoring the volume of the installation package. In addition, by performing a package volume analysis on the target installation package in the machine where the target assembly line is executed, the growth of the package volume, the reason for the growth, the reason for the reduction, the growth trend, the reduction trend, etc. can be obtained, so that the volume of the installation package can be monitored in a flexible and efficient manner. The specific implementation method is specifically described through the following embodiments.
[0080] refer to Figure 1 FIG. 1 is a flow chart of a pipeline-based installation package volume monitoring method disclosed in an embodiment of the present application. The pipeline-based installation package volume monitoring method mainly includes the following steps:
[0081] S101: During the operation of a target pipeline with volume analysis, a target installation package generated by the target pipeline is selected; wherein the target installation package is the installation package with the highest priority.
[0082] In S101 , during the process of running a target pipeline with volume analysis, if a package analysis node exists in the target pipeline, a target installation package with the highest priority is selected from multiple installation packages generated by building the target pipeline.
[0083] It should be noted that the target pipeline is the pipeline corresponding to the Jenkinsfile configuration in which the user has enabled package size analysis. In a CI / CD platform, there are usually multiple pipelines corresponding to different Jenkinsfiles. Different pipelines will produce installation packages with different functions. Package size analysis will only be performed on the pipeline that has enabled package size analysis in the Jenkinsfile configuration.
[0084] Use the target pipeline to perform packet size analysis. You can configure whether to enable packet size analysis based on the type of packet being printed.
[0085] Configure whether to enable package size analysis based on the pipeline dimension. Because different pipelines generally produce different package types, such as test packages, regression packages, release packages, and debug packages, you can usually choose to enable package size analysis for release packages.
[0086] Execute the target pipeline to construct the target pipeline. During the operation of the target pipeline with volume analysis, if the target pipeline does not contain the configured packet analysis node, the process is terminated. If the target pipeline contains the configured packet analysis node, execute the following S102.
[0087] For example, when the target pipeline contains the following node snippet, packet analysis is performed.
[0088] stage('package analysis'){
[0089] agent{
[0090] node{
[0091] label'base'
[0092] }
[0093] }
[0094] steps{
[0095] PackageAnalysis()
[0096] }
[0097] }.
[0098] After a pipeline build node is completed, multiple installation packages may be generated. Priority rules are used to select the target installation package with the highest priority for analysis. Priority rules refer to the fact that a single build may produce multiple installation packages, such as ad-hoc packages or appstore packages. However, when analyzing installation packages, only one of these packages is typically selected. In this case, each package is marked by priority, and the one with the highest priority is selected for analysis.
[0099] For example, during the pipeline build process, debug, ad-hoc, and app-store installation packages may be generated. In this case, only the app-store installation package is selected for analysis based on the priority rules, and other types of packages are not included in the subsequent process. For example, if the app-store package has a priority of 2 and the adhoc package has a priority of 1, the app-store package is selected as the target installation package.
[0100] Configure the package analysis step in the build pipeline. You can add it in the following two ways:
[0101] 1. Add by editing the Jenkinsfile file:
[0102] 1. Edit the Jenkinsfile file;
[0103] 2. Insert a function call PackageAnalysis() after the normal Jenkins build step, for example:
[0104] steps{
[0105] iosBuild(...args)
[0106] PackageAnalysis()
[0107] };
[0108] 3. Save the jenkinsfile file.
[0109] 2. Add through platform visualization:
[0110] 1. Use the continuous integration (CI) / continuous deployment (CD) visualization tool (jenkins) to add a stage and then select a PackageAnalysis step, such as Figure 2 As shown, Figure 2 A schematic diagram showing how to configure and enable package analysis in a build pipeline.
[0111] Figure 2 , the configuration to enable package analysis in the build pipeline includes building, specifying containers, downloading code, Android building, adding steps, adding parallel stages, package size analysis, PackageAnalysis, etc.
[0112] S102: Send the target installation package to the machine where the target pipeline is executed;
[0113] In S102, the target installation package is sent to the machine where the target pipeline is executed through the package analysis module.
[0114] Packet analysis module execution steps:
[0115] 1. Download the target installation package from the file storage service to the machine where the pipeline is executed.
[0116] 2. Decompress the target installation package on the machine where the pipeline is executed to obtain the decompressed file list.
[0117] 3. Traverse the framework folder, get the size of each module, and output the module size list;
[0118] 4. Traverse the list of decompressed files and perform subsequent steps during the traversal;
[0119] 5. Get the suffix of each file, classify the files, and output the classified file list and their sizes;
[0120] 6. Get the file size and output the top 100 files in size as a list;
[0121] 7. Determine the file format. If it is an image format, determine whether the image has been compressed. If it has been compressed, add the image to the compressed image list and finally output the compressed image list;
[0122] 8. Determine the file format. If it is an image format, calculate the image MD5. If the MD5 is the same, add the image paths with the same MD5 value to the same category and output a list of duplicate images. If there is no image with the same MD5, do not add it to any category and do not need to output this image path.
[0123] 9. Generate a compilation file list, unused class check list, unused method check list, etc. based on the linkmap file.
[0124] The linkmap file generated by Xcode records the various components of the iOS package, including all classes, methods, and variables. By analyzing this file, you can determine the size of each module in the package. The linkmap is a text file generated during compilation and linking that records the space occupied by each method in the current binary architecture. By analyzing the linkmap, you can calculate the installation package space occupied by each class and even each method.
[0125] S103: Performing a package volume analysis on the target installation package in the machine to obtain an analysis report.
[0126] Perform a package size analysis on the target installation package on the machine where the target pipeline is executed to generate an analysis report. The package size analysis includes at least multi-dimensional comparison, file difference comparison within the package, trend monitoring, and pipeline execution monitoring.
[0127] Perform package volume analysis on the installation package. This process will first decompress the installation package, count the sizes of various files after decompression, and calculate their MD5 and volume percentage. Output for each subtask to form a report. The data aggregation service extracts key information from the analysis report (such as the size of each file, MD5, volume fluctuation, etc.) to form package volume trend statistics. Based on the package volume statistics, query by dimension to view trends, volume floating trends and other monitoring operations. Based on the package volume analysis report, view the package volume component distribution, MD5, volume percentage, and the analysis module outputs for each subtask to form a report. After the report is generated, it needs to be uploaded to the file storage service for archiving so that subsequent tasks can read the package analysis report. Package volume factors such as large file analysis are viewed.
[0128] Perform volume analysis on the APP build running on the pipeline, supporting comparison by version, by build (build refers to the process of producing one or more installation packages each time the pipeline is triggered in the CI / CD pipeline. In fact, each installation package will have a corresponding build), by multiple dimensions, file differences within the package volume, etc., and support viewing of volume distribution details. Multi-dimensional comparison: Store the APP volume analysis information in the database, and support volume differences by version dimension, by time dimension, and by build dimension through query. Among them, the build dimension refers to the build number. The same version may have multiple builds and multiple build numbers. In fact, comparing the volume differences by build can more specifically correspond to the developer's work changes.
[0129] Comparison of file differences within the package size: After decompressing the installation package, you can compare the file differences after decompressing the package without building it. This can help you find the specific reasons for the increase or decrease in package size. Figure 3 shown.
[0130] Figure 3 In the .so, dex, .png, .webp, and .xml files, these are all file formats. These files are the files after the installation package is decompressed and are an important means of analyzing the package size.
[0131] Comparing the growth difference of APP volume is often not just comparing with the last compilation result. In fact, the same version will produce multiple installation packages, and the differences between the installation packages of the same version are relatively small. In fact, comparing the installation packages by date and by different versions is also an important dimension.
[0132] By analyzing the many factors that affect package size, users can quickly attribute changes in package size.
[0133] Trend monitoring: aggregate the package volumes analyzed from different builds into volume trends, view the volume increase and decrease trends, and view the volume floating trends. Specific volume floating trends are as follows: Figure 4 shown.
[0134] Figure 4 In the figure, the horizontal axis represents the version and the vertical axis represents the size.
[0135] Pipeline execution monitoring: The pipeline can decide whether to perform package volume analysis as needed.
[0136] As can be seen above, by analyzing the pipeline package task and combining it with the method used in this solution, we can obtain the growth of the package size, the reasons for the growth, and the trend, and monitor the installation package volume in a flexible and efficient manner.
[0137] The specific process of obtaining the analysis report is as follows: A1-A11 and Figure 7 shown.
[0138] A1: Decompress the target installation package on the machine to obtain a list of decompressed files.
[0139] For example, you can download the ipa installation package through the link, decompress the ipa installation package, and analyze the ipa installation package. Figure 5 shown.
[0140] Figure 5 In the analysis of ipa package, the task classification includes uncompressed file checking, large file checking, finding duplicate files, volume distribution, etc.
[0141] IPA package analysis task classification is divided into Figure 5 Analysis of the ipa layer and Figure 6 Parsing of the linkmap layer in .
[0142] Figure 6 In the linkmap layer analysis, unused method detection, unused class detection, unused resource detection, compiled file list, etc.
[0143] A2: Traverse all files in the decompressed file list to obtain the suffix type of each file.
[0144] In A2, the framework folder is traversed, the size (volume) of each module in the framework folder is analyzed and obtained, and each module size is output to the module size list.
[0145] Traverse the decompressed files, obtain the size and MD5 data of each file, and write the installation file format into the file list.
[0146] A3: Classify all files in the file list according to the suffix type of each file to obtain the classified files.
[0147] In A3, files are categorized by type. You only need to aggregate files based on the category. Common file types include car, dylib, and files without suffixes.
[0148] A4: Aggregate the categorized files according to a preset aggregation method, and write the aggregated files into the corresponding data list.
[0149] A5: For each file written into the corresponding data list after aggregation, determine the file format and whether the file meets the file standard.
[0150] Among them, the linkmapAnalyzer tool is used to analyze the compiled file size. The compiled file can usually determine the size of each class. Important data such as the class size can be analyzed and written into the compiled file size list.
[0151] The linkmapAnalyzer tool analyzes compiled files, including unused method checks, unused class detection, unused resource checks, compiled file lists, etc.
[0152] For each file written into the corresponding data list after aggregation, the files exceeding the preset threshold are counted and written into the large file list in the order of large to small or small to large.
[0153] The preset threshold is set according to the actual situation and is not specifically limited in this application.
[0154] According to the preset threshold of the file (read before decompression) in the configuration, the decompressed file is then traversed. If the file size is greater than the preset threshold of the configuration, it is considered a large file.
[0155] A6: If the file format is an image, determine whether the file is compressed and calculate the unique identification code (MD5) of all images corresponding to the image format.
[0156] Among them, whether there are duplicate files (pictures) is confirmed according to MD5, and the duplicate files (pictures) are written into the duplicate file list.
[0157] Determine whether the file format image format is a compressed file format. If not, write it to the uncompressed image list.
[0158] A7: If the file is compressed, the compressed images are stored in the compressed image list until all compressed images in the aggregated files are written into the corresponding data list.
[0159] It should be noted that whether a file is compressed is determined based on the file format. For example, the image file format webp usually has a higher compression ratio than the image file format jpeg.
[0160] A8: Add all images with the same MD5 to the same category and output a list of duplicate images in the same category.
[0161] A9: If the file size of the file is larger than a preset threshold, it is determined that the file meets the file standard, and the file meeting the file standard is written into the large file data list.
[0162] A10: Generate a compilation file list, an unused class check list, and an unused method check list based on the link map file (linkmap file) of the target installation package.
[0163] The linkmap file generated by Xcode records the various components of the iOS package, including all classes, methods, and variables. By analyzing this file, you can determine the size of each module in the package. The linkmap is a text file generated during compilation and linking that records the space occupied by each method in the current binary architecture. By analyzing the linkmap, you can calculate the installation package space occupied by each class and even each method.
[0164] A11: Get an analysis report based on the duplicate image list, corresponding data list, large file data list, compressed image list, compiled file list, unused class check list, and unused method check list. The analysis report is as follows: Figure 7 shown.
[0165] Figure 7 , download the ipa file;
[0166] Unzip the ipa file;
[0167] Traverse the framework folder to get the size of each module;
[0168] Traverse all files under the ipa file to obtain file size, MD5 information, etc., classify all files, and write the classified file data into their corresponding data lists;
[0169] Determine whether the classified documents meet the document standards;
[0170] If the size of the classified file is greater than a preset threshold, it is determined that the file corresponding to the file greater than the preset threshold meets the file standard;
[0171] Write files that meet the file standards into the large file data list;
[0172] If the current file is an image, and there is a unique identification code (MD5) of a duplicate image in the image, write the image into the duplicate image list;
[0173] If the current file is a picture, and there is no MD5 of a duplicate picture in the picture, and the picture is compressed, write the picture into the compressed picture list;
[0174] The classified file data is written into the corresponding data list, large file data list, duplicate image list, and compressed image list to obtain an analysis report.
[0175] Generate a package analysis report based on a list of all outputs:
[0176] For example:
[0177]
[0178]
[0179]
[0180]
[0181] The analysis report is the result of classification and organization based on the output list.
[0182] You can also query the package volume content distribution through the analysis report. Among them, the package volume content distribution is the package volume comparison. Figure 3 The content in.
[0183] The analysis report can be divided into several subtasks. Each subtask corresponds to an output result, and each result contains the following fields: task type, task description, task ID, content. Task ID is the only field that distinguishes different tasks. Figure 8 shown. Figure 8 A schematic diagram showing the division of an analysis report into several subtasks is shown.
[0184] It should be noted that the purpose of dividing subtasks is to expand functions. Each functional step above is a subtask, such as file list, large file list, compiled file size, etc.
[0185] S104: Obtain volume data of each package in the analysis report.
[0186] In S104, the analysis report stored in the file storage service is downloaded to the corresponding aggregation machine environment through the data aggregation module. In the aggregation machine environment, the volume data of each package in the analysis report is extracted through the pipeline corresponding to the package volume analysis report.
[0187] Each package size data item includes at least the total package size, version, build time, build ID, and a preset variable (variable A). The preset variable stores a preset number of file entries that match a preset task type. For example, in the machine environment where the aggregation module resides, a preset number (e.g., the first 10) of entries with a total-size value in the entries field that match a preset task type (e.g., a task type with taskType set to 1) are extracted and stored in variable A.
[0188] Specific package volume data such as Figure 9 shown.
[0189] The data aggregation module executes the following steps:
[0190] 1. Download the package volume analysis report stored in the file storage service to the machine environment where the aggregation module is located;
[0191] 2. In the machine environment where the aggregation module is located, extract the top 10 entries of the total-size in the entries field of the task type with taskType set to 1 and store them in variable A;
[0192] It should be noted that taskType is the task type; entries is a list of file types; and total-size is the total size of files of this type.
[0193] TaskType 1 is a subtask in packet analysis that counts the size of all files. It traverses the decompressed files, obtains the size and MD5 data of each file, and writes them into a file list according to the file format.
[0194] 3. Add the first 10 entries of the total-size in the entries field of the task type with taskType 1 to variable A, pull the pipeline corresponding to the package size analysis report, obtain the current package total size, version, build time, build ID and other build information, and insert the total package size, version, build time, build ID, and variable A into the database as a record;
[0195] 4. Provides interfaces for querying package size analysis in different dimensions, including querying by version, by time, and by build dimension, and comparing the upward and downward trends of files within the package size under these dimensions;
[0196] For example, this interface returns data in the following format:
[0197]
[0198]
[0199] Through the above data, we can compare the package size increase and decrease trends of the two version dimensions, as well as the increase and decrease trends of the files within the package size and other multi-dimensional information.
[0200] The analysis module and data aggregation module are used to implement multi-dimensional package size queries, including by version, by time, and by build. The difference in internal file size of the package volume between any two builds (versions) can be queried, and the historical fluctuation trend of the Android application package (APK) volume can be queried.
[0201] S105: Aggregate and count the volume data of each package to obtain the package volume change data and package volume trend.
[0202] Among them, the package volume trend includes volume increase and decrease trend, volume floating trend, etc.
[0203] The specific process of aggregating and statistically analyzing the volume data of each package to obtain the package volume change data and package volume trend is shown in B1-B3.
[0204] B1: Aggregate and count the volume data of each package to determine whether there is a change in package volume between different time points or versions of each package, and obtain statistical indicators for each package; where the statistical indicators include at least the average volume, median volume, maximum volume, and minimum volume.
[0205] B2: If there is a change in package size at different time points for each package, or a change in package size between versions, obtain the package size change data.
[0206] B3: Determine the package volume trend based on the statistical indicators of each package.
[0207] S106: When a query instruction is received, query and display the package volume change data and package volume trend according to the query instruction.
[0208] Specifically, when a query instruction is received, the process of querying and displaying the package volume change data and the package volume trend according to the query instruction is shown in C1-C2.
[0209] C1: When a query instruction is received, the query instruction is parsed to obtain a query dimension of the query instruction; wherein the query dimension includes at least a version dimension, a time dimension and / or a build dimension.
[0210] C2: Query and display package volume change data and package volume trends based on the query dimension.
[0211] Provides interfaces for querying package size analysis in different dimensions, including queries by version, time, and build dimensions, and can compare the upward and downward trends of files within the package size under these dimensions.
[0212] In order to facilitate the understanding of the process of pipeline-based installation package volume monitoring, combined with Figure 10 To explain:
[0213] Figure 10 , start running the pipeline with volume analysis;
[0214] Build a pipeline and select the target installation package that has been produced as the input for the next step based on the priority level;
[0215] Perform package size analysis on the target installation package through the analysis module;
[0216] Output the analysis report after package volume analysis, and query the package volume content distribution through the analysis report;
[0217] The data aggregation module obtains multiple package volume data in the analysis report, aggregates and statistics the multiple package volume data, and obtains the package volume change data and package volume trend;
[0218] The query module displays the package volume change data and package volume trends according to different dimensions.
[0219] The advantages of this application are as follows:
[0220] Flexibility: This application can query the package size difference between any two builds by querying the conditions;
[0221] Visualization: This application can clearly see the version fluctuation and size trend through the visualization module, and the internal difference of package volume can be seen in the trend;
[0222] Package size multi-factor analysis: This application allows you to quickly query the many factors that affect package size, including duplicate images, large files, unused class methods, etc.
[0223] This application's pipeline-based installation package volume monitoring method is applied to iOS package volume monitoring. The following package volume refers to the installation package volume of iOS applications. It mainly solves the problem that the APP volume becomes more and more bloated as the business iterates during the APP development process. This application efficiently, conveniently, and multi-dimensionally compares the APP volume growth and analyzes the APP volume components.
[0224] In the embodiment of the present application, a large number of temporary installation packages are generated during the application development process. However, this solution does not require monitoring the volume of all temporary installation packages one by one. Instead, it only requires selecting the target installation package produced by the target pipeline, sending the target installation package to the machine where the target pipeline is executed, and performing a package volume analysis on the target installation package on the machine to obtain an analysis report, thereby improving the efficiency of monitoring the installation package volume. Furthermore, by performing a package volume analysis on the target installation package on the machine where the target pipeline is executed, information such as package volume growth, reasons for growth, reasons for reduction, growth trends, and reduction trends can be obtained, thereby enabling flexible and efficient monitoring of the installation package volume.
[0225] Based on the above embodiment Figure 1 The disclosed method for monitoring the volume of an installation package based on an assembly line is also disclosed in the embodiment of the present application. The disclosed method for monitoring the volume of an installation package based on an assembly line is also disclosed in the embodiment of the present application. Figure 11 As shown, the pipeline-based installation package volume monitoring device includes:
[0226] The selection unit 1101 is configured to select a target installation package generated by the target pipeline during the operation of the target pipeline with volume analysis; wherein the target installation package is the installation package with the highest priority;
[0227] The sending unit 1102 is used to send the target installation package to the machine where the target pipeline is executed;
[0228] An analysis unit 1103 is configured to perform a package volume analysis on the target installation package in the machine to obtain an analysis report;
[0229] The acquisition unit 1104 is used to obtain the volume data of each package in the analysis report;
[0230] Aggregation statistics unit 1105, used to aggregate and count the volume data of each packet to obtain the packet volume change data and packet volume trend;
[0231] The query and display unit 1106 is used to query and display the packet volume change data and packet volume trend according to the query instruction when a query instruction is received.
[0232] Furthermore, the selection unit 1101 is specifically configured to select a target installation package with the highest priority from multiple installation packages generated by building the target pipeline when running the target pipeline with volume analysis, if a package analysis node exists in the target pipeline.
[0233] Furthermore, the analysis unit 1103 includes:
[0234] The decompression module is used to decompress the target installation package on the machine and obtain a list of decompressed files;
[0235] The traversal module is used to traverse all files in the decompressed file list to obtain the suffix type of each file;
[0236] The classification module is used to classify all files in the file list according to the suffix type of each file to obtain the classified files;
[0237] An aggregation module is used to aggregate the classified files according to a preset aggregation method and write the aggregated files into a corresponding data list;
[0238] A first judgment module is used to judge the format of each file written into the corresponding data list after aggregation, and to judge whether the file meets the file standard;
[0239] The second judgment module is used to judge whether the file is compressed if the file format is a picture format, and calculate the unique identification code of all pictures corresponding to the picture format;
[0240] A storage module, configured to store the compressed images in a compressed image list if the file is compressed, until all compressed images in the corresponding data list after aggregation are written into the compressed image list;
[0241] The output module is used to add all images with the same unique identification code to the same category and output a list of duplicate images according to the same category;
[0242] A first determination module is configured to determine that a file meets a file standard if the file size of the file is greater than a preset threshold, and write the file meeting the file standard into a large file data list;
[0243] A generation module is used to generate a compilation file list, an unused class check list and an unused method check list according to the link map file of the target installation package;
[0244] The first acquisition module is used to obtain an analysis report according to the duplicate image list, the corresponding data list, the large file data list, the compressed image list, the compiled file list, the unused class check list and the unused method check list.
[0245] Furthermore, the acquisition unit 1104 includes:
[0246] A download module, configured to download the analysis report stored in the file storage service to a corresponding aggregation machine environment;
[0247] The extraction module is used to extract the package volume data of each package in the analysis report through the pipeline corresponding to the package volume analysis report in an aggregated machine environment; wherein, each package volume data includes at least the total package volume size, version, build time, build ID and preset variables; the preset variables store a preset number of file entries that meet the preset task type.
[0248] Furthermore, the aggregation statistics unit 1105 includes:
[0249] A determination acquisition module is used to aggregate and statistically analyze the volume data of each package to determine whether there is a change in the volume of each package at different time points or between versions, and to obtain statistical indicators for each package; wherein the statistical indicators include at least the average volume, median volume, maximum volume, and minimum volume;
[0250] The second acquisition module is used to obtain the package volume change data if there is a package volume change at different time points of each package, or a package volume change between versions;
[0251] The second determining module is used to determine the package volume trend according to the statistical indicators of each package.
[0252] Furthermore, the query display unit 1106 includes:
[0253] A parsing module is configured to parse a query instruction upon receiving the query instruction to obtain a query dimension of the query instruction; wherein the query dimension includes at least a version dimension, a time dimension, and / or a build dimension;
[0254] The query and display module is used to query and display the package volume change data and package volume trends based on the query dimension.
[0255] Furthermore, the pipeline-based installation package volume monitoring device also includes:
[0256] The query unit is used to query the package volume content distribution through analysis reports.
[0257] In the embodiment of the present application, a large number of temporary installation packages are generated during the application development process. However, this solution does not require monitoring the volume of all temporary installation packages one by one. Instead, it only requires selecting the target installation package produced by the target pipeline, sending the target installation package to the machine where the target pipeline is executed, and performing a package volume analysis on the target installation package on the machine to obtain an analysis report, thereby improving the efficiency of monitoring the installation package volume. Furthermore, by performing a package volume analysis on the target installation package on the machine where the target pipeline is executed, information such as package volume growth, reasons for growth, reasons for reduction, growth trends, and reduction trends can be obtained, thereby enabling flexible and efficient monitoring of the installation package volume.
[0258] An embodiment of the present application further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned pipeline-based installation package volume monitoring method.
[0259] The present application also provides an electronic device, the structure of which is shown in FIG. Figure 12 As shown, it specifically includes a memory 1201 and one or more instructions 1202, wherein the one or more instructions 1202 are stored in the memory 1201 and are configured to be executed by one or more processors 1203 to execute the one or more instructions 1202 to perform the above-mentioned pipeline-based installation package volume monitoring method.
[0260] For the sake of simplicity, the aforementioned method embodiments are described as a series of action combinations. However, those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0261] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similarities between the various embodiments can be referred to in conjunction with each other. For device embodiments, since they are generally similar to method embodiments, their description is relatively simple, and for relevant details, reference can be made to the description of the method embodiments.
[0262] The steps in the methods of the various embodiments of the present application can be adjusted in sequence, combined, and deleted according to actual needs.
[0263] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0264] The above description of the disclosed embodiments will enable those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
[0265] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A pipeline-based installation package volume monitoring method, characterized in that: The method comprises: During the process of running the target pipeline with volume analysis, selecting a target installation package produced by building the target pipeline; wherein the target installation package is the installation package with the highest priority; Sending the target installation package to the machine where the target pipeline is executed; Performing a package volume analysis on the target installation package in the machine to obtain an analysis report; Obtaining volume data of each package in the analysis report; Aggregate and count the volume data of each package to obtain the change data and package volume trend; When a query instruction is received, the package volume change data and the package volume trend are queried and displayed according to the query instruction.
2. The method according to claim 1, characterized in that In the process of running the target pipeline with volume analysis, selecting and building a target installation package produced by the target pipeline includes: During the process of running the target pipeline with volume analysis, if there is a package analysis node in the target pipeline, a target installation package with the highest priority is selected from multiple installation packages generated by building the target pipeline.
3. The method according to claim 1, characterized in that The performing of package volume analysis on the target installation package in the machine to obtain an analysis report includes: Decompressing the target installation package in the machine to obtain a decompressed file list; Traverse all files in the decompressed file list to obtain the suffix type of each file; Classify all files in the file list according to the suffix type of each file to obtain the classified files; Aggregate the classified files according to the preset aggregation method, and write the aggregated files into the corresponding data list; For each file written into the corresponding data list after aggregation, determine the format of the file and whether the file meets the file standard; If the file format is a picture format, determine whether the file is compressed, and calculate the unique identification codes of all pictures corresponding to the picture format; If the file is compressed, the compressed pictures are stored in the compressed picture list until all compressed pictures in the aggregated files are written into the corresponding data list are stored in the compressed picture list; Add all images with the same unique identification code to the same category, and output a list of duplicate images according to the same category; If the file size of the file is larger than a preset threshold, it is determined that the file meets the file standard, and the file meeting the file standard is written into the large file data list; Generate a compilation file list, an unused class check list, and an unused method check list based on the link map file of the target installation package; An analysis report is obtained according to the duplicate picture list, the corresponding data list, the large file data list, the compressed picture list, the compiled file list, the unused class check list, and the unused method check list.
4. The method according to claim 1, wherein The obtaining of the volume data of each package in the analysis report includes: Downloading the analysis report stored in the file storage service to the corresponding aggregation machine environment; In an aggregated machine environment, each package volume data in the analysis report is extracted through the pipeline corresponding to the package volume analysis report; wherein, each package volume data includes at least the total package volume size, version, build time, build ID and preset variables; the preset variables store a preset number of file entries that meet the preset task type.
5. The method according to claim 1, wherein Aggregating and counting the volume data of each package to obtain the package volume change data and package volume trend includes: Aggregate and count the volume data of each package to determine whether there is a change in the volume of each package at different time points or between versions, and obtain statistical indicators for each package; wherein the statistical indicators include at least the average volume, median volume, maximum volume, and minimum volume; If there is a change in the package size of each package at different time points, or a change in the package size between versions, obtain the package size change data; Determine package volume trends based on statistical metrics for each package.
6. The method according to claim 1, characterized in that When a query instruction is received, querying and displaying the package volume change data and the package volume trend according to the query instruction includes: When a query instruction is received, the query instruction is parsed to obtain a query dimension of the query instruction; wherein the query dimension includes at least a version dimension, a time dimension and / or a build dimension; The package volume change data and package volume trend are queried and displayed according to the query dimension.
7. The method according to claim 1, characterized in that Also includes: Through the analysis report, the package volume and content distribution are queried.
8. A pipeline-based installation package volume monitoring device, characterized in that: The device comprises: A selection unit is configured to select, during the process of running a target pipeline with volume analysis, a target installation package produced by building the target pipeline; wherein the target installation package is the installation package with the highest priority; A sending unit, configured to send the target installation package to a machine where the target pipeline is executed; an analysis unit, configured to perform a package volume analysis on the target installation package in the machine to obtain an analysis report; an acquiring unit, configured to acquire volume data of each package in the analysis report; Aggregation statistics unit, used to aggregate and count the volume data of each package to obtain the change data and package volume trend; The query and display unit is used to query and display the package volume change data and package volume trend according to the query instruction when a query instruction is received.
9. The device according to claim 8, characterized in that The selection unit is specifically configured to: During the process of running the target pipeline with volume analysis, if there is a package analysis node in the target pipeline, a target installation package with the highest priority is selected from multiple installation packages generated by building the target pipeline.
10. The device according to claim 8, characterized in that The analysis unit comprises: A decompression module, configured to decompress the target installation package in the machine to obtain a decompressed file list; The traversal module is used to traverse all files in the decompressed file list to obtain the suffix type of each file; A classification module, configured to classify all files in the file list according to the suffix type of each file to obtain the classified files; An aggregation module is used to aggregate the classified files according to a preset aggregation method and write the aggregated files into a corresponding data list; A first judgment module is used to judge the format of each file written into the corresponding data list after aggregation, and to judge whether the file meets the file standard; A second determination module is configured to determine, if the file format is a picture format, whether the file is compressed, and calculate unique identification codes for all pictures corresponding to the picture format; a storage module, configured to store the compressed pictures in a compressed picture list if the file is compressed, until all compressed pictures in the corresponding data list of the aggregated files are written into the compressed picture list; The output module is used to add all images with the same unique identification code to the same category and output a list of duplicate images according to the same category; a first determining module, configured to determine that the file meets the file standard if the file size of the file is greater than a preset threshold, and write the file meeting the file standard into a large file data list; A generation module is used to generate a compilation file list, an unused class check list and an unused method check list according to the link map file of the target installation package; The first acquisition module is used to obtain an analysis report according to the duplicate image list, the corresponding data list, the large file data list, the compressed image list, the compiled file list, the unused class check list and the unused method check list.
Citation Information
Patent Citations
Application updating method and terminal
CN106293849A
Installation package volume monitoring method and device, electronic equipment and storage medium
CN115373741A