Component update method, component update device, equipment and storage medium

Automatically parsing and updating dependency files through Fastlane tool, solving the problem of component version conflicts in the CocoaPods management tool, simplifying the operation process, improving development efficiency and reducing costs.

CN115291935BActive Publication Date: 2025-07-22CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210949904.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-09
Publication Date
2025-07-22
Estimated Expiration
2042-08-09

AI Technical Summary

Technical Problem

During the collaboration of multiple teams, the dependency file modification of the CocoaPods management tool is complex and error-prone, resulting in component version conflicts, long time, low work efficiency, and high project development costs.

Method used

Use the Fastlane tool to obtain the source code file on the server side, use the index file to detect new components, read the component configuration table to obtain the version number, automatically parse and update the dependency file, simplify the operation process, and avoid manual modification conflicts.

Benefits of technology

It reduces operational complexity, improves developer work efficiency, reduces error rate, and reduces project development costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115291935B_ABST
    Figure CN115291935B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide a component update method, a component update device, a device, and a storage medium, which relate to the field of computer technology. Component updates are managed using the Fastlane tool. By obtaining source code files from the server side; among them, the source code files include index files and dependency files. According to the index files, it is detected whether there are new components in the source code files. If there are new components, a preset component configuration table is read to obtain the version numbers of the new components. The dependency files are parsed according to the version numbers to obtain the target dependency parsing results between the new components and the preset components. The dependency files are updated according to the parsing results. Through automatic parsing of the dependency files and obtaining component configuration information, this embodiment avoids manual modification conflicts, simplifies the operation process, reduces the operation complexity. At the same time, there is no need for manual search and modification of configuration information, avoiding errors, improving the work efficiency of developers, and reducing the project development cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a component update method, a component update device, a device, and a storage medium. Background Art

[0002] With the rapid development of computer technology, there are more and more development requirements for different applications. Generally, a large number of third-party libraries are cited during the development of an application. In order to conveniently manage these third-party libraries uniformly, a dependency file is used to define relevant information such as the dependency relationship and version relationship between the third-party library and the development project, and the CocoaPods management tool is used to manage the dependent third-party libraries.

[0003] However, a project usually requires multiple members to complete together. Each member needs to maintain the same dependency file. The usage specification of CocoaPods states that the dependency file should not be directly modified, but should be modified through the Pod install or Pod update command. During the collaboration of multiple teams, a large number of component version conflicts will occur. At this time, the Podfile file cannot be directly modified through the above two commands. To solve the component conflicts, members need to manually complete the modification. However, this configuration file generally contains thousands of configuration items, and it often takes half a day or even longer to complete manually. The operation is troublesome and error-prone, the work efficiency cannot be improved, and the project development cost is relatively high. Summary of the Invention

[0004] The main purpose of the embodiments of the present invention is to propose a component update method, device, device, and storage medium, which reduce the operation complexity, save the learning cost, improve the work efficiency of developers, and reduce the project development cost.

[0005] To achieve the above object, a first aspect of the embodiments of the present invention proposes a component update method, which is applied to the Fastlane tool and includes:

[0006] Obtain the source code file on the server side; wherein, the source code file includes an index file and a dependency file;

[0007] Detect whether there is a new component in the source code file according to the index file;

[0008] If there is a new component, read a preset component configuration table to obtain the version number of the new component, and the version number is used to represent the latest version number of the new component;

[0009] Parse the dependency file according to the version number to obtain a parsing result, and the parsing result is the;

[0010] Update the dependency file according to the target dependency relationship;

[0011] Install the new component according to the dependency file.

[0012] In some embodiments, parsing the dependency file according to the version number to obtain a parsing result includes:

[0013] Read the component configuration table to obtain description information, where the description information includes: first information, second information, and third information; the first information is used to indicate that the referenced version number is equal to the version number of the new component, the referenced version number indicates the version number of the new component referenced by the preset component, the second information is used to indicate that the referenced version number is greater than the version number of the new component, and the third information is used to indicate that the referenced version number is less than the version number of the new component;

[0014] Obtain the parsing result according to the description information, where the parsing result includes: updating the dependency file and generating conflict information.

[0015] In some embodiments, updating the dependency file according to the parsing result includes:

[0016] If the description information is the first information, update the dependency file;

[0017] If the description information is the second information, do not update the dependency file;

[0018] If the description information is the third information, generate conflict information.

[0019] In some embodiments, after installing the new component according to the dependency file, it further includes: performing annotation processing on the dependency file, specifically including:

[0020] Obtain the modification information of the dependency file;

[0021] Generate annotation information according to the modification information;

[0022] Annotate the annotation information in the dependency file.

[0023] In some embodiments, after installing the new component according to the dependency file, it further includes:

[0024] Generate a push command;

[0025] Use the push command to push the dependency file to the server side.

[0026] Before obtaining the source code file on the server side in some embodiments, it further includes:

[0027] Detect the code status on the local side; wherein, the code status includes the editing status;

[0028] Clear the code in the editing status.

[0029] In some embodiments, the source code file further includes branch information. After obtaining the source code file on the server side, it further includes:

[0030] Obtain the current project branch information on the local side;

[0031] Compare the branch information with the current branch information for consistency;

[0032] If the original branch information is inconsistent with the current project branch information, obtain the source code file again.

