Installation package volume monitoring method and device based on assembly line
By performing package volume analysis on the target installation package on the assembly line machine, the problem of insufficient volume monitoring efficiency and flexibility of installation packages in the prior art is solved, and accurate monitoring and analysis of the causes and trends of the volume changes of the installation packages is achieved.
Patent Information
- Application Number
- CN202411632156.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-15
AI Technical Summary
The prior art has poor efficiency and flexibility when monitoring the installation package volume of mobile phone applications, and cannot effectively monitor the reasons for the changes in the installation package volume, resulting in low monitoring efficiency.
The installation package volume monitoring method based on the assembly line is adopted. By analyzing the target installation package volume on the machine that executes the target assembly line, data on the growth, reason for growth, reason for reduction, growth trend, and trend of the package volume are obtained to achieve flexible and efficient monitoring of the installation package volume.
It improves the efficiency and flexibility of monitoring installation package volume, can accurately analyze and display the causes and trends of package volume changes, and helps developers more effectively manage and optimize the application installation package volume.
Smart Images

Figure CN119576692A_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] At present, the installation package of mobile phone applications (Application, APP) is an important part of the mobile phone's memory. The larger the size of the installation package, the more mobile phone memory it occupies, and it will consume more traffic when downloading, which 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] 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.
[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 solution is as follows:
[0007] The first aspect of the present application discloses a pipeline-based installation package volume monitoring method, the method comprising:
[0008] In 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 within the package volume and the 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, in the process of running the target pipeline with volume analysis, selecting to build a 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 determine whether the file meets the file standard;
[0022] If the format of the file is a picture format, determine whether the file is compressed, and calculate 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 corresponding data list after the aggregation are written into 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 based on 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 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.
[0028] Preferably, the obtaining of 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 conform to the preset task type.
[0031] Preferably, the aggregating and counting 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 of each package; wherein the statistical indicators at least include average volume, median volume, maximum volume and minimum volume;
[0033] If there is a change in the package size at different time points for each package, or there is a change in the package size between versions, obtain the change data within the package size;
[0034] Determine package volume trends based on statistical metrics for each package.
[0035] Preferably, when a query instruction is received, querying and displaying the packet volume change data and the packet 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 at least includes a version dimension, a time dimension and / or a build dimension;
[0037] According to the query dimension, the package volume change data and package volume trend are queried and displayed.
[0038] Preferably, it also includes:
[0039] Through the analysis report, the package volume content distribution is queried.
[0040] The second aspect of the present application discloses a pipeline-based installation package volume monitoring device, the device comprising:
[0041] A selection unit, 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, used to send the target installation package to the 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 acquisition unit, used for acquiring volume data of each package in the analysis report;
[0045] Aggregation statistics unit, used to aggregate and count the volume data of each package, and obtain the change data and package volume trend within the package;
[0046] The query and display unit is used to query and display the package volume change data and the package volume trend according to the query instruction when a query instruction is received.
[0047] Preferably, the selection unit is specifically used for:
[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, used 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, used for classifying 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 the aggregation, and judge whether the file meets the file standard;
[0055] A second determination module is used to determine whether the file is compressed if the file format is a picture format, and to calculate unique identification codes of all pictures corresponding to the picture format;
[0056] A storage module, used for storing the compressed pictures into a compressed picture list if the file is compressed, until all compressed pictures in the corresponding data list after the aggregation are written into the compressed picture list;
[0057] An output module is used to add all pictures with the same unique identification code to the same category and output a list of duplicate pictures according to the same category;
[0058] A first determination 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, used for generating a compilation file list, an unused class check list and an unused method check list according to a link map file of a 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 known from the above technical scheme that the present application discloses a method and device for monitoring the volume of installation packages based on pipelines. In the process of running a target pipeline with volume analysis, a target installation package produced by building a 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 a 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 change data within the package volume and the package volume trend. When a query instruction is received, the change data within the package volume and the package volume trend are queried and displayed according to the query instruction.
[0062] Through the above scheme, a large number of temporary installation packages will be generated during the application development process, but this scheme 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 pipeline, send the target installation package to the machine where the target pipeline is executed, and perform package volume analysis on the target installation package in the machine to obtain an analysis report, thereby improving the efficiency of monitoring the installation package volume. In addition, by performing package volume analysis on the target installation package in the machine where the target pipeline 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 installation package volume can be monitored in a flexible and efficient manner. 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 drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0064] Figure 1 A schematic diagram of a flow chart of a method for monitoring the volume of an installation package based on a pipeline disclosed in an embodiment of the present application;
[0065] Figure 2 A schematic diagram of configuring and enabling package analysis in a build pipeline disclosed in an embodiment of the present application;
[0066] Figure 3 A schematic diagram of comparing file differences within a package volume disclosed in an embodiment of the present application;
[0067] Figure 4 A schematic diagram of the volume floating trend disclosed in the embodiment of the present application;
[0068] Figure 5 This is a schematic diagram of the ipa layer parsing disclosed in the embodiment of the present application;
[0069] Figure 6 A schematic diagram of linkmap layer parsing disclosed in an embodiment of the present 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 of dividing the analysis report disclosed in the embodiment of the present application into several subtasks;
[0072] Fig. 9 A schematic diagram of package volume data disclosed in an embodiment of the present application;
[0073] Fig.10 A schematic diagram of a flow chart of another pipeline-based installation package volume monitoring method disclosed in an embodiment of the present application;
[0074] Fig.11 A schematic diagram of the structure of a pipeline-based installation package volume monitoring device disclosed in an embodiment of the present application;
[0075] Fig.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 the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work 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 cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0078] As can be seen from the background technology, in the existing process of monitoring the volume of the APP installation package, if a large number of temporary installation packages are generated, it is necessary to monitor the volumes of all temporary installation packages one by one. In addition, in the existing process of monitoring the volume of the installation package, only the size of the installation package can be monitored, and the reason for the change in the volume of the installation package cannot be known, resulting in poor efficiency and flexibility in monitoring the volume of the installation package. Therefore, how to realize the monitoring of the volume of the installation package 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 installation packages based on pipelines. During the application development process, a large number of temporary installation packages will be generated, but 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 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 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 pipeline is executed, the growth of the package volume, the reason for the growth, the reason for the decrease, the growth trend, the decrease 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 method for monitoring the volume of an installation package based on an assembly line according to an embodiment of the present application. The method for monitoring the volume of an installation package based on an assembly line mainly includes the following steps:
[0081] S101: In the process of running a target pipeline with volume analysis, a target installation package generated by building 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 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.
[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 the 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 volume analysis. You can configure whether to enable packet volume 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 the release package.
[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, terminate the process. 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 the pipeline build node is completed, multiple installation package types may be generated. At this time, it is necessary to select a target installation package with the highest priority for analysis based on the priority rule. The priority rule means that the same build may produce multiple installation packages, such as ad-hoc packages and appstore packages, but when we analyze the installation packages, we usually only need to select one of them for analysis. At this time, each package is marked by priority, and the package with the highest priority is selected for analysis.
[0099] For example, during the pipeline construction process, debug, ad-hoc, and app-store installation packages may be generated. At this time, only the app-store installation package needs to be selected for analysis according to the priority rule, and other types of packages will not enter the subsequent process. For example, if the priority of the app-store package is 2 and the priority of the adhoc package is 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 the configuration of enabling package analysis in the build pipeline.
[0111] Figure 2 In the build pipeline, configuration to enable package analysis 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 a picture format, determine whether the picture has been compressed. If it has been compressed, add the picture to the compressed picture list and finally output the compressed picture list;
[0122] 8. Determine the file format. If it is a picture format, calculate the picture MD5. If the MD5 is the same, add the picture paths with the same MD5 value to the same category, and finally output the duplicate picture list. If there is no picture with the same MD5, do not add it to any category, and finally do not need to output this picture 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, variables, etc. By analyzing this file, you can know the size of each module in the package. Linkmap is a txt file that can be generated during compilation and linking, which records the space occupied by each method under the current binary architecture. By analyzing the linkmap, you can calculate how much installation package space each class or even each method occupies.
[0125] S103: Performing a package volume analysis on the target installation package in the machine to obtain an analysis report.
[0126] Perform package volume analysis on the target installation package on the machine where the target pipeline is executed to obtain an analysis report. The package volume analysis includes at least multi-dimensional comparison, file difference comparison within the package volume, trend monitoring, pipeline execution monitoring, etc.
[0127] Perform package volume analysis on the installation package. This process will first decompress the installation package, count the sizes of various files after the installation package is decompressed, 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, MD5, volume fluctuation, and other information of each file) to form package volume trend statistics. According to the package volume statistics, query by dimension, view trends, volume floating trends and other monitoring operations. According to 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. Output of the 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. View package volume factors such as large file analysis.
[0128] Perform volume analysis on the APP build running on the pipeline, support 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 query to support volume differences by version dimension, time dimension, and build dimension. 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 work changes of developers.
[0129] Comparison of file differences in 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 of APP volume is often not just a comparison with the last compilation result. In fact, the same version will produce multiple installation packages, and the installation packages of the same version have small differences. 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 volume ups and downs, and view 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] It can be seen from the above that by analyzing the pipeline package task and combining it with the method used in this solution, the growth of the package volume, the reason for the growth, and the trend can be obtained, and the installation package volume can be monitored in a flexible and efficient way.
[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, tasks such as uncompressed file check, large file check, finding duplicate files, and volume distribution are classified.
[0141] ipa package analysis task classification, according to the implementation principle of the task 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 checking, unused class detection, unused resource checking, 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 the size of each module 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 the files in the file list according to the suffix type of each file to obtain the classified files.
[0147] In A3, files are classified by type. You only need to aggregate them according to the classification. Common file types include car, dylib, and files without suffixes.
[0148] A4: Aggregate the classified files according to a preset aggregation method, and write the aggregated files into a corresponding data list.
[0149] A5: 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.
[0150] Among them, the linkmapAnalyzer tool is used to analyze the size of the compiled file. The compiled file can usually determine the size of each class, and 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 checks, 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 this application does not make any specific limitation.
[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 larger than the preset threshold of the configuration, it is considered a large file.
[0155] A6: If the file format is a picture format, determine whether the file is compressed, and calculate the unique identification code (MD5) of all pictures corresponding to the picture 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 the compressed images in the corresponding data list after the aggregation are written into the compressed image 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 based on 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 according to 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, variables, etc. By analyzing this file, you can know the size of each module in the package. Linkmap is a txt file that can be generated during compilation and linking, which records the space occupied by each method under the current binary architecture. By analyzing the linkmap, you can calculate how much installation package space each class or even each method occupies.
[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., and classify all files, and write the classified file data into their corresponding data lists;
[0169] Determine whether the classified files meet the file 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 a picture, and there is a unique identification code (MD5) of a duplicate picture in the picture, write the picture into the duplicate picture 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, the picture is written 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 listing of all output:
[0176] For example:
[0177]
[0178]
[0179]
[0180]
[0181] The analysis report is the result of categorizing and organizing the output list.
[0182] You can also query the package volume content distribution through the analysis report. 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. The 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.
[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, each package volume data in the analysis report is extracted through the pipeline corresponding to the package volume analysis report.
[0187] Each package volume data includes at least the total package volume, version, build time, build ID and preset variables (variable A); the preset variables store a preset number of file entries that match the preset task type. For example, in the machine environment where the aggregation module is located, extract the total-size preset number (such as the first 10) of entries in the entries field that match the preset task type (such as the task type with taskType of 1) to variable A.
[0188] Specific package volume data such as Fig. 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 first 10 entries of total-size in the entries field of the task type with taskType of 1 into 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 the size statistics of all files, which is a subtask in packet analysis. It traverses the decompressed files, obtains the size and MD5 data of each file, and writes them into the file list according to the file format.
[0194] 3. Add the first 10 entries of 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 size, version, build time, build ID and other build information, and insert the package size, version, build time, build ID, and variable A into the database as a record;
[0195] 4. Provides interfaces for querying package volume analysis in different dimensions, including querying by version, by time, and by build dimension, and comparing the rising and falling trends of files within the package volume under these dimensions;
[0196] For example, the 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 volume query, 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 floating 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 counting the volume data of each package to obtain the change data within the package volume and the 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 the package volume between different time points or versions of each package, and obtain statistical indicators of each package; wherein the statistical indicators at least include average volume, median volume, maximum volume and minimum volume.
[0205] B2: If there is a change in the package size of each package at different time points, or there is a change in the package size between versions, the change data in the package size is obtained.
[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 the package volume change data and package volume trend according to the query dimension.
[0211] Provides interfaces for querying package volume analysis in different dimensions, including querying by version, by time, and by build dimension, and can compare the increase and decrease trends of files within the package volume under these dimensions.
[0212] In order to facilitate the understanding of the process of pipeline-based installation package volume monitoring, combined with Fig.10 To explain:
[0213] Fig.10 , start running the pipeline with volume analysis;
[0214] Build the pipeline and select the target installation package that is sufficient to be output as the input for the next step according to the priority;
[0215] Perform package volume 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 is used to obtain multiple package volume data in the analysis report, and aggregate and count the multiple package volume data to obtain 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 volume difference and package volume comparison between any two builds through query conditions;
[0221] Visualization: This application can clearly see the version fluctuation and size trend through the visualization module, and the internal difference of the package volume can be seen in the trend;
[0222] Multi-factor analysis of package size: This application can quickly query many factors that affect package size, including duplicate images, large files, unused class methods, etc.
[0223] The pipeline-based installation package volume monitoring method of this application 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 due to business iterations 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 will be generated during the application development process, but 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 pipeline, send the target installation package to the machine where the target pipeline is executed, and perform 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 package volume analysis on the target installation package in the machine where the target pipeline 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.
[0225] Based on the above embodiments Figure 1 A method for monitoring the volume of an installation package based on an assembly line is disclosed. The embodiment of the present application also discloses a device for monitoring the volume of an installation package based on an assembly line. Fig.11 As shown, the assembly line-based installation package volume monitoring device includes:
[0226] The selection unit 1101 is used to select a target installation package produced by building a 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] The analysis unit 1103 is used 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 acquire 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 display unit 1106 is used to query and display the packet volume change data and the 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 during the operation of the target pipeline with volume analysis, if there is a package analysis node in the target pipeline.
[0233] Furthermore, the analysis unit 1103 includes:
[0234] The decompression module is used to decompress the target installation package in the machine and obtain the decompressed file list;
[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 each aggregated file, and 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 codes of all pictures corresponding to the picture format;
[0240] A storage module, used for storing the compressed pictures into a compressed picture list if the file is compressed, until all compressed pictures in the corresponding data list after the aggregation are written into the compressed picture list;
[0241] An output module is used to add all pictures with the same unique identification code to the same category and output a list of duplicate pictures according to the same category;
[0242] A first determination module, 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, used for generating a compilation file list, an unused class check list and an unused method check list according to a link map file of a 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, used 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 in the analysis report through the pipeline corresponding to the package volume analysis report in the 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] Determine an acquisition module, which is used to 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 versions, and obtain statistical indicators of each package; wherein the statistical indicators at least include average volume, median volume, maximum volume and minimum volume;
[0250] The second acquisition module is used to obtain the change data of the package volume if there is a change in the package volume at different time points of each package, or there is a change in the package volume between versions;
[0251] The second determination 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, configured to parse the query instruction upon receiving the query instruction, and obtain the 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 trend according to the query dimension.
[0255] Furthermore, the assembly line-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 will be generated during the application development process, but 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 pipeline, send the target installation package to the machine where the target pipeline is executed, and perform 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 package volume analysis on the target installation package in the machine where the target pipeline 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.
[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, whose structural diagram is as follows: Fig.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 execute the above-mentioned pipeline-based installation package volume monitoring method.
[0260] For the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0261] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0262] The steps in the methods of the embodiments of the present application can be adjusted in order, 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 enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be 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 will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
[0265] The above is only a preferred implementation 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: In 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 within the package volume and the 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 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 determine whether the file meets the file standard; If the format of the file is a picture format, determine whether the file is compressed, and calculate 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 corresponding data list after the aggregation are written into the compressed picture list; Add all images with the same unique identification code to the same category, and output a list of duplicate images based on 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 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.
4. The method according to claim 1, characterized in that The obtaining of each package volume data 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 conform to the preset task type.
5. The method according to claim 1, characterized in that The aggregate statistics of each package volume data are performed to obtain the package volume change data and package volume trend, including: 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 of each package; wherein the statistical indicators at least include average volume, median volume, maximum volume and minimum volume; If there is a change in the package size at different time points for each package, or there is a change in the package size between versions, obtain the change data within the package size; 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 packet volume change data and the packet 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 at least includes a version dimension, a time dimension and / or a build dimension; According to the query dimension, the package volume change data and package volume trend are queried and displayed.
7. The method according to claim 1, characterized in that Also includes: Through the analysis report, the package volume content distribution is queried.
8. A pipeline-based installation package volume monitoring device, characterized in that: The device comprises: A selection unit, 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, used to send the target installation package to the 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 acquisition unit, used for acquiring volume data of each package in the analysis report; Aggregation statistics unit, used to aggregate and count the volume data of each package, and obtain the change data and package volume trend within the package; The query and display unit is used to query and display the package volume change data and the 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 used for: During the operation of 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, used 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, used for classifying 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 the aggregation, and judge whether the file meets the file standard; A second determination module is used to determine whether the file is compressed if the file format is a picture format, and to calculate unique identification codes of all pictures corresponding to the picture format; A storage module, used for storing the compressed pictures into a compressed picture list if the file is compressed, until all compressed pictures in the corresponding data list after the aggregation are written into the compressed picture list; An output module is used to add all pictures with the same unique identification code to the same category and output a list of duplicate pictures according to the same category; A first determination 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, used for generating a compilation file list, an unused class check list and an unused method check list according to a link map file of a 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
System and method for software upgrade analysis
US20170039133A1