A code integration method, apparatus, device, and medium

By creating multiple code execution paths in software project development and utilizing multi-threading and interface checking mechanisms, the problems of cumbersome code integration process and frequent errors are solved, efficient code integration and error exposure are achieved, and development efficiency is improved.

CN115357227BActive Publication Date: 2025-10-21CHONGQING CHANGAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210986734.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-17
Publication Date
2025-10-21
Estimated Expiration
2042-08-17

AI Technical Summary

Technical Problem

In software project development, the code integration process is cumbersome and prone to errors, resulting in low development efficiency and the inability to promptly detect code conflicts and errors between modules.

Method used

By creating multiple code execution paths, running the code repository to obtain source code data, performing code conversion and compilation to generate dynamic libraries, performing interface checks in conjunction with the interface check directory, generating integrated target files and sending them to the server, and using multi-threading and email feedback mechanisms to handle failures.

Benefits of technology

It reduces code acquisition and compilation time, improves code integration efficiency, detects and corrects code errors in a timely manner, and reduces complicated operations during the integration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115357227B_ABST
    Figure CN115357227B_ABST
Patent Text Reader

Abstract

The application relates to the computer technology field and provides a code integration method, which comprises the following steps: creating multiple code execution channels; running the code execution channels to obtain source code data from a code warehouse; performing code conversion and code compilation on the source code data to generate a dynamic library; placing the dynamic library in an interface checking directory; obtaining a configuration file with the same name as the dynamic library from the code warehouse and placing the configuration file in the interface checking directory; performing interface checking through the interface checking directory according to the dynamic library and the configuration file; and after the interface checking is correct, generating an integrated target file and sending the integrated target file to a server. The code integration method provided by the application improves the code integration efficiency and solves the problems of complicated and inefficient integration work.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a code integration method, apparatus, device and medium. Background Art

[0002] During software project development, to reduce interference in the early stages and improve efficiency, different modules are divided according to functionality or specific methodologies, and development work is carried out in separate modules. While developing each module independently reduces coupling, it can lead to changes in one module being lost in the lives of related modules, resulting in wasted time. Once all development work is complete, the developed program modules need to undergo code integration. This integration process primarily involves code acquisition, integration, conversion, compilation, and verification. This process is not only cumbersome but can also lead to errors. Furthermore, code integration requires significant developer time and, without effective methods, will be inefficient. Summary of the Invention

[0003] In view of the above-mentioned shortcomings of the prior art, the present invention provides a code integration method to solve the above-mentioned technical problems.

[0004] The present invention provides a code integration method, which includes:

[0005] Create multiple code execution paths;

[0006] Running the code execution path to obtain source code data from a code repository;

[0007] Performing code conversion and code compilation on the source code data to generate a dynamic library;

[0008] Put the dynamic library into the interface inspection directory;

[0009] Obtaining a configuration file with the same name as the dynamic library from the code repository, and placing the configuration file in the interface inspection directory; and

[0010] According to the dynamic library and the configuration file, an interface check is performed through the interface check directory, and after the interface check is correct, an integrated target file is generated and sent to the server.

[0011] In one embodiment of the present invention, after the source code data is obtained from the code repository, the method further includes the step of determining whether the source code data is obtained successfully. If the acquisition fails, the names of all failed source code data repositories are reported.

[0012] In one embodiment of the present invention, the steps of converting and compiling the source code data to generate a dynamic library include:

[0013] Performing code conversion on the source code data to generate conversion code data, wherein the format of the conversion code data is unified;

[0014] Compiling the converted code data to obtain a target file;

[0015] Generate a dynamic library based on the target file.

[0016] In one embodiment of the present invention, after the code conversion and the code compilation, the step is further included: determining whether the code conversion and the code compilation are successful; if the conversion and compilation fail, uploading the source code data warehouse name corresponding to the conversion and compilation failure.

[0017] In one embodiment of the present invention, after uploading the source code data warehouse name corresponding to the conversion and compilation failure, the method further includes the steps of modifying the source code data corresponding to the code conversion and the code compilation failure, and performing code conversion and code compilation again.

[0018] In one embodiment of the present invention, after performing the interface check, the method further includes the step of checking whether the numbers of the dynamic library and the configuration file are matched, or checking whether the publishing and subscription are matched.

