Code synchronization, component publishing method and device, and computer storage medium
By modifying the dependency model of the code and generating attribute description files, automatic code synchronization and manual-free release of components are realized, solving the problems of low code synchronization efficiency and high development cost in the existing technology, and improving the efficiency of multi-person collaborative development. .
Patent Information
- Application Number
- CN202111482168.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-12-06
AI Technical Summary
Code synchronization in the existing technology relies on manual operations, resulting in low efficiency, slow development progress, and high costs, especially in multi-person collaborative development projects.
By changing the dependency mode of the code to be modified to the path dependency mode, a property description file is generated, and the Pod library is used to synchronize the target code to the managed project. At the same time, during the component release phase, the dependency mode is changed to a version dependency mode, and the property description is modified. file to publish the component.
It realizes automatic code synchronization and manual-free release of components, improves the efficiency of code synchronization and component release, saves development costs, and improves teamwork efficiency.
Smart Images

Figure CN114153480B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a code synchronization and component publishing method and device thereof, a computer storage medium, an electronic device, and a computer program product. Background Art
[0002] When developing an application, the problem of code synchronization is involved. However, in the prior art, code synchronization is completely dependent on manual development operations, which results in low synchronization efficiency, slow application development progress, and high development costs. Summary of the invention
[0003] The embodiments of the present disclosure provide a code synchronization and component publishing method and device thereof, a computer storage medium, an electronic device, and a computer program product to overcome or alleviate the above-mentioned technical problems existing in the prior art.
[0004] The technical solution adopted in this disclosure is:
[0005] A code synchronization method, comprising:
[0006] Modifying the dependency mode of the code to be modified into a path dependency mode, and generating a property description file for the code to be modified, so as to edit the code to be modified and generate a target code to be synchronized;
[0007] The Pod library including the target code is executed to synchronize the target code to the project managing the Pod library.
[0008] Optionally, the step of modifying the dependency mode of the code to be modified into a path dependency mode includes:
[0009] Determining a component corresponding to the code to be modified;
[0010] By modifying the dependency mode of the component into a path dependency mode, the dependency mode of the code to be modified is modified into a path dependency mode.
[0011] Optionally, the dependency mode of the component is modified to a path dependency mode by the following operations:
[0012] Obtaining declaration data for the component;
[0013] The declaration data is modified so that the dependency mode of the component is modified to a path dependency mode.
[0014] Optionally, the modifying the declaration data so that the dependency mode of the component is modified to a path dependency mode includes:
[0015] The declaration data is modified by modifying the regular matching of the dependency pattern so that the dependency pattern of the component is modified to a path dependency pattern.
[0016] Optionally, generating a property description file for the code to be modified includes:
[0017] A property description file for the code to be modified is generated by modifying the component configuration file of the code to be modified.
[0018] Optionally, the step of modifying a component configuration file of the code to be modified to generate a property description file for the code to be modified includes:
[0019] The property description file for the code to be modified is generated by modifying the basic component description data of the code to be modified and the record data of the dependency pattern.
[0020] Optionally, the code synchronization method further comprises: in response to receiving a synchronization request for the target code,
[0021] Upload the target code to a specified directory;
[0022] The target code is synchronized from the designated directory to the initiator of the synchronization request.
[0023] Optionally, the code synchronization method further comprises: in response to receiving a synchronization request for the target code,
[0024] When it is determined that the target code has been synchronized to the project, uploading the target code to a designated directory and synchronizing the target code from the designated directory to the initiator of the synchronization request; and / or
[0025] When it is determined that the target code has not yet been synchronized to the project, first notify the developer of the target code to synchronize the target code to the project, then upload the target code to the specified directory, and synchronize the target code from the specified directory to the initiator of the synchronization request.
[0026] Optionally, the code synchronization method further includes: when it is determined that the target code has been synchronized to the project, first notifying the developer of the target code to confirm whether there is an updated version of the target code that has not been synchronized to the project, wherein:
[0027] If the developer confirms that there is an updated version of the target code that has not been synchronized to the project, remind the developer to update the version of the target code, and after the developer synchronizes the updated version of the target code to the project, perform the operation of uploading the target code to a designated directory and synchronizing the target code from the designated directory to the initiator of the synchronization request; and / or
[0028] When the developer confirms that there is no updated version of the target code that needs to be synchronized to the project, the target code is directly uploaded to the designated directory and synchronized from the designated directory to the initiator of the synchronization request.
[0029] Optionally, the code synchronization method further comprises: in response to receiving a synchronization request for the target code,
[0030] When it is determined that the initiator of the synchronization request is also the developer of the target code and it is determined that the target code has not been locally synchronized from the first development terminal of the developer to the project, a prompt for uploading the code is generated and sent to the developer.
[0031] Optionally, the code synchronization method further includes:
[0032] In the case where the target code has been uploaded to the project based on the prompt, an operation of uploading the target code to a designated directory and synchronizing the target code from the designated directory to a second development terminal of the developer is performed.
[0033] A component publishing method, comprising:
[0034] Determine the target code that has been synchronized or can be synchronized to the project that manages the Pod library;
[0035] The dependency mode of the target code is modified to a version dependency mode, and the property description file corresponding to the target code is modified to publish the component corresponding to the target code to the corresponding server.
[0036] Optionally, modifying the dependency mode of the target code to a version dependency mode includes:
[0037] determining a component corresponding to the object code;
[0038] By modifying the dependency mode of the component into a version dependency mode, the dependency mode of the target code is modified into a version dependency mode.
[0039] Optionally, the dependency mode of the component is modified to a version dependency mode by performing the following operations:
[0040] Obtaining declaration data for the component;
[0041] The declaration data is modified so that the dependency mode of the component is modified to a version dependency mode.
[0042] Optionally, the modifying the declaration data so that the dependency mode of the component is modified to a version dependency mode includes:
[0043] The declaration data is modified by modifying the regular matching of the dependency pattern so that the dependency pattern of the component is modified to a version dependency pattern.
[0044] Optionally, the modifying the dependency mode of the target code to a version dependency mode, and modifying a property description file corresponding to the target code to publish a component corresponding to the target code to a corresponding server, includes:
[0045] The project publishes the component corresponding to the target code to the corresponding server based on the version dependency mode and the modified property description file.
[0046] A code synchronization device, comprising:
[0047] A first processing unit is used to modify the dependency mode of the code to be modified to a path dependency mode, and generate a property description file for the code to be modified, so as to edit the code to be modified and generate a target code to be synchronized;
[0048] The second processing unit is used to execute the Pod library including the target code to synchronize the target code to the project managing the Pod library.
[0049] A component publishing device, comprising:
[0050] A third processing unit is used to determine the target code in the project that has been synchronized or can be synchronized to the management Pod library;
[0051] The fourth processing unit is used to modify the dependency mode of the target code to a version dependency mode, and modify the property description file corresponding to the target code to publish the component corresponding to the target code to the corresponding server.
[0052] A computer storage medium having a computer executable program stored thereon, wherein the computer executable program is executed to implement the method according to any one of the embodiments of the present disclosure.
[0053] An electronic device comprises a memory and a processor, wherein the memory is used to store a computer executable program, and the processor is used to run the computer executable program to implement any one of the methods according to the embodiments of the present disclosure.
[0054] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the computer program implements the method according to any one of the embodiments of the present disclosure.
[0055] In the disclosed embodiment, the dependency mode of the code to be modified is modified to a path dependency mode, and a property description file for the code to be modified is generated, so that the code to be modified is edited to generate a target code that needs to be synchronized, and a Pod library including the target code is executed to synchronize the target code to a project that manages the Pod library. In this way, in a multi-person collaborative development project, all developers can automatically synchronize the software codes they develop to the same shared location (i.e., the project that manages the Pod library), and then these developers can also obtain the target codes synchronized by themselves or others from the project that manages the Pod library, thereby improving the code synchronization efficiency, while improving the teamwork efficiency and saving development costs.
[0056] In the disclosed embodiment, the dependency mode of the target code is modified to a version dependency mode, and the property description file corresponding to the target code is modified to publish the component corresponding to the target code to the corresponding server. The entire process does not require manual operation, thereby improving the efficiency of component publishing, accelerating the progress of application development, and reducing development costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A schematic diagram of an application scenario of an embodiment of the present disclosure is schematically shown;
[0058] Figure 2 A schematic diagram of an application scenario of another embodiment of the present disclosure is schematically shown;
[0059] Figure 3A The flowchart of the code synchronization method according to the embodiment of the present disclosure is schematically shown;
[0060] Figure 3B The flowchart of step S301 of the embodiment of the present disclosure is schematically shown;
[0061] Figure 3C The flowchart of step S321 of the embodiment of the present disclosure is schematically shown;
[0062] Figure 4A The schematic diagram schematically shows the process flow of the component publishing method of the embodiment of the present disclosure;
[0063] Figure 4B The flowchart of step S402 of the embodiment of the present disclosure is schematically shown;
[0064] Figure 4C The flowchart of step S422 of the embodiment of the present disclosure is schematically shown;
[0065] Figure 5 A schematic diagram schematically shows a code synchronization device according to an embodiment of the present disclosure;
[0066] Figure 6 A schematic diagram schematically shows a component publishing device according to an embodiment of the present disclosure;
[0067] Figure 7 A schematic diagram of an electronic device according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0068] In order to make the technical problems, technical solutions and advantages to be solved by the present disclosure more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0069] In the following embodiments of the present disclosure, for example, considering that when developing an application, it will involve multiple functions to be implemented by the application, for this reason, for the development of each function, there are multiple functional components divided according to the components, that is, the goal of developing a functional component is to realize at least one function, and this development mode is also called component development in the industry. For this reason, in the development process of the application, a component management tool is introduced, such as for the application development based on the IOS (Internet Operating System, Internet operating system) system, the CocoaPods tool is generally used for management. When component development is carried out based on the CocoaPods tool, a Pod library will be allocated for the development of each functional component to independently write the relevant code, and the Pod libraries of all components are managed under a project (i.e., engineering), and after the corresponding code of each component is completed, it can be synchronized to the project by running the corresponding Pod library, so that all developers responsible for the development of different components of the same application can see it, and when the product is about to go online, it is merged together for testing (or also called merged testing).
[0070] When the requirements of the application change, the Pod library will be modified in conjunction with it, or when switching between multiple Pod libraries, the synchronization of the codes corresponding to each component will be involved.
[0071] In one implementation, the synchronization of the above codes completely relies on manual operations of developers, which results in low efficiency of code synchronization, and further leads to slow development progress and high development costs of the application.
[0072] Based on the above specific application scenarios, the embodiments of the present disclosure are exemplarily described as follows.
[0073] Figure 1 The following schematically shows an application scenario diagram of an embodiment of the present disclosure. Figure 1 As shown, the application scenario is for a code synchronization system, which includes an electronic device 101 and a server 102. The server 102 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The electronic device 101 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this. The electronic device 101 and the above-mentioned server 102 can be directly or indirectly connected via wireless communication (such as a network), and the present disclosure is not limited here.
[0074] To this end, in an embodiment of the present disclosure, a code synchronization device is set on the electronic device 101, and the following code synchronization method can be executed through the device: the dependency mode of the code to be modified is modified to a path dependency mode, and a property description file for the code to be modified is generated to edit the code to be modified and generate a target code that needs to be synchronized; the Pod library including the target code is executed to synchronize the target code to the project that manages the Pod library.
[0075] And / or, the electronic device 101 can also execute the following method: determine the target code that has been synchronized or can be synchronized to the project that manages the Pod library; modify the dependency mode of the target code to a version dependency mode, and modify the property description file corresponding to the target code to publish the component corresponding to the target code to the corresponding server.
[0076] In the disclosed embodiments, during the software code development stage, the dependency mode of the code to be modified can be modified to a path dependency mode, and a property description file for the code to be modified can be generated, so that the code to be modified can be edited to generate a target code that needs to be synchronized, and the Pod library including the target code can be executed to synchronize the target code to the project that manages the Pod library, so that in a multi-person collaborative development project, all developers can automatically synchronize the software code they develop to the same shared location (i.e., the project that manages the Pod library), and then these developers can also obtain the target code synchronized by themselves or others from the project that manages the Pod library, thereby improving the code synchronization efficiency, while also improving the teamwork efficiency and saving development costs.
[0077] In the embodiment of the present disclosure, during the component release stage, it is possible to determine the target code that has been synchronized or can be synchronized to the project managing the Pod library, modify the dependency mode of the target code to a version dependency mode, and modify the property description file corresponding to the target code to release the component corresponding to the target code to the corresponding server. The entire process does not require manual operation, thereby improving the efficiency of component release, accelerating the progress of application development, and reducing development costs.
[0078] Figure 2 The following schematically shows an application scenario diagram of another embodiment of the present disclosure. Figure 2 As shown, in the system, the development of an application based on the IOS system is taken as an example for explanation. For this purpose, a CocoaPods tool is installed on each electronic device 101 for code writing. The CocoaPods tool is used to implement component management. For example, a functional component is used to provide code to implement a function of an application. For a functional component, if only one electronic device is used to participate in the development, a Pod library is set on the electronic device. Therefore, since there are multiple functional components, there will be multiple Pod libraries, and the multiple Pod libraries are managed under one project.
[0079] Of course, here we only take the IOS system as an example for explanation. The application development based on the ANDROID system is similar, so we will not go into details.
[0080] Figure 3A The flowchart of the code synchronization method according to the embodiment of the present disclosure is schematically shown. Figure 3A As shown, it includes:
[0081] S301, modifying the dependency mode of the code to be modified into a path dependency mode, and generating a property description file for the code to be modified, so as to edit the code to be modified and generate a target code that needs to be synchronized.
[0082] Optionally, Figure 3B The flowchart of step S301 of the embodiment of the present disclosure is schematically shown. Figure 3B As shown, the step S301 of modifying the dependency mode of the code to be modified into a path dependency mode includes:
[0083] S311, determining a component corresponding to the code to be modified;
[0084] S321. Modify the dependency mode of the component into a path dependency mode, so that the dependency mode of the code to be modified is modified into a path dependency mode.
[0085] Specifically, if applied to the scenario of the IOS system, in the step 311, the component that manages the code to be modified can be determined specifically through the Pod library (eg, Podfile).
[0086] It should be understood that once the dependency mode of a component is modified to a path dependency mode, it indicates that the component is currently in a development state. Once the dependency mode of a component is modified to a version dependency mode, it indicates that the component is currently in a released state.
[0087] Figure 3C The flowchart of step S321 of the embodiment of the present disclosure is schematically shown. Figure 3C As shown, in step S321, the dependency mode of the component is modified to a path dependency mode by the following operations:
[0088] S3211, obtaining declaration data of the component;
[0089] S3212: Modify the declaration data so that the dependency mode of the component is changed to a path dependency mode.
[0090] Specifically, the dependency pattern of the component is recorded in the declaration data, and therefore, the dependency pattern of the component can be modified by modifying the recorded dependency pattern.
[0091] For application development based on IOS system, the path dependency mode is also called path dependency mode.
[0092] Further, in this embodiment or other embodiments, in step S3212, the declaration data is modified so that the dependency mode of the component is modified to a path dependency mode, including: modifying the declaration data by modifying the regular match of the dependency pattern so that the dependency mode of the component is modified to a path dependency mode.
[0093] Since the types of dependency patterns are relatively limited in the component-based development process, the simple method of regular matching can effectively implement the modification of declaration data, and thus quickly achieve the purpose of dependency pattern modification. For example, in a specific application scenario, the regular matching of modifying the dependency pattern is triggered by modifying the dependency pattern instruction to implement the step of modifying the dependency pattern to the path dependency pattern. For example, the instruction to modify the dependency pattern is Pod changePodName-path, where PodName is the name of the Pod library corresponding to the component. Since the Pod library and the component are one-to-one corresponding, the Pod library name can be used to determine which component to modify, and then the instruction here is used to trigger the step of modifying the path dependency pattern.
[0094] In one application scenario, the dependency mode of the component defaults to version dependency (i.e., the officially released component version). Since the dependency mode is the version dependency mode, real-time synchronization of the target code cannot be achieved. Therefore, in step S301, the version dependency mode is modified to the path dependency mode.
[0095] Optionally, in this embodiment or other embodiments, in step S301, generating a property description file for the code to be modified may specifically include: generating a property description file for the code to be modified by modifying a component configuration file of the code to be modified.
[0096] Furthermore, the method of modifying the component configuration file of the code to be modified to generate a property description file for the code to be modified specifically includes: modifying the basic component description data of the code to be modified and the record data of the dependency pattern to generate a property description file for the code to be modified.
[0097] The basic description data of the component includes the version number of the component and the address of the component corresponding code, and the recording data of the dependency pattern records the mapping relationship between the path dependency pattern and the component. Therefore, the version number and the address of the code can be modified by modifying the basic description data, and the mapping relationship between the component and the path dependency pattern can be added to the recording data of the dependency pattern by modifying the recording data of the dependency pattern.
[0098] Exemplarily, in a scenario where application development is performed based on the IOS system, the component configuration file includes, for example, PodSource.plist and SourchArray. PodSource.plist is modified to modify the basic component description data of the code to be modified, and SourchArray is modified to modify the dependency pattern record data to add the mapping relationship between the component and the path dependency pattern to the dependency pattern record data. The property description file of the code to be modified includes the modified PodSource.plist and SourchArray, so that the name of the Pod library can be matched based on PodSource.plist, and then SourchArray is used to confirm that the dependency pattern is path dependency, thereby ensuring that the Pod library is downloaded for editing during the development process.
[0099] S302: Execute the Pod library including the target code to synchronize the target code to the project that manages the Pod library.
[0100] In this embodiment, for example, the install pod instruction may be run to execute the Pod library including the target code to synchronize the target code to the project that manages the Pod library.
[0101] Furthermore, in some embodiments of the present disclosure, the code synchronization method may also include: in response to receiving a synchronization request for the target code, uploading the target code to a designated directory; and synchronizing the target code from the designated directory to the initiator of the synchronization request.
[0102] Alternatively, in other embodiments of the present disclosure, the code method may further specifically include: in response to receiving a synchronization request for the target code, when it is determined that the target code has been synchronized to the project, executing the operation of uploading the target code to a designated directory, and synchronizing the target code from the designated directory to the initiator of the synchronization request.
[0103] And / or, in other embodiments of the present disclosure, the code method may further specifically include: in response to receiving a synchronization request for the target code, when it is determined that the target code has not yet been synchronized to the project, first notifying the developer of the target code to synchronize the target code to the project, then uploading the target code to a designated directory, and synchronizing the target code from the designated directory to the initiator of the synchronization request.
[0104] Alternatively, in some embodiments of the present disclosure, the code synchronization method further includes: in a case where it is determined that the target code has been synchronized to the project, first notifying the developer of the target code to confirm whether there is an updated version of the target code that has not been synchronized to the project, wherein, in a case where the developer confirms that there is an updated version of the target code that has not been synchronized to the project, reminding the developer to perform a version update on the target code, and after the developer synchronizes the updated version of the target code to the project, uploading the target code to a designated directory and synchronizing the target code from the designated directory to the initiator of the synchronization request is performed; and / or, in a case where the developer confirms that there is no updated version of the target code that needs to be synchronized to the project, directly uploading the target code to a designated directory and synchronizing the target code from the designated directory to the initiator of the synchronization request is performed.
[0105] Alternatively, in some embodiments of the present disclosure, the code synchronization method further includes: in response to receiving a synchronization request for the target code, when it is determined that the initiator of the synchronization request is also the developer of the target code, and when it is determined that the target code has not yet been locally synchronized from the first development end of the developer to the project, generating and sending a prompt to the developer to upload the code.
[0106] Further, in other embodiments of the present disclosure, the code synchronization method may further include: when the target code has been uploaded to the project based on the prompt, performing an operation of uploading the target code to a designated directory and synchronizing the target code from the designated directory to a second development terminal of the developer. This operation may be performed after generating and sending a prompt for uploading the code to the developer.
[0107] Here, it should be noted that the execution order of the above-mentioned related steps based on responding to the receipt of the synchronization request for the target code can be flexibly set according to the requirements of the application scenario without deviating from the concept of the present disclosure.
[0108] Figure 4A The schematic diagram of the process flow of the component publishing method of the embodiment of the present disclosure is shown. Figure 4A As shown, the component publishing method may include:
[0109] S401, determining the target code that has been synchronized or can be synchronized to the project managing the Pod library;
[0110] S402: Modify the dependency mode of the target code to a version dependency mode, and modify the property description file corresponding to the target code to publish the component corresponding to the target code to the server.
[0111] Optionally, Figure 4B The flowchart of step S402 of the embodiment of the present disclosure is schematically shown. Figure 4B As shown, the modification of the dependency mode of the target code to the version dependency mode includes:
[0112] S412, determining a component corresponding to the target code;
[0113] S422. Modify the dependency mode of the component into a version dependency mode, so that the dependency mode of the target code is modified into a version dependency mode.
[0114] Optionally, Figure 4C The flowchart of step S422 of the embodiment of the present disclosure is schematically shown. Figure 4C As shown, in step S422, the dependency mode of the component is modified to the version dependency mode by the following operations:
[0115] S4221. Obtain declaration data of the component;
[0116] S4222. Modify the declaration data so that the dependency mode of the component is changed to a version dependency mode.
[0117] Optionally, in this embodiment, modifying the declaration data so that the dependency mode of the component is modified to a version dependency mode includes: modifying the declaration data by modifying the regular match of the dependency mode so that the dependency mode of the component is modified to a version dependency mode.
[0118] In this embodiment, the execution of the above steps S4221 and S4222 is similar to the above steps S3111 and S3112. The difference is that the above steps S3111 and S3112 modify the dependency mode to path dependency, while in steps S4221 and S4222, considering that the code is subsequently released to the server in components, that is, the code release is completed only after all the codes corresponding to a component are released. In order to support this need, the above steps S4221 and S4222 are used to modify the dependency mode to version dependency.
[0119] Exemplarily, since the dependency pattern is modified to version dependency, the mapping relationship between the component and the path dependency pattern can be removed from SourchArray. At the same time, PodSource.plist is modified to update the version number of the component and the address of the component corresponding code to facilitate the execution of the Pod library.
[0120] Exemplarily, in this embodiment, the dependency mode of the target code is modified to a version dependency mode, and the property description file corresponding to the target code is modified to synchronize the components corresponding to the target code to the server, including: the project publishes the components corresponding to the target code to the corresponding server based on the version dependency mode and the modified property description file.
[0121] Figure 5 A schematic diagram of a code synchronization device according to an embodiment of the present disclosure is schematically shown. Figure 5 As shown, the code synchronization device 500 includes:
[0122] The first processing unit 501 is used to modify the dependency mode of the code to be modified to a path dependency mode, and generate a property description file for the code to be modified, so as to edit the code to be modified and generate a target code to be synchronized;
[0123] The second processing unit 502 is used to execute the Pod library including the target code to synchronize the target code to the project managing the Pod library.
[0124] Optionally, the first processing unit 501 is specifically used to determine a component corresponding to the code to be modified; and modify the dependency mode of the code to be modified to a path dependency mode by modifying the dependency mode of the component to a path dependency mode.
[0125] Optionally, the first processing unit 501 is specifically used to modify the dependency mode of the component to a path dependency mode by the following operations: obtaining declaration data of the component; and modifying the declaration data to modify the dependency mode of the component to a path dependency mode.
[0126] Optionally, the first processing unit 501 is specifically configured to modify the declaration data by modifying the regular matching of the dependency pattern, so that the dependency pattern of the component is modified to a path dependency pattern.
[0127] Optionally, the first processing unit 501 is specifically configured to generate a property description file for the code to be modified by modifying a component configuration file of the code to be modified.
[0128] Optionally, the first processing unit 501 is specifically configured to generate a property description file for the code to be modified by modifying basic component description data of the code to be modified and record data of the dependency pattern.
[0129] Optionally, the code synchronization device may further include a code uploading unit for uploading the target code to a designated directory in response to receiving a synchronization request for the target code; and synchronizing the target code from the designated directory to the initiator of the synchronization request.
[0130] Alternatively, optionally, the code synchronization device may further include a code uploading unit for responding to receiving a synchronization request for the target code, and upon determining that the target code has been synchronized to the project, uploading the target code to a designated directory and synchronizing the target code from the designated directory to the initiator of the synchronization request; and / or upon determining that the target code has not yet been synchronized to the project, first notifying the developer of the target code to synchronize the target code to the project, and then uploading the target code to the designated directory and synchronizing the target code from the designated directory to the initiator of the synchronization request.
[0131] Alternatively, optionally, the code synchronization device may further include a code uploading unit which, in response to receiving a synchronization request for the target code, generates and sends a prompt to the developer to upload the code when it is determined that the initiator of the synchronization request is also the developer of the target code and when it is determined that the target code has not yet been locally synchronized from the developer's first development end to the project.
[0132] Optionally, the code uploading unit is also used to upload the target code to a designated directory and synchronize the target code from the designated directory to a second development terminal of the developer when the target code has been uploaded to the project based on the prompt.
[0133] Figure 6 The schematic diagram of the component publishing device of the embodiment of the present disclosure is schematically shown. Figure 6 As shown, the code synchronization device 600 includes:
[0134] The third processing unit 601 is used to determine the syncable target code in the management Pod library project;
[0135] The fourth processing unit 602 is used to modify the dependency mode of the target code to a version dependency mode, and modify the property description file corresponding to the target code to synchronize the component corresponding to the target code to the corresponding server.
[0136] Optionally, the third processing unit 601 is specifically used to determine a component corresponding to the target code; and modify the dependency mode of the target code to a version dependency mode by modifying the dependency mode of the component to a version dependency mode.
[0137] Optionally, the third processing unit 601 is specifically used to modify the dependency mode of the component to the version dependency mode through the following operations: obtaining declaration data of the component; and modifying the declaration data to modify the dependency mode of the component to the version dependency mode.
[0138] Optionally, the third processing unit 601 is specifically configured to modify the declaration data by modifying the regular matching of the dependency pattern, so that the dependency pattern of the component is modified to a version dependency pattern.
[0139] Optionally, the fourth processing unit 602 is specifically configured to: publish, by the project, the component corresponding to the target code to a corresponding server based on the version dependency pattern and the modified property description file.
[0140] Figure 7 The schematic diagram of the electronic device of the embodiment of the present disclosure is schematically shown. Figure 7 As shown, the electronic device includes: a memory 701 and a processor 702, the memory stores a computer executable program, and the processor is used to run the computer executable program to implement any one of the methods in the embodiments of the present disclosure.
[0141] The embodiments of the present disclosure further provide a computer storage medium, on which a computer executable program is stored, and the computer executable program is executed to implement any one of the methods in the embodiments of the present disclosure.
[0142] The embodiments of the present disclosure further provide a computer program product, including a computer program, which implements the method according to any one of the embodiments of the present disclosure when executed by a processor.
[0143] The above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A code synchronization method, include: Modifying the dependency mode of the code to be modified into a path dependency mode, and generating a property description file for the code to be modified, so as to edit the code to be modified and generate a target code to be synchronized; Executing a Pod library including the target code to synchronize the target code to a project managing the Pod library; The step of modifying the dependency mode of the code to be modified into a path dependency mode includes: Determining a component corresponding to the code to be modified; By modifying the dependency mode of the component to be a path dependency mode, the dependency mode of the code to be modified is modified to be a path dependency mode; The dependency mode of the component is modified to a path dependency mode by the following operations: Obtaining declaration data for the component; By modifying the declaration data, the dependency mode of the component is modified to a path dependency mode; The step of modifying the declaration data so that the dependency mode of the component is changed to a path dependency mode includes: The declaration data is modified by modifying the regular matching of the dependency pattern so that the dependency pattern of the component is modified to a path dependency pattern; The regular matching of modifying the dependency pattern is triggered by modifying the dependency pattern instruction, so as to implement the step of modifying the dependency pattern to the path dependency pattern. The instruction for modifying the dependency pattern is Pod change PodName –path, where PodName is the Pod library name corresponding to the component. The generating of the property description file for the code to be modified includes: generating the property description file for the code to be modified by modifying the component configuration file of the code to be modified; The step of modifying the component configuration file of the code to be modified to generate the property description file for the code to be modified includes: modifying the basic component description data of the code to be modified and the record data of the dependency pattern to generate the property description file for the code to be modified; The component configuration file includes PodSource.plist and SourchArray. PodSource.plist is modified to modify the basic description data of the component of the code to be modified. SourchArray is modified to modify the dependency pattern record data to add the mapping relationship between the component and the path dependency pattern to the dependency pattern record data. The property description file of the code to be modified includes the modified PodSource.plist and SourchArray.
2. The method according to claim 1, further comprising: include: In response to receiving a synchronization request for the object code, Upload the target code to a specified directory; The target code is synchronized from the designated directory to the initiator of the synchronization request.
3. The method according to claim 2, further comprising: include: In response to receiving a synchronization request for the object code, When it is determined that the target code has been synchronized to the project, uploading the target code to a designated directory and synchronizing the target code from the designated directory to the initiator of the synchronization request; and / or When it is determined that the target code has not yet been synchronized to the project, first notify the developer of the target code to synchronize the target code to the project, then upload the target code to the specified directory, and synchronize the target code from the specified directory to the initiator of the synchronization request.
4. The method according to claim 3, further comprising: include: When it is determined that the target code has been synchronized to the project, the developer of the target code is first notified to confirm whether there is an updated version of the target code that has not been synchronized to the project, wherein: If the developer confirms that there is an updated version of the target code that has not been synchronized to the project, remind the developer to update the version of the target code, and after the developer synchronizes the updated version of the target code to the project, perform the operation of uploading the target code to a designated directory and synchronizing the target code from the designated directory to the initiator of the synchronization request; and / or When the developer confirms that there is no updated version of the target code that needs to be synchronized to the project, the target code is directly uploaded to the designated directory and synchronized from the designated directory to the initiator of the synchronization request.
5. The method according to claim 1, further comprising: include: In response to receiving a synchronization request for the object code, When it is determined that the initiator of the synchronization request is also the developer of the target code and it is determined that the target code has not been locally synchronized from the first development terminal of the developer to the project, a prompt for uploading the code is generated and sent to the developer.
6. The method according to claim 5, further comprising: include: In the case where the target code has been uploaded to the project based on the prompt, an operation of uploading the target code to a designated directory and synchronizing the target code from the designated directory to a second development terminal of the developer is performed.
7. A component publishing method based on the code synchronization method according to any one of claims 1 to 6, include: Determine the target code that has been synchronized or can be synchronized to the project that manages the Pod library; The dependency mode of the target code is modified to a version dependency mode, and the property description file corresponding to the target code is modified to publish the component corresponding to the target code to the corresponding server.
8. The method according to claim 7, It is characterized in that The modifying the dependency mode of the target code to a version dependency mode includes: determining a component corresponding to the object code; By modifying the dependency mode of the component into a version dependency mode, the dependency mode of the target code is modified into a version dependency mode.
9. The method according to claim 7, It is characterized in that Change the dependency mode of the component to version dependency mode by performing the following operations: Obtaining declaration data for the component; The declaration data is modified so that the dependency mode of the component is modified to a version dependency mode.
10. The method according to claim 9, It is characterized in that The step of modifying the declaration data so that the dependency mode of the component is changed to a version dependency mode includes: The declaration data is modified by modifying the regular matching of the dependency pattern so that the dependency pattern of the component is modified to a version dependency pattern.
11. The method according to claim 7, It is characterized in that The step of modifying the dependency mode of the target code to a version dependency mode and modifying the property description file corresponding to the target code to publish the component corresponding to the target code to the corresponding server includes: The project publishes the component corresponding to the target code to the corresponding server based on the version dependency mode and the modified property description file.
12. A code synchronization device, include: A first processing unit is used to modify the dependency mode of the code to be modified to a path dependency mode, and generate a property description file for the code to be modified, so as to edit the code to be modified and generate a target code to be synchronized; A second processing unit, configured to execute a Pod library including the target code to synchronize the target code to a project managing the Pod library; The step of modifying the dependency mode of the code to be modified into a path dependency mode includes: Determining a component corresponding to the code to be modified; By modifying the dependency mode of the component to be a path dependency mode, the dependency mode of the code to be modified is modified to be a path dependency mode; The dependency mode of the component is modified to a path dependency mode by the following operations: Obtaining declaration data for the component; By modifying the declaration data, the dependency mode of the component is modified to a path dependency mode; The step of modifying the declaration data so that the dependency mode of the component is changed to a path dependency mode includes: The declaration data is modified by modifying the regular matching of the dependency pattern so that the dependency pattern of the component is modified to a path dependency pattern; The regular matching of modifying the dependency pattern is triggered by modifying the dependency pattern instruction, so as to implement the step of modifying the dependency pattern to the path dependency pattern. The instruction for modifying the dependency pattern is Pod change PodName –path, where PodName is the Pod library name corresponding to the component. The generating of the property description file for the code to be modified includes: generating the property description file for the code to be modified by modifying the component configuration file of the code to be modified; The step of modifying the component configuration file of the code to be modified to generate the property description file for the code to be modified includes: modifying the basic component description data of the code to be modified and the record data of the dependency pattern to generate the property description file for the code to be modified; The component configuration file includes PodSource.plist and SourchArray. PodSource.plist is modified to modify the basic description data of the component of the code to be modified. SourchArray is modified to modify the dependency pattern record data to add the mapping relationship between the component and the path dependency pattern to the dependency pattern record data. The property description file of the code to be modified includes the modified PodSource.plist and SourchArray.
13. A component publishing device based on the code synchronization device according to claim 12, include: A third processing unit is used to determine the target code in the project that has been synchronized or can be synchronized to the management Pod library; The fourth processing unit is used to modify the dependency mode of the target code to a version dependency mode, and modify the property description file corresponding to the target code to publish the component corresponding to the target code to the corresponding server.
14. A computer storage medium having a computer executable program stored thereon, wherein the computer executable program is executed to implement the method according to any one of claims 1 to 11.
15. An electronic device, comprising a memory and a processor, wherein the memory is used to store a computer executable program, and the processor is used to run the computer executable program to implement the method according to any one of claims 1 to 11.
16. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 11.