[0033] To achieve the above object, a second aspect of the present invention proposes a component update device, which is applied to the Fastlane tool and includes:

[0034] A source code file acquisition module for acquiring the source code file on the server side; wherein, the source code file includes an index file and a dependency file;

[0035] A component detection module for detecting whether there is a new component in the source code file according to the index file;

[0036] A version number reading module for reading a preset component configuration table to obtain the version number of the new component if there is a new component;

[0037] A dependency file parsing module for parsing the dependency file according to the version number to obtain a parsing result;

[0038] A dependency file update module for updating the dependency file according to the parsing result;

[0039] A component installation module for installing the new component according to the dependency file. The parsing result of the target dependency relationship between the new component and the preset component

[0040] To achieve the above object, a third aspect of the present invention proposes an electronic device, including:

[0041] At least one memory;

[0042] At least one processor;

[0043] At least one program;

[0044] The program is stored in a memory, and a processor executes the at least one program to implement the method according to the first aspect of the present invention as described above.

[0045] To achieve the above object, a fourth aspect of the present invention provides a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute:

[0046] The method according to the first aspect as described above.

[0047] The component update method, device, equipment and storage medium provided by the embodiments of the present invention are managed by using the Fastlane tool. By obtaining the source code files on the server side; wherein, the source code files include index files and dependency files, detecting whether there are new components in the source code files according to the index files, if there are new components, reading a preset component configuration table to obtain the version numbers of the new components, parsing the dependency files according to the version numbers to obtain parsing results, and updating the dependency files according to the parsing results. This embodiment automatically parses the dependency files to obtain component configuration information, avoids manual modification of conflicts, simplifies the operation process, reduces the operation complexity, and at the same time eliminates the need for manual search and modification of configuration information, avoids errors, improves the work efficiency of developers, and reduces the project development cost. Description of the Drawings

[0048] Figure 1 is a flowchart of the component update method provided by the embodiments of the present invention.

[0049] Figure 2 is a flowchart of the component update method provided by another embodiment of the present invention.

[0050] Figure 3 is a flowchart of the component update method provided by another embodiment of the present invention.

[0051] Figure 4 is a flowchart of the component update method provided by another embodiment of the present invention.

[0052] Figure 5 is a schematic diagram of the interaction between the server side and the local side when the component update method provided by another embodiment of the present invention is applied.

[0053] Figure 6 is a block diagram of the component update device provided by another embodiment of the present invention.

[0054] Figure 7 is a schematic diagram of the hardware structure of the electronic device provided by the embodiments of the present invention. Detailed Embodiments

[0055] In order to make the objectives, technical solutions and advantages of the present invention more clear and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0056] It should be noted that although functional module division is performed in the device schematic diagram and the logical sequence is shown in the flowchart, in some cases, the steps shown or described may be executed in a different module division in the device or a different order in the flowchart.

[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.

[0058] First, several nouns involved in the present invention are analyzed:

[0059] CocoaPods: CocoaPods is a dependency management tool for third-party libraries in the development of OS X and iOS applications. With CocoaPods, you can define your own dependencies, which is very convenient for version management of third-party libraries in the entire development environment. It can download the source code of the library and connect these third-party libraries to the project by creating an Xcode workspace, making it convenient for development. The main benefits of CocoaPods are that it can automatically, centrally, and intuitively manage third-party libraries, making it easy to find the required libraries and automatically configure compilation options.

[0060] Git: Git is currently the most popular distributed version control system, which can effectively and quickly handle the version management of various projects. Its advantages include being suitable for distributed development, not putting too much pressure on the public server, being fast, and easy to resolve conflicts, etc.

[0061] Pods: The dependencies defined using CocoaPods. When developing an application, the corresponding source code program can be understood as a project. A project can contain multiple projects. The dependency relationship table between projects is defined as a Podfile, and the dependency relationship table between components is defined as a Podspec. After executing commands related to Pod install, a combined total dependency relationship file will be generated based on the multiple dependency relationship tables of the Podfile and Podspec, which is defined as the Podfile.lock file. This Podfile.lock file is used to ensure that each member of the team under the same project has the same version of the components installed in the Pods.

[0062] Component: It is an object. A component is a simple encapsulation of data and methods. A component is a specific object derived from TComponent. A component can have its own properties and methods. Properties are simple accessors for component data, and methods are some simple and visible functions of the component. Using components can achieve drag-and-drop programming, fast property handling, and true object-oriented design.

[0063] Repository: When a developer creates a project, a code repository and a configuration repository can be created in the area where a private library can be created. Among them, the Code Repository is usually understood as a code repository, and the code generated when creating a project can be uploaded to this code repository. The CodeRepository is usually understood as a configuration repository, and the configuration information about the project can be uploaded to this configuration repository. For example, the component name and version can be stored in the configuration repository, and the configuration repository is used to store the component dependency file (Podspec file). Among them, the content in the Podspec file is the dependency relationship information for a component, and this dependency relationship information can include the source files on which the component depends, the third-party components on which the component depends, the download address of the component, the component version, and other information. The code repository and the configuration repository can usually be created locally and on the server side, that is, the Podspec file of the configuration repository is also stored on the local side and the server side.

[0064] Fastlane: It is a set of client CI tool collections that replace developers to handle the cumbersome tasks in building and releasing apps. It can set up an automated release service very quickly and simply, and supports Android, iOS, and MacOS. Fastlane itself does not have a special syntax and uses the Ruby language.

[0065] With the rapid development of computer technology, there are more and more development requirements for different applications. During the development process of an application, a large number of third-party libraries are generally referenced. In order to conveniently manage these third-party libraries uniformly, dependency relationship files are used to define the dependency relationship and version relationship and other relevant information between the third-party libraries and the development project, and the CocoaPods management tool is used to manage the dependency libraries.

[0066] However, a project usually requires multiple members to complete together, and each member needs to maintain the same dependency file. The usage specification of CocoaPods states that the dependency file should not be directly modified, but should be modified through the `pod install` or `pod update` commands. During the collaboration of multiple teams, a large number of component version conflicts may occur. At this time, the Podfile cannot be directly modified through the above two commands. To resolve component conflicts, members need to manually complete the modification. The general modification steps include: 1) finding the conflicting component; 2) comparing the version differences of the component in the two teams; 3) selecting the latest version of the component; 4) manually searching for the places where the component is referenced in the dependency file; 5) judging whether replacement is needed based on experience. Generally speaking, a configuration file like the dependency file contains thousands of configuration items. If done manually, it often takes half a day or even longer, is cumbersome to operate, time-consuming and laborious, and prone to errors, resulting in low work efficiency and high project development costs.