[0019] In one embodiment of the present invention, after checking whether the number of the dynamic library and the configuration file is matched, or checking whether the publishing and subscription are paired, the step is further included: if the number of the dynamic library and the configuration file does not match, or the publishing and subscription are not paired, an error report is generated.

[0020] The present invention also provides a code integration device, comprising:

[0021] Obtaining a module and creating multiple code execution paths; running the code execution paths and obtaining source code data from a code repository;

[0022] A conversion module, performing code conversion on the source code data to generate conversion code data;

[0023] A compiling module compiles the converted code data to generate a dynamic library; and

[0024] The interface check module places the dynamic library in the interface check directory; obtains a configuration file with the same name as the dynamic library from the code repository and places the configuration file in the interface check directory; performs an interface check through the interface check directory based on the dynamic library and the configuration file, and after the interface check is correct, generates an integrated target file and sends it to the server.

[0025] The present invention further provides an electronic device, comprising:

[0026] one or more processors;

[0027] A storage device is used to store one or more programs.

[0028] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer is caused to execute the code integration method.

[0029] The beneficial effects of the present invention are as follows: The code integration method provided by the present invention reduces the time required for code acquisition and compilation. Furthermore, combined with the interface checking function, it exposes simple coding errors in advance, reduces the complexity of integration, and improves the efficiency of code integration.

[0030] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings are incorporated into and constitute a part of the specification, illustrating embodiments consistent with the present application and, together with the specification, serving to explain the principles of the present application. It is obvious that the drawings described below are merely some embodiments of the present application, and a person of ordinary skill in the art can derive other drawings based on these drawings without inventive effort. In the drawings:

[0032] Figure 1 A schematic diagram of an implementation environment for code integration shown in an exemplary embodiment of the present application;

[0033] Figure 2 is a flowchart of a code integration method shown in an exemplary embodiment of the present application;

[0034] Figure 3 is a flowchart of another code integration method shown in an exemplary embodiment of the present application;

[0035] Figure 4 yes Figure 2 Step S210 in the illustrated embodiment is a flow chart in an exemplary embodiment;

[0036] Figure 5 yes Figure 2 Step S220 in the illustrated embodiment is a flow chart in an exemplary embodiment;

[0037] Figure 6 yes Figure 2 A flow chart of step S220 in the illustrated embodiment in another exemplary embodiment;

[0038] Figure 7yes Figure 2 Step S260 in the illustrated embodiment is a flow chart in an exemplary embodiment;

[0039] Figure 8 is a block diagram of a code integration device shown in an exemplary embodiment of the present application;

[0040] Figure 9 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0041] The following describes the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art will readily appreciate the other advantages and benefits of the present invention from the disclosure herein. The present invention may also be implemented or applied through various other specific embodiments, and the various details in this specification may be modified or altered based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are intended only to illustrate the present invention and are not intended to limit the scope of protection of the present invention.

[0042] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. Therefore, the illustrations only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.

[0043] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it will be apparent to those skilled in the art that the embodiments of the present invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring the embodiments of the present invention.

[0044] First of all, it should be noted that integration can be divided into the integration of code-type modules and the integration of application layer modules. For the integration of code-type modules, the software is based on code. One version of the software can be applied to different customers through different configurations, so when integrating, it is necessary to consider the analysis of system configuration variables. When the code writing of the module is completed and code integration is required, the analysis of the code module input variables must be considered. Simply put, the integration of code-type modules is to combine different modules together. For the integration of application layer modules, it is mostly used in the application layer. Model-based development only focuses on algorithms to develop the application layer, which is particularly suitable for a software to be completed by different companies. The embodiment of this application is the integration of code-type modules.

[0045] During software development, integrating code written by different developers is a common operation for development teams. During the integration process, developers create integration tasks, and a single thread is often used for everything from initial pre-processing information to subsequent code checks and email notifications. When multiple tasks need to be processed, they can only be executed in the order they were created. Furthermore, the accumulation of integration issues can lead to numerous code conflicts or system malfunctions during subsequent merging. The embodiments of the present application effectively address the problems associated with code integration, saving time and improving the efficiency of code integration.

