Static library packaging method, device, computer equipment and storage medium
Through parallel compilation and integration of resources, the problem of low packaging efficiency of multiple static libraries is solved, and an efficient static library packaging process is realized, the overall packaging efficiency is improved, and configuration and customization functions are provided, with high reusability and scalability.
Patent Information
- Application Number
- CN202011296209.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-18
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2040-11-18
AI Technical Summary
In the prior art, the packaging efficiency of multi-static libraries is low, and traditional methods need to be packaged one by one, which takes a long time and lacks efficient integration and compilation methods.
By responding to packaging instructions, obtaining instruction configuration information, determining the code file and resource path of the library to be packaged, and using parallel compilation to generate static libraries, and then integrating resources to realize the simultaneous packaging of multiple static libraries, improving overall packaging efficiency.
It realizes efficient packaging of multiple static libraries, reduces compilation time, provides configuration and customization functions, and has high reusability and scalability. Developers can complete the packaging work in one click without caring about the compilation and integration process.
Smart Images

Figure CN112256321B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software development technology, and in particular to a static library packaging method, device, computer equipment and storage medium. Background Art
[0002] With the development of mobile software development technology, more and more mobile applications have emerged, and with the continuous iteration, many applications will become larger and larger. Due to the requirement for iteration speed, application developers do not have enough time to repeatedly "reinvent the wheel" (referring to re-doing a set of existing functions). They can go to open source communities such as GitHub to find packaged static libraries / source codes and use them directly in their own applications; some large companies can also set up their own middle-end project teams to provide blood for each application.
[0003] Currently, the mainstream iOS project management tool on the market is CocoaPods. Many component development teams use CocoaPods to batch manage their component libraries. Since many code-level contents cannot be fully open source, middleware / component developers need to package their own content into static libraries and then publish them.
[0004] However, the official plug-ins currently only support the packaging of a single library. For the parallel development and testing of multiple components, they need to be packaged one by one, which leads to low packaging efficiency. Summary of the invention
[0005] Based on this, it is necessary to provide a static library packaging method, device, computer equipment and storage medium that can improve packaging efficiency in response to the above technical problems.
[0006] A static library packaging method, the method comprising:
[0007] In response to a packaging instruction, obtaining instruction configuration information corresponding to the packaging instruction;
[0008] Determine the code files and resource paths of each library to be packaged according to the instruction configuration information;
[0009] Compile the code files of the libraries to be packaged in parallel to generate corresponding static libraries;
[0010] The static libraries and the resources obtained according to the resource paths are integrated to obtain an output library.
[0011] A static library packaging device, the device comprising:
[0012] An acquisition module, configured to acquire, in response to a packaging instruction, instruction configuration information corresponding to the packaging instruction;
[0013] A determination module, used to determine the code files and resource paths of each library to be packaged according to the instruction configuration information;
[0014] A compilation module, used to compile the code files of the libraries to be packaged in parallel to generate corresponding static libraries;
[0015] The integration module is used to integrate the static libraries and the resources obtained according to the resource paths to obtain an output library.
[0016] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0017] In response to a packaging instruction, obtaining instruction configuration information corresponding to the packaging instruction;
[0018] Determine the code files and resource paths of each library to be packaged according to the instruction configuration information;
[0019] Compile the code files of the libraries to be packaged in parallel to generate corresponding static libraries;
[0020] The static libraries and the resources obtained according to the resource paths are integrated to obtain an output library.
[0021] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0022] In response to a packaging instruction, obtaining instruction configuration information corresponding to the packaging instruction;
[0023] Determine the code files and resource paths of each library to be packaged according to the instruction configuration information;
[0024] Compile the code files of the libraries to be packaged in parallel to generate corresponding static libraries;
[0025] The static libraries and the resources obtained according to the resource paths are integrated to obtain an output library.
[0026] The above-mentioned static library packaging method, device, computer equipment and storage medium respond to the packaging instruction and obtain the instruction configuration information corresponding to the packaging instruction; determine the code file and resource path of each library to be packaged according to the instruction configuration information; compile the code files of each library to be packaged in parallel to generate the corresponding static library; integrate each static library and the resources obtained according to each resource path to obtain the output library. Accordingly, multiple static libraries can be packaged simultaneously through parallel compilation, solving the time-consuming problem caused by the process packaging of multiple static libraries in traditional technology, improving the overall packaging efficiency, and providing configuration and customization functions, with high reusability and scalability. Developers can configure instruction information based on packaging requirements and complete the packaging work by initiating packaging instructions. There is no need to worry about how to compile and how to integrate resources, and one-click delivery can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 An application environment diagram of a static library packaging method in an embodiment;
[0028] Figure 2 A schematic diagram of a static library packaging method in one embodiment;
[0029] Figure 3 is a schematic diagram of a traditional compilation process in one embodiment;
[0030] Figure 4 is a schematic diagram of a parallel compilation process in one embodiment;
[0031] Figure 5 A schematic diagram of standardizing instruction configuration information in one embodiment;
[0032] Figure 6 A schematic diagram of a Podfile file in one embodiment;
[0033] Figure 7 is a schematic diagram of a standardized Podspec file in one embodiment;
[0034] Figure 8 is a schematic diagram of a standard output library in one embodiment;
[0035] Fig. 9 A schematic diagram of the file structure in a project before packaging in one embodiment;
[0036] Fig.10 A schematic diagram of the file structure in a folder before packaging in one embodiment;
[0037] Fig.11 A schematic diagram of the file structure in a folder after packaging in one embodiment;
[0038] Fig.12A schematic diagram of a custom conversion script in one embodiment;
[0039] Fig.13 A schematic diagram of a static library packaging method in one embodiment;
[0040] Fig.14 It is a structural block diagram of a static library packaging device in one embodiment;
[0041] Fig.15 is an internal structure diagram of a computer device in one embodiment;
[0042] Fig.16 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] The static library packaging method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. Developers can access the software development platform through the terminal 102, and the server 104 can be the server where the platform is located. The static library packaging method can be applied to a terminal installed with a software development platform, or to a server where the platform is located, or to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a laptop, a desktop computer, an intelligent speaker, a smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected by wired or wireless communication, and this application is not limited here.
[0045] In one embodiment, Figure 2 As shown, a static library packaging method is provided, which is applied to Figure 1 Taking the terminal in as an example, the method includes the following steps S202 to S208.
[0046] S202, in response to the packing instruction, obtaining instruction configuration information corresponding to the packing instruction.
[0047] The packaging instruction indicates the instruction that triggers the packaging operation, and the instruction configuration information indicates the detailed information of the instruction to be executed in the packaging operation. Packaging can be understood as the process of compiling code into a static library, and the static library can be understood as a binary file package compiled from the source code. During the project development process, a project can contain multiple component libraries, such as login components, encryption components, push components, hot fix components, cloud instruction components, etc. Many components are functionally coupled to each other. Usually, all component source codes are integrated into one project for unified development and debugging. When delivered, they need to be packaged into static libraries, so the component source code needs to be packaged.
[0048] During implementation, developers can set instruction configuration information based on customized packaging requirements, and then initiate packaging instructions. After receiving the packaging instructions, the terminal automatically executes the packaging process based on the instruction configuration information, without the need for developers to participate manually.
[0049] S204, determining the code files and resource paths of each library to be packaged according to the instruction configuration information.
[0050] The library to be packaged indicates the component library that needs to be packaged. The library to be packaged can be all the component libraries in the project, which means full packaging. The library to be packaged can also be some customized component libraries, which means incremental packaging. The code file and resource path can be obtained from the configuration file of the library to be packaged. For example, in a CocoaPods project, the Podspec file is used to configure the configuration information of the component library, including the files, resources, dependencies, and basic information of the component library.
[0051] S206, compile the code files of the libraries to be packaged in parallel to generate corresponding static libraries.
[0052] Compilation converts code files into binary files, which can be easily delivered without causing source code leakage. Parallel compilation refers to the use of multi-threaded methods to compile multiple libraries that need to be compiled simultaneously, without waiting for the previous library to be compiled before compiling the next library, thus reducing compilation time.
[0053] For example, in a CocoaPods project, the Xcode (development tool) command line instruction "xcodebuild" is used for compilation. Traditional Xcode can only complete full compilation. If you only want to compile a few libraries, you need to wait for a long time. Figure 3 As shown in FIG. 1 , a schematic diagram of a traditional compilation process is shown. After obtaining a specific library to be compiled, this embodiment uses a multi-threaded environment to concurrently implement incremental compilation, such as Figure 4As shown, a schematic diagram of the parallel compilation process of this embodiment is shown. In addition, the delivery version generally needs to be compatible with 4 architectures: x86_64, i386, armv7s, arm64. Traditional Xcode compilation requires full compilation twice: simulator (x86_64, i386) + real machine (armv7s, arm64), while this embodiment, due to the multi-threaded approach, only needs to concurrently complete the entire process at one time, which can greatly improve the overall compilation performance.
[0054] S208, integrating the static libraries and the resources obtained according to the resource paths to obtain an output library.
[0055] After the compilation is completed, the compiled content is integrated and packaged to obtain the final output library. Since all the resources that need to be delivered may be scattered in various locations after compilation, the resources can be obtained according to the resource path determined in the previous steps, and the obtained resources can be copied and integrated in batches.
[0056] In the above static library packaging method, multiple static libraries can be packaged simultaneously through parallel compilation, which solves the time-consuming problem caused by the process-based packaging of multiple static libraries in traditional technology and improves the overall packaging efficiency. At the same time, it provides configuration and customization functions, and has high reusability and scalability. Developers can configure instruction information based on packaging requirements and complete the packaging work by initiating packaging instructions. There is no need to worry about how to compile and how to integrate resources, and one-click delivery can be achieved.
[0057] In one embodiment, the steps of determining the code files and resource paths of each library to be packaged according to the instruction configuration information may specifically include the following steps: standardizing the instruction configuration information in the form of key-value pairs to obtain the keys associated with the instruction configuration information and their corresponding values; determining the code files and resource paths of each library to be packaged according to the keys associated with the instruction configuration information and their corresponding values.
[0058] The instruction configuration information may specifically include the instruction symbol of the instruction to be executed, and may also include specific parameters corresponding to the instruction symbol. After obtaining the instruction configuration information, you can first check whether it is legal. After the check passes, use regular matching to obtain the detailed information of each instruction and convert it into a more readable file (such as a JSON file), and store it locally. Specifically, the instruction configuration information is standardized in the form of key-value pairs (Key-Value) to obtain the key (Key) associated with the instruction configuration information and its corresponding value (Value). The mapping relationship between instruction symbols and keys can be established in advance, and the key associated with the instruction configuration information is the key corresponding to the instruction symbol contained in the instruction configuration information.
[0059] like Figure 5As shown, a schematic diagram of standardizing instruction configuration information in one embodiment is provided. For example, the instruction configuration information input by the developer is shown as follows: py package.py -s "TargetA TargetB" -w "xxx / xxxx" -l, where the instruction symbol "-s" represents the name of the library to be incrementally packaged, and the corresponding Key is represented by "Target", and -s "TargetA TargetB" is represented as "Target:A,B" after standardization; the instruction symbol "-w" represents the project path, and the corresponding Key is represented by "Path", and -w "xxx / xxxx" is represented as "Path:xxx / xxxx" after standardization; the instruction symbol "-l" represents turning on the log, and the corresponding Key is represented by "LogEnable", and -l is represented as "LogEnable:true" after standardization. Accordingly, the developer can complete the instruction input by entering the corresponding instruction symbols and parameters, and can customize the packaging requirements through different instruction combinations, and realize personalized packaging configuration without modifying the code.
[0060] In this embodiment, by standardizing the instruction configuration information and using a unified data format as the data transmission medium in each link, it is beneficial to quickly extract the required information and improve the packaging efficiency.
[0061] In one embodiment, the step of determining the code file and resource path of each to-be-packaged library according to the keys associated with the instruction configuration information and their corresponding values may specifically include the following steps: determining a first key corresponding to the identifier of the to-be-packaged library in the keys associated with the instruction configuration information, and determining the identifier of each to-be-packaged library according to the value corresponding to the first key; determining a second key corresponding to the path of the to-be-packaged library in the keys associated with the instruction configuration information, and determining the path of each to-be-packaged library according to the value corresponding to the second key; and obtaining the code file and resource path of each to-be-packaged library according to the identifier and path of each to-be-packaged library.
[0062] The identifier of the library to be packaged is used to indicate which libraries need to be packaged. When the instruction configuration information includes an incremental packaging instruction, the identifier of the library to be packaged can specifically refer to the name of the library to be packaged. For example, the -s "TargetATargetB" in the aforementioned embodiment is expressed as "Target:A,B" after standardization, indicating that there are two libraries to be packaged, named "A" and "B" respectively. When the instruction configuration information includes a full packaging instruction, the identifier of the library to be packaged can specifically refer to the names of all libraries in the current project. For example, the instruction configuration information contains the instruction symbol "-a" representing full packaging, which is expressed as "All:true" after standardization, indicating that the library to be packaged is all the libraries in the current project.
[0063] The path of the library to be packaged is used to indicate where the file information of the library to be packaged can be obtained. The path of the library to be packaged can be the path entered by the developer or the current directory. When the instruction configuration information contains an input path instruction, the path of the library to be packaged can specifically refer to the input path. For example, -w "xxx / xxxx" in the aforementioned embodiment is standardized as "Path:xxx / xxxx", indicating that the code warehouse path where the library to be packaged is located is "xxx / xxxx", and the code warehouse path is used as the path of each library to be packaged. When there is no input path instruction in the instruction configuration information, the path of the library to be packaged can specifically refer to the current directory, and the current directory location is used as the path of each library to be packaged.
[0064] In this embodiment, considering the diversity of packaging environments, the developer is provided with the ability to customize the packaging input path, so that the developer can specify the packaged path through specific instructions. In addition, after obtaining the input path, the path conversion can also be performed to convert the input path into an absolute path. For example, the developer inputs the path ".. / Demo / Frameworks", and the input path is converted to obtain the absolute path " / Users / xxx / Desktop / Demo / Tools / .. / Demo / Frameworks".
[0065] In one embodiment, before determining the code files and resource paths of each library to be packaged based on the keys associated with the instruction configuration information and their corresponding values, the following steps are also included: when it is detected that the keys associated with the instruction configuration information contain a third key corresponding to the code update instruction, the code of each library to be packaged is updated.
[0066] The code update instruction is used to instruct code updates. This is because the local repository code may not be the latest code when the developer performs packaging, so the code update instruction is provided. Specifically, the code update instruction is represented by the instruction symbol "-o", and its corresponding key is represented by "Pod". When the key associated with the instruction configuration information contains "Pod", it can be considered that the third key corresponding to the code update instruction is detected, and the code of each library to be packaged is updated. Specifically, the code can be updated through the built-in instruction "Pod update" of CocoaPods.
[0067] In one embodiment, after obtaining the instruction configuration information, the instruction configuration information can also be stored to achieve fast packaging capability. The next time, the packaging operation can be completed with one click by directly reading the historical instruction configuration information, which is suitable for pipeline processes.
[0068] In one embodiment, the step of obtaining the code file and resource path of each library to be packaged according to the identification and path of each library to be packaged may include the following steps: obtaining the configuration file information of each library to be packaged according to the identification and path of each library to be packaged; standardizing each configuration file information in the form of a key-value pair to obtain the key associated with each configuration file information and its corresponding value; obtaining the code file and resource path of each library to be packaged according to the key associated with each configuration file information and its corresponding value.
[0069] After obtaining the identifier and path of each library to be packaged, you can obtain the code repository configuration file where each library to be packaged is located. In the CocoaPods project, use the Podfile file to configure the configuration information of the code repository, including all library names and path indexes in the code repository. Figure 6 As shown, a schematic diagram of the Podfile file in an embodiment is provided, which includes information such as index libraries. These index libraries are saved in the CocoaPods project in the form of Target. The ipc command provided by CocoaPods can be used to convert the Podfile information into a more readable JSON file, and then extract specific fields in the Podfile-JSON file to obtain all Target information, and then obtain the configuration file information of each library to be packaged.
[0070] In the CocoaPods project, the Podspec file is used to configure the configuration information of the component library. The Podspec file information is parsed and converted in the Key-Value format into a more readable JSON file, and then important information such as the required resource path is extracted through a specific Key. Figure 7 As shown, a schematic diagram of a standardized Podspec file in an embodiment is provided, wherein the vendored_libraries / frameworks / headers / resources and other information (including dependent libraries, header files, index resource information) contained therein represent the content that needs to be integrated after packaging. By recursively traversing all JSON files and obtaining specific keys such as vendored_libraries / frameworks / headers / resources, all resource items are integrated into the index array in the memory.
[0071] In one embodiment, the step of integrating the static libraries and the resources obtained according to the resource paths to obtain the output library may specifically be integrating the static libraries and the resources obtained according to the resource paths according to a standardized format to obtain the output library.
[0072] like Figure 8As shown, a schematic diagram of a standard output library in an embodiment is provided, which includes the following contents: library configuration (Podspec), protocol (LICENSE), header file (Headers), binary library (Libraries), and library index resource (Resources). After compilation, all resources may not be integrated according to the format of the output package, but scattered in various locations. Therefore, the index array corresponding to the resource item can be used to obtain all index resource file paths through regular matching, and batch copy operations can be performed on the resources to ensure that the resources are automatically integrated into the fixed file package. Figure 9-11 FIG. 1 shows a schematic diagram of file structure changes before and after packaging in an embodiment, wherein: Fig. 9 A schematic diagram of the file structure in a project before packaging in one embodiment is shown. Fig.10 A schematic diagram of the file structure in a folder before packaging in one embodiment is shown. Fig.11 A schematic diagram of the file structure in a folder after packaging in one embodiment is shown. Fig.11 correspond Figure 8 The output library structure for delivery.
[0073] In one embodiment, after integrating the static libraries and the resources obtained according to the resource paths in a standardized format to obtain the output library, the following steps are also included: when a custom conversion script is detected, the custom conversion script is executed to perform personalized conversion on the standardized output library.
[0074] The custom conversion script is used to convert the standardized output library into a personalized one. Considering that not all output libraries need to be output in a standardized form, this embodiment supports personalized configuration optimization, such as Fig.12 As shown, a schematic diagram of a custom conversion script in an embodiment is provided. After completing the standardized packaging, the script instructions are executed in the form of an embedded script to perform personalized transformation on the standardized output library, thereby completing the process packaging without the need for secondary operations.
[0075] In one embodiment, when it is detected that the key associated with the instruction configuration information contains a fourth key corresponding to the output path, the target output path of the output library is determined according to the value corresponding to the fourth key; after the static libraries and the resources obtained according to each resource path are integrated to obtain the output library, all the contents of the static library are copied to the target output path.
[0076] In this embodiment, the developer is provided with the ability to customize the package output path, so that the developer can specify the target output path of the output library through a specific instruction. Specifically, the instruction symbol "-e" is used to represent the output path, and the corresponding Key is represented by "Export". When the key associated with the instruction configuration information contains "Export", it can be considered that the fourth key corresponding to the output path is detected. Then, after the output library is integrated, all the contents of the output library are copied to the output path specified by the developer, and a prompt message is issued to remind the developer that the output of the output library has been completed.
[0077] In one embodiment, Fig.13 As shown, a static library packaging method applied to a CocoaPods project is provided, including the following steps S1301 to S1312.
[0078] S1301, in response to a packing instruction, obtaining instruction configuration information corresponding to the packing instruction.
[0079] S1302, standardize the instruction configuration information in the form of key-value pairs to obtain the keys associated with the instruction configuration information and their corresponding values.
[0080] S1303, determine whether the keys associated with the instruction configuration information include a third key corresponding to the code update instruction, if so, proceed to step S1304, if not, proceed to step S1305.
[0081] S1304, execute pod update to update the warehouse code.
[0082] S1305, determining whether the keys associated with the instruction configuration information include a second key corresponding to the input path, if so, proceeding to step S1306, if not, proceeding to step S1307.
[0083] S1306: Determine the input path according to the value corresponding to the second key, and convert the input path into an absolute path.
[0084] S1307, converting to an absolute path according to the current directory.
[0085] S1308, determine whether the key associated with the instruction configuration information contains a key corresponding to the full packaging instruction, if so, go to step S1309, if not, go to step S1310.
[0086] S1309, parse the Podfile file, search for all library Targets, parse all library Podspec files, and obtain all dependent resources of the current library.
[0087] S1310, determining a first key corresponding to the incremental packaging instruction in the keys associated with the instruction configuration information, and determining the name of each to-be-packaged library according to a value corresponding to the first key.
[0088] S1311, parse the Podfile file, search for the corresponding library Target according to the name of each library to be packaged, parse the corresponding library Podspec file, and obtain all dependent resources of each library to be packaged.
[0089] S1312, Multi-threaded execution of xcodebuild compilation.
[0090] S1313, integrating the compiled content and all dependent resources according to a standardized format to obtain an output library.
[0091] S1314, determine whether there is a custom conversion script, if so, go to step S1315, if not, go to step S1316.
[0092] S1315, executing a custom conversion script to convert the output library in a standardized format into an output library in a custom format.
[0093] S1316, determine whether the keys associated with the instruction configuration information include the fourth key corresponding to the output path, if so, proceed to step S1317.
[0094] S1317, determining a target output path according to the value corresponding to the fourth key, and copying all the contents of the output library to the target output path.
[0095] For the specific description of steps S1301 to S1317, please refer to the previous embodiments, which will not be repeated here. The above embodiments provide a simple-to-use, customizable one-click packaging tool, which provides a variety of different user instructions to customize packaging requirements, can complete the packaging of multiple static libraries at the same time, and can personalize the packaging configuration without modifying the code. In addition, the standard information transmission format is used to complete the extraction and storage of specific information before compilation, and the compilation is optimized by taking advantage of the multi-threading advantage, compressing the time-consuming entire packaging process, improving the compilation performance, and integrating and packaging the compiled content to achieve standardized or personalized output. Thus, from before compilation to after compilation, it supports the compilation and packaging process of integrating the middle platform components, has high reusability and scalability, can improve the development and output efficiency of the middle platform components, and can also be applied to pipeline construction such as Blue Shield to form an automated process.
[0096] It should be understood that, although the steps in each flow chart involved in the above-described embodiment are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a portion of the steps in each flow chart involved in the above-described embodiment may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0097] In one embodiment, Fig.14 As shown, a static library packaging device 1400 is provided. The device can adopt a software module or a hardware module, or a combination of the two to become a part of a computer device. The device specifically includes: an acquisition module 1410, a determination module 1420, a compilation module 1430 and an integration module 1440, wherein:
[0098] The acquisition module 1410 is used to obtain instruction configuration information corresponding to the packaging instruction in response to the packaging instruction.
[0099] The determination module 1420 is used to determine the code files and resource paths of each library to be packaged according to the instruction configuration information.
[0100] The compiling module 1430 is used to compile the code files of each library to be packaged in parallel to generate a corresponding static library.
[0101] The integration module 1440 is used to integrate the static libraries and the resources obtained according to the resource paths to obtain an output library.
[0102] In one embodiment, when determining the code files and resource paths of each library to be packaged based on the instruction configuration information, the determination module 1420 is specifically used to: standardize the instruction configuration information in the form of key-value pairs to obtain the keys associated with the instruction configuration information and their corresponding values; determine the code files and resource paths of each library to be packaged based on the keys associated with the instruction configuration information and their corresponding values.
[0103] In one embodiment, when determining the code files and resource paths of each library to be packaged according to the keys associated with the instruction configuration information and their corresponding values, the determination module 1420 is specifically used to: determine the first key corresponding to the identifier of the library to be packaged in the keys associated with the instruction configuration information, and determine the identifier of each library to be packaged according to the value corresponding to the first key; determine the second key corresponding to the path of the library to be packaged in the keys associated with the instruction configuration information, and determine the path of each library to be packaged according to the value corresponding to the second key; obtain the code files and resource paths of each library to be packaged according to the identifier and path of each library to be packaged.
[0104] In one embodiment, the device further includes an updating module, which is used to update the code of each library to be packaged when it is detected that the key associated with the instruction configuration information contains a third key corresponding to the code update instruction.
[0105] In one embodiment, when the determination module 1420 obtains the code file and resource path of each library to be packaged according to the identification and path of each library to be packaged, it is specifically used to: obtain the configuration file information of each library to be packaged according to the identification and path of each library to be packaged; standardize each configuration file information in the form of a key-value pair to obtain the key associated with each configuration file information and its corresponding value; obtain the code file and resource path of each library to be packaged according to the key associated with each configuration file information and its corresponding value.
[0106] In one embodiment, when integrating the static libraries and the resources obtained according to the resource paths to obtain the output library, the integration module 1440 is specifically used to integrate the static libraries and the resources obtained according to the resource paths according to the standardized format to obtain the output library. The device also includes a conversion module, which is used to execute the custom conversion script when a custom conversion script is detected to perform personalized conversion on the standardized output library.
[0107] In one embodiment, the determination module 1420 is further configured to determine the target output path of the output library according to the value corresponding to the fourth key when it is detected that the keys associated with the instruction configuration information include a fourth key corresponding to the output path. The device also includes a directional output module, configured to copy all contents of the output library to the target output path.
[0108] For the specific definition of the static library packaging device, please refer to the definition of the static library packaging method above, which will not be repeated here. Each module in the above-mentioned static library packaging device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0109] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.15 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a static library packaging method is implemented.
[0110] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.16 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a static library packaging method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0111] Those skilled in the art will understand that Fig.15 or Fig.16 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0112] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0113] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0114] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.
[0115] It should be understood that the terms "first", "second", etc. in the above embodiments are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. In addition, in the description of this application, unless otherwise specified, the meaning of "multiple" refers to at least two.
[0116] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0117] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0118] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A static library packaging method, characterized in that: The method comprises: In response to a packaging instruction, obtaining instruction configuration information corresponding to the packaging instruction; Standardize the instruction configuration information in a key-value pair format to obtain a key associated with the instruction configuration information and a corresponding value thereof; Determine a first key corresponding to the identifier of the library to be packaged in the keys associated with the instruction configuration information, and determine the identifier of each library to be packaged according to the value corresponding to the first key; the library to be packaged represents a component library that needs to be packaged; If the key associated with the instruction configuration information includes a second key corresponding to the input path, the input path is determined according to the value corresponding to the second key, and the input path is converted into an absolute path as the path of each of the libraries to be packaged; If the key associated with the instruction configuration information does not include the second key corresponding to the input path, converting the path into an absolute path according to the current directory as the path of each of the libraries to be packaged; According to the identifier and path of each library to be packaged, obtain the configuration file information of each library to be packaged; the configuration file information includes the library name and path index of the library to be packaged; Standardizing each of the configuration file information in a key-value pair format to obtain a key associated with each of the configuration file information and a corresponding value thereof; According to the keys associated with each of the configuration file information and their corresponding values, the code files and resource paths of each of the libraries to be packaged are obtained; Compile the code files of the libraries to be packaged in parallel to generate corresponding static libraries; Integrate the static libraries and the resources obtained according to the resource paths to obtain an output library; The integration process includes: using the index array corresponding to the resource item, obtaining all index resource file paths through regular matching, copying the resources, and automatically integrating the resources into a fixed file package.
2. The method according to claim 1, characterized in that Before obtaining the code files and resource paths of each library to be packaged, it also includes: When it is detected that the keys associated with the instruction configuration information include a third key corresponding to the code update instruction, code update is performed on each of the libraries to be packaged.
3. The method according to claim 1 or 2, characterized in that: Integrating the static libraries and the resources obtained according to the resource paths to obtain an output library, including: integrating the static libraries and the resources obtained according to the resource paths according to a standardized format to obtain an output library; After integrating the static libraries and the resources obtained according to the resource paths in a standardized format to obtain an output library, the method further includes: When a custom conversion script is detected, the custom conversion script is executed to perform personalized conversion on the standardized output library.
4. The method according to claim 1, characterized in that: Also includes: When it is detected that the keys associated with the instruction configuration information include a fourth key corresponding to an output path, determining a target output path of the output library according to a value corresponding to the fourth key; After integrating the static libraries and the resources obtained according to the resource paths to obtain the output library, the process further includes: copying all the contents of the output library to the target output path.
5. A static library packaging device, characterized in that: The device comprises: An acquisition module, configured to acquire, in response to a packaging instruction, instruction configuration information corresponding to the packaging instruction; A determination module, used to standardize the instruction configuration information in the form of key-value pairs, obtain the keys associated with the instruction configuration information and their corresponding values; determine the first key corresponding to the identifier of the library to be packaged in the keys associated with the instruction configuration information, and determine the identifier of each library to be packaged according to the value corresponding to the first key; if the keys associated with the instruction configuration information contain the second key corresponding to the input path, determine the input path according to the value corresponding to the second key, and convert it into an absolute path according to the input path as the path of each library to be packaged; if the keys associated with the instruction configuration information do not contain the second key corresponding to the input path, convert it into an absolute path according to the current directory as the path of each library to be packaged; obtain the configuration file information of each library to be packaged according to the identifier and path of each library to be packaged; standardize the configuration file information in the form of key-value pairs, obtain the keys associated with each configuration file information and their corresponding values; obtain the code file and resource path of each library to be packaged according to the keys associated with each configuration file information and their corresponding values; the library to be packaged represents a component library that needs to be packaged; the configuration file information includes the library name and path index of the library to be packaged; A compilation module, used to compile the code files of the libraries to be packaged in parallel to generate corresponding static libraries; An integration module, used to integrate the static libraries and the resources obtained according to the resource paths to obtain an output library; The integration process includes: using the index array corresponding to the resource item, obtaining all index resource file paths through regular matching, copying the resources, and automatically integrating the resources into a fixed file package.
6. The device according to claim 5, characterized in that The device also includes an updating module, which is used to: When it is detected that the keys associated with the instruction configuration information include a third key corresponding to the code update instruction, code update is performed on each of the libraries to be packaged.
7. The device according to claim 5 or 6, characterized in that When the integration module integrates the static libraries and the resources obtained according to the resource paths to obtain the output library, it is specifically used to: integrate the static libraries and the resources obtained according to the resource paths according to the standardized format to obtain the output library; The device also includes a conversion module, which is used to execute the custom conversion script when a custom conversion script is detected, and perform personalized conversion on the standardized output library.
8. The device according to claim 5, characterized in that The determination module is further configured to determine the target output path of the output library according to a value corresponding to the fourth key when it is detected that the keys associated with the instruction configuration information include a fourth key corresponding to the output path; The device also includes a directional output module, which is used to copy all the contents of the output library to the target output path.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Method, apparatus, computer device and readable storage medium for generating static library
CN109144521A
Application program packaging method and device, storage medium and terminal
CN109683950A