[0067] Based on this, the embodiments of the present invention provide a component update method, device, equipment and storage medium, which are managed by applying the Fastlane tool. By obtaining the source code files on the server side; wherein, the source code files include an index file and a dependency file, detecting whether there are new components in the source code files according to the index file, if there are new components, reading a preset component configuration table to obtain the version numbers of the new components, parsing the dependency file according to the version numbers to obtain a parsing result, and updating the dependency file according to the parsing result. This embodiment automatically parses the dependency file to obtain component configuration information, avoids manual modification of conflicts, simplifies the operation process, reduces the operation complexity, and at the same time eliminates the need for manual searching and modification of configuration information, avoiding errors, improving the work efficiency of developers, and reducing the project development cost.

[0068] The embodiments of the present invention provide a component update method, device, equipment and storage medium, which will be specifically described through the following embodiments. First, the component update method in the embodiments of the present invention will be described.

[0069] The component update method provided by an embodiment of the present invention relates to the field of computer technology, and particularly to the field of software development technology. The component update method provided by an embodiment of the present invention can be applied to a terminal, can also be applied to a server, or can be software running on a terminal or a server. Among them, the terminal communicates with the server through a network. This component update method can be executed by a terminal or a server, or jointly executed by a terminal and a server. Here, taking the example that this component update method is executed by a terminal for illustration: The terminal obtains the source code file of the server side by using the Fastlane tool, and obtains the source code file of the server side; wherein, the source code file includes an index file and a dependency file, and detects whether there is a new component in the source code file according to the index file. If there is a new component, then read a preset component configuration table to obtain the version number of the new component, parse the dependency file according to the version number to obtain a parsing result, and update the dependency file according to the parsing result. This embodiment automatically parses the dependency file to obtain component configuration information, avoids manual modification of conflicts, simplifies the operation process, and reduces the operation complexity.

[0070] In some embodiments, the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, or a smart watch, etc. The server can be an independent server, or can be a cloud server providing 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, Content Delivery Network (CDN), and big data and artificial intelligence platforms; it can also be a service node in a blockchain system, and a peer-to-peer (P2P) network is formed among the service nodes in this blockchain system. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). A server-side of a requirements management system can be installed on the server, and through this server-side, it can interact with the terminal. For example, a corresponding software can be installed on the server-side, and the software can be an application implementing the component update method, etc., but is not limited to the above forms. The terminal and the server can be connected through communication connection methods such as Bluetooth, USB (Universal Serial Bus), or a network, and this embodiment does not limit this here.

[0071] The present invention can be used in numerous general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0072] In one embodiment, the component update method is based on the way of managing components by CocoaPods, integrates Fastlane as the front-end driver, and uses Python as the back-end implementation mode, thereby enhancing the function expansion of component management for CocoaPods. Among them, Fastlane internally integrates Git functions, so it can increase the control of source code throughout the process, reduce the manual input of users from another aspect, and reduce the time cost of having to start over due to errors in manual input at a certain step. The entire process is implemented in an automated manner, and intelligent detection and judgment steps are added throughout the process, so that the dependency file (i.e., the Podfile.lock file) can be penetrated more accurately. Figure 1 It is an optional flowchart of the component update method provided by the embodiment of the present invention. Figure 1 The method in it may include but is not limited to steps S110 to S160.

[0073] Step S110: Obtain the source code file of the server side.

[0074] Step S120: Detect whether there are new components in the source code file according to the index file.

[0075] Step S130: If there are new components, read the preset component configuration table to obtain the version number of the new components.

[0076] Step S140: Parse the dependency file according to the version number to obtain the parsing result.

[0077] Step S150: Update the dependency file according to the parsing result.

[0078] Step S160: Install new components according to the dependency file.