[0046] Figure 1 This is a schematic diagram of the code integration implementation environment shown in an exemplary embodiment of the present application. In the early stages of software project development, different modules are divided according to functions or specific methods. Multiple developers work on these modules using personal computers 110. Each developer may work on the code development work in isolation for a long period of time. Only after the development work of the project developers is completed can code integration be carried out. According to the schematic diagram of the code integration system, after the developers have completed the development work for all modules, they will submit the code. All completed source code data is placed in different code repositories for the next code integration work. During the code integration process, due to the different technical levels of each developer, the actual code integration may encounter integration issues such as code errors or numerous code conflicts. Identifying and resolving these issues in a timely manner is the only way to ensure timely delivery. At the same time, if an error occurs, the corresponding developer will be notified by email. If no error occurs, the files generated by the successful integration are uploaded to the server 120, allowing the next development work to proceed.

[0047] in, Figure 1 The illustrated personal computers 110 are available in common desktop and laptop models. They are used by developers for development work. As the number of developers on a project increases or decreases, one or more personal computers 110 are used for development work. Developers use personal computers 110 to write code according to project requirements and modify code based on errors reported during code integration. They can also perform operations such as local model verification. Figure 1 The server 120 shown receives files generated by code integration and provides a storage environment to facilitate subsequent development work such as testing and operation.

[0048] The code integration process proposed above is generally applicable. However, various problems may arise during actual operation. To address these problems, embodiments of the present application propose a code integration method, which will be described in detail below.

[0049] See also Figure 2 , Figure 2 This is a flowchart of a code integration method shown in an exemplary embodiment of the present application. This method can be applied to Figure 1 It should be understood that the method can also be applied to other exemplary implementation environments and specifically executed by devices in other implementation environments, and this embodiment does not limit the implementation environment to which the method is applicable.

[0050] like Figure 2 As shown, in an exemplary embodiment, the code integration method includes at least steps S210 to S260, which are described in detail as follows:

[0051] Step S210: creating multiple code execution paths.

[0052] Developers run scripts to enable multithreading and create multiple code execution paths. In this embodiment, the number of threads corresponds to the number of code execution paths. By setting multiple threads and creating multiple code execution paths, multiple tasks can be performed simultaneously during the code integration process.

[0053] First of all, it should be noted that a script is an executable file written in a specific descriptive language according to a certain format. Usually, it is saved as text and only explained when called. In this embodiment, multithreading is enabled by running the script.

[0054] It is important to understand that to understand the meaning of multithreading, we must first understand the difference between threads and processes. A program is compiled into an executable program and stored on the hard disk. When this executable file is read into the memory and executed, the program becomes a process. If you want to execute multiple tasks in parallel within a process, multithreading technology is used. In this embodiment, multithreading is enabled through the mkfifo function, and the number of threads is specified, for example, 10 threads. Among them, the mkfifo function creates a named pipe, allowing the CPU (central processing unit) to execute multiple threads simultaneously, thereby achieving greater efficiency.

[0055] Step 220: Run the code execution path to obtain source code data from the code repository.

[0056] According to the project requirements, the developers have completed the development work of each module, and the program codes submitted by the developers are placed in multiple code repositories. Multithreading is enabled and the code execution path is run to obtain source code data from each repository. Figure 3 As shown, if the code acquisition fails, the failed repository name will be reported to the developer via email. If the code acquisition is successful, the next step of integration can be carried out.

[0057] Step 230: Perform code conversion and code compilation on the source code data to generate a dynamic library.

[0058] In actual module development, different developers use different methods to write program codes. The acquired source code data is converted into a unified code format through code conversion, and the converted code data is generated to facilitate code compilation. Figure 3 As shown, multi-threading is enabled to convert the acquired source code data. If the conversion fails, the repository name where the failure occurred is reported to the developer via email. If the conversion succeeds, all the code is converted into a unified programming language before proceeding to the next step of integration.

[0059] After the code conversion is completed, the converted code data is compiled through the code execution path. Through the code compilation process, a dynamic library is generated. Figure 3 As shown, if the code compilation fails, the repository name where the failure occurred is reported to the developer via email. If the code compilation succeeds, the next step of integration can be carried out. For the repository where compilation failed, the corresponding developer needs to wait for the email to be received, make the appropriate modifications, and then run the script again to compile the code, skipping the repository that previously compiled successfully.

[0060] Step 240: put the dynamic library into the interface check directory.

