Method and system for improving project compiling speed
By analyzing and replacing source code components in iOS projects and generating binary components, the problem of long compilation time for large iOS projects is solved, and a more efficient project development and iteration process is achieved.
Patent Information
- Application Number
- CN202411773165.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-14
AI Technical Summary
In large-scale iOS projects, more and more tripartite component and business component codes have led to longer time for project compilation, debugging and generation of IPAs, seriously affecting development and iteration efficiency.
Analyze the engineering configuration through the analysis module, run the analysis script to identify all components that the project depends on, and find the same version of the components in the component binary index source, replace the source code components to generate binary components, and optimize the project compilation process.
It has achieved rapid improvement of project compilation and package efficiency, simplified project development and iteration processes, and improved project development iteration efficiency.
Smart Images

Figure CN119621071A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of project compilation speed optimization, and in particular to a method and system for improving project compilation speed. Background Art
[0002] In iOS projects, each project will rely on a variety of basic third-party components, such as network libraries, image loading libraries, sqllite databases, layout libraries, etc. Especially in medium and large iOS projects, the project complexity is high, and there will be more dependent basic component libraries. At the same time, in addition to third-party components, there are more various business components, which are the part with the highest code share in the entire project.
[0003] The increasing number of third-party components and business component codes has led to longer compilation and debugging time for updated projects, as well as longer time to generate IPA, which has seriously affected project development and iteration efficiency.
[0004] The basic solutions in the industry are as follows:
[0005] Solution 1: Manually compile the third-party components to generate binary files, and then use the binary files of the third-party components in the project;
[0006] Solution 2: Use scripts to compile third-party components into binary files, and then use the binary files of third-party components in the project.
[0007] The above solution has the following disadvantages:
[0008] Solution 1 requires developers to manually pull third-party source code from GitHub, set compilation parameters for compilation, upload the compiled binary file to the file server, upload the binary file description file to the private Git server, and then replace the third-party component description file in the project. This solution has a long process, each step requires manual operation, and the subsequent update and maintenance process is cumbersome and inefficient.
[0009] Solution 2 optimizes Solution 1 and implements the process of Solution 1 through scripts, which solves the problem to a certain extent and improves the compilation speed. But in fact, the code in the project is mainly concentrated in the business part, and the third-party component code generally accounts for no more than 30%. Therefore, the key is to solve the problem of time-consuming compilation of business code. Summary of the invention
[0010] The present invention provides a method and system for improving the project compilation speed in order to solve the technical problems of slow compilation speed in large-scale project development and long time to generate IPA packages.
[0011] The present invention solves the above technical problems through the following technical solutions:
[0012] The present invention provides a method for improving project compilation speed, and the method for improving project compilation speed comprises the following steps:
[0013] 1) Analyze the project configuration through the analysis module, then start running the analysis script to analyze all the components that the project depends on, and then go to the component binary index source and use the search module to traverse to find out whether there is a component of the same version that is currently dependent, and it is not in the source code component whitelist;
[0014] 2) After the analysis in step 1), the remaining source code component list is set as the components that need to be made into binary components. The dependency analysis results of the project are modified by modifying the module, the existing binary components of the dependent components are replaced, and the dependency analysis results are saved;
[0015] 3) Then, according to the dependency analysis results, relevant components are downloaded through the download module and then integrated into the project;
[0016] 4) According to the compilation parameters of the custom configuration file, the entire project is compiled and packaged through the compilation and packaging module. After the packaging is completed, the compilation product is copied through the copy module and compressed into zip format;
[0017] 5) Then upload the zip file to the binary file server through the upload module;
[0018] 6) According to the podspec description file of the source code component, make the following modifications: replace the source, source_files, public_header_files, and vendored_libraries values;
[0019] 7) Push the podspec generated in the previous step to the binary index repository of the corresponding environment.
[0020] Preferably, in step 1), the analysis module reads the global configuration file through a Ruby plug-in to determine the source address of the source code component repository index and the source address of the binary component repository index under each compilation environment separation.
[0021] Preferably, in step 1), the analysis module reads the project's customized configuration file through a Ruby plug-in, analyzes the compilation environment used by the current project, and then determines the source code component repository index source address and the binary component repository index source address according to the compilation environment.
[0022] Preferably, in step 1), the analysis module reads a custom configuration file of the project through a Ruby plug-in, and analyzes a whitelist of source code components and a whitelist of binary components.
[0023] Preferably, the content copied in step 4) is the static library file generated for each component, as well as the Headers folder and Resource generated by the podinstall / update process; the compilation product and the configuration are combined into a .a type static library or a framework type static library, and the Headers, Resource, and compilation product are combined into a folder and compressed into a zip format.
[0024] Preferably, the compressed zip file is renamed and a corresponding version number is added after the name.
[0025] Preferably, the Resource searches for resources in the corresponding component library according to the resource field of the podspec.
[0026] Preferably, after uploading to the binary file server in step 5), the uploaded address is obtained.
[0027] Preferably, in step 6), source corresponds to the file address saved in the previous step, source_files corresponds to the content under the Headers path under the zip folder, and public_header_files corresponds to the content with the .h suffix under the Headers path under the zip folder.
[0028] Furthermore, the present invention provides a system for improving the speed of project compilation, the system comprising: an analysis module; the analysis module is connected to a Ruby plug-in, and the analysis module is connected to an analysis script;
[0029] Also includes:
[0030] A search module, the search module is connected to the analysis module, and the search module is connected to the modification module and the download module;
[0031] A compiling and packaging module, which compiles and packages the entire project, and is connected to a copy module;
[0032] The upload module is connected to the copy module and the upload module is connected to the binary file server, and the upload module uploads the compressed copied file.
[0033] On the basis of being in accordance with the common sense in the art, the above-mentioned preferred conditions can be arbitrarily combined to obtain the preferred embodiments of the present invention.
[0034] The positive and progressive effects of the present invention are:
[0035] The above-mentioned method and system for improving the project compilation speed, through a Ruby script, all components of the entire project are made into binary components with one click; according to the version number of the podspec file, build, assemble binary components, make binary podspec, upload binary files, and upload binary podspec to a private source repository are automatically executed; through the project configuration file, separate configuration of the project is supported to avoid Git conflicts; global configuration is supported to configure the Git address of the private source binary component, the Git address of the source code component, and the file server address; the script supports component whitelists, and the source code repository and the binary repository can be easily switched, and the use of source code components or binary components can be dynamically controlled according to the business scenario; through the overall compilation solution, coupled components are supported, that is, the source code components in the project can be made into binary components without independent compilation; by dynamically supporting no binary version, the source code version is automatically adopted; the project configuration file supports the definition of multiple code environments, thereby realizing the separation of compilation environments.
[0036] In summary, the compilation efficiency improvement solution provided by the present invention is highly versatile and supports all components of the project. At the same time, each component does not require independent compilation, and can be quickly connected to and used in the system, thereby quickly improving the project compilation and packaging efficiency and improving the project development iteration efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 The figure is a flow chart of the method of the present invention.
[0038] Figure 2 It is a logical schematic diagram of the present invention.
[0039] Figure 3 Schematic diagram of the system of the present invention.
[0040] Description of Reference Numerals
[0041] 1. Analysis module; 2. Ruby plug-in; 3. Analysis script; 4. Search module; 5. Modify module; 6. Download module; 7. Compile and package module; 8. Copy module; 9. Upload module; 10. Binary file server. DETAILED DESCRIPTION
[0042] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.
[0043] like Figure 1-3 As shown, a method for improving project compilation speed includes the following steps:
[0044] 1) Analyze the project configuration through analysis module 1, then start running analysis script 3 to analyze all components that the project depends on, and then go to the component binary index source and traverse through search module 4 to find out whether there is a component of the same version as the current dependency, and it is not in the source code component whitelist;
[0045] The script supports component whitelisting, and can easily switch between source code repositories and binary repositories, dynamically controlling whether to use source code components or binary components based on business scenarios.
[0046] 2) After the analysis in step 1), the remaining source code component list is set as the components that need to be made into binary components, and the dependency analysis results of the project are modified by modifying module 5, replacing the existing binary components of the dependent components, and saving the dependency analysis results;
[0047] 3) Then, according to the dependency analysis results, relevant components are downloaded through download module 6, and then integrated into the project;
[0048] 4) According to the compilation parameters of the custom configuration file, the entire project is compiled and packaged through the compilation and packaging module 7. After the packaging is completed, the compiled product is copied through the copy module 8 and compressed into a zip format;
[0049] 5) Then upload the zip file to the binary file server 10 through the upload module 9;
[0050] 6) According to the podspec description file of the source code component, make the following modifications: replace the source, source_files, public_header_files, and vendored_libraries values;
[0051] 7) Push the podspec generated in the previous step to the binary index repository of the corresponding environment.
[0052] According to the version number of the podspec file, build will be automatically executed, binary components will be assembled, binary podspec will be produced, binary files will be uploaded, and binary podspec will be uploaded to private source warehouse support.
[0053] Through the project configuration file, it supports individual configuration of projects to avoid Git conflicts.
[0054] Supports global configuration, configuring private source binary component Git address, source code component Git address, and file server address.
[0055] Through the overall compilation solution, coupled components are supported, that is, the source code components in the project can be made into binary components without independent compilation.
[0056] Automatically use source code versions when no binary versions are supported via dynamic support.
[0057] The project configuration file supports the definition of multiple code environments, thereby achieving separation of compilation environments.
[0058] In the step 1), the analysis module 1 reads the global configuration file through the Ruby plug-in 2 to determine the source address of the source code component repository index and the binary component repository index source address under each compilation environment separation.
[0059] In the step 1), the analysis module 1 reads the project's customized configuration file through the Ruby plug-in 2, analyzes the compilation environment used by the current project, and then determines the source code component repository index source address and the binary component repository index source address according to the compilation environment.
[0060] In the step 1), the analysis module 1 reads the customized configuration file of the project through the Ruby plug-in 2, and analyzes the white list of source code components and the white list of binary components.
[0061] Through the Ruby script, all components of the entire project can be made into binary components in one click.
[0062] The content copied in the step 4) is the static library file generated for each component, as well as the Headers folder and Resource generated by the pod install / update process; the compilation product and the configuration are combined into a .a type static library or a framework type static library, and the Headers, Resource, and compilation product are combined into a folder and compressed into a zip format.
[0063] The compressed zip file is renamed and the corresponding version number is added after the name.
[0064] The Resource searches for resources in the corresponding component library according to the resource field of the podspec.
[0065] After uploading to the binary file server 10 in step 5), the uploaded address is obtained.
[0066] In step 6), source corresponds to the file address saved in the previous step, source_files corresponds to the content under the Headers path under the zip folder, and public_header_files corresponds to the content with the .h suffix under the Headers path under the zip folder.
[0067] Furthermore, a system for improving project compilation speed includes: an analysis module 1; the analysis module 1 is connected to a Ruby plug-in 2, and the analysis module 1 is connected to an analysis script 3;
[0068] Also includes:
[0069] A search module 4, wherein the search module 4 is connected to the analysis module 1, and the search module 4 is connected to the modification module 5 and the download module 6;
[0070] A compiling and packaging module 7, which compiles and packages the entire project, and is connected to a copy module 8;
[0071] The upload module 9 is connected to the copy module 8 and the upload module 9 is connected to the binary file server 10. The upload module 9 uploads the compressed copied file.
[0072] The present invention is not limited to the above-mentioned embodiments. Any changes in shape or structure are within the protection scope of the present invention. The protection scope of the present invention is defined by the attached claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principle and essence of the present invention, but these changes and modifications are within the protection scope of the present invention.
Claims
1. A method for improving project compilation speed, characterized in that: The method for improving the project compilation speed comprises the following steps: 1) Analyze the project configuration through the analysis module (1), then start running the analysis script (3) to analyze all the components that the project depends on, and then go to the component binary index source and use the search module (4) to traverse and find whether there is a component of the same version as the current dependency, and it is not in the source code component whitelist; 2) After the analysis in step 1), the remaining source code component list is set as the components that need to be made into binary components, and the dependency analysis results of the project are modified by modifying the module (5), replacing the existing binary components of the dependent components, and saving the dependency analysis results; 3) Then, according to the dependency analysis results, the download module (6) is used to download related components and then integrated into the project; 4) According to the compilation parameters of the custom configuration file, the entire project is compiled and packaged through the compilation and packaging module (7). After the packaging is completed, the compiled product is copied through the copy module (8) and compressed into a zip format; 5) Then, the zip file is uploaded to the binary file server (10) through the upload module (9); 6) According to the podspec description file of the source code component, make the following modifications: replace the source, source_files, public_header_files, and vendored_libraries values; 7) Push the podspec generated in the previous step to the binary index repository of the corresponding environment.
2. The method for improving project compilation speed as claimed in claim 1, characterized in that: In the step 1), the analysis module (1) reads the global configuration file through the Ruby plug-in (2) to determine the source address of the source code component repository index and the source address of the binary component repository index under each compilation environment separation.
3. The method for improving project compilation speed as claimed in claim 1, characterized in that: In the step 1), the analysis module (1) reads the project's customized configuration file through the Ruby plug-in (2), analyzes the compilation environment used by the current project, and then determines the source address of the source code component repository index and the binary component repository index source address according to the compilation environment.
4. The method for improving project compilation speed as claimed in claim 1, characterized in that: In the step 1), the analysis module (1) reads the project's customized configuration file through the Ruby plug-in (2) to analyze a white list of source code components and a white list of binary components.
5. The method for improving project compilation speed as claimed in claim 1, characterized in that: The content copied in the step 4) is the static library file generated for each component, as well as the Headers folder and Resource generated by the pod install / update process; the compilation product and the configuration are combined into a .a type static library or a framework type static library, and the Headers, Resource, and compilation product are combined into a folder and compressed into a zip format.
6. The method for improving project compilation speed as claimed in claim 5, characterized in that: The compressed zip file is renamed and the corresponding version number is added after the name.
7. The method for improving project compilation speed as claimed in claim 5, characterized in that: The Resource searches for resources in the corresponding component library according to the resource field of the podspec.
8. The method for improving project compilation speed as claimed in claim 1, characterized in that: After uploading to the binary file server (10) in step 5), the uploaded address is obtained.
9. The method for improving project compilation speed as claimed in claim 1, characterized in that: In step 6), source corresponds to the file address saved in the previous step, source_files corresponds to the content under the Headers path under the zip folder, and public_header_files corresponds to the content with the .h suffix under the Headers path under the zip folder.
10. A system for improving project compilation speed obtained by the method for improving project compilation speed according to any one of claims 1 to 9, characterized in that: The system comprises: an analysis module (1); the analysis module (1) is connected to a Ruby plug-in (2), and the analysis module (1) is connected to an analysis script (3); Also includes: A search module (4), the search module (4) is connected to the analysis module (1), and the search module (4) is connected to the modification module (5) and the download module (6); A compiling and packaging module (7), wherein the compiling and packaging module (7) compiles and packages the entire project, and the compiling and packaging module (7) is connected to a copy module (8); An upload module (9), the upload module (9) is connected to the copy module (8), and the upload module (9) is connected to the binary file server (10), and the upload module (9) uploads the compressed copied file.