[0079] In step S110 of an embodiment, the server side refers to the code server repository, i.e., the Git repository, and the local side refers to the developer's computer. The developer uses the "Git pull" command on the local side to pull the source code files from the server side. The specific process is as follows: When importing the files related to the required third-party libraries from the Git repository on the server side according to the requirements, first find the corresponding Git repository according to the address of the third-party library by Git, and then locate the corresponding version commit information according to the corresponding version number (if no version number is specified, the latest version is downloaded). There is a component dependency file with the suffix.Podspec in the version commit information. After finding the.Podspec file, first verify whether the component name is the same as that in the dependency file (Podfile.lock file). If it is not the same, an error is reported stating that it cannot be found. If it is the same, the verification is successful. Then, find the source code files to be imported according to the source code folder in the component dependency file, and find the corresponding configuration files and resource files through other data. Finally, download them to the local project, that is, obtain the source code files on the server side. In this embodiment, the dependency file is a form jointly maintained by developers in the entire project, and the downloaded source code files include the index file and the dependency file.

[0080] In one embodiment, the content of the Podfile.lock file of CocoaPods is as follows:

[0081] target 'Project' do

[0082] use_frameworks!

[0083] Pod 'ModuleA', :git =>'ssh: / / Git@xxxxxx / Module.Git', :tag => '2.0.0'

[0084] end

[0085] Among them, this file refers to integrating the Module component in the project engineering and gives the Git repository address and tag version information of this module. The Git address points to the code management library of this module, which is used to pull the source code files of the sub-module. And the tag is a snapshot of the Git version library, a pointer pointing to a certain commit, which is used to represent the version information. The version information can also be represented by branch. Branch corresponds to a series of commits, which is a line connected by many points. There is a HEAD pointer, and it can move depending on the HEAD pointer.

[0086] In one embodiment, to ensure the consistency of the code at both ends during the development process, before any operation on the local side, it is necessary to first pull the latest source code files from the server side. To ensure higher consistency when pulling the source code files, referring to Figure 2 Before step S110, the component update method further includes step S111 and step S112.

[0087] Step S111: Detect the code status of the local side.

[0088] Step S112: Determine the current project branch information.

[0089] In step S111 of one embodiment, the purpose of this step is to ensure that there is no code being edited in the local working area. The code status includes the editing status, and the code in the editing status is cleared. Use a script to execute the "Git status" command to view the file status in the local working area. The status command can display the status of the working directory and the staging area. Use the return result of this command to determine whether there is code being edited in the local working area. Only by ensuring that the local development environment is clean and there is no code being edited in the working area can we avoid conflicts between the source code files pulled from the server side and the files being modified locally.

[0090] In step S112 of one embodiment, after obtaining the source code files from the server side, obtain the current project branch information of the local side, and then obtain the branch information in the source code files and compare the branch information for consistency with the current branch information. If the branch information is inconsistent with the current project branch information, re-obtain the source code files.

[0091] In one embodiment, a development project may contain a large number of branches, such as the main branch, development branch, feature branch, release branch, etc. To prevent related code from being wrongly committed to other places, by detecting the branches and comparing them with the branch information in the configuration files related to the source code files, the accuracy of the branches can be ensured.

[0092] In one embodiment, use a script to read out the branches of the current project and then compare them with the branch information in the configuration files related to the source code files.

[0093] In step S120 of an embodiment, the source code file is detected according to the index file to determine whether it contains new components. A component is the implementation of the smallest functional granularity. In this embodiment, a new component may be a newly developed function in the project. The process of adding a new component in CocoaPods is as follows: copy the source code of the new component to the internal network, then add a tag with the version number plus *.1 to the component, install this component in a Demo project file, and there is a component dependency file with the suffix.Podspec in the corresponding version commit information. Finally, modify the version number in the component dependency file and point the Git address in the component dependency file to the source code repository, verify whether the new version can be installed normally locally, and after passing the verification, transfer the.Podspec to the configuration repository using a command. The index file of the source code file obtained by pulling in step S110 can guide the configuration repository, thereby determining whether there are new components in the source code file.

[0094] In one embodiment, in step S130 of an embodiment, the new components include components with brand-new functions and updated old-version components. Read the component configuration table to obtain the version number of the new component, and the version number is used to represent the latest version number of the new component.

[0095] In one embodiment, referring to Figure 3 , step S130 of the component update method further includes step S131 and step S132.

[0096] Step S131: Read the component configuration table to obtain the description information.

[0097] Step S132: Parse the description information to obtain the parsing result.

[0098] In one embodiment, the description information is mainly used to describe the version number information. Here, the description information about the version number information includes: the first information, the second information, and the third information, and the parsing result is used to determine whether to update the dependency file.

[0099] In this embodiment, the first information is used to indicate that the version number referenced by other components in the dependency relationship is equal to the version number of the new component, which is expressed as: =Version: equal to the version number, and the referenced version number indicates the version number of the preset component referencing this new component, which is expressed as: (Version).

[0100] The second information is used to indicate that the referenced version number is greater than the version number of the new component, which is expressed as: ~>Version: greater than the version number.

[0101] The third information is used to indicate that the referenced version number is less than the version number of the new component, which is expressed as <Version: indicating less than the version number.

[0102] In addition, the above information is the description information of the component itself in the Podfile.lock file. If the component is updated, it will be synchronously modified.

[0103] It can be understood that the above representation form of the description information is only for illustration and does not mean that there is only this one representation form.

[0104] After obtaining the version number of the component, the dependency file is parsed and step S140 is entered.

[0105] In step S140 of an embodiment, by analyzing the Podfile.lock dependency file, the configuration of the component is parsed line by line. The parsing result is whether to update the dependency file. The preset components are other components in the project. The purpose of this step is to obtain the target dependency relationship between other components and the updated component. The specific parsing process is as follows:

[0106] In step S150 of an embodiment, it is judged whether there are other components depending on the new component according to the configuration information in the dependency file, that is, there is a dependency relationship between the new component and other components. If there is a new component, the version reference relationship between different components will be different. Therefore, the dependency file needs to be modified according to the version number of the new component and the component dependency relationship.

[0107] If there are other components depending on the new component, when the description information is the first information, the dependency file is updated according to the parsing result.

[0108] If there are other components depending on the new component, when the description information is the second information, the dependency file is not updated according to the parsing result, that is, if the referenced version is greater than the new version, there is no need to change the dependency file, and other components reference the latest version.

[0109] If there are other components depending on the new component, when the description information is the third information, conflict information is generated according to the parsing result. The third information indicates that the referenced version number is less than the version number of the new component, which means there is a version conflict, and conflict information needs to be sent to the relevant engineers for corresponding modification.

[0110] In step S160 of an embodiment, the new component is installed according to the target dependency file, and the new component is installed by executing the command "Pod install".

[0111] In an embodiment, after the new component is installed in step S160, the component update method further includes: performing annotation processing on the dependency file, that is, generating annotation information according to the modification information of the dependency file and performing annotation.

[0112] In this embodiment, the modification information of the dependency file is obtained, annotation information is generated according to the modification information, and the annotation information is annotated in the dependency file. In this embodiment, the commands "Git add & Git commit" are executed to generate annotation information for the modification information of the corresponding component and add it to the annotation position, so that other members of the project team can intuitively understand the modification information of the component based on the annotation information, improving the readability of the project.

[0113] In one embodiment, after the new component is installed in step S160, the component update method further includes: pushing the dependency file to the server side.

[0114] In this embodiment, a push command is generated in the local segment, and the dependency file is pushed to the server side by using the push command, that is, the modifications made to the dependency file locally are pushed to the server side, that is, the Git side, by using the "Git push" command, ensuring that other members of the project can carry out subsequent development based on this update and improving the project development process. Since after executing "Pod install", it is necessary to update the dependency file of Podfile.lock in CocoaPods. The most useful function of this.lock file is for multi-person development. If the Pods version is not specified in the Podfile, the latest version of the current third-party library is obtained by default. When someone in the team executes the "Pod install" command, the generated Podfile.lock records the version of the latest Pods dependency relationship at that time. When other developers in the project pull down this project containing the Podfile.lock file and then execute the "Pod install" command, the version of the Pods dependency library obtained is the same as the version obtained by the initial user. Without the Podfile.lock file, all subsequent executions of "Pod install" will obtain the latest version of the dependency relationship, which causes the versions of the dependency libraries used in a team to be inconsistent, seriously affecting the development process.

[0115] In one embodiment, after the dependency file is pushed to the server side, the component update method further includes: executing environment cleaning code to ensure that there are no remaining files that have not been pushed in the local working area.

[0116] In this embodiment, by using the environment cleaning code, after the push operation is completed, it is ensured that the local working environment is clean and there are no remaining files that have not been pushed.

[0117] In one embodiment, the above steps can all be automatically completed by setting up scripts using the Fastlane tool. The specific operations and conditional judgments involved are automatically completed in the scripts. The penetration technology for locked files can intelligently identify the components that need to be updated in the project and dynamically complete the update of the components for the developer. For example, the developer only needs to trigger the command to update the component, such as "fastlane update xxx", where "xxx" represents the component name, and the subsequent operations are automatically completed by the script. If the above steps are completed manually, it often takes half a day or even longer, while the method of this embodiment only requires executing one command to complete, saving the learning cost of the CocoaPods mechanism, liberating the developer's time from resolving conflicts, reading the configuration line by line in the form of a script, matching components according to the given rules, which can reduce the mental burden of the developer reading the configuration, avoid manually modifying conflicts, simplify the operation process, reduce the operation complexity, and at the same time, there is no need to manually search for and modify the configuration information, avoiding errors, improving the work efficiency of developers, reducing the project development cost, enabling developers to spend more time and energy on optimizing the business logic and project experience, creating a more refined product, and improving user satisfaction.

[0118] Referring to Figure 4 , which is the flowchart of the component update method in an embodiment of the present application. It can be seen from the figure that it includes steps S410 to S460.

[0119] Step S410: Obtain the index file related to the component.

[0120] In this embodiment, it is judged whether there are new components according to the index file of the source code file. Since the index file of the source code file obtained by pulling can guide the configuration repository, it is possible to judge whether there are new components in the source code file according to the index file.

[0121] Step S420: Read the component configuration information.

[0122] In this embodiment, the component configuration table is read to obtain the description information, and the description information is parsed to obtain the parsing result.

[0123] In one embodiment, the description information is mainly used to describe the version number information. Here, the description information about the version number information includes: the first information, the second information, and the third information. In this embodiment, the first information is used to indicate that the version number referenced by other components in the dependency relationship is equal to the version number of the new component, which is expressed as: =Version: equal to the version number, and the referenced version number indicates the version number of the preset component referencing the new component, which is expressed as: (Version). The second information is used to indicate that the referenced version number is greater than the version number of the new component, which is expressed as: ~>Version: greater than the version number. The third information is used to indicate that the referenced version number is less than the version number of the new component, which is expressed as <Version: indicating less than the version number. Additionally, the above information is the description information of the component itself in the Podfile.lock file. If the component is updated, it will be synchronously modified.

[0124] Step S430: Parse the dependency file.

[0125] In this embodiment, by analyzing the Podfile.lock dependency file, the configuration of the component is parsed line by line, and it is determined whether the dependency file needs to be updated based on the obtained version number information.

[0126] Step S440: Update the dependency file.

[0127] In this embodiment, it is determined whether there are other components depending on the new component according to the configuration information in the dependency file, that is, there is a dependency relationship between the new component and other components, and the dependency file is updated.

[0128] If there are other components depending on the new component, when the description information is the first information, the dependency file is updated according to the parsing result.

[0129] If there are other components depending on the new component, when the description information is the second information, the dependency file is not updated according to the parsing result, that is, if the referenced version is greater than the new version, there is no need to change the dependency file, and other components reference the latest version.

[0130] If there are other components depending on the new component, when the description information is the third information, conflict information is generated according to the parsing result. The third information indicates that the referenced version number is less than the version number of the new component, which means there is a version conflict, and conflict information needs to be sent to the relevant engineer for corresponding modification.

[0131] Step S450: Install the component according to the dependency file.

[0132] In this embodiment, the command "Pod install" is executed to install new components according to the latest dependency file. After the new components are installed, annotation information is generated and annotated based on the modification information of the new components. By executing the commands "Git add & Git commit", the modification information of the corresponding components is generated into annotation information and added to the annotation position, facilitating other members of the project team to intuitively understand the modification information of the components and improving the readability of the project.

[0133] Step S460: Push the dependency file to the server side.

[0134] In this embodiment, the modifications made to the dependency file locally are pushed to the server side, i.e., the Git side, to ensure that other members of the project can carry out subsequent development based on this update, improving the project development process.

[0135] Reference Figure 5 , is a schematic diagram of the interaction between the server side and the local side in an embodiment of the present application.

[0136] Figure 5 The server side in [reference] refers to the code server repository, i.e., the Git repository. The server side stores the source code file (repo), the dependency relationship table between components (Podspec), the dependency relationship table between projects (Podfile), and the dependency file (Podfile.lock), and there is an association between the source code file (repo) and the dependency relationship table between components (Podspec), the dependency relationship table between projects (Podfile), and the dependency file (Podfile.lock). The local side refers to the developer's computer. When the developer needs to update the components, the "Git pull" command is used locally to pull the source code file from the server side, and then the dependency file is updated and configured according to the dependency relationship table between components. Finally, new components are installed. Since the new components have associated modifications to the dependency relationship table between components (Podspec), the dependency relationship table between projects (Podfile), and the dependency file (Podfile.lock), after the installation is completed, the modifications made to the dependency file locally are pushed to the server side using the "Git push" command.

[0137] The technical solution provided by the embodiment of the present invention is managed by using the Fastlane tool. By obtaining the source code files on the server side, where the source code files include index files and dependency files, it is detected whether there are new components in the source code files according to the index files. If there are new components, a preset component configuration table is read to obtain the version numbers of the new components, and the dependency files are parsed according to the version numbers to obtain the parsing results, and the dependency files are updated according to the parsing results. This embodiment automatically parses the dependency files to obtain component configuration information, avoids manual modification of conflicts, simplifies the operation process, reduces the operation complexity, and at the same time eliminates the need for manual search and modification of configuration information, avoiding errors, improving the work efficiency of developers, and reducing the project development cost.

[0138] The method of this embodiment only needs to execute one command to complete, saving the learning cost of the CocoaPods mechanism, liberating the developer's time from resolving conflicts, reading the configuration line by line in the form of a script, and matching components according to the given rules, which can reduce the mental burden of developers reading the configuration, avoid manual modification of conflicts, simplify the operation process, reduce the operation complexity, and at the same time eliminate the need for manual search and modification of configuration information, avoiding errors, improving the work efficiency of developers, and reducing the project development cost, enabling developers to spend more time and energy on optimizing business logic and project experience, creating more refined products, and improving user satisfaction.

[0139] The embodiment of the present invention also provides a component update device that can implement the above component update method. Refer to Figure 6 , the device includes:

[0140] A source code file acquisition module 610, configured to obtain the source code files on the server side; where the source code files include index files and dependency files.

[0141] In this embodiment, when the source code file acquisition module 610 imports the required third-party library related files from the Git repository on the server side according to the requirements, first, the corresponding Git repository is found according to the address of the third-party library in Git, and then the corresponding version commit information is located according to the corresponding version number (if no version number is specified, the latest version is downloaded). There is a component dependency file with the suffix.Podspec in the version commit information. After finding the.Podspec file, it is necessary to verify whether the component name is consistent with that in the dependency file (Podfile.lock file). If not, an error is reported stating that it cannot be found. If it is consistent, the verification is successful. Then, the source code files to be imported are found according to the source code folder in the component dependency file, and the corresponding configuration files and resource files are found through other data. Finally, they are downloaded to the local project, that is, the source code files on the server side are obtained.

