CN115357227A - Code integration method, device, equipment and medium - Google Patents

Code integration method, device, equipment and medium Download PDF

Info

Publication number
CN115357227A
CN115357227A CN202210986734.6A CN202210986734A CN115357227A CN 115357227 A CN115357227 A CN 115357227A CN 202210986734 A CN202210986734 A CN 202210986734A CN 115357227 A CN115357227 A CN 115357227A
Authority
CN
China
Prior art keywords
code
conversion
dynamic library
integration
code data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210986734.6A
Other languages
Chinese (zh)
Inventor
陈真
胡裕杰
王宽
任凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Changan Automobile Co Ltd
Original Assignee
Chongqing Changan Automobile Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Changan Automobile Co Ltd filed Critical Chongqing Changan Automobile Co Ltd
Priority to CN202210986734.6A priority Critical patent/CN115357227A/en
Publication of CN115357227A publication Critical patent/CN115357227A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to the technical field of computers, and provides a code integration method, which comprises the following steps: creating a plurality of code execution paths; running the code execution path to acquire 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 into an interface check directory; obtaining a configuration file with the same name as the dynamic library from the code warehouse and placing the configuration file into the interface check directory; and according to the dynamic library and the configuration file, performing interface check through the interface check directory, and generating an integrated target file and sending the integrated target file to a server after the interface check is correct. The code integration method provided by the invention improves the code integration efficiency and solves the problems of complexity and low efficiency of integration work.

Description