[0061] The dynamic library generated by code compilation will be stored in the interface inspection directory. At the same time, because multi-threading is enabled and the code execution path is running, the code data modified by code compilation failures can be recompiled at the same time, thus reducing the code compilation time.

[0062] It is important to understand that interfaces can implement data transmission and data buffering, as well as mutual conversion between signals. Dynamic libraries, combined with interface checking functions, can help detect code writing errors.

[0063] Step 250: Obtain a configuration file with the same name as the dynamic library from the code repository, and place the configuration file in the interface check directory.

[0064] Developers store their completed source code in a code repository, along with configuration files. Based on the dynamic library generated by compiling the code, a configuration file with the same name as the dynamic library is retrieved from the code repository and placed in the interface check directory. Interface checks can be performed using the dynamic library and configuration files.

[0065] Step 260: Perform an interface check through the interface check directory according to the dynamic library and the configuration file, and after the interface check is correct, generate an integrated target file and send it to the server.

[0066] Based on the completion of code compilation, all warehouses are compiled successfully. First, all dynamic libraries are collected into the interface inspection directory. In this embodiment, the dynamic library is, for example, a file with an extension of .so. Then go to each warehouse to obtain the configuration file with the same name as the dynamic library and put it into the interface inspection directory. In this embodiment, the configuration file is, for example, a file with an extension of .json, and it can also be a file with other extensions. Finally, the interface inspection directory will have multiple dynamic libraries and configuration files, and interface inspection will be performed in the interface inspection directory through the dynamic libraries and configuration files. Figure 3 As shown in the figure, if the interface check fails, all errors are reported via email to the developer. If the interface check succeeds without errors, the integration target file is generated and packaged and sent to the server.

[0067] See also Figure 3 , Figure 3 This is a flowchart of another code integration method shown in an exemplary embodiment of the present application. This method can be applied to Figure 1 The code shown is integrated into the system and is specifically executed Figure 2 The code integration method steps shown correspond to each other.

[0068] For example, during the code integration process, this embodiment may fail to retrieve source code data from the code repository, fail to convert and compile code, and finally discover errors during interface checking. Any errors encountered during the integration process are emailed to the corresponding developer, including the names of all failed repositories and a list of all errors. The developer uses this feedback to modify the code, reupload the code, and continue with the integration process.

[0069] It's important to understand that error message emails are primarily sent and received via mail servers. Mail servers are devices responsible for managing the sending and receiving of emails and form the core of modern email systems. Each recipient has a mailbox located on a mail server. In this embodiment, the developer's mailbox is used to manage and maintain sent and received email messages. An email message begins with the sender's user agent, then passes from the sender's mail server to the recipient's mail server, and is then delivered to the recipient's mailbox. The recipient authenticates with the mail server storing the mailbox using the provided username and password to access the email messages in their mailbox. The Simple Mail Transfer Protocol (SMTP) is the primary application layer protocol in Internet email systems, facilitating the transfer of email messages from the sender's mail server to the recipient's mail server. In this embodiment, email allows for secure and high-speed upload of failed repository names and error messages, providing timely feedback to developers for code modifications and completion of code integration.

[0070] Figure 4 yes Figure 2 Step S220 in the embodiment shown is a flow chart in an exemplary embodiment. Figure 4 As shown, the process of obtaining source code data may include steps S410 to S430, which are described in detail as follows:

[0071] Step S410: Develop source code data by module.

[0072] At the beginning of a project, developers need to fully understand the project requirements and develop and design accordingly. Furthermore, based on the requirements analysis, the project is divided into modules, with different developers assigned responsibility for each module. During modular development, one or more developers carry out the work. Each developer develops and designs the corresponding module based on their specific task requirements. Specifically, each developer has their own areas of expertise and is responsible for developing a specific module, which facilitates the completion of development work and the progress of the project.

[0073] Step S420: Send the source code data of each module to the code repository.

[0074] When the module development work reaches the later stage, the developers responsible for different modules will complete the development work of the corresponding modules. Next, the code integration work will be carried out to submit the source code data of these different modules. Figure 1 As shown in the figure, one or more developers complete their development work and submit their code. These submitted source code data are stored in code repositories, and each repository has a corresponding repository name.

[0075] Step S430: Obtain source code data from the code repository.

