Data processing method and device for dependency manager
By obtaining and utilizing the minimum deployment unit mode total switch variable value in the dependency manager, the problem of low development efficiency is solved, fast and accurate library management and integration is achieved, and the development process is simplified. .
Patent Information
- Application Number
- CN202411143340.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, in mobile operating systems, the development efficiency of dependency managers is inefficient, especially when switching between the binary and source code of the Pod library, complex plug-in development and code changes are required, resulting in difficulty in debugging.
By obtaining the minimum deployment unit mode total switch variable value when loading the specification file of the dependency manager, automatically starting the binary or source code mode, and loading the corresponding library according to the mode version number, the version switching process is simplified and code changes are reduced.
Improves the development efficiency and accuracy of the dependency manager, allowing developers to easily add, update and delete third-party libraries, avoid manual downloads and integrations, save time and reduce the possibility of errors.
Smart Images

Figure CN119127169A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer development technology, and more specifically, to a data processing method and device for a dependency manager. Background Art
[0002] In the process of compiling and optimizing in the mobile operating system (IOS) industry, a minimum deployment unit (Pod) binary solution is used, the purpose of which is to make the Pod library in source code form into a binary framework library. In this way, by integrating the binary framework of the corresponding Pod, the compilation speed can be accelerated during compilation, thus achieving the purpose of compiling optimization.
[0003] However, this Pod binary solution brings a problem. Sometimes when debugging the Pod library, the Pod needs to be integrated into the project in the form of source code, but the binary framework library cannot be debugged, which brings difficulties to daily development and debugging.
[0004] The prior art is to dynamically switch between the binary version and the source version of the CocoaPods Pod component library by creating a dependency manager (CocoaPods) plug-in and configuring data. However, this method relies on the development of the CocoaPods plug-in, the change of the Pod command, and the storage of configuration data. This method is complex to use and requires a large number of code changes, resulting in low development efficiency for the dependency manager.
[0005] Therefore, how to improve the development efficiency of the dependency manager is an urgent problem to be solved in this application. Summary of the invention
[0006] In view of this, the present application discloses a data processing method and device for a dependency manager, aiming to improve the efficiency and accuracy of development for the dependency manager.
[0007] In order to achieve the above purpose, the disclosed technical solution is as follows:
[0008] In a first aspect, the present application discloses a data processing method for a dependency manager, the method comprising:
[0009] In the process of loading the specification file of the dependency manager, obtain the total switch variable value of the current minimum deployment unit mode;
[0010] According to the total switch variable value of the current minimum deployment unit mode, start the corresponding mode; the mode includes a binary mode or a source code mode of the global minimum deployment unit;
[0011] If the startup mode is the binary mode, obtain the version number corresponding to the binary mode, and load the minimum deployment unit library according to the version number corresponding to the binary mode;
[0012] If the startup mode is the source code mode, obtain the independent configuration switch value of the current minimum deployment unit component library;
[0013] A corresponding version number is determined according to the independent configuration switch value, and a minimum deployment unit library is loaded according to the corresponding version number determined according to the independent configuration switch value.
[0014] Preferably, in the process of loading the specification file of the dependency manager, obtaining the total switch variable value of the current minimum deployment unit mode includes:
[0015] Enter the project folder through the command terminal and execute the update minimum deployment unit library command of the dependency manager;
[0016] The updating minimum deployment unit library command triggers the loading of the specification file of the dependency manager in the engineering project folder to obtain the total switch variable value of the current minimum deployment unit mode.
[0017] Preferably, starting the corresponding mode according to the total switch variable value of the current minimum deployment unit mode includes:
[0018] If the total switch variable value of the current minimum deployment unit mode is 1, the binary mode of the global minimum deployment unit is started through the minimum deployment unit library in the minimum deployment unit version configuration table;
[0019] If the total switch variable value of the current minimum deployment unit mode is 0, the source code mode of the global minimum deployment unit is started through the minimum deployment unit library in the minimum deployment unit version configuration table.
[0020] Preferably, if the startup mode is the binary mode, obtaining the version number corresponding to the binary mode, and loading the minimum deployment unit library according to the version number corresponding to the binary mode, includes:
[0021] If the startup mode is the binary mode, obtain the version number of the binary inheritance mode of the current minimum deployment unit component;
[0022] The minimum deployment unit library is loaded according to the version number of the current minimum deployment unit component binary inheritance mode.
[0023] Preferably, the determining a corresponding version number according to the independent configuration switch value, and loading a minimum deployment unit library according to the independent configuration switch value, includes:
[0024] If the independent configuration switch value is 1, determine that the corresponding version number is the binary version number of the binary integration mode of the current minimum deployment unit component library, and load the minimum deployment unit library according to the binary version number;
[0025] If the independent configuration switch value is 0, the corresponding version number is determined to be the source code version number of the source code integration mode of the current minimum deployment unit component library, and the minimum deployment unit library is loaded according to the source code version number.
[0026] A second aspect of the present application discloses a data processing device for a dependency manager, the device comprising:
[0027] A first acquisition unit is used to acquire the total switch variable value of the current minimum deployment unit mode during the process of loading the specification file of the dependency manager;
[0028] A startup unit, used to start a corresponding mode according to the total switch variable value of the current minimum deployment unit mode; the mode includes a binary mode or a source code mode of the global minimum deployment unit;
[0029] A second acquisition unit is used to acquire a version number corresponding to the binary mode if the startup mode is the binary mode, and load the minimum deployment unit library according to the version number corresponding to the binary mode;
[0030] A third acquisition unit is used to acquire the independent configuration switch value of the current minimum deployment unit component library if the startup mode is the source code mode;
[0031] A determination unit is used to determine a corresponding version number according to the independent configuration switch value, and load a minimum deployment unit library according to the corresponding version number determined according to the independent configuration switch value.
[0032] Preferably, the first acquisition unit includes:
[0033] The execution module is used to enter the project folder through the command terminal and execute the update minimum deployment unit library command of the dependency manager;
[0034] The trigger acquisition module is used to trigger the loading of the specification file of the dependency manager under the engineering project folder through the update minimum deployment unit library command to obtain the total switch variable value of the current minimum deployment unit mode.
[0035] Preferably, the starting unit comprises:
[0036] A first startup module, configured to start the binary mode of the global minimum deployment unit through the minimum deployment unit library in the minimum deployment unit version configuration table if the value of the total switch variable of the current minimum deployment unit mode is 1;
[0037] The second startup module is used to start the source code mode of the global minimum deployment unit through the minimum deployment unit library in the minimum deployment unit version configuration table if the value of the total switch variable of the current minimum deployment unit mode is 0.
[0038] Preferably, the second acquisition unit includes:
[0039] An acquisition module, used for acquiring the version number of the binary inheritance mode of the current minimum deployment unit component if the startup mode is the binary mode;
[0040] The loading module is used to load the minimum deployment unit library according to the version number of the binary inheritance mode of the current minimum deployment unit component.
[0041] Preferably, the determining unit includes:
[0042] A first determination module is used to determine, if the value of the independent configuration switch is 1, that the corresponding version number is a binary version number of the binary integration mode of the current minimum deployment unit component library, and load the minimum deployment unit library according to the binary version number;
[0043] The second determination module is used to determine that if the independent configuration switch value is 0, its corresponding version number is the source code version number of the source code integration method of the current minimum deployment unit component library, and load the minimum deployment unit library according to the source code version number.
[0044] Through the above technical scheme, it can be known that the present application discloses that in the process of loading the specification file of the dependency manager, in the process of loading the specification file of the dependency manager, the total switch variable value of the current minimum deployment unit mode is obtained, and the corresponding mode is started according to the total switch variable value of the current minimum deployment unit mode, the mode includes the binary mode or source code mode of the global minimum deployment unit, if the started mode is the binary mode, the version number corresponding to the binary mode is obtained, and the minimum deployment unit library is loaded according to the version number corresponding to the binary mode, if the started mode is the source code mode, the independent configuration switch value of the current minimum deployment unit component library is obtained, the corresponding version number is determined according to the independent configuration switch value, and the minimum deployment unit library is loaded according to the corresponding version number determined according to the independent configuration switch value. Through the above scheme, in the process of the user switching the source code and binary of the minimum deployment unit version, there is no need to make a large number of code changes, only through the global switch, that is, through a small amount of code of the total switch variable value of the current minimum deployment unit mode, one-click configuration of the minimum deployment unit component library that the current project depends on is the source code version or the binary version, the corresponding mode is started through the total switch variable value of the current minimum deployment unit mode, and the minimum deployment unit library is loaded according to the version number corresponding to the mode. And in the process of loading the specification file of the dependency manager, the dependency manager allows developers to easily add, update, and delete third-party libraries in the project. By using the specification file of the dependency manager, developers can avoid manually downloading and integrating these libraries, thereby saving a lot of time and reducing the possibility of errors, improving the efficiency and accuracy of development for the dependency manager. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] 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.
[0046] Figure 1 A flowchart of a data processing method for a dependency manager disclosed in an embodiment of the present application;
[0047] Figure 2 A schematic diagram of the Pod version configuration table structure disclosed in an embodiment of the present application;
[0048] Figure 3 A flowchart of another data processing method for a dependency manager disclosed in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of the structure of a data processing device for a dependency manager disclosed in an embodiment of the present application;
[0050] Figure 5 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0051] 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.
[0052] 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.
[0053] As can be seen from the background technology, the prior art is to dynamically switch the binary version and source version of the CocoaPods Pod component library by making a dependency manager (CocoaPods) plug-in form and configuration data, but this method relies on the development of the CocoaPods plug-in, the change of the Pod command and the storage of configuration data. This method is complicated to use and requires a large number of code changes, resulting in low development efficiency for the dependency manager. Therefore, how to improve the development efficiency for the dependency manager is a problem that this application urgently needs to solve.
[0054] In order to solve the above problems, the present application discloses a data processing method and device for a dependency manager. In the process of switching the source code and binary of the minimum deployment unit version by the user, there is no need to make a large number of code changes. It only needs to use a global switch, that is, a small amount of code through the total switch variable value of the current minimum deployment unit mode, to configure the minimum deployment unit component library that the current project depends on as a source code version or a binary version with one click, and start the corresponding mode through the total switch variable value of the current minimum deployment unit mode, and load the minimum deployment unit library according to the version number corresponding to the mode. And in the process of loading the specification file of the dependency manager, the dependency manager allows developers to easily add, update and delete third-party libraries in the project. By using the specification file of the dependency manager, developers can avoid manually downloading and integrating these libraries, thereby saving a lot of time, reducing the possibility of errors, and improving the efficiency and accuracy of development for the dependency manager. The specific implementation method is specifically described through the following embodiments.
[0055] refer to Figure 1 As shown, a data processing method for a dependency manager disclosed in an embodiment of the present application is provided. The data processing method for a dependency manager mainly includes the following steps:
[0056] S101: In the process of loading the specification file of the dependency manager, the total switch variable value of the current minimum deployment unit (Pod) mode is obtained.
[0057] In S101, enter the project folder (Podfile) through the command terminal, execute the update Pod command of the dependency manager (cocoaPod), and trigger the loading of the specification file of the dependency manager under the project folder through the update Pod command to obtain the current Pod mode total switch variable value.
[0058] Pod commands include Pod update (update) commands or Pod installation (install) commands, etc.
[0059] By using specification files that load dependency managers, developers can avoid manually downloading and integrating these libraries, saving a lot of time and reducing the possibility of errors, improving the efficiency and accuracy of development for dependency managers.
[0060] In the process of loading the specification file of the dependency manager, before obtaining the total switch variable value of the current minimum deployment unit (Pod) mode, an initialization creation operation is required. The initialization creation operation includes establishing a Pod version configuration table, creating variable switches, and creating function functions.
[0061] Create a Pod version configuration table. The table structure of the Pod version configuration table is a hash map structure. Each key is the name of the Pod library. The configuration structure dictionary (PodsVerDict) contains two attribute fields [src] and [bin]. [src] is the source code version number, and [bin] is the binary link library version number. The specific structure of the Pod version configuration table is as follows Figure 2 shown.
[0062] Figure 2 In PodsVerMap, PodsVerMap is a dictionary object; Key is the name of the Pod that needs to be dependent in the project; Value is the dictionary object configured for the current Pod. There can be an unlimited number of Keys, but the uniqueness of the Key name must be guaranteed;
[0063] PodConfig is a Pod configuration dictionary object, which has a total of 3 keys ("src", "bin", "onl"), which are explained as follows:
[0064] "src" is the source code version of the current Pod component, and its corresponding Value value is the specific source code version number name.
[0065] "bin" is the binary library version of the current Pod component, and its corresponding Value is the specific binary version number name.
[0066] "onl" indicates whether the current Pod component uses the binary version. The corresponding values are "0" and "1". "0" represents the value of the source code version "src". "1" represents the value of the binary version "bin".
[0067] The execution script file "HLLUPodDepeLock.podspec" of this solution is used to store the Pod version configuration table of the CocoaPods Pod component that the current project depends on. The logic execution script file "PodHelp.rb" of this solution is used to execute the logical conditional processing of the configuration items.
[0068] With the help of the open source distributed version control system (GIT), the configuration information of the CocoaPods Pod components that the current project depends on can be saved and stored and managed along with the iterative versions released by the application. GIT is mainly used to manage source code files during the development process.
[0069] Without changing the usage of CocoaPods official tools, this solution can be developed using, including but not limited to, object-oriented programming scripting languages (ruby).
[0070] Create a global switch for the variable. When the Pod mode switch variable value is set to "1", the Pod library in the Pod version configuration table will use the Pod binary mode. When the Pod mode switch variable value is set to "0", the Pod source mode will be used. Provide a global switch. Through the current Pod mode switch variable value, you can configure the Pod component library that the current project depends on to be a source code version or a binary version with one click. This global switch has the highest priority and is mainly used for local debugging to enable all to reduce configuration costs. If the current variable switch is in source code mode, the Pod library will use the value in the "src" field. If the current variable switch is in binary mode, the Pod library will use the value in the "bin" field. If you need to control a Pod library separately in source code or / binary mode, you can manually change the value to the version you need to set, so that you can control a Pod library separately in source code mode or binary mode.
[0071] CocoaPods first reads the Podfile file in the root directory of the project. This file defines the detailed dependencies of the project (current project) on the Pod component library, including the third-party libraries that need to be integrated and their version requirements.
[0072] Create a function, which is used to customize the dependency configuration and Pod dependency rule description, and lock the version into the function for processing.
[0073] To help you understand the rules for configuring Pod dependencies for custom dependencies, we will use a code example to illustrate the process of locking the version inside the function:
[0074] #Integration dependent Pod name
[0075] #Define method name: dependency
[0076] #Define parameter specObj: current CocoaPod execution object
[0077] #Define parameter PodName: the name of the Pod component that currently needs to be configured
[0078] defdependency(specObj,PodName)
[0079] PodTag=self.getPodTag(PodName)
[0080] specObj.dependency("#{PodName}","#{PodTag}")
[0081] puts"\033[31m>>>#{PodName}#{PodTag}\033[0m\n"
[0082] end
[0083] #Get the version tag name corresponding to the Pod.
[0084] defgetPodTag(Pod_name)
[0085] tagKey = 'src'
[0086] if$needUseBinary
[0087] tagKey="bin"
[0088] else
[0089] tagKey="src"
[0090] end
[0091] begin
[0092] needOnline=@PodsVerDict[Pod_name]["onl"]
[0093] if$PublishMode andneedOnline=='1'
[0094] tagKey="bin"
[0095] end
[0096] retVal=@PodsVerDict[Pod_name][tagKey]
[0097] rescue
[0098] raise"!!!Error:[#{Pod_name}]PodTag cannot be found, please check whether it is configured correctly."
[0099] end
[0100] returnretVal
[0101] end.
[0102] The specific explanations for the code examples are as follows:
[0103] 1. Provide an external function to program logic code for the Pod that needs to be integrated. Define the parameter specObj: the current CocoaPod execution object. Define the parameter PodName: the name of the Pod component that currently needs to be configured;
[0104] 2. Get the corresponding Pod version number in the PodsVerDict dictionary through the getPodTag function. It will decide whether to use the source version number or the binary version number based on the "onl" configuration switch in each Pod object;
[0105] 3. After obtaining the corresponding version number of the currently passed Pod name, it will be returned to the calling side;
[0106] 4. Specific execution calling code example:
[0107] $dsp.dependency(s,"Masonry")
[0108] 5. PodsVerDict dictionary configuration structure example:
[0109] $dsp.setPodsVerDict({
[0110] "Example: Pod library name"=>{
[0111] "Source Tag"=>"4.0.1",
[0112] "Binary Tag"=>"4.0.1-xcbin",
[0113] "Whether to run online"=>"1"#[1: can run online, 0: not used online]
[0114] },
[0115] "Masonry"=>{
[0116] "src"=>"1.1.0",
[0117] "bin"=>"1.1.0.1-binary",
[0118] "onl"=>"1"
[0119] }}).
[0120] S102: According to the value of the current Pod mode master switch variable, start the corresponding mode; the mode includes the binary mode of the Pod or the source code mode of the Pod.
[0121] In the current project, the Pod update command will trigger the loading of the Podfile in the project directory, and read the value of the current Pod component library mode master switch variable. Depending on whether the switch is "0" or "1", it determines whether to enable the binary mode of the Pod component library that the global project depends on. If the value of the current Pod component library mode master switch variable is "1", all the binary configuration data items of the Pod components that the current project depends on will be read, and the specific version number value of the binary integration mode of each Pod component will be read.
[0122] When the current Pod mode master switch variable value is 0, the Pod binary mode is not started. When the current Pod mode master switch variable value is 1, the binary mode of the global dependent Pod component is enabled.
[0123] Specifically, if the current Pod mode total switch variable value is 1, the binary mode of the global minimum deployment unit (Pod) is started through the Pod library in the Pod version configuration table; if the current Pod mode total switch variable value is 0, the source code mode of the global Pod is started through the Pod library in the Pod version configuration table.
[0124] It should be noted that Podfile is a core component of CocoaPods, a dependency management tool widely used in iOS and macOS development. It allows developers to easily add, update, and delete third-party libraries (also known as Pods) in their projects. By using CocoaPods, developers can avoid manually downloading and integrating these libraries, saving a lot of time and reducing the possibility of errors.
[0125] A basic Podfile usually contains the following sections:
[0126] Platform declaration: specifies the platforms (iOS, macOS, watchOS, tvOS, etc.) and their versions supported by the project;
[0127] Target: Specifies which Xcode projects or targets should contain which Pods;
[0128] Pod version configuration table: List the Pods you want to add to your project. Each Pod is preceded by the Pod keyword, followed by the Pod name and an optional version number. Load the Pod version configuration table associated with the Podfile.
[0129] Load the configuration data version in different Pod modes and load the Pod components that the application project depends on to read the version values in different Pod modes and perform Pod dependency loading according to the version values in different Pod modes.
[0130] The Pod mode master switch has the highest priority. If the current Pod mode master switch variable value is set to 1, it means that all dependent Pod component libraries will uniformly use the binary version, and the individual configuration of each Pod component will be ignored.
[0131] The Pod components that the application project depends on include but are not limited to third-party SDKs. The Pod components that the application project depends on are all products generated based on the Cocoapod framework tool.
[0132] S103: If the startup mode is the binary mode of the Pod, obtain the version number corresponding to the binary mode of the Pod, and load the minimum deployment unit library according to the version number corresponding to the binary mode of the Pod.
[0133] In S103, if the startup mode is binary mode, the version number of the binary inheritance mode of the current minimum deployment unit (Pod) component is obtained, and the loading operation of the Pod library is performed according to the version number of the binary inheritance mode of the Pod component.
[0134] S104: If the startup mode is the source code mode, obtain the independent configuration switch value of the current Pod component library.
[0135] This solution provides a separately controllable independent configuration switch, which can configure the dependent CocoaPods Pod component library and control whether the current Pod component is a source version or a binary version. This function is affected by function 1. When the current Pod mode total switch variable value of the global switch is configured to "1", the independent configuration switch will not work.
[0136] In S104, when the global Pod component library binary is not enabled, the independent configuration switch value of the current Pod component library will be read. If the current Pod component library is enabled with the binary version integration mode, the binary version number will be used. If not enabled, the source code set version number of the current Pod component library will be used.
[0137] The specific version numbers of the Pod component library that have been decided above are loaded and executed in order (such as the order in which the version numbers were generated). Each version number of the Pod is unique, and whether the version number corresponds to a binary version or a source code version is determined by the publisher of the Pod component library.
[0138] S105: Determine a corresponding version number according to the independent configuration switch value, and load a minimum deployment unit library according to the corresponding version number determined according to the independent configuration switch value.
[0139] If the independent configuration switch value is 1, its corresponding version number is determined to be the binary version number of the binary integration mode of the current Pod component library, and the minimum deployment unit library is loaded according to the binary version number; if the independent configuration switch value is 0, its corresponding version number is determined to be the source code version number of the source code integration mode of the current Pod component library, and the minimum deployment unit library is loaded according to the source code version number.
[0140] CocoaPods performs the loading of Pod component libraries.
[0141] After CocoaPods completes the Podupdate task or Pod install, the project can be compiled normally and the task is completed.
[0142] The features of CocoaPods are as follows:
[0143] 1. Parsing Podfile:
[0144] CocoaPods first reads the Podfile file in the project root directory. This file defines the dependencies of the project, including the third-party libraries that need to be integrated and their version requirements.
[0145] If a Podfile.lock file exists (which records the exact dependency versions last installed), cocoaPod will try to respect the versions in this file unless a newer version is explicitly specified in the Podfile.
[0146] 2. Parsing dependencies:
[0147] CocoaPods uses its internal resolver to parse the dependencies specified in the Podfile and determine the specific version of each Pod that needs to be installed.
[0148] This process may include resolving dependency conflicts, which is when multiple Pods depend on the same library but specify different versions, and CocoaPods will try to find a compatible version combination.
[0149] 3. Download and install Pods:
[0150] Once the Pods and their versions that need to be installed are determined, CocoaPods downloads the source code of these Pods from the specified source (usually the official Specs repository of CocoaPods).
[0151] The downloaded Pods will be installed in the Pods folder under the project directory, and each Pod will be configured as an independent Xcode project (or target).
[0152] 4. Generate Pods project:
[0153] CocoaPods creates an Xcode project file named Pods.xcodeproj, which contains all installed Pods as targets.
[0154] This project file will be configured as a dependency of the project, allowing you to reference and use these Pods in your own projects.
[0155] 5. Integrate Pods into your project:
[0156] CocoaPods modifies your Xcode project file (.xcodeproj or .xcworkspace), adds a reference to Pods.xcodeproj, and sets the necessary build configuration and linker settings.
[0157] If the project does not have a .xcworkspace file before, CocoaPods will create one. .xcworkspace is a workspace file of Xcode, which is used to manage complex project structures containing multiple Xcode projects.
[0158] 6. Generate Podfile.lock:
[0159] Once the installation is complete, CocoaPods updates the Podfile.lock file with the exact versions of all installed Pods. This helps ensure that team members and others are working in the same environment.
[0160] 7. Completion:
[0161] CocoaPods ends the task.
[0162] In order to facilitate the understanding of the data processing method for the dependency manager, combined with Figure 3 Give an example. Figure 3 A flowchart of another data processing method for a dependency manager is shown.
[0163] Figure 3 , open the computer (Macintosh, Mac) command terminal and execute the Podupdate command / install command;
[0164] During the execution of the Podupdate / install command, the value of the Pod mode master switch variable is read, and the value of the Pod mode master switch variable is used to determine whether to enable the global Pod binary version (i.e., start the binary mode).
[0165] If the value of the Pod mode master switch variable is 1, the binary mode is started, that is, all Pod component libraries use the binary version, and the binary configuration data items of all Pod components that the current project depends on are read, and the version numbers of the binary integration methods of all Pod components that the current project depends on are read;
[0166] Execute Pod library loading according to the version number of the binary integration mode of all Pod components that the current project depends on, and complete the Podupdate command / install command;
[0167] If the value of the Pod mode total switch variable is 0, it is determined that the global Pod binary version is not enabled, and the independent configuration switch value of a current Pod component library (that is, the Pod component library that the application project depends on) is read;
[0168] If the independent configuration switch value is 1, the binary version is enabled, the binary version number of the current Pod component binary integration mode is read, and the Pod library is loaded according to the binary version number to complete the podupdate command / install command;
[0169] If the independent configuration switch value is 0, it is determined that the binary version is not enabled, and its corresponding version number is determined to be the source code version number of the source code integration method of the current Pod component library. The source code version number of the source code integration method of the current Pod component library is read, and the minimum deployment unit library is loaded according to the source code version number to complete the podupdate command / install command.
[0170] It should be noted that when the value of the Pod mode total switch variable is 1, all Pod component libraries that the current project depends on will be introduced into the project using the Pod binary library.
[0171] When the value of the Pod mode total switch variable is 0, each Pod component library will correspond to a configuration model, which contains a switch value. When the value is 1, the Pod component library will use the binary version. When the value is 0, the source version is used.
[0172] This solution is a technology that has been applied in the project. It is a supplementary optimization technology for Pod binary. It allows developers to enjoy the compilation speed improvement without affecting the development and debugging experience. This solution is a set of technical solutions based on the cocoapods three-party open source solution. It has the characteristics of low cost, easy management and implementation. It is applied to the pod library binary solution to solve the problem of switching between pod binary and source code. It has been implemented on the iOS user side, and the effect is outstanding with the pod binary compilation optimization.
[0173] In the embodiment of the present application, when the user switches between the source code and binary of the minimum deployment unit version, there is no need to make a large number of code changes. It is only necessary to use a global switch, that is, a small amount of code through the total switch variable value of the current minimum deployment unit mode, to configure the minimum deployment unit component library that the current project depends on as a source code version or a binary version with one click, start the corresponding mode through the total switch variable value of the current minimum deployment unit mode, and load the minimum deployment unit library according to the version number corresponding to the mode. And in the process of loading the specification file of the dependency manager, the dependency manager allows developers to easily add, update and delete third-party libraries in the project. By using the specification file of the dependency manager, developers can avoid manually downloading and integrating these libraries, thereby saving a lot of time, reducing the possibility of errors, and improving the efficiency and accuracy of development for the dependency manager.
[0174] Based on the above embodiments Figure 1 A data processing method for a dependency manager is disclosed. The embodiment of the present application also discloses a data processing device for a dependency manager. Figure 4 As shown, the data processing device for the dependency manager mainly includes:
[0175] The first acquisition unit 401 is used to acquire the total switch variable value of the current minimum deployment unit mode during the process of loading the specification file of the dependency manager;
[0176] The start unit 402 is used to start the corresponding mode according to the total switch variable value of the current minimum deployment unit mode; the mode includes the binary mode or the source code mode of the global minimum deployment unit;
[0177] The second acquisition unit 403 is used to acquire a version number corresponding to the binary mode if the startup mode is the binary mode, and load the minimum deployment unit library according to the version number corresponding to the binary mode;
[0178] The third acquisition unit 404 is used to acquire the independent configuration switch value of the current minimum deployment unit component library if the startup mode is the source code mode;
[0179] The determination unit 405 is used to determine the corresponding version number according to the independent configuration switch value, and load the minimum deployment unit library according to the corresponding version number determined according to the independent configuration switch value.
[0180] Furthermore, the first acquisition unit 401 includes:
[0181] The execution module is used to enter the project folder through the command terminal and execute the update minimum deployment unit library command of the dependency manager;
[0182] The trigger acquisition module is used to trigger the loading of the specification file of the dependency manager under the project folder by updating the minimum deployment unit library command to obtain the total switch variable value of the current minimum deployment unit mode.
[0183] Furthermore, the startup unit 402 includes:
[0184] The first startup module is used to start the binary mode of the global minimum deployment unit through the minimum deployment unit library in the minimum deployment unit version configuration table if the current minimum deployment unit mode total switch variable value is 1;
[0185] The second startup module is used to start the source code mode of the global minimum deployment unit through the minimum deployment unit library in the minimum deployment unit version configuration table if the current minimum deployment unit mode total switch variable value is 0.
[0186] Furthermore, the second acquisition unit 403 includes:
[0187] The acquisition module is used to obtain the version number of the binary inheritance mode of the current minimum deployment unit component if the startup mode is binary mode;
[0188] The loading module is used to load the minimum deployment unit library according to the version number of the current minimum deployment unit component binary inheritance mode.
[0189] Further, the determining unit 405 includes:
[0190] The first determination module is used to determine that if the independent configuration switch value is 1, the corresponding version number is the binary version number of the binary integration mode of the current minimum deployment unit component library, and load the minimum deployment unit library according to the binary version number;
[0191] The second determination module is used to determine that if the independent configuration switch value is 0, its corresponding version number is the source code version number of the source code integration mode of the current minimum deployment unit component library, and load the minimum deployment unit library according to the source code version number.
[0192] In the embodiment of the present application, when the user switches between the source code and binary of the minimum deployment unit version, there is no need to make a large number of code changes. It is only necessary to use a global switch, that is, a small amount of code through the total switch variable value of the current minimum deployment unit mode, to configure the minimum deployment unit component library that the current project depends on as a source code version or a binary version with one click, start the corresponding mode through the total switch variable value of the current minimum deployment unit mode, and load the minimum deployment unit library according to the version number corresponding to the mode. And in the process of loading the specification file of the dependency manager, the dependency manager allows developers to easily add, update and delete third-party libraries in the project. By using the specification file of the dependency manager, developers can avoid manually downloading and integrating these libraries, thereby saving a lot of time, reducing the possibility of errors, and improving the efficiency and accuracy of development for the dependency manager.
[0193] 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 data processing method for the dependency manager as described above.
[0194] The present application also provides an electronic device, whose structural diagram is as follows: Figure 5 As shown, it specifically includes a memory 501 and one or more instructions 502, wherein the one or more instructions 502 are stored in the memory 501 and are configured to be executed by one or more processors 503 to execute the above-mentioned data processing method for the dependency manager.
[0195] 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.
[0196] 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 system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0197] The steps in the methods of the embodiments of the present application can be adjusted in order, combined, and deleted according to actual needs.
[0198] 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.
[0199] 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.
[0200] 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 data processing method for a dependency manager, characterized in that: The method comprises: In the process of loading the specification file of the dependency manager, obtain the total switch variable value of the current minimum deployment unit mode; According to the total switch variable value of the current minimum deployment unit mode, start the corresponding mode; the mode includes a binary mode or a source code mode of the global minimum deployment unit; If the startup mode is the binary mode, obtain the version number corresponding to the binary mode, and load the minimum deployment unit library according to the version number corresponding to the binary mode; If the startup mode is the source code mode, obtain the independent configuration switch value of the current minimum deployment unit component library; A corresponding version number is determined according to the independent configuration switch value, and a minimum deployment unit library is loaded according to the corresponding version number determined according to the independent configuration switch value.
2. The method according to claim 1, characterized in that: In the process of loading the specification file of the dependency manager, obtaining the total switch variable value of the current minimum deployment unit mode includes: Enter the project folder through the command terminal and execute the update minimum deployment unit library command of the dependency manager; The updating minimum deployment unit library command triggers the loading of the specification file of the dependency manager in the engineering project folder to obtain the total switch variable value of the current minimum deployment unit mode.
3. The method according to claim 1, characterized in that The starting of the corresponding mode according to the total switch variable value of the current minimum deployment unit mode includes: If the total switch variable value of the current minimum deployment unit mode is 1, the binary mode of the global minimum deployment unit is started through the minimum deployment unit library in the minimum deployment unit version configuration table; If the total switch variable value of the current minimum deployment unit mode is 0, the source code mode of the global minimum deployment unit is started through the minimum deployment unit library in the minimum deployment unit version configuration table.
4. The method according to claim 1, characterized in that: If the startup mode is the binary mode, obtaining a version number corresponding to the binary mode, and loading a minimum deployment unit library according to the version number corresponding to the binary mode, including: If the startup mode is the binary mode, obtain the version number of the binary inheritance mode of the current minimum deployment unit component; The minimum deployment unit library is loaded according to the version number of the current minimum deployment unit component binary inheritance mode.
5. The method according to claim 1, characterized in that The determining a corresponding version number according to the independent configuration switch value, and loading a minimum deployment unit library according to the independent configuration switch value, includes: If the independent configuration switch value is 1, determine that the corresponding version number is the binary version number of the binary integration mode of the current minimum deployment unit component library, and load the minimum deployment unit library according to the binary version number; If the independent configuration switch value is 0, the corresponding version number is determined to be the source code version number of the source code integration mode of the current minimum deployment unit component library, and the minimum deployment unit library is loaded according to the source code version number.
6. A data processing device for a dependency manager, characterized in that: The device comprises: A first acquisition unit is used to acquire the total switch variable value of the current minimum deployment unit mode during the process of loading the specification file of the dependency manager; A startup unit, used to start a corresponding mode according to the total switch variable value of the current minimum deployment unit mode; the mode includes a binary mode or a source code mode of the global minimum deployment unit; A second acquisition unit is used to acquire a version number corresponding to the binary mode if the startup mode is the binary mode, and load the minimum deployment unit library according to the version number corresponding to the binary mode; A third acquisition unit is used to acquire the independent configuration switch value of the current minimum deployment unit component library if the startup mode is the source code mode; A determination unit is used to determine a corresponding version number according to the independent configuration switch value, and load a minimum deployment unit library according to the corresponding version number determined according to the independent configuration switch value.
7. The device according to claim 6, characterized in that The first acquisition unit includes: The execution module is used to enter the project folder through the command terminal and execute the update minimum deployment unit library command of the dependency manager; The trigger acquisition module is used to trigger the loading of the specification file of the dependency manager under the engineering project folder through the update minimum deployment unit library command to obtain the total switch variable value of the current minimum deployment unit mode.
8. The device according to claim 6, characterized in that The starting unit comprises: A first startup module, configured to start the binary mode of the global minimum deployment unit through the minimum deployment unit library in the minimum deployment unit version configuration table if the value of the total switch variable of the current minimum deployment unit mode is 1; The second startup module is used to start the source code mode of the global minimum deployment unit through the minimum deployment unit library in the minimum deployment unit version configuration table if the value of the total switch variable of the current minimum deployment unit mode is 0.
9. The device according to claim 6, characterized in that The second acquisition unit includes: An acquisition module, used for acquiring the version number of the binary inheritance mode of the current minimum deployment unit component if the startup mode is the binary mode; The loading module is used to load the minimum deployment unit library according to the version number of the binary inheritance mode of the current minimum deployment unit component.
10. The device according to claim 6, characterized in that The determining unit comprises: A first determination module is used to determine, if the value of the independent configuration switch is 1, that the corresponding version number is a binary version number of the binary integration mode of the current minimum deployment unit component library, and load the minimum deployment unit library according to the binary version number; The second determination module is used to determine that if the independent configuration switch value is 0, its corresponding version number is the source code version number of the source code integration method of the current minimum deployment unit component library, and load the minimum deployment unit library according to the source code version number.
