Program generation method and device and electronic equipment

By implementing a program generation method on the CICD server, receiving task creation instructions for each platform, creating target tasks, and obtaining program resource configuration tables based on the program parameter configuration table, obtaining target source code projects for generating target programs from the preset source code project configuration table, and generating target programs based on the target source code project, solving the problems of cumbersome maintenance of multi-source code projects and high computing resource consumption, realizing the sharing and effective management of source code projects.

CN119987838APending Publication Date: 2025-05-13HANGZHOU JIEFENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411967239.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In software development, the program consisting of multiple source code projects is cumbersome to maintain and consumes a lot of computing resources on the CICD server, especially when multiple people develop together and dependencies are complex.

Method used

By implementing a program generation method on the CICD server, it receives task creation instructions for each platform, creates target tasks, and obtains program resource configuration tables based on program parameter configuration tables, obtains target source code projects for generating target programs from the preset source code project configuration tables, and generates target programs based on target source code projects.

Benefits of technology

This method reduces the number of tasks, facilitates maintenance, and reduces the computing resource consumption of CICD servers, realizing the sharing of source code projects and effective management of dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987838A_ABST
    Figure CN119987838A_ABST
Patent Text Reader

Abstract

The invention provides a program generation method and apparatus, and an electronic device. The method comprises the steps of creating a corresponding target task for each platform; and for the program information of each to-be-created program, obtaining a program parameter configuration table, further obtaining a program resource configuration table, and obtaining a target source code item from the source code item configuration table to generate a target program. According to the mode, the program resource configuration table can be selected according to the resource parameter information in the program parameter configuration table, and then the target source code item required for generating the target program corresponding to the to-be-created program is obtained from the source code item configuration table according to the resource file information in the program resource configuration table; due to the fact that the source code item configuration table comprises all source code items in the same platform, the source code items can be shared, the target task is created according to the platform in the mode, the task does not need to be created for each source code item, the number of the tasks is reduced, maintenance is more convenient, and consumption of computing resources of the CICD server is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a program generation method, device and electronic equipment. Background Art

[0002] In software development, source code is usually divided into multiple projects for management. Most device programs are composed of many source code projects. If a program is composed of dozens, hundreds, or even more source code projects, it is very cumbersome to create an automated compilation task for each source code project. In addition, in order to make the source code as shareable as possible and reduce the cost of later development and maintenance, the company's R&D will carefully structure the source code, which will cause dependencies between source code projects, that is, some need to be compiled first and some need to be compiled later. If a source code project is submitted and compilation is triggered immediately, and the source code project it depends on is submitted later and compiled later, errors will inevitably occur. In complex software development, it is difficult to control that multiple people participate in the development and that they can all be submitted in order. Even if they are submitted in order, it is difficult to ensure that the CICD server can compile in order. In summary, when a program depends on many source code projects, the method of building tasks for each source code project in related technologies will lead to cumbersome maintenance and consume more computing resources of the CICD server. Summary of the invention

[0003] The object of the present invention is to provide a program generation method, device and electronic device to reduce the number of tasks, facilitate maintenance, and reduce the consumption of computing resources of a CICD server.

[0004] The present invention provides a method for generating a program, which is applied to a CICD server; the method comprises: for each platform, receiving a task creation instruction for the platform, and creating a target task corresponding to the platform according to the task creation instruction; wherein the target task includes program information of at least one program to be created; each platform comprises at least one master control, each master control is connected to a corresponding device, and different devices correspond to different programs to be created; each master control belonging to the same platform corresponds to the same compiler and the same basic compilation options; for the program information of each program to be created, a program parameter configuration table corresponding to the program information is obtained; wherein the program parameter configuration table includes: resource parameter information required for generating a target program corresponding to the program to be created; according to the program parameter configuration table, a program resource configuration table corresponding to the program information is obtained; wherein the program resource configuration table includes: resource file information on which the target program depends; according to the program resource configuration table, a target source code project for generating the target program is obtained from a preset source code project configuration table; wherein the source code project configuration table includes all source code projects corresponding to the platform, and all source code projects are arranged in a preset compilation order; based on the target source code project, a target program corresponding to the program to be created is generated.

[0005] Furthermore, according to the program parameter configuration table, the step of obtaining a program resource configuration table corresponding to the program information includes: determining location information and name information corresponding to the program resource configuration table according to the resource parameter information in the program parameter configuration table; and obtaining the program resource configuration table corresponding to the program information according to the location information and name information.

[0006] Furthermore, the resource file information includes: first information associated with the target source code project; the first information includes: a target resource module name; the source code project configuration table includes: a source code module name and a source code repository URL; according to the program resource configuration table, from a preset source code project configuration table, the step of obtaining a target source code project for generating a target program includes: according to the target resource module name in the program resource configuration table, from the preset source code project configuration table, obtaining a target source code repository URL corresponding to a target source code module name matching the target resource module name; obtaining a target source code project for generating a target program to be created from the repository indicated by the target source code repository URL.

[0007] Furthermore, the first information also includes: a target resource repository URL and a target resource version number; there is at least one target source code project; based on the target source code project, the step of generating a target program corresponding to the program to be created includes: for each target source code project, obtaining the first current version number of the current target source code project and the first historical version number corresponding to the last compilation of the target source code project; if the first current version number is different from the first historical version number, compiling the current target source code project to obtain a compilation result; saving the compilation result to the repository indicated by the target resource repository URL; taking the next target source code project as the new current target source code project, and repeating the step of obtaining the current version number of the current target source code project until the last target source code project; if the first current version number is the same as the first historical version number, taking the next target source code project as the new current target source code project, and repeating the step of obtaining the current version number of the current target source code project until the last target source code project; for each target resource version number, according to the target resource version number, obtaining the target resource from the repository indicated by the target resource repository URL; linking the obtained target resource to generate the target program corresponding to the program to be created.

[0008] Furthermore, the acquired target resources are linked, and the step of generating a target program corresponding to the program to be created includes: for each target resource, obtaining the second current version number of the current target resource and the second historical version number corresponding to the last time the target resource was linked; if the second current version number and the second historical version number are different, updating the target resource; taking the next target resource as the new current target resource, and repeating the step of obtaining the second current version number of the current target resource, until the last target resource; if the second current version number and the second historical version number are the same, taking the next target resource as the new current target resource, and repeating the step of obtaining the second current version number of the current target resource, until the last target resource; linking each target resource to generate the target program corresponding to the program to be created.

[0009] Furthermore, the method also includes: based on the target program, generating target data corresponding to the target program; wherein the target data includes at least one of the following: a target upgrade package, a target firmware.