[0142] The component detection module 620 is used to detect whether there are new components in the source code file according to the index file.

[0143] In this embodiment, the component detection module 620 obtains the configuration repository guided by it according to the index file of the pulled source code file, so as to determine whether there are new components in the source code file.

[0144] The version number reading module 630 is used to read the preset component configuration table to obtain the version number of the new component if there are new components. The version number is used to represent the latest version number of the new component.

[0145] In this embodiment, if there are new components, the version number reading module 630 reads the component configuration table to obtain the version number of the new component. The new components include components with new functions and updated old version components. Reading the component configuration table to obtain the version number of the new component. It is mainly to obtain the description information in the dependency file according to the component configuration table, and obtain the version number of the new component according to the description information. Among them, the description information includes: the first information, the second information and the third information. In this embodiment, the first information is used to represent that the version number referenced by other components in the dependency relationship is equal to the version number of the new component, which is expressed as: = Version: equal to the version number, and the referenced version number represents the version number of the preset component referencing this new component, which is expressed as: (Version). The second information is used to represent that the referenced version number is greater than the version number of the new component, which is expressed as: ~> Version: greater than the version number. The third information is used to represent that the referenced version number is less than the version number of the new component, which is expressed as <Version: less than the version number. In addition, the above information is the description information of the component itself in the Podfile.lock file, and will be synchronously modified if the component is updated.

[0146] The dependency file parsing module 640 is used to parse the dependency file according to the version number to obtain a parsing result, and the parsing result is whether to update the dependency file.

[0147] In this embodiment, the dependency file parsing module 640 determines whether there are other components depending on the new component according to the configuration information in the dependency file, that is, there is a dependency relationship between the new component and other components. If there are other components depending on the new component, when the description information is the first information, the dependency file is updated according to the parsing result. If there are other components depending on the new component, when the description information is the second information, the dependency file is not updated according to the parsing result, that is, if the referenced version is greater than the new version, there is no need to change the dependency file, and other components reference the latest version. If there are other components depending on the new component, when the description information is the third information, conflict information is generated according to the parsing result. The third information indicates that the referenced version number is less than the version number of the new component, which means there is a version conflict, and the conflict information needs to be sent to the relevant engineer for corresponding modification.

[0148] The dependency file update module 650 is used to update the dependency file according to the parsing result.

[0149] The component installation module 660 is used to install the new component according to the dependency file.

[0150] In this embodiment, the component installation module 660 executes the command "Pod install" to install the new component. According to the latest dependency file, if other components with dependencies are also updated, they can be installed together. After installing the new component, annotation information is generated and annotated according to the modification information of the new component. By executing the commands "Git add & Git commit", the modification information of the corresponding component is generated into annotation information and added to the annotation position, so that other members of the project team can intuitively understand the modification information of the component according to the annotation information, improving the readability of the project.

[0151] The specific implementation manner of the component update device in this embodiment is basically the same as that of the above component update method, and will not be elaborated here.

[0152] This embodiment of the present invention further provides an electronic device, including:

[0153] At least one memory;

[0154] At least one processor;

[0155] At least one program;

[0156] The program is stored in the memory, and the processor executes at least one program to implement the component update method described above in this embodiment of the present invention. The electronic device can be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (Personal DiGitalAssistant, abbreviated as PDA), an in-vehicle computer, etc.

[0157] Please refer toFigure 7 , Figure 7 schematically shows the hardware structure of an electronic device according to another embodiment. The electronic device includes:

[0158] A processor 701, which can be implemented in ways such as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided by the embodiments of the present invention;

[0159] A memory 702, which can be implemented in forms such as a ROM (Read Only Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory). The memory 702 can store an operating system and other application programs. When implementing the technical solutions provided by the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 702 and are called by the processor 701 to execute the component update method of the embodiments of the present invention;

[0160] An input / output interface 703, which is used to implement information input and output;

[0161] A communication interface 704, which is used to implement communication interaction between this device and other devices. Communication can be achieved through a wired method (such as USB, network cable, etc.) or through a wireless method (such as a mobile network, WIFI, Bluetooth, etc.); and

[0162] A bus 705, which transmits information between various components of the device (such as the processor 701, the memory 702, the input / output interface 703, and the communication interface 704);

[0163] Wherein the processor 701, the memory 702, the input / output interface 703, and the communication interface 704 are communicatively connected to each other inside the device through the bus 705.

[0164] The embodiments of the present invention also provide a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute the above-mentioned component update method.

[0165] The component update method, component update device, electronic device, and storage medium proposed in the embodiments of the present invention are managed using the Fastlane tool. By obtaining the source code files from the server side, where the source code files include index files and dependency files, it is detected whether there are new components according to the index files. If there are new components, a preset component configuration table is read to obtain the version numbers of the new components, and the dependency files are parsed according to the version numbers to obtain the parsing results, and the dependency files are updated according to the parsing results. This embodiment automatically parses the dependency files to obtain component configuration information, avoiding manual modification conflicts, simplifying the operation process, reducing the operation complexity. At the same time, there is no need for manual search and modification of configuration information, avoiding errors, improving the work efficiency of developers, and reducing the project development cost.

[0166] The method of this embodiment only needs to execute one command to complete, saving the learning cost of the CocoaPods mechanism, liberating the developer's time from resolving conflicts, reading the configuration line by line in the form of a script, matching components according to the given rules, which can reduce the mental burden of developers reading the configuration, avoid manual modification conflicts, simplify the operation process, reduce the operation complexity. At the same time, there is no need for manual search and modification of configuration information, avoiding errors, improving the work efficiency of developers, and reducing the project development cost, enabling developers to put more time and energy into optimizing the business logic and project experience, creating a more refined product, and improving user satisfaction.

[0167] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include high-speed random access memory, and can also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory optionally includes a memory remotely set relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include but are not limited to the Internet, enterprise intranets, local area networks, mobile communication networks, and combinations thereof.

[0168] The embodiments described in the embodiments of the present invention are for more clearly illustrating the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Those skilled in the art know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are equally applicable to similar technical problems.

[0169] Those skilled in the art can understand that Figures 1-7 the technical solutions shown do not constitute a limitation on the embodiments of the present invention, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0170] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0171] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, and their appropriate combinations.

[0172] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present invention and the above-mentioned drawings are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order different from those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily limit to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0173] It should be understood that in the present invention, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects and indicates that three relationships can exist. For example, "A and / or B" can represent: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after. "At least one (one)" or its similar expression below refers to any combination of these items, including any combination of single item (one) or plural items (ones). For example, at least one (one) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0174] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.

[0175] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0176] In addition, in each embodiment of the present invention, the functional units can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0177] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions for causing an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention. The foregoing storage medium includes: various media that can store programs such as USB flash drives, mobile hard disks, read-only memories (ROM for short), random access memories (RAM for short), magnetic disks, or optical discs.

[0178] The preferred embodiments of the embodiments of the present invention have been described above with reference to the accompanying drawings, but this does not limit the scope of the rights of the embodiments of the present invention. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present invention shall be within the scope of the rights of the embodiments of the present invention.

Claims

1. A component update method, applied to the Fastlane tool, characterized in that Including: Obtain the source code files of the server side; wherein, the source code files include index files and dependency files; Detect whether there are new components in the source code files according to the index files If there are new components, read a preset component configuration table to obtain the version numbers of the new components; Read the component configuration table to obtain description information, and obtain a parsing result according to the description information, where the parsing result is used to determine whether to update the dependency file, and the description information includes: first information, second information, and third information; the first information is used to indicate that the referenced version number is equal to the version number of the new component, the referenced version number indicates the version number of the preset component referencing the new component, the second information is used to indicate that the referenced version number is greater than the version number of the new component, and the third information is used to indicate that the referenced version number is less than the version number of the new component; Update the dependency file according to the parsing result; Install the new components according to the dependency file; The updating of the dependency file according to the parsing result at least includes: if the description information is the first information, then update the dependency file.

2. The component update method according to claim 1, wherein The updating of the dependency file according to the parsing result includes: If the description information is the second information, do not update the dependency file; If the description information is the third information, generate conflict information.

3. The component update method according to any one of claims 1 to 2, characterized in that, After installing the new components according to the dependency file, it further includes: performing annotation processing on the dependency file, specifically including: Obtain the modification information of the dependency file; Generate annotation information according to the modification information; Annotate the annotation information in the dependency file.

4. The component update method according to any one of claims 1 to 2, characterized in that After installing the new components according to the dependency file, it further includes: Generate a push command; Use the push command to push the dependency file to the server side.

5. The component update method according to claim 1, wherein Before obtaining the source code files of the server side, it further includes: Detect the code status of the local side; wherein, the code status includes the editing status; Clear the code in the editing status.

6. The component update method according to claim 1, wherein The source code files further include branch information. After obtaining the source code files of the server side, it further includes: Obtain the current project branch information of the local side; Compare the branch information with the current project branch information for consistency; If the branch information is inconsistent with the current project branch information, re-obtain the source code files.

7. A component update device, applied to the Fastlane tool, characterized in that Including: A source code file acquisition module for obtaining the source code files of the server side; wherein, the source code files include index files and dependency files; A component detection module for detecting whether there are new components in the source code files according to the index files; A version number reading module for, if there are new components, reading a preset component configuration table to obtain the version numbers of the new components; A dependency file parsing module, configured to read the component configuration table to obtain description information, and obtain a parsing result according to the description information, where the parsing result is used to determine whether to update the dependency file, and the description information includes: first information, second information, and third information; the first information is used to indicate that the referenced version number is equal to the version number of the new component, the referenced version number represents the version number of the preset component referencing the new component, the second information is used to indicate that the referenced version number is greater than the version number of the new component, and the third information is used to indicate that the referenced version number is less than the version number of the new component; A dependency file update module, configured to update the dependency file according to the parsing result; A component installation module, configured to install the new component according to the dependency file; The updating the dependency file according to the parsing result at least includes: if the description information is the first information, then update the dependency file.

8. An electronic device, characterized in that, Comprising a processor and a memory; The memory is used to store programs; The processor is configured to execute the component update method according to any one of claims 1 to 6 according to the program.

9. A computer-readable storage medium, storing computer-executable instructions, where the computer-executable instructions are used to execute the component update method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Version releasing method and device based on multi-environment offline task

    CA3159788A1

  • Software package-based online automatic updating method for open source operating system of mobile terminal

    CN102118500A