[0076] In this embodiment, the mkfifo function is mainly used to run the script to start multi-threading and create multiple code execution paths. At runtime, the number of threads is specified, for example, 10 threads. At the beginning of code integration, multi-threading is first started, the code execution path is run, and source code data is obtained from the code repository. Figure 1 and Figure 3 As shown in the figure, if the source code acquisition fails, the repository name where the failure occurred is reported in the form of an email and sent to the corresponding mail server. The corresponding developer receives it on their personal computer and makes the corresponding code modifications. If the source code acquisition is successful, the next step of integration is to proceed, starting with code conversion.

[0077] Figure 5 yes Figure 2 Step S230 in the embodiment shown is a flow chart in an exemplary embodiment. Figure 5 As shown, the code conversion of the source code data may include steps S510 to S520, which are described in detail as follows:

[0078] Step S510: Acquire source code data that needs to be converted, and perform code conversion on the source code data.

[0079] Based on project requirements analysis, modular development is adopted, with each module being completed by a different developer. Source code data is retrieved from different code repositories. If the retrieval is successful, code conversion can be performed. Due to the different development habits of each developer, the source code data retrieved from the code repositories may not be in a standardized format. Therefore, it is necessary to set a preset unified code type and convert other code types to the preset type to facilitate code conversion. In this embodiment, the retrieved source code data is, for example, Matlab code, and the preset type of code data is, for example, C++ code.

[0080] The code conversion process can be performed manually. However, manual conversion alone is time-consuming and labor-intensive, and errors are prone to occur during the actual conversion process and in the final results. To avoid numerous errors that could impact project progress, a conversion tool, such as Matlab Coder, can be used to convert the source code. Open the Matlab Coder toolbox and select the Matlab function names you want to convert to C++ code. You can select multiple function names at once. Then, test the aforementioned function functionality and follow the corresponding steps. Also, check for errors during the conversion process. If errors occur, modify them according to the specific situation until they are resolved. Finally, configure the settings accordingly to generate C++ code and successfully complete the conversion.

[0081] Step S520: Generate conversion code data to achieve code format unification.

[0082] In this embodiment, it is necessary to unify the code format through code conversion. Figure 1 and Figure 3 As shown, if the code conversion fails, the name of the failed repository is reported in the form of an email and sent to the corresponding email server. The corresponding developer receives it on a personal computer and makes the corresponding code modifications. If the code conversion is successful, the code format can be unified and the converted code data can be generated for the next step of integration. The first step is code compilation.

[0083] Figure 6 yes Figure 2 Step S230 in the embodiment shown is a flow chart of another exemplary embodiment. Figure 6 As shown, the code compilation may include steps S610 to S630, which are described in detail as follows:

[0084] Step S610: Obtain conversion code data.

[0085] The converted code data with a unified format generated by the code conversion is obtained. In this embodiment, the unified format is C++ code. After successful acquisition, the code compilation step is performed based on the format.

[0086] Step S620: compile the converted code data to obtain a target file.

[0087] During code compilation, the source code in C++ format is first obtained. The compiler generates a target file based on the obtained code using the compiler command. Typically, target files have a .O extension and do not require a specific function implementation, only its declaration.

[0088] Step S630: Generate a dynamic library based on the target file.

[0089] As previously mentioned, the compiler generates a target file through the compilation command. This target file can be compressed to create a static library file, which is directly copied to the executable file when linked. The target file is used to generate a dynamic library file, which is not copied to the executable file when linked. Instead, it is linked to the address of the dynamic library through the dynamic library. This link generates the corresponding static dependency library, which can be used to generate the executable file using the static library or without the dependency library.

[0090] In this embodiment, the conversion code is obtained to perform the code compilation process. Figure 1 and Figure 3 As shown in the figure, if the code compilation fails, the name of the failed repository is reported in the form of an email and sent to the corresponding email server. The corresponding developer receives it on a personal computer and makes the corresponding code modifications. If the code compilation is successful, the required dynamic library can be generated for the next step of integration. Among them, for the repository that failed to compile, it is reported to the developer, modified, and recompiled, and the repository that compiled successfully is skipped.

[0091] Figure 7 yes Figure 2 Step S260 in the embodiment shown is a flow chart in an exemplary embodiment. Figure 7 As shown, according to the dynamic library and the configuration file, performing the interface check through the interface check directory, and generating the integrated target file after the check is correct and sending it to the server may include steps S710 to S730, which are detailed as follows:

[0092] Step S710: Acquire multiple dynamic libraries and configuration files and store them in the interface inspection directory.

[0093] According to the generated dynamic library, the configuration file with the same name as the dynamic library is obtained from the code repository. That is to say, after the repository is compiled successfully, multiple dynamic libraries and configuration files will be generated, and then the generated dynamic libraries and configuration files will be stored in the interface inspection directory.

[0094] Step S720: perform interface check.

[0095] In a general project, the number of dynamic libraries and configuration files is, for example, dozens. The dynamic libraries and configuration files are stored in the interface inspection directory, and the interface inspection is performed. First, it is necessary to check whether the quantity is paired and whether there are any omissions. In this embodiment, the accuracy and efficiency of the inspection are improved through code inspection. In other embodiments, manual visual inspection can also be performed. However, due to the large number, errors are prone to occur, and the inspection efficiency is not high. At the same time, if the number of dynamic libraries and configuration files does not match each other, the missing warehouse name is reported in the form of an email and sent to the corresponding mail server, which is received by the corresponding developer through a personal computer and supplemented accordingly.

[0096] In this embodiment, during the interface check, it is also necessary to check whether the configuration file's title (topic) is aligned, that is, whether the sending topic and the subscription topic are consistent or missing. If there is a publisher without a subscriber, or a subscriber without a publisher, the integration will be stopped and an error report will be generated. It should be understood that the topic is the transmission medium between the message publisher and subscriber. Devices can send and receive messages through the topic, thereby realizing communication between the server and the device.

[0097] Specifically, if the sending topic of the send.json configuration file is send.object and the receiving topic of the recv.json configuration file is sent.object, then the two sides do not correspond at this time, and the final function will have problems. At the same time, if there is only a sending topic and no receiving topic, a warning will be prompted. However, if there is a receiving topic but no sending topic, an error will be reported, which means that an omission has occurred and the module responsible for the developer has omitted the code. In this embodiment, the efficiency and accuracy are improved by mainly checking through code instead of human eyes. At the same time, if the publication and subscription are inconsistent, all errors will be prompted in the form of emails, sent to the corresponding mail server, and received by the corresponding developers through personal computers, so that the corresponding code can be supplemented and modified.

[0098] Step S730: If the interface check is successful, the integration target file is generated, packaged and uploaded to the server.

[0099] Based on the dynamic library and configuration files, combined with the interface inspection function, interface inspection is performed to expose simple coding errors in advance, or even if code omissions are found. Figure 1 and Figure 3As shown, if the interface check fails, all errors will be prompted in the form of an email and sent to the corresponding mail server, which will be received by the corresponding developer through a personal computer to make corresponding code modifications or supplements. If the code interface check is successful, the integration target file can be generated. Among them, after the interface check is successful, the entire project will be traversed in turn, and according to certain rules, the interference caused by different file contents but the same file name will be eliminated. The correct files required for integration will be automatically collected, and then packaged into the integration target file and uploaded to the server. The whole process reduces the complexity and inefficiency of copying and integrating each directory separately, and improves the efficiency of code integration.

[0100] Figure 8 This is a block diagram of a code integration device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The device can also be applied to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applied.

[0101] like Figure 8 As shown, the exemplary code integration device includes:

[0102] Acquisition module 801 allows developers to develop code in modules and store the completed source code data in a code repository. Multithreading is enabled to run the code execution path, allowing the source code data to be retrieved from the code repository. If the retrieval fails, the repository name corresponding to the failed code retrieval is reported and emailed to the developer.

[0103] The conversion module 802 starts multiple threads, runs the code execution path, converts the acquired source code data, and generates converted code data in a unified format. If the conversion fails, the repository name corresponding to the failed code conversion is reported and sent to the developer via email.

[0104] Compilation module 803 compiles the converted code data generated by code conversion, obtains a target file, and generates a dynamic library from the target file. If compilation fails, the repository name corresponding to the failed code compilation is reported and emailed to the developer. At this point, because multithreading is enabled and the code execution path is executed, the code data modified by the failed code compilation can be recompiled simultaneously.