Code integration method, device, equipment and medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a code integration method, apparatus, device, and medium.
Background
In the development process of a software project, in order to reduce mutual interference and improve development efficiency in the initial development stage, different modules are divided according to functions or specific methods, and development work is performed in the divided modules. After each module is developed independently, although the coupling is reduced, the situation that one module is changed and the associated module is not known in time easily occurs, so that the time is wasted. And after all the development work is completed, the developed program modules need to be subjected to code integration. In the integration process, the method is mainly realized by code acquisition, code integration, code conversion, code compilation, code inspection and the like, so that the process is complicated, and errors can occur in actual operation. Meanwhile, code integration also requires a developer to spend a lot of time, and efficient work cannot be realized if an effective method is not adopted.
Disclosure of Invention
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.
The invention provides a code integration method, which comprises the following steps:
creating a plurality of code execution paths;
running the code execution path to acquire 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 into an interface check directory;
obtaining a configuration file with the same name as the dynamic library from the code warehouse and placing the configuration file into the interface check directory; and
and according to the dynamic library and the configuration file, performing interface check through the interface check directory, and generating an integrated target file and sending the integrated target file to a server after the interface check is correct.
In an embodiment of the present invention, after obtaining the source code data from the code repository, the method further includes the following steps: and judging whether the source code data is successfully acquired or not, and if the source code data is unsuccessfully acquired, reporting all failed source code database names.
In an embodiment of the present invention, the step of performing code conversion and code compilation on the source code data to generate the dynamic library includes:
carrying out code conversion on the source code data to generate conversion code data, wherein the format of the conversion code data is uniform;
performing code compiling on the converted code data to obtain a target file;
and generating a dynamic library according to the target file.
In an embodiment of the present invention, after the code conversion and the code compilation, the method further includes the steps of: and judging whether the code conversion and the code compilation are successful, and if the conversion and the compilation are failed, uploading the source code database name corresponding to the conversion and the compilation failure.
In an embodiment of the present invention, after uploading the source code database name corresponding to the conversion and compilation failure, the method further includes the following steps: and modifying the source code data corresponding to the code conversion and the code compiling failure, and performing the code conversion and the code compiling again.
In an embodiment of the present invention, after the interface check is executed, the method further includes: checking whether the number of dynamic libraries and profiles are paired or whether publications and subscriptions are paired.
In an embodiment of the present invention, after checking whether the number of the dynamic library and the configuration file is paired, or checking whether the publication and the subscription are paired, the method further includes the following steps: and if the number of the dynamic library and the configuration file are not matched or the release and the subscription are not paired, generating an error report.
The present invention also provides a code integrating apparatus, the apparatus comprising:
the acquisition module is used for creating a plurality of code execution paths; running the code execution path, and acquiring source code data from a code warehouse;
the conversion module is used for carrying out code conversion on the source code data to generate conversion code data;
the compiling module is used for compiling the converted code data to generate a dynamic library; and
the interface checking module is used for placing the dynamic library into an interface checking directory; acquiring a configuration file with the same name as the dynamic library from the code warehouse, and putting the configuration file into the interface check directory; and according to the dynamic library and the configuration file, performing interface check through the interface check directory, and generating an integrated target file and sending the integrated target file to a server after the interface check is correct.
The present invention also provides an electronic device, including:
one or more processors;
a storage device to store one or more programs.
The present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor of a computer, causes the computer to execute the code integration method.
The invention has the beneficial effects that: the code integration method provided by the invention reduces the time for code acquisition and code compiling. Meanwhile, by combining the interface checking function, simple code writing errors are exposed in advance, complexity of integration is reduced, and code integration efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 is a schematic diagram of a code integration implementation environment shown in an exemplary embodiment of the present application;
FIG. 2 is a flow chart illustrating a method of code integration in accordance with an exemplary embodiment of the present application;
FIG. 3 is a flow chart illustrating another method of code integration in accordance with an exemplary embodiment of the present application;
FIG. 4 is a flow chart of step S210 in the embodiment shown in FIG. 2 in an exemplary embodiment;
FIG. 5 is a flow chart of step S220 in the embodiment shown in FIG. 2 in an exemplary embodiment;
FIG. 6 is a flow chart of step S220 in the embodiment shown in FIG. 2 in another exemplary embodiment;
FIG. 7 is a flowchart of step S260 in the embodiment shown in FIG. 2 in an exemplary embodiment;
FIG. 8 is a block diagram of a code integration apparatus shown in an exemplary embodiment of the present application;
FIG. 9 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
Other advantages and effects of the present invention will become apparent to those skilled in the art from the disclosure herein, wherein the embodiments of the present invention are described in detail with reference to the accompanying drawings and preferred embodiments. The invention is capable of other and different embodiments and of being practiced or of being carried out in various ways, and its several details are capable of modification in various respects, all without departing from the spirit and scope of the present invention. It should be understood that the preferred embodiments are illustrative of the invention only and are not limiting upon the scope of the invention.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present invention, and the components related to the present invention are only shown in the drawings rather than drawn according to the number, shape and size of the components in actual implementation, and the type, quantity and proportion of the components in actual implementation may be changed freely, and the layout of the components may be more complicated.
In the following description, numerous details are set forth to provide a more thorough explanation of embodiments of the present invention, however, it will be apparent to one skilled in the art that embodiments of the present invention may be practiced without these specific details, and in other embodiments, well-known structures and devices are shown in block diagram form, rather than in detail, in order to avoid obscuring embodiments of the present invention.
It should be noted that integration can be divided into integration of code class modules and integration of application layer modules. For the integration of code class modules, the software is code based. One version of software can be applied to different customers through different configurations, so that analysis of system configuration variables needs to be considered during integration. When the code writing of the module is completed and the code integration is needed, the analysis of the input variables of the code module is considered. It is simply understood that the integration of code class modules is the mashup of different modules together. For the integration of application layer modules, the application layer module is mostly used. The model-based development only focuses on algorithms, so that the application layer is developed, and the method is particularly suitable for one software completed by different companies. The embodiment of the application is the integration of the code class module.
In the software development process, integrating code written by different developers together is a common operation for development teams. In the integration process, integration tasks are established by developers, single-line operation is usually adopted from initial preprocessing information to subsequent code inspection, mail notification and the like, and when a plurality of tasks need to be processed, the tasks can be executed only according to the task sequence. Meanwhile, the accumulation of integration problems causes a problem that a large number of code conflicts occur or the system cannot work normally when merging later. The embodiment of the application effectively solves the problems generated in code integration, saves time and improves the efficiency of code integration.
Fig. 1 is a schematic diagram of an implementation environment of code integration shown in an exemplary embodiment of the present application. At the initial stage of software project development, different modules are divided according to functions or specific methods, a plurality of developers carry out development work through the personal computer 110 in the mode division mode, each developer can carry out code development work in an isolated mode for a long time, and only after the development work of the project developer is completed, code integration can be carried out. According to the schematic diagram of the code integration system, after the development work of all modules is completed by developers, codes are submitted. And putting all the completed source code data into different code warehouses for subsequent code integration work. In the working process of code integration, due to the difference of the technical level of each developer, the integration problems of code errors or a large number of code conflicts and the like can occur in the actual code integration, and the problems can be found and solved in time so as to be delivered in time. Meanwhile, if an error occurs, the corresponding developer is notified in the form of an email, and if no error occurs, the generated file that is successfully integrated is uploaded to the server 120, so that the next development work is performed.
The personal computers 110 shown in fig. 1 are classified into common desktop computers and notebook computers, and are devices used by developers for development, and one or more personal computers 110 are used for development as the number of developers increases or decreases. The developer writes codes according to project requirements through the personal computer 110, and modifies the codes according to error feedback in the code integration process. Meanwhile, local model verification and other operations can be carried out. The server 120 shown in fig. 1 receives the file generated by the code integration, provides a storage environment for subsequent development work such as testing and running.
The code integration process proposed above has general applicability. It can be seen that in actual operation, various problems can exist. To solve these problems, embodiments of the present application, which will be described in detail below, propose a code integration method.
Referring to fig. 2, fig. 2 is a flowchart illustrating a code integration method according to an exemplary embodiment of the present application. The method may be applied to the implementation environment shown in fig. 1. It should be understood that the method may be applied to other exemplary implementation environments and is specifically executed by devices in other implementation environments, and the embodiment does not limit the implementation environment to which the method is applied.
As shown in fig. 2, in an exemplary embodiment, the code integration method at least includes steps S210 to S260, which are described in detail as follows:
in step S210, a plurality of code execution paths are created.
And running a script by a developer to start multithreading and create a plurality of code execution paths. In this embodiment, the number of threads and the number of code execution paths are in one-to-one correspondence, and multiple tasks can be performed simultaneously in the code integration process by setting multiple threads and creating multiple code execution paths.
It should be noted that the script is an executable file written according to a certain format using a specific descriptive language. Usually, the explanation is made only when the explanation is called, and the explanation is made in text. In this embodiment, multiple threads are started by running a script.
It is to be understood that for the meaning of multithreading, the distinction between threads and processes is first understood. A program is compiled into an executable program and stored in the hard disk. When this executable file is read into memory for execution, the program becomes a process. If it is desired to execute multiple tasks in parallel in a process, then multi-threading is used. In this embodiment, multithreading is enabled by the mkfifo function, specifying a thread count setting, e.g., 10 threads. The named pipeline is created through the mkfifo function, so that a Central Processing Unit (CPU) can execute multiple threads at the same time, thereby achieving greater efficiency.
Step 220, running the code execution path to obtain the source code data from the code warehouse.
According to the project requirements, the development work of each module of the developer is completed, and program codes submitted by the developer are placed in a plurality of code warehouses. And starting multithreading, and running a code execution path to acquire source code data in each warehouse. As shown in fig. 3, if the code acquisition fails, the failed warehouse name is reported in the form of an email and sent to the developer. And if the code is successfully acquired, the next integration work can be carried out.
And step 230, performing code conversion and code compilation on the source code data to generate a dynamic library.
In the actual module development work of developers, different developers write program codes in different modes. And converting the acquired source code data into a uniform code format through code conversion to generate converted code data so as to facilitate code compilation. As shown in fig. 3, multithreading is started, code conversion is performed on the acquired source code data, and if code conversion fails, a failed warehouse name is reported in the form of an email and sent to a developer. And if the codes are converted successfully, converting all the codes into the uniform program language, and then carrying out the next integration work.
And after the code conversion is finished, the code compiling is carried out on the converted code data through a code execution path. And generating a dynamic library through a code compiling process. As shown in fig. 3, if the code compiling fails, the failed warehouse name is reported in the form of an email and sent to the developer. If the code is compiled successfully, the next integration work can be carried out. And for the warehouse with the compiling failure, after the corresponding developer receives the mail, correspondingly modifying, running the script again to compile the code, and skipping over the warehouse which has been successfully compiled before.
Step 240, put the dynamic library into the interface check directory.
And storing the dynamic library generated by compiling the code into an interface check directory. Meanwhile, since the multithreading is started and the code execution path is operated, the recompilation of the code data modified by the failed code compilation can be carried out at the same time, thereby reducing the time of code compilation.
It should be understood that the interface may implement data transmission and data buffering, and may also implement functions such as interconversion between signals. And the dynamic library is combined with an interface checking function to realize the checking of the writing error of the help code.
Step 250, obtaining the configuration file with the same name as the dynamic library from the code warehouse, and placing the configuration file into the interface check directory.
The source code data developed by the developer is placed in a code warehouse, and meanwhile, a configuration file is also arranged in the code warehouse. And according to the dynamic library generated by code compiling, acquiring a configuration file with the same name as the dynamic library from a code warehouse, and then placing the configuration file in an interface check directory. Through the dynamic library and configuration file, interface checking tasks may be performed.
And step 260, according to the dynamic library and the configuration file, executing interface check through the interface check directory, and generating an integrated target file and sending the integrated target file to a server after the interface check is correct.
All warehouse compilation is successful based on the code compilation completion. All dynamic libraries are first collected into the interface check directory. In the present embodiment, the dynamic library is, for example, a file with an extension of. So. Then, each warehouse obtains the configuration file with the same name as the dynamic library to the interface check directory. In this embodiment, the configuration file is, for example, a file with an extension of json, and may be other extension files. Finally, the interface check directory has a plurality of dynamic libraries and configuration files, and interface check is performed in the interface check directory through the dynamic libraries and configuration files. As shown in fig. 3, if the interface check fails, all errors are prompted in the form of an email and sent to the developer. And if the interface check is successful and no error occurs, generating an integrated target file. And packaging the integration target file and sending the integration target file to a server.
Referring to fig. 3, fig. 3 is a flowchart illustrating another code integration method according to an exemplary embodiment of the present application. The method can be applied to the code integration system shown in fig. 1 for specific execution, and corresponds to the steps of the code integration method shown in fig. 2.
For example, in the code integration process, the source code data may fail to be obtained from the code repository firstly, may fail to be converted and compiled secondly, and may find errors when the interface check is performed finally. And uploading all failed warehouse names in the form of mails and prompting all errors to send to corresponding developers for errors occurring in the integration process. And the developer modifies the codes and other operations through the feedback information, and uploads the codes again after the modification is finished, so that the code integration work is continued.
It should be understood that the mail fed back with the error information is mainly received and transmitted through the mail server. The mail server is a device responsible for the management of sending and receiving e-mails, and forms the core of the current e-mail system. Each addressee has a mailbox located on a certain mail server. In this embodiment, the mailbox of the developer is used to manage and maintain the mail messages that have been sent and received. A mail message is first forwarded from a user agent of a sender, from a mail server of the sender to a mail server of the recipient, and then delivered to a mailbox of the recipient. The addressee will authenticate with the provided user name and password through the mail server storing the mailbox, so as to view the mail message in the mailbox. Simple mail transfer protocol is the primary application layer protocol of the internet e-mail system that facilitates the transfer of mail messages from a sender's mail server to a recipient's mail server. In the embodiment, the failed warehouse name and the error information can be uploaded safely and at high speed in the form of the mail, and are fed back to the developer in time for code modification, so that the code integration work is completed conveniently.
Fig. 4 is a flow chart of step S220 in the embodiment shown in fig. 2 in an exemplary embodiment. As shown in fig. 4, the process of acquiring the source code data may include steps S410 to S430, which are described in detail as follows:
and step S410, developing source code data in modules.
At the initial stage of starting a project, developers need to fully know the requirements of the project and carry out corresponding development and design according to the requirements. Meanwhile, according to the requirement analysis, the project is divided into different modules, and different developers are responsible for different modules. In the development of the sub-module, development work is performed by one or more developers. And each developer carries out corresponding module development design according to the task requirement of the developer. Specifically, each developer has a field which is better in own, is responsible for corresponding module development, and is more beneficial to the completion of development work and the implementation of projects.
Step S420, sending the source code data of each module to a code repository.
And the development work of the sub-modules is carried out to the later stage, and developers in charge of different modules complete the development work of the corresponding modules. Next, code integration work is performed, and the source code data of these different modules is submitted. As shown in FIG. 1, one or more developers complete the development work and commit the code. The submitted source code data is stored in code warehouses, and each warehouse has a corresponding warehouse name.
Step S430, acquiring source code data from the code repository.
In the embodiment, multithreading is started mainly through an mkfifo function running script, and a plurality of code execution paths are created. At run-time, the number of threads is specified, setting for example 10 threads. At the beginning of code integration, firstly, multi-threads are started, a code execution path is run, and source code data is obtained from a code warehouse. As shown in fig. 1 and 3, if the source code fails to be obtained, the failed repository name is reported in the form of an email and sent to a corresponding email server, and a corresponding developer receives the repository name through a personal computer, so as to modify a corresponding code. And if the source code is successfully acquired, performing the next integration work, wherein the code conversion is performed firstly.
Fig. 5 is a flow chart of step S230 in the embodiment shown in fig. 2 in an exemplary embodiment. As shown in fig. 5, transcoding the source code data may include steps S510 to S520, which are described in detail as follows:
step S510, obtaining source code data to be converted, and performing code conversion on the source code data.
Through project demand analysis, development work of sub-modules is adopted, and all the modules are completed by different developers. And acquiring the source code data from different code warehouses, and if the acquisition is successful, performing code conversion work. Due to different development habits of each developer, the source code data format obtained from the code warehouse is not uniform. It is necessary to set a preset uniform code type and convert other types of codes into a preset type of codes so as to perform code conversion. In this embodiment, the obtained source code data is, for example, matlab code, and the preset type code data is, for example, C + + code.
For the transcoding process, this can be done by manual conversion. However, since only manual conversion is needed, time and effort are consumed, and many errors are easily generated in view of the actual conversion process and the final conversion result. In order to avoid a large number of errors and influence on project process, a conversion tool can be used for converting the source data codes, for example, matlab Coder is used. And opening a Matlab Coder tool box, selecting the function name of Matlab needing to be converted into C + + code, and selecting a plurality of function names at one time. And testing the function, and sequentially carrying out corresponding steps for operation. At the same time, it is checked whether an error occurs during the conversion process. If an error occurs, the error needs to be modified according to specific conditions until the error does not occur any more. And finally, setting according to corresponding conditions to generate a C + + code, and successfully realizing conversion.
Step S520, generating the conversion code data to realize the code format unification.
In this embodiment, the code format needs to be unified through code conversion. As shown in fig. 1 and 3, if the code conversion fails, the failed repository name is reported in the form of an email and sent to the corresponding email server, and the corresponding developer receives the repository name through a personal computer, so as to modify the corresponding code. If the code conversion is successful, the code format can be unified, and the converted code data is generated so as to be convenient for the next integration work, wherein the code compiling is firstly carried out.
Fig. 6 is a flowchart of step S230 in the embodiment shown in fig. 2 in another exemplary embodiment. As shown in fig. 6, the code compiling may include steps S610 to S630, which are described in detail as follows:
in step S610, the conversion code data is acquired.
And acquiring the converted code data with a uniform format generated by code conversion, wherein in the embodiment, the uniform format is C + + code, and after the acquisition is successful, performing a code compiling step.
Step S620, performing code compilation on the converted code data to obtain a target file.
In the process of compiling the codes, firstly, obtaining source code data in a C + + format. And compiling the command through a compiler, and generating a target file according to the obtained code. Generally, the target file is a file with O as an extension, and a specific implementation of a function is not required, and only the declaration process thereof needs to be found.
Step S630, according to the target file, generating a dynamic library.
As described above, the target file is generated by compiling the command by the compiler. With the object file, a static library file can be compressed, which is characterized by being copied directly to the executable file when linked to the executable file. The target file is used to generate a dynamic library file whose nature is such that it is not copied to the executable file when linked, but rather is linked to the address of the dynamic library through the dynamic library. The static dependency library corresponding to the link can be obtained, and the executable file can be generated by using the static library or can be generated without depending on the library.
In the present embodiment, the translation code is acquired to perform a code compiling process. As shown in fig. 1 and 3, if the code compiling fails, the failed warehouse name is reported in the form of an email and sent to the corresponding email server, and the corresponding developer receives the failed warehouse name through a personal computer, so as to modify the corresponding code. If the code is compiled successfully, a required dynamic library can be generated so as to carry out the next integration work. And for the warehouse with the compiling failure, reporting the warehouse to a developer, modifying, then re-compiling, and skipping over the warehouse with the compiling success.
Fig. 7 is a flow chart of step S260 in the embodiment shown in fig. 2 in an exemplary embodiment. As shown in fig. 7, performing interface check through the interface check directory according to the dynamic library and the configuration file, and generating an integration target file to send to the server after checking without error may include steps S710 to S730, which are described in detail as follows:
step S710, obtain a plurality of dynamic libraries and configuration files, and store them in the interface check directory.
And acquiring a configuration file with the same name as the dynamic library from the code warehouse according to the generated dynamic library, namely generating a plurality of dynamic libraries and configuration files after the warehouse is successfully compiled, and storing the generated dynamic libraries and configuration files in an interface check directory.
Step S720, an interface check is performed.
Under general engineering, the number of the dynamic libraries and the configuration files is, for example, several tens, the dynamic libraries and the configuration files are stored in an interface check directory, and interface check is performed. First, it is necessary to check whether the number is paired, and whether a miss occurs. In the embodiment, the code check is performed, so that the check accuracy and efficiency are improved. In other embodiments, visual inspection by a human may also be used. However, because of the large number, errors are easy to occur, and the inspection efficiency is not high. Meanwhile, if the quantities of the dynamic library and the configuration file are not matched, the lacking library name is reported in a mail form and is sent to a corresponding mail server, and a corresponding developer receives the library name through a personal computer, so that corresponding supplement is performed.
In this embodiment, in the interface checking process, it is also necessary to check whether the titles (topic) of the configuration files are aligned, that is, whether the sending topic and the subscription topic are consistent or lack. If the publisher does not have the subscriber or the subscriber does not have the publisher, the integration is stopped, and an error report is generated. It should be understood that topic is a transmission intermediary between a message publisher and a message subscriber, and a device can implement sending and receiving of messages through topic, thereby implementing communication between a server side and a device side.
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 send.object, the two parties do not correspond to each other at this time, and finally, the function has a problem. Meanwhile, if only topic is sent and topic is not received, warning is prompted, but if topic is received and topic is not sent, an error is reported, at this moment, omission occurs, and a module in charge of developers misses a code. In the embodiment, the efficiency and the accuracy are improved by mainly checking the code instead of checking the code by human eyes. Meanwhile, if the release and the subscription are inconsistent, all errors are prompted in the form of mails and sent to corresponding mail servers, and corresponding developers receive the errors through personal computers, so that corresponding code supplement and modification are carried out.
And step S730, successfully checking the interface, generating an integrated target file, packaging and uploading the integrated target file to the server.
According to the dynamic library and the configuration file, the interface check is executed by combining the interface check function, so that simple code writing errors are exposed in advance, or even if code omission is found. As shown in fig. 1 and 3, if the interface check fails, all errors are prompted in the form of a mail and sent to the corresponding mail server, and the corresponding developer receives the error through a personal computer, so as to modify or supplement the corresponding code. If the code interface check is successful, an integration target file may be generated. After the interface check is successful, the whole project can be traversed in sequence, interference caused by different file contents but the same file name is eliminated according to a certain rule, correct files required by integration are automatically collected and packaged into an integrated target file, and the integrated target file is uploaded to a server. In the whole process, the complexity and the inefficiency of respectively copying and integrating each directory are reduced, and the code integration efficiency is improved.
Fig. 8 is a block diagram of a code integration apparatus shown in an exemplary embodiment of the present application. The apparatus may be applied to the system shown in fig. 1. The apparatus may also be applied to other exemplary implementation environments and specifically configured in other devices, and the embodiment does not limit the implementation environment to which the apparatus is applied.
As shown in fig. 8, the exemplary code integrating apparatus includes:
the obtaining module 801 performs development work by modules of developers, and places the developed source code data in a code warehouse. And starting multiple threads, running a code execution path, and acquiring source code data from a code warehouse. Meanwhile, if the acquisition fails, reporting the failed code to acquire the corresponding warehouse name, and sending the warehouse name to developers through mails.
The conversion module 802 starts multithreading, runs a code execution path, performs code conversion on the acquired source code data, and generates conversion code data with a uniform format. And meanwhile, if the conversion fails, reporting the name of the warehouse corresponding to the failed code conversion, and sending the name of the warehouse to developers through mails.
The compiling module 803 compiles the converted code data generated by code conversion to obtain an object file, and generates a dynamic library from the object file. Meanwhile, if the compiling fails, reporting the corresponding warehouse name of the failed code compiling, and sending the warehouse name to developers through mails. At this time, since the multithreading is started and the code execution path is executed, the recompilation of the code data modified by the code compiling failure can be performed at the same time.
The interface check module 804 retrieves a configuration file from the code repository that is the same name as the dynamic repository. And according to the dynamic library and the configuration file, combining an interface checking function and executing interface checking. And if the interface check fails, prompting all error information and sending the error information to the developer through a mail. And if the interface check is successful, generating an integration target file.
In the exemplary code integration apparatus, development work is performed in blocks by one or more developers to submit codes, which are stored in a code repository. And acquiring source code data from each code warehouse, and performing code conversion and code compilation. And finally, executing interface check according to the configuration file and the dynamic library to generate an integrated target file. And starting multithreading, running a code execution path and realizing simultaneous execution of a plurality of tasks.
It should be noted that the code integration apparatus provided in the foregoing embodiment and the code integration method provided in the foregoing embodiment belong to the same concept, and specific ways for the modules and units to perform operations have been described in detail in the method embodiment, and are not described herein again. In practical applications, the code integration apparatus provided in the foregoing embodiment may allocate the above functions to different functional modules according to requirements, that is, divide the internal structure of the apparatus into different functional modules to complete all or part of the above described functions, which is not limited herein.
An embodiment of the present application further provides an electronic device, including: one or more processors; a storage device for storing one or more programs, which when executed by the one or more processors, cause the electronic device to implement the code integration method provided in the above-described embodiments.
FIG. 9 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application. It should be noted that the computer system 900 of the electronic device shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments.
As shown in fig. 9, the computer system 900 includes a Central Processing Unit (CPU) 901, which can execute various appropriate actions and processes, such as executing the method described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 902 or a program loaded from a storage portion 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for system operation are also stored. 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 bus 904.
The following components are connected to the I/O interface 905: an input portion 906 including a keyboard, a mouse, and the like; an output portion 907 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage portion 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, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as necessary. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 910 as necessary, so that a computer program read out therefrom is mounted into the storage section 908 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 909, and/or installed from the removable medium 911. The computer program executes various functions defined in the system of the present application when executed by a Central Processing Unit (CPU) 901.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may be, for example, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer-readable signal medium may comprise a propagated data signal with a computer-readable computer program embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
Another aspect of the present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor of a computer, causes the computer to execute the code integration method as described above. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist separately without being incorporated in the electronic device.
Another aspect of the application also provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the code integration method provided in the above embodiments.
The foregoing embodiments are merely illustrative of the principles of the present invention and its efficacy, and are not to be construed as limiting the invention. Any person skilled in the art can modify or change the above-mentioned embodiments without departing from the spirit and scope of the present invention. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical spirit of the present invention be covered by the claims of the present invention.