[0010] The present invention provides a program generation device, which is arranged in a CICD server; the device comprises: a creation module, which is used for receiving a task creation instruction for each platform, and creating a target task corresponding to the platform according to the task creation instruction; wherein the target task includes program information of at least one program to be created; each platform comprises at least one master control, each master control is connected to a corresponding device, and different devices correspond to different programs to be created; each master control belonging to the same platform corresponds to the same compiler and the same basic compilation options; a first acquisition module, which is used for acquiring a program parameter configuration table corresponding to the program information of each program to be created; wherein, The program parameter configuration table includes: resource parameter information required to generate a target program corresponding to the program to be created; a second acquisition module is used to obtain a program resource configuration table corresponding to the program information according to the program parameter configuration table; wherein the program resource configuration table includes: resource file information on which the target program depends; a third acquisition module is used to obtain a target source code project for generating the target program from a preset source code project configuration table according to the program resource configuration table; wherein the source code project configuration table includes all source code projects corresponding to the platform, and all source code projects are arranged in a preset compilation order; a generation module is used to generate a target program corresponding to the program to be created based on the target source code project.

[0011] Furthermore, the second acquisition module is also used to: determine the location information and name information corresponding to the program resource configuration table according to the resource parameter information in the program parameter configuration table; and acquire the program resource configuration table corresponding to the program information according to the location information and name information.

[0012] An electronic device provided by the present invention includes a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement any of the above-mentioned program generation methods.

[0013] The present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement any of the above-mentioned program generation methods.

[0014] The program generation method, device and electronic device provided by the present invention receive a task creation instruction for each platform, and create a target task corresponding to the platform according to the task creation instruction; wherein the target task includes program information of at least one program to be created; each platform includes at least one main control, each main control is connected to a corresponding device, and different devices correspond to different programs to be created; each main control belonging to the same platform corresponds to the same compiler and the same basic compilation options; for the program information of each program to be created, a program parameter configuration table corresponding to the program information is obtained; wherein the program parameter configuration table includes: resource parameter information required for generating a target program corresponding to the program to be created; according to the program parameter configuration table, a program resource configuration table corresponding to the program information is obtained; wherein the program resource configuration table includes: resource file information on which the target program depends; according to the program resource configuration table, a target source code project for generating the target program is obtained from a preset source code project configuration table; wherein the source code project configuration table includes all source code projects corresponding to the platform, and all source code projects are arranged in a preset compilation order; based on the target source code project, a target program corresponding to the program to be created is generated. This method can select a program resource configuration table according to the resource parameter information in the program parameter configuration table, and then obtain the target source code project required to generate the target program corresponding to the program to be created from the source code project configuration table according to the resource file information in the program resource configuration table. Since the source code project configuration table contains all source code projects on the same platform, it is possible to share source code projects. In addition, this method creates target tasks according to the platform, and there is no need to create tasks for each source code project separately, which reduces the number of tasks, is easier to maintain, and reduces the consumption of computing resources on the CICD server. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 A flowchart of a method for generating a program provided by an embodiment of the present invention;

[0017] Figure 2 A schematic diagram of the structure of a program generation device provided by an embodiment of the present invention;

[0018] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0020] In software development, it is unrealistic to put all source codes into one project. Generally, source codes can be divided into multiple projects (Projects) for management according to different functions, different compilation methods, different permissions, etc. Most device programs are composed of many source code projects. For example, some manufacturers' IOT SDK (Internet of Things Software Development Kit, a set of IoT device software development kits) links to several hundred libraries, and some companies' ordinary IPC (Inter-Process Communication) programs also link to hundreds of libraries (usually each library corresponds to a source code project). Too many source code projects will bring some disadvantages. For administrators, the workload of creating source code projects and setting permissions for different developers will increase significantly. But for developers, there are two sides. On the one hand, dividing the source code into multiple projects is more conducive to multi-person collaborative development, and at the same time reduces the technical requirements of developers, because each developer only needs to develop and maintain a few projects, which is in line with the company's talent echelon construction. On the other hand, as the permissions increase, the more source code projects you are responsible for, you may often need to modify multiple source code projects, compile, verify and publish them one by one, which makes the work more cumbersome and reduces efficiency. In addition, modifying a source code project may affect other source code projects that depend on it. Manual compilation and verification one by one takes a lot of time. The ideal way is that developers upload the source code project after modifying it and passing the self-test, and leave the rest to the computer. The currently popular CICD (Continuous Integration, Continuous Delivery, Continuous Deployment) process is a big step towards this ideal.

[0021] Continuous integration (CI) means that developers only need to focus on source code development and submit the source code to the source code repository (such as the most popular git), and the automated compilation server will automatically compile it into a library or executable file.

[0022] Continuous delivery (CD) is the next step of continuous integration, which continuously delivers new versions of the software to testing and product acceptance. Continuous delivery emphasizes "delivery". After the source code is submitted and integrated, it can be delivered at any time. Continuous delivery also performs some API (Application Programming Interface) tests, integration tests, etc. to ensure that the delivered products can be directly delivered and deployed.

[0023] Continuous deployment (CD) is the next step of continuous delivery, "automatically" deploying delivered programs to production environments, user upgrade servers, etc.

[0024] The integration speed can be significantly improved through automation. In the traditional R&D process, compilation, packaging, testing, and deployment are generally performed manually. After automation, the integration frequency can be greatly improved, and problems can be discovered and solved in time, which is equivalent to pre-empting the problem. Frequent integration can prevent the local source code from deviating significantly from the main source code. The main source code is constantly updated. If it is not integrated for a long time, it will make it more difficult to integrate in the future, or even impossible to integrate.

[0025] Using the CICD process, developers only need to submit the source code, and the CICD server will help complete the rest. There are many CICD tools, such as Jenkins (an open source continuous integration and continuous delivery tool), GitlabCI (a continuous integration tool), CircleCI (a continuous integration and continuous delivery platform), GithubActions (a continuous integration and continuous delivery platform), etc.

[0026] If the source code of a project can be directly compiled into a finished product, it is very simple to use the CICD process. Just create a task for the source code project to automatically detect whether the source code has been submitted (currently CICD tool software generally has the function of integrating and communicating with version management tools, and can obtain source code submission information). Once submitted, the compilation is triggered, and the compilation is delivered. However, if a program consists of dozens, hundreds, or even more source code projects, and an automated compilation task is created for each source code project to complete continuous integration, continuous delivery, and continuous deployment, then the maintenance work can be imagined to be very cumbersome. The device program involves many functions, and modular programming is generally advocated. Therefore, there are many source code projects involved. In order to make the source code projects as shareable as possible and reduce the cost of later development and maintenance, the company's R&D will carefully structure the source code projects, which will cause dependencies between some source code projects, that is, some need to be compiled first and some later. If a source code project is submitted and the compilation is triggered immediately, and the source code project it depends on is submitted later and compiled later, it will inevitably cause errors. In complex software development, usually multiple people are involved in the development, and it is difficult to control each developer to submit in order. Even if they are submitted in order, it is difficult to ensure that the CICD server can compile in order.

[0027] From the previous analysis, it can be seen that creating a CICD build task for each source code project is not appropriate when a program depends on many libraries. However, in actual research and development, device program development usually involves hundreds or thousands of source code projects. Using related technologies to build tasks for each source code project will lead to cumbersome maintenance and consume more computing resources of the CICD server. In addition, there is the problem of repeated compilation. Based on this, an embodiment of the present invention provides a program generation method, device and electronic device, which can be applied to scenarios based on CICD servers to achieve automated program compilation and packaging.

[0028] To facilitate understanding of this embodiment, a method for generating a program disclosed in an embodiment of the present invention is first introduced, and the method is applied to a CICD server;

[0029] like Figure 1 As shown, the method comprises the following steps:

[0030] Step S102, for each platform, receiving a task creation instruction for the platform, and creating a target task corresponding to the platform according to the task creation instruction; wherein the target task includes program information of at least one program to be created; each platform includes at least one master control, each master control is connected to a respective corresponding device, and different devices correspond to different programs to be created; each master control belonging to the same platform corresponds to the same compiler and the same basic compilation options;

[0031] The above program information may include program name, etc.; this embodiment introduces the concept of platform. For different master controls, as long as the compiler corresponding to the master control is the same and the basic compilation options are the same, they can be considered to belong to the same platform; the basic compilation options can be understood as the options that the master control manufacturer requires to be passed in for source code compilation; the same platform can contain multiple master controls, and the same master control can be used for different devices. Since the functions of each device are usually different, different programs must be written and packaged for each device; the same platform has the same compiler and basic compilation options, so the tools and programs compiled by the same platform can be run on all devices (including devices corresponding to different master controls) on the same platform, but they are only runnable. In fact, different programs must be written and packaged for different devices because the functions required to be provided by each device are different. This embodiment can create target tasks according to the platform. Specifically, for each platform, when receiving the task creation instruction corresponding to the platform, the corresponding target task can be created for the platform. The target task includes program information such as the program name of the program to be created in the platform.

[0032] Step S104, for each program information of the program to be created, obtaining a program parameter configuration table corresponding to the program information; wherein the program parameter configuration table includes: resource parameter information required to generate a target program corresponding to the program to be created;

[0033] The above resource parameter information may include: master name, client name, program resource configuration table, DDR (Double Data Rate SDRAM, double rate synchronous dynamic random access memory) type, DDR size, DDR main frequency, storage device type (such as Nor, Nand, eMMC, etc.), storage device capacity, Wifi model, supported languages, etc.; in actual implementation, a program parameter configuration table is usually pre-designed for each program to be created, and the program parameter configuration table is usually configured with all the resource parameter information required to generate the target program corresponding to the program to be created. When the above target task is created, the corresponding program parameter configuration table can be obtained for the program information of each program to be created. For example, a program parameter configuration table with the same program name as the program information can be selected.

[0034] The parameters in the program parameter configuration table can be expressed in the form of key-value pairs; for example, you can refer to the following key-value pairs:

[0035] CHIP:<master control name>;

[0036] CUSTOMER:<customer name>;

[0037] PROGRAM_CFG:<program resource configuration table name>;

[0038] The program parameter configuration table defines the characteristics of the program. When compiling the source code project, you can fine-tune the source code compilation options according to this program parameter configuration table. For example, if the selected storage device is Nor Flash, then when compiling the driver, you must compile the NorFlash driver into it. When linking the program, you can find the dependent files according to the parameter combination listed in the program parameter configuration table. For example, if the program resource configuration table is placed according to "customer name / master control name / program resource configuration table", then the program resource configuration table of the selected program can be obtained through the "customer name", "master control name", and "program resource configuration table" in the program parameter configuration table. In addition, it can also be used to name the program files to be delivered that are finally packaged and generated. Obviously, the program name of the program file to be delivered should contain characteristic values ​​such as customer name, master control name, DDR (type, size, main frequency), storage device type, Wifi model, etc., which is easier to identify.

[0039] Step S106, obtaining a program resource configuration table corresponding to the program information according to the program parameter configuration table; wherein the program resource configuration table includes: resource file information on which the target program is dependent;

[0040] The above-mentioned resource file information may include libraries, tools, configuration files, etc.; in actual implementation, after obtaining the above-mentioned program parameter configuration table, the corresponding program resource configuration table can be obtained according to the program parameter configuration table, and the program resource configuration table stores the resource file information such as libraries, tools and configuration files that the target program corresponding to the program to be created depends on.

[0041] It should be noted that the resource file information that the target program depends on is not necessarily compiled from the source code project, and may also include some configuration files and files provided by third-party manufacturers (such as libraries, tools, configuration files, etc.).

[0042] Step S108, according to the program resource configuration table, obtaining a target source code project for generating a target program from a preset source code project configuration table; wherein the source code project configuration table includes all source code projects corresponding to the platform, and all source code projects are arranged in a preset compilation order;

[0043] In actual implementation, a source code project configuration table is usually set in advance, and the source code project configuration table usually includes all source code projects corresponding to the platform. Therefore, after obtaining the above-mentioned program resource configuration table, the target source code project required for generating the target program of the program to be created can be selected from the program resource configuration table; in addition, all source code projects in the source code project configuration table have been arranged according to a preset compilation order, that is, the arrangement order of all source code projects has taken into account the dependencies between different source code projects. Therefore, subsequent compilation errors caused by incorrect compilation order of source code projects with dependencies can be avoided.

[0044] Step S110: generating a target program corresponding to the program to be created based on the target source code project.

[0045] After obtaining the target source code project, the target program corresponding to the program to be created can be compiled based on the target source code project.

[0046] The above-mentioned program generation method receives a task creation instruction for each platform, and creates a target task corresponding to the platform according to the task creation instruction; wherein the target task includes program information of at least one program to be created; each platform includes at least one master control, each master control is connected to its corresponding device, and different devices correspond to different programs to be created; each master control belonging to the same platform corresponds to the same compiler and the same basic compilation options; for the program information of each program to be created, a program parameter configuration table corresponding to the program information is obtained; wherein the program parameter configuration table includes: resource parameter information required to generate a target program corresponding to the program to be created; according to the program parameter configuration table, a program resource configuration table corresponding to the program information is obtained; wherein the program resource configuration table includes: resource file information on which the target program depends; according to the program resource configuration table, a target source code project for generating the target program is obtained from a preset source code project configuration table; wherein the source code project configuration table includes all source code projects corresponding to the platform, and all source code projects are arranged in a preset compilation order; based on the target source code project, a target program corresponding to the program to be created is generated. This method can select a program resource configuration table according to the resource parameter information in the program parameter configuration table, and then obtain the target source code project required to generate the target program corresponding to the program to be created from the source code project configuration table according to the resource file information in the program resource configuration table. Since the source code project configuration table contains all source code projects on the same platform, it is possible to share source code projects. In addition, this method creates target tasks according to the platform, and there is no need to create tasks for each source code project separately, which reduces the number of tasks, is easier to maintain, and reduces the consumption of computing resources on the CICD server.

[0047] The embodiment of the present invention also provides another method for generating a program, which is implemented on the basis of the method of the above embodiment. In this method, the resource file information includes: first information associated with the target source code project; the first information includes: the target resource module name, the target resource repository URL (Uniform Resource Locator) and the target resource version number;

[0048] For example, resource file information can be represented in the following file format:

[0049] "Resource module name, resource repository URL, version number";

[0050] The resource module name in the above file format can be used as a synonym for the resource repository URL, which is convenient for subsequent reference and identification.

[0051] The resource repository URL in the above file format indicates the repository path established by the version management tool for the resource project. For example, the URL of the commonly used git version management tool can be as follows:

[0052] git@<git server IP address>:API_Include / P_API_INCLUDE_20240118.git;

[0053] The version number in the above file format represents the version number of the resources used by the current product in the version control repository. The version numbers of some version control tools are numbers, such as svn, and some are a string of characters, such as git, which is a 40-character hash value. The version number of the same resource project is unique.

[0054] The above representation of the version number can be flexibly designed according to actual needs to represent different meanings for convenient subsequent processing. For example, taking git as an example, it can be stipulated that: 0 represents the latest version; a string of 40 characters is the actual git commit id; less than 40 characters and non-zero is the branch; more than 40 characters is: branch name + git commit id.

[0055] The following explains the different meanings represented by different version numbers:

[0056] Latest version (0): When building a task, always download the latest version. If it is a library, it means that when the program is linked, always link to the latest library, that is, when building a task, update the source code project to the latest, compile and generate the library for linking.

[0057] git commit id (length of 40): It means using a specific library version. Having a git commit id means the version has been committed, that is, there is no need to compile the source code project, and you can directly use the corresponding version of the committed library.

[0058] Branch name (length less than 40 and non-zero): Here, it specifies the latest version resources of the corresponding branch. If it is a library, it means that when the program is linked, always link to the latest version library corresponding to the branch specified here, that is, when building, switch the source code project to the specified branch, update to the latest, and then compile and generate the library for linking.

[0059] Branch name + git commit id (length greater than 40): It means using the resources of the branch and the corresponding version specified here. If it is a library, it means that when the program is linked, always link to the library of the branch and version number specified here. Having a commit id means it has definitely been committed, that is, there is no need to compile the source code project, and you can directly use the corresponding branch and version of the committed library.

[0060] According to the content read from the program resource configuration table, obtain the resource module name and version number. For those with a fixed version number, subsequent source code compilation can be ignored. For those that require the latest version number, save them together with the resource module name for subsequent source code compilation.

[0061] The source code project configuration table usually contains all source code projects for the current platform. Subsequently, selective compilation can be performed from all source code projects according to the program resource configuration table. The source code project configuration table includes: the source code module name and the source code repository URL. For example, the source code project configuration table can be represented in the following file format:

[0062] "Source code module name Source code repository URL";

[0063] The source code module name in the above file format can be used as a synonym for the source code repository URL, which is convenient for subsequent reference and identification.

[0064] As mentioned before, if the required resource file information is a library, the corresponding source code project needs to be compiled. When the build task is being built, it will look up the corresponding source code project in the source code project configuration table for compilation. To quickly find the corresponding source code project, the source code module name and the corresponding resource module name can be set to be the same, and then it is very convenient to determine the source code project to be compiled by matching the resource module name and the source code module name.

[0065] The source code repository URL in the above file format represents the repository path established by the version control tool for this source code project. For example, for the commonly used git version control tool currently, the URL can be as follows:

[0066] git@<git server IP address>:LibXmDvr / P_LIBXMCOMM_20180725.git;

[0067] It should be noted that the source code projects in the source code project configuration table do not need to configure the branch name: specifically, whether to switch branches is completely determined by the corresponding branch in the program resource configuration table.

[0068] The number of programs currently supported by a platform can be determined by the number of program parameter configuration tables. Usually, one program parameter configuration table corresponds to one program. The file name of the program parameter configuration table can be used as a synonym for this program in the automated build, and can be used in the object list traversed in the automated build, or in the drop-down box for manually building only a selected program.

[0069] In this embodiment, the number of target source code projects is at least one; the method includes the following steps:

[0070] Step 1, for each platform, receive a task creation instruction for that platform, and create a target task corresponding to that platform according to the task creation instruction; wherein, the target task includes the program information of at least one program to be created; each platform includes at least one main control, each main control is connected to its corresponding device, and different devices correspond to different programs to be created; for each main control belonging to the same platform, the corresponding compiler is the same and the basic compilation options are the same;

[0071] Step 2: for each program information of the program to be created, obtain a program parameter configuration table corresponding to the program information; wherein the program parameter configuration table includes: resource parameter information required to generate a target program corresponding to the program to be created;

[0072] Step 3, according to the resource parameter information in the program parameter configuration table, determine the location information and name information corresponding to the program resource configuration table;

[0073] Step 4: obtaining a program resource configuration table corresponding to the program information according to the location information and the name information; wherein the program resource configuration table includes: generating resource file information that the target program depends on;

[0074] In actual implementation, the location information of the program resource configuration table and the name information of the program resource configuration table can be obtained from the resource parameter information of the program parameter configuration table, that is, the program resource configuration table matching the name information can be obtained from the location indicated by the location information.

[0075] Step 5: According to the target resource module name in the program resource configuration table, obtain the target source code repository URL corresponding to the target source code module name matching the target resource module name from the preset source code project configuration table;

[0076] Step 6: Obtain a target source code project for generating a target program to be created from the repository indicated by the target source code repository URL; wherein the source code project configuration table includes all source code projects corresponding to the platform, and all source code projects are arranged in a preset compilation order;

[0077] In actual implementation, in one of the embodiments, the target source code repository URL corresponding to the target source code module name with the same name as the target resource module name can be obtained from the source code project configuration table, and then the target source code project for generating the target program to be created can be downloaded or updated from the location indicated by the target source code repository URL; of course, other matching methods can also be selected, which are not limited here.

[0078] Step 7: for each target source code project, obtain the first current version number of the current target source code project and the first historical version number corresponding to the last compilation of the target source code project;

[0079] Step 8: If the first current version number is different from the first historical version number, compile the current target source code project to obtain a compilation result;

[0080] Step 9: Save the compilation result to the repository indicated by the target resource repository URL;

[0081] Step 10: Take the next target source code project as the new current target source code project, and repeat the step of obtaining the current version number of the current target source code project until the last target source code project.

[0082] Step eleven: if the first current version number is the same as the first historical version number, the next target source code project is used as the new current target source code project, and the step of obtaining the current version number of the current target source code project is repeated until the last target source code project.

[0083] If the directory where the current target source code project is located (usually named by the source code module name) does not exist, it is usually necessary to download the current target source code project first. If the corresponding version number is a branch name, switch to the corresponding branch. If the directory where the current target source code project is located exists and the corresponding version number is not a branch name, it is usually necessary to switch to the trunk and update the current target source code project to the latest. If the corresponding version number is a branch name, switch to the corresponding branch and update the current target source code project to the latest (Note: How to switch branches depends on the specific version management tool used, and is not limited here). After the current target source code project is downloaded or updated, obtain its corresponding first current version number to determine whether it is the same as the first historical version number submitted by the last compilation. If they are the same, ignore the current target source code project and continue to process the next target source code project; if they are not the same, you can start compiling the current source code project. After the compilation is successful, switch the repository corresponding to the compilation result to the corresponding trunk or branch, and then copy the compilation result to it, and submit it according to the trunk or branch. The specific submission method can refer to the relevant technology, which will not be repeated here; after submission, continue to process the next target source code project.

[0084] Step 12: for each target resource version number, obtain the target resource from the warehouse indicated by the target resource warehouse URL according to the target resource version number;

[0085] Step thirteen, linking the acquired target resources to generate a target program corresponding to the program to be created.

[0086] This step can be implemented by following steps 130 to 133:

[0087] Step 130, for each target resource, obtaining a second current version number of the current target resource and a second historical version number corresponding to the last link to the target resource;

[0088] Step 131, if the second current version number is different from the second historical version number, update the target resource;

[0089] Step 132, taking the next target resource as the new current target resource, and repeating the step of obtaining the second current version number of the current target resource until the last target resource;

[0090] Step 133, if the second current version number is the same as the second historical version number, the next target resource is used as the new current target resource, and the step of obtaining the second current version number of the current target resource is repeated until the last target resource;

[0091] Step 134, linking each target resource to generate a target program corresponding to the program to be created.

[0092] After all target source code projects are compiled, read the contents of the program resource configuration table, and download or update the corresponding version of the target resource from the corresponding resource repository URL one by one according to the version number. Specifically, if the target resource does not exist, it is usually necessary to download the target resource. If the target resource exists, it is usually necessary to update the target resource. After downloading or updating the current target resource, obtain its corresponding second current version number to determine whether it is the same as the second historical version number successfully submitted last time the link is linked. If they are the same, the current target resource can be ignored and the next target resource can be processed. If they are not the same, you can enter the program link project to link the downloaded or updated current target resource to generate the target program corresponding to the program to be created; usually the program link project needs to be designed in advance and can be downloaded or updated in advance.

[0093] Step fourteen: based on the target program, generate target data corresponding to the target program; wherein the target data includes at least one of the following: a target upgrade package, a target firmware.

[0094] After obtaining the target program, you can start packaging the program, that is, make the target program and its dependent tools and configuration files into an upgradeable or burnable target upgrade package or target firmware, etc. according to the characteristics of the storage device. After the current target program is packaged, you can continue to process the next program to be created according to the steps in the above embodiment.

[0095] In this embodiment, all programs in the current platform can be automatically built, or only the operation of specifying the program name can be built. In this way, when traversing all the program parameter configuration tables in the directory where the program parameter configuration table is located, the program parameter configuration table corresponding to the specified program name can be found, and exit after processing the program parameter configuration table.

[0096] The method for generating the above-mentioned program manages all source code projects under the platform (refer to the source code project configuration table), compiles the required source code projects according to the needs of the program, and can refer to the program resource configuration table. The program resource configuration table contains the source code projects that the program depends on, and also contains other resources without source code (these resource files have no source code, as long as the developer uploads them to the version management server by himself, without the participation of CICD). If the corresponding source code resources are configured, the corresponding source code project must be found through the corresponding relationship in the source code project configuration table for downloading. Whether it needs to be compiled depends on the corresponding first current version number and the first historical version number. You can refer to the relevant description in the aforementioned embodiment, which will not be repeated here. After all the source code projects required by the program are compiled and submitted to the corresponding resource warehouse, refer to the program resource configuration table, download or update the resources, download or update the compilation results corresponding to the source code project, and then link these compilation results to generate the target program, and finally package it. The resources required by the target program are usually packaged together for subsequent upgrades and production burning, and the corresponding target upgrade package or target firmware is generated, which can be delivered accordingly.

[0097] There may also be some problems when using platform management. The main problem is that after sharing source code projects, repeated compilation and repeated submission of compilation results will occur, and conflicts will occur when submitting at the same time. In order to solve this problem, the CICD server limits parallel construction when creating a build task, that is, only one instance of a task is running at the same time. You can also consider creating multiple tasks for the same platform for time-sharing builds. For example, you can create an automatic build task, which can be built in the middle of the night when everyone is not at work, and build the projects that have modified the source code that day and deliver them; create a manual build task, run it during the day, use manual triggering, and limit parallel builds to ensure that only one person can trigger the build at a time (you can communicate through the instant messaging group and assign someone to be responsible for triggering it); you can also create a scheduled build task during the day, such as stipulating automatic builds at a certain time point in the afternoon or / and the afternoon, and manual triggering is not allowed during this period. For details, please refer to the relevant technology, which will not be repeated here.

[0098] The tasks are created by platform and can be organized as follows: platform / customer name (can be multiple) / master control (can be multiple) / program (can be multiple, a customer may need to customize different program functions). Of course, it is also possible to swap the customer name and the master control, or even remove them, as long as the program name can be guaranteed to be unique.

[0099] In this embodiment, it can be deduced from the target program to be built in the end that to link and generate a target program, source code projects (in order to adapt to various scenarios, the specific number is not limited) are required to compile the generated libraries and tools. When multiple source code projects are required, considering the dependencies between the source code projects, the source code projects need to be sorted to ensure that they are compiled in order.

[0100] Some companies use CICD tools. Every time they build a task, they will pull all the source code projects needed by the target program from the warehouse and compile them anew. This operation has certain advantages: the entire process is very simple to implement. In addition, each new download and compilation is reliable and not prone to errors, which can ensure that each verification is indeed a clean source code project in the source code warehouse. However, the disadvantages are also very obvious, which wastes server resources. Every time the source code and compilation packaging environment are downloaded from the version management server for each product program, the network bandwidth is very consumed. The source code and compilation packaging environment are downloaded to the local storage device of the CICD server, and the storage device is frequently read and written, which shortens its service life. There are also some source code projects that are particularly time-consuming to compile (such as compiling the operating system kernel and some manufacturers' SDKs), which limits the number of programs that the server can support. To solve this problem, it is necessary to increase server investment. The developer experience is also relatively poor. Originally, only a small amount of code was modified, which only affected individual source code projects. They just wanted to verify it quickly, but they had to download all the code and recompile it all.

[0101] According to current version management tools (such as the most popular git), it is entirely possible to compile only the modified source code projects, and then upload the compilation results to the version management server. If it is detected that the source code has not been modified, there is no need to recompile, and the last one can be used directly. To avoid repeated compilation of unchanged source code, a version management mechanism can be introduced. For details, please refer to relevant technologies, which will not be described here.

[0102] Version management tools can support the management of branches or branch-like systems. For example, the most popular git itself supports branches. Branches are relative to the trunk. When a project is submitted for the first time, it is generally submitted to the trunk. First develop based on the trunk. When it is developed to a certain extent, it is found that there is a new product program that can be used with slight modifications based on the trunk, but this function does not need to be merged into the trunk. At this time, a branch can be derived based on the current version of the trunk. At this time, the branch content is exactly the same as the trunk. Subsequent development based on branches is submitted to the branch. In this way, the new submission will only appear on the branch and will not affect the trunk. The trunk and branch concepts of version management tools are existing mature technologies and will not be elaborated here.

[0103] In order to make automated compilation and packaging concise and easy to control, when linking the program, if the library uses a branch, that is, the library generated by the source code compilation is submitted as a branch, then the source code is also submitted as a branch with the same name.

[0104] Based on the above analysis, a target program can be generated by linking n libraries, and n libraries are generated by compiling the corresponding n source code projects. There are two processing procedures that can insert version information judgment to avoid repeated operations. Specifically, after the source code project is compiled successfully and the compilation result is submitted to the version management server, the CICD server records the version number of the source code project. When the next build task is started, it is used to determine whether the corresponding source code project has a version change, avoiding repeated compilation when the source code has not changed. When linking the generated program, the version information of the linked library can be recorded for version verification when the library is connected next time, avoiding repeated linking when the library has not changed.

[0105] The above program generation method provides a set of effective and very efficient solutions. First, create tasks according to the platform and build mode. As long as the compiler and basic compilation options are the same, they belong to the same platform. The build mode is divided into manual and automatic according to the trigger method. For a platform and a build mode, the processing flow is the same, as outlined below:

[0106] 1. Select the program name to be packaged and obtain the program parameter configuration table corresponding to the program name.

[0107] 2. According to the program parameter configuration table, obtain the program resource configuration table required by the program. Through the program resource configuration table, you can download the libraries, tools and dependent configuration files required by the program.

[0108] 3. Through the program resource configuration table, you can find the corresponding source code project and the branch it uses from the source code project configuration table of the program's corresponding platform.

[0109] 4. After finding the source code project, download it locally, switch to the corresponding branch, and compile it. After compiling, you can submit the compilation results to the version management server. The corresponding project path must be consistent with the configuration in the program resource configuration table.

[0110] 5. Download or update the resource items required for the program according to the program resource configuration table.

[0111] 6. Compile and link the program, start the packaging operation, generate the program firmware, and complete the delivery.

[0112] In this method, many source code projects and compiled libraries and tools on the same platform can be shared. By integrating the device programs on the same platform (even if they correspond to different main controls) into the same system, many libraries and tools can be shared easily, greatly reducing the number of source code projects that need to be maintained. This solution creates build tasks for CICD servers by platform, which can maximize the sharing of source code projects and the libraries and tools generated by their compilation. The advantages of management by platform are briefly described as follows:

[0113] 1. Maximize the use of shared source code projects and the libraries and tools they compile;

[0114] 2. All source code projects of the same platform can be listed in the same source code project configuration table;

[0115] 3. Can clearly sort according to the order of project compilation;

[0116] 4. During compilation, the compiler and basic compilation options can be issued uniformly to facilitate cross-platform porting of source code projects.

[0117] 5. It is convenient to compile and submit source code by group, that is, the source code projects are independent, but the compilation results can be put together by group.

[0118] 6. Create build tasks on the CICD server according to the platform, effectively controlling the number of build tasks on the CICD server. (Generally, a company will introduce a platform after careful consideration, and the number of platforms is very limited).

[0119] This method uses three configuration tables, namely the program parameter configuration table, the program resource configuration table and the source code project configuration table, to manage the compilation and submission of source code projects associated with all programs on a platform, and to manage the linking and packaging of all programs on a platform. In conjunction with the CICD server, automatic compilation and packaging can be achieved.

[0120] This approach avoids using specific source code projects and / or programs to create build tasks, which greatly reduces the number of build tasks created on the CICD server.

[0121] This solution can handle both automated build tasks that traverse all programs and build tasks with specified program names. They share the same processing flow, but to build a specified program name, you only need to find the program parameter configuration table for the corresponding program name.

[0122] This solution puts the source code projects of the same platform together. The compilation results of the same source code project can also be submitted to the same repository for sharing by all programs on this platform. One platform only needs to maintain one set of source code and one set of source code compilation results, which greatly reduces the investment and maintenance costs of CICD servers and version management servers.

[0123] This solution selects the program resource configuration table according to the program parameter configuration table currently being processed, and then determines the source code repository URL and branch of the source code project to be compiled according to the content of the program resource configuration table. In the meantime, the source code compilation corresponding to the library with the specified actual version number can be ignored (after the program is stable, most libraries can have fixed version numbers, so there is no need to compile the source code). This on-demand compilation of the source code significantly improves the processing efficiency of a single program and the utilization rate of the CICD server. In addition, it reduces the bandwidth pressure of the version management server and the waste of storage capacity.

[0124] Before compiling the source code, this design can make a judgment based on the version number information successfully saved by the historical compilation to avoid repeated compilation. Before linking the program, this design makes a judgment based on the version number information successfully saved by the historical link to avoid repeated linking. In the related art, in order to facilitate debugging, developers need to track when the compilation results are compiled, and often insert the system time at compile time in the source code, resulting in differences when the same source code is compiled at different times. After compilation, it will be submitted to the version management server to generate a new version, but the actual function of this version is the same as the previous version, resulting in a waste of resources on the version management server. The source code compilation result changes due to the insertion of the compilation time information. Once submitted to the version management server, it will trigger the program to be relinked, repackaged and delivered. The resources wasted are not only the version management server, but also the subsequent testing, and deployment resources. The resources listed in the program resource configuration table have not changed, and repeated links should also be avoided, because in order to track the time of program linking, developers often add the current system time to the program when linking the program, resulting in changes to the program itself or the program name, and a new version is generated for delivery, which will also lead to a waste of resources such as the version management server, and subsequent testing, and deployment. This solution makes judgments based on the version number of the source code project and the version number of the resource, and will not cause the problem of being inserted into the compilation time. Therefore, the above-mentioned repeated compilation problem can be avoided.

[0125] This solution has designed a practical method to solve the problem of automatic compilation of hundreds of source code projects involved in making programs for many devices, especially embedded devices (such as security equipment, IOT devices, etc.). The CICD server has built a CICD process framework. To handle a transaction, you need to create a build task and set the trigger condition for this task. Assuming there are many source code projects, create a build task for each source code project. After the trigger condition is met, each project is compiled separately. This has many disadvantages: 1) The source code project is already on the version management server, and now you need to create another build task on the CICD server. The maintenance workload is large with more projects. 2) You also need to solve the dependency relationship of the source code project, that is, some projects are compiled first and some are compiled later. It is difficult to guarantee that each project is compiled separately; 3) The problem of source code sharing. Several programs can share a source code by adjusting individual parameters. If they are built separately, because you don’t know which set of parameters to use, you have to build all the parameters again. In fact, from the perspective of the program, the developer may only trigger a program package, that is, only need to build a library corresponding to a certain parameter. Some companies will create a build task for each program, and compile all the source code projects that the program depends on each time, and then link them to make the program. This practice wastes the bandwidth of the version management server and the CPU of the CICD server (some source code compilation is very slow, in this case, only additional servers can be added). This practice has some disadvantages. For example, if the customer's customized program is complex and the number of programs is large, it is not realistic to create a build task for each program. Moreover, the processing capacity of a CICD server is limited. If there are too many build tasks, additional servers will be required.

[0126] This design proposes a solution to use the platform to create CICD build tasks, and then the platform manages all the programs of the platform, and the previous problems are solved. The platform is reflected in the CICD server build task, and one platform corresponds to one build task. The program is reflected in the program parameter configuration table, the program resources are reflected in the program resource configuration table, and the program source code is reflected in the source code project configuration. In this way, through the platform + three configuration tables, all the programs of a platform and their corresponding source code projects are automatically compiled and strung together, compiled on demand, and version difference comparison is added in the middle, only compiling and packaging programs that have differences since the last build. This way of using the platform and the three configuration tables to cooperate with each other optimizes the compilation and packaging of multi-source code project programs on the device (such as compilation on demand, compilation after judging version differences, etc.), which is also the biggest improvement of this solution.

[0127] The embodiment of the present invention provides a program generation device, which is arranged in a CICD server; Figure 2 As shown, the device comprises:

[0128] The creation module 20 is used for receiving a task creation instruction for each platform, and creating a target task corresponding to the platform according to the task creation instruction; wherein the target task includes program information of at least one program to be created; each platform includes at least one master control, each master control is connected to a corresponding device, and different devices correspond to different programs to be created; each master control belonging to the same platform corresponds to the same compiler and the same basic compilation options;

[0129] The first acquisition module 21 is used to acquire a program parameter configuration table corresponding to the program information of each program to be created; wherein the program parameter configuration table includes: resource parameter information required to generate a target program corresponding to the program to be created;

[0130] The second acquisition module 22 is used to acquire a program resource configuration table corresponding to the program information according to the program parameter configuration table; wherein the program resource configuration table includes: resource file information that the target program depends on;

[0131] The third acquisition module 23 is used to acquire a target source code project for generating a target program from a preset source code project configuration table according to the program resource configuration table; wherein the source code project configuration table includes all source code projects corresponding to the platform, and all source code projects are arranged in a preset compilation order;

[0132] The generating module 24 is used to generate a target program corresponding to the program to be created based on the target source code project.

[0133] The generation device of the above-mentioned program can select the program resource configuration table according to the resource parameter information in the program parameter configuration table, and then obtain the target source code project required to generate the target program corresponding to the program to be created from the source code project configuration table according to the resource file information in the program resource configuration table. Since the source code project configuration table contains all source code projects in the same platform, it is possible to share source code projects. In addition, this method creates target tasks according to the platform, and there is no need to create tasks for each source code project separately, which reduces the number of tasks, is easier to maintain, and reduces the consumption of computing resources of the CICD server.

[0134] Furthermore, the second acquisition module is also used to: determine the location information and name information corresponding to the program resource configuration table according to the resource parameter information in the program parameter configuration table; and acquire the program resource configuration table corresponding to the program information according to the location information and name information.

[0135] Furthermore, the resource file information includes: first information associated with the target source code project; the first information includes: the target resource module name; the source code project configuration table includes: the source code module name and the source code repository URL; the third acquisition module is also used to: according to the target resource module name in the program resource configuration table, obtain the target source code repository URL corresponding to the target source code module name matching the target resource module name from the preset source code project configuration table; obtain the target source code project for generating the target program to be created from the repository indicated by the target source code repository URL.

[0136] Furthermore, the first information also includes: a target resource repository URL and a target resource version number; there is at least one target source code project; the generation module is also used to: for each target source code project, obtain the first current version number of the current target source code project, and the first historical version number corresponding to the last compilation of the target source code project; if the first current version number is different from the first historical version number, compile the current target source code project to obtain the compilation result; save the compilation result to the repository indicated by the target resource repository URL; take the next target source code project as the new current target source code project, and repeat the step of obtaining the current version number of the current target source code project until the last target source code project; if the first current version number is the same as the first historical version number, take the next target source code project as the new current target source code project, and repeat the step of obtaining the current version number of the current target source code project until the last target source code project; for each target resource version number, according to the target resource version number, obtain the target resource from the repository indicated by the target resource repository URL; link the obtained target resource to generate the target program corresponding to the program to be created.

[0137] Furthermore, the generation module is also used to: for each target resource, obtain the second current version number of the current target resource and the second historical version number corresponding to the last time the target resource was linked; if the second current version number and the second historical version number are different, update the target resource; use the next target resource as the new current target resource, and repeat the step of obtaining the second current version number of the current target resource until the last target resource; if the second current version number and the second historical version number are the same, use the next target resource as the new current target resource, and repeat the step of obtaining the second current version number of the current target resource until the last target resource; link each target resource to generate a target program corresponding to the program to be created.

[0138] Furthermore, the device is also used to: based on the target program, generate target data corresponding to the target program; wherein the target data includes at least one of the following: a target upgrade package, a target firmware.

[0139] The program generation device provided in the embodiment of the present invention has the same implementation principle and technical effects as those in the aforementioned program generation method embodiment. For the sake of brief description, for matters not mentioned in the program generation device embodiment, reference may be made to the corresponding contents in the aforementioned program generation method embodiment.

[0140] The embodiment of the present invention further provides an electronic device, see Figure 3 As shown, the electronic device includes a processor 130 and a memory 131. The memory 131 stores machine executable instructions that can be executed by the processor 130. The processor 130 executes the machine executable instructions to implement the above-mentioned program generation method.

[0141] Further, Figure 3 The electronic device shown further includes a bus 132 and a communication interface 133 , and the processor 130 , the communication interface 133 and the memory 131 are connected via the bus 132 .

[0142] The memory 131 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 132 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0143] The processor 130 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 130. The above processor 130 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and completes the steps of the method of the above embodiment in combination with its hardware.

[0144] An embodiment of the present invention also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for generating the above-mentioned program. The specific implementation can be found in the method embodiment, which will not be repeated here.

[0145] The program generation method, device and computer program product of the electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0146] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating a program, characterized in that: The method is applied to a CICD server; the method comprises: For each platform, a task creation instruction for the platform is received, and a target task corresponding to the platform is created according to the task creation instruction; wherein the target task includes program information of at least one program to be created; each of the platforms comprises at least one master control, each of the master controls is connected to a respective corresponding device, and different devices correspond to different programs to be created; each of the master controls belonging to the same platform corresponds to the same compiler and the same basic compilation options; For each program information of the program to be created, a program parameter configuration table corresponding to the program information is obtained; wherein the program parameter configuration table includes: resource parameter information required to generate a target program corresponding to the program to be created; According to the program parameter configuration table, a program resource configuration table corresponding to the program information is obtained; wherein the program resource configuration table includes: generating resource file information on which the target program depends; According to the program resource configuration table, a target source code project for generating the target program is obtained from a preset source code project configuration table; wherein the source code project configuration table includes all source code projects corresponding to the platform, and all source code projects are arranged in a preset compilation order; Based on the target source code project, a target program corresponding to the program to be created is generated.

2. The method according to claim 1, characterized in that According to the program parameter configuration table, the step of obtaining the program resource configuration table corresponding to the program information includes: Determine the location information and name information corresponding to the program resource configuration table according to the resource parameter information in the program parameter configuration table; According to the location information and the name information, a program resource configuration table corresponding to the program information is obtained.

3. The method according to claim 1, characterized in that The resource file information includes: first information associated with the target source code project; the first information includes: the target resource module name; the source code project configuration table includes: the source code module name and the source code repository URL; The step of obtaining a target source code project for generating the target program from a preset source code project configuration table according to the program resource configuration table includes: According to the target resource module name in the program resource configuration table, obtaining a target source code repository URL corresponding to a target source code module name matching the target resource module name from a preset source code project configuration table; A target source code project for generating a target program for the program to be created is obtained from the repository indicated by the target source code repository URL.

4. The method according to claim 3, characterized in that The first information also includes: a target resource repository URL and a target resource version number; the number of the target source code project is at least one; based on the target source code project, the step of generating a target program corresponding to the program to be created includes: For each of the target source code projects, obtaining a first current version number of the current target source code project and a first historical version number corresponding to the last compilation of the target source code project; If the first current version number is different from the first historical version number, compile the current target source code project to obtain a compilation result; Saving the compilation result to the repository indicated by the target resource repository URL; Take the next target source code project as the new current target source code project, and repeat the steps of obtaining the current version number of the current target source code project until the last target source code project. If the first current version number is the same as the first historical version number, taking the next target source code project as a new current target source code project, and repeatedly executing the step of obtaining the current version number of the current target source code project until the last target source code project; For each target resource version number, according to the target resource version number, obtain the target resource from the warehouse indicated by the target resource warehouse URL; The acquired target resource is linked to generate a target program corresponding to the program to be created.

5. The method according to claim 4, characterized in that The step of linking the acquired target resource to generate a target program corresponding to the program to be created includes: For each of the target resources, obtain a second current version number of the current target resource and a second historical version number corresponding to the last link to the target resource; If the second current version number is different from the second historical version number, updating the target resource; The next target resource is used as the new current target resource, and the step of obtaining the second current version number of the current target resource is repeated until the last target resource is reached; If the second current version number is the same as the second historical version number, the next target resource is used as the new current target resource, and the step of obtaining the second current version number of the current target resource is repeated until the last target resource; Each of the target resources is linked to generate a target program corresponding to the program to be created.

6. The method according to claim 1, characterized in that The method further comprises: Based on the target program, target data corresponding to the target program is produced; wherein the target data includes at least one of the following: a target upgrade package and a target firmware.

7. A program generation device, characterized in that: The device is arranged on a CICD server; the device comprises: A creation module is used for receiving a task creation instruction for each platform, and creating a target task corresponding to the platform according to the task creation instruction; wherein the target task includes program information of at least one program to be created; each of the platforms comprises at least one master control, each of the master controls is connected to a respective corresponding device, and different devices correspond to different programs to be created; each of the master controls belonging to the same platform corresponds to the same compiler and the same basic compilation options; A first acquisition module is used to acquire, for each program information of the program to be created, a program parameter configuration table corresponding to the program information; wherein the program parameter configuration table includes: resource parameter information required to generate a target program corresponding to the program to be created; A second acquisition module is used to acquire a program resource configuration table corresponding to the program information according to the program parameter configuration table; wherein the program resource configuration table includes: resource file information on which the target program depends; A third acquisition module is used to acquire a target source code project for generating the target program from a preset source code project configuration table according to the program resource configuration table; wherein the source code project configuration table includes all source code projects corresponding to the platform, and all source code projects are arranged in a preset compilation order; A generation module is used to generate a target program corresponding to the program to be created based on the target source code project.

8. The device according to claim 7, characterized in that The second acquisition module is also used for: Determine the location information and name information corresponding to the program resource configuration table according to the resource parameter information in the program parameter configuration table; According to the location information and the name information, a program resource configuration table corresponding to the program information is obtained.

9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for generating a program according to any one of claims 1 to 6.

10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the program generation method described in any one of claims 1-6.