[0105] Interface check module 804 retrieves a configuration file with the same name as the dynamic library from the code repository. Based on the dynamic library and configuration file, combined with the interface check function, it performs an interface check. If the interface check fails, all errors are displayed and emailed to the developer. If the interface check succeeds, the integration target file is generated.

[0106] In this exemplary code integration device, one or more developers complete development work in modules and submit code for storage in a code repository. Source code data is retrieved from each code repository, and code conversion and compilation are performed. Finally, interface checks are performed based on configuration files and dynamic libraries to generate integration target files. Multithreading is enabled to run code execution paths, allowing multiple tasks to be performed simultaneously.

[0107] It should be noted that the code integration device provided in the above embodiment and the code integration method provided in the above embodiment are based on the same concept. The specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here. In actual applications, the code integration device provided in the above embodiment can, as needed, allocate the above functions to different functional modules, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0108] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the code integration method provided in the above-mentioned embodiments.

[0109] Figure 9 The following is a schematic diagram showing the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application. Figure 9 The computer system 900 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0110] like Figure 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage part 908 into the random access memory (RAM) 903, such as executing the method described in the above embodiment. Various programs and data required for system operation are also stored in the RAM 903. The CPU 901, ROM 902 and RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0111] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output section 907 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. Removable media 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like, are installed in the drive 910 as needed, so that computer programs read therefrom can be installed into the storage section 908 as needed.

[0112] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from a removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the various functions defined in the system of the present application are executed.

[0113] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable computer program. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0114] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0115] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.

[0116] Another aspect of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer processor, the computer executes the code integration method described above. The computer-readable storage medium may be included in the electronic device described in the above embodiments, or may exist independently and not be incorporated into the electronic device.

[0117] Another aspect of the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the code integration method provided in each of the above embodiments.

[0118] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, any equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.

Claims

1. A code integration method, characterized in that: The method comprises: Create multiple code execution paths; Running the code execution path to obtain source code data from a code repository; Performing code conversion on the source code data to generate converted code data, and compiling the converted code data to obtain a target file, wherein the format of the converted code data is unified; determining whether the code conversion and the code compilation are successful; if the conversion and the compilation fail, uploading the source code data repository name corresponding to the failed conversion and compilation, modifying the source code data corresponding to the failed code conversion and compilation, and performing code conversion and code compilation again; Generate a dynamic library according to the target file; Put the dynamic library into the interface inspection directory; Obtaining a configuration file with the same name as the dynamic library from the code repository, and placing the configuration file in the interface inspection directory; and According to the dynamic library and the configuration file, an interface check is performed through the interface check directory, and after the interface check is correct, an integration target file is generated and sent to the server; Check whether the quantity of the dynamic library and the configuration file is matched, or check whether the publishing and subscription are paired; if the quantity of the dynamic library and the configuration file does not match, or the publishing and subscription are not paired, generate an error report.

2. The code integration method according to claim 1, characterized in that: After the source code data is obtained from the code repository, the method further includes the steps of: determining whether the source code data is obtained successfully; if the acquisition fails, reporting the names of all failed source code data repositories.

3. A code integration device, characterized in that: The device comprises: Obtaining a module and creating multiple code execution paths; running the code execution paths and obtaining source code data from a code repository; A conversion module, performing code conversion on the source code data to generate conversion code data; a compiling module, compiling the converted code data to obtain a target file, wherein the format of the converted code data is unified; determining whether the code conversion and the code compilation are successful; if the conversion and compilation fail, uploading the source code data repository name corresponding to the conversion and compilation failure, modifying the source code data corresponding to the code conversion and the code compilation failure, and performing code conversion and code compilation again; generating a dynamic library based on the target file; and The interface check module places the dynamic library in an interface check directory; obtains a configuration file with the same name as the dynamic library from the code repository and places the configuration file in the interface check directory; performs an interface check through the interface check directory based on the dynamic library and the configuration file, and after the interface check is correct, generates an integrated target file and sends it to the server; checks whether the number of the dynamic library and the configuration file is matched, or checks whether the publishing and subscription are paired; if the number of the dynamic library and the configuration file does not match, or the publishing and subscription are not paired, generates an error report.

4. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the code integration method according to any one of claims 1 to 2.

5. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the code integration method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Method for using dynamic library under Android development environment

    CN103455337A

  • Playing method and device of starting-up animation of vehicle-mounted terminal, equipment and storage medium

    CN108595215A