Claims (10)

1. A method of code integration, the method comprising:
creating a plurality of code execution paths;
running the code execution path to acquire source code data from a code warehouse;
performing code conversion and code compilation on the source code data to generate a dynamic library;
putting the dynamic library into an interface checking catalog;
obtaining a configuration file with the same name as the dynamic library from the code warehouse and placing the configuration file into the interface check directory; and
and according to the dynamic library and the configuration file, executing interface check through the interface check directory, and generating an integrated target file and sending the integrated target file to a server after the interface check is correct.
2. The code integration method of claim 1, further comprising, after obtaining the source code data from the code repository, the steps of: and judging whether the source code data is successfully acquired or not, and if the source code data is unsuccessfully acquired, reporting all failed source code database names.
3. The code integration method of claim 1, wherein transcoding and compiling the source code data to generate the dynamic library comprises:
carrying out code conversion on the source code data to generate conversion code data, wherein the format of the conversion code data is uniform;
performing code compiling on the converted code data to obtain a target file;
and generating a dynamic library according to the target file.
4. The code integration method of claim 3, wherein after the code conversion and the code compilation, further comprising the steps of: and judging whether the code conversion and the code compilation are successful, and if the conversion and the compilation are failed, uploading the source code database name corresponding to the conversion and the compilation failure.
5. The code integration method of claim 4, wherein after uploading the source code database name corresponding to the failed translation and compilation, further comprising the steps of: and modifying the source code data corresponding to the code conversion and the code compiling failure, and performing the code conversion and the code compiling again.
6. The code integration method of claim 1, further comprising, after performing the interface check, the steps of: checking whether the number of dynamic libraries and profiles are paired or whether publications and subscriptions are paired.
7. The code integration method of claim 6, wherein checking whether the number of the dynamic library and the configuration file are paired or whether the publication and the subscription are paired further comprises the steps of: and if the number of the dynamic library and the configuration files is not matched or the release and the subscription are not paired, generating an error report.
8. A code integration apparatus, characterized in that the apparatus comprises:
the acquisition module is used for creating a plurality of code execution paths; running the code execution path to acquire source code data from a code warehouse;
the conversion module is used for carrying out code conversion on the source code data to generate conversion code data;
the compiling module is used for compiling the converted code data to generate a dynamic library; and
the interface checking module is used for placing the dynamic library into an interface checking directory; acquiring a configuration file with the same name as the dynamic library from the code warehouse, and putting the configuration file into the interface check directory; and according to the dynamic library and the configuration file, performing interface check through the interface check directory, and generating an integrated target file and sending the integrated target file to a server after the interface check is correct.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
storage means for storing one or more programs that, when executed by the one or more processors, cause the electronic device to implement the code integration method of any of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor of a computer, causes the computer to execute the code integration method of any one of claims 1 to 7.
CN202210986734.6A 2022-08-17 2022-08-17 Code integration method, device, equipment and medium Pending CN115357227A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210986734.6A CN115357227A (en) 2022-08-17 2022-08-17 Code integration method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210986734.6A CN115357227A (en) 2022-08-17 2022-08-17 Code integration method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN115357227A true CN115357227A (en) 2022-11-18

Family

ID=84003125

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210986734.6A Pending CN115357227A (en) 2022-08-17 2022-08-17 Code integration method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115357227A (en)

Similar Documents

Publication Publication Date Title
WO2018228211A1 (en) Application conversion method, apparatus and device
US9916137B2 (en) Rest service source code generation
US7493597B2 (en) System and method for model based generation of application programming interface test code
US20130339931A1 (en) Application trace replay and simulation systems and methods
US9626283B1 (en) System and method for automatically assigning a defect to a responsible party
CN110716870B (en) Automatic service testing method and device
US10466981B1 (en) System and method for generative programming in an integrated development environment (IDE)
CN110543297B (en) Method and apparatus for generating source code
CN113297081B (en) Execution method and device of continuous integrated pipeline
US9542165B2 (en) Model to Petri-Net transformation
CN117055913A (en) Method, device, equipment and medium for constructing environment of perception system
CN115357227A (en) Code integration method, device, equipment and medium
Diercks et al. Evaluation of tools for describing, reproducing and reusing scientific workflows
CN113032004B (en) Method, apparatus and program product for managing development jobs in a development environment
CN114691527A (en) Unit test case generation method, apparatus, device, medium, and program product
US9195704B2 (en) Automated logging for object-oriented environments
CN113885841A (en) Script generation method and device, electronic equipment and readable medium
CN110399296B (en) Method, system and medium for testing interactive interface between client and server
US8572567B2 (en) Specifying and processing composed patterns
CN111880775A (en) Multi-module layered architecture implementation method and device, electronic equipment and storage medium
CN112363700A (en) Cooperative creation method and device of intelligent contract, computer equipment and storage medium
Othman et al. Test Case Auto-Generation For Web Applications: A Model-Based Approach
CN113704079A (en) Interface testing method and device based on Protobuf
CN113126961A (en) Pipeline processing method, device and storage medium
CN113031960B (en) Code compiling method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination