Source code construction method, system and storage medium

By obtaining source code information, determining the data information of pipeline nodes, and generating target code flow, resources, and services, the problem of low build efficiency in cross-architecture pipelines is solved, enabling rapid builds and seamless cross-platform operation.

CN119336303BActive Publication Date: 2026-04-07CHINA MOBILE GRP GUANGDONG CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Cross-architecture pipelines, when handling build tasks for different architectures, experience increased waiting times during the build process due to dependencies between different build tasks, thus reducing code build efficiency.

Method used

By acquiring source code information, we can determine the data information of each node in the pipeline, and based on this data information, determine the target code flow, resources and services, generate the target container image, simplify the process, match resources, and sequence processing services, thereby speeding up the build process.

Benefits of technology

It improves code building efficiency, supports multiple hardware architectures and operating systems, enables source code to run seamlessly on different platforms, and reduces the workload of platform adaptation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336303B_ABST
    Figure CN119336303B_ABST
Patent Text Reader

Abstract

The present disclosure provides a source code construction method, system and storage medium, comprising: obtaining source code information, and determining each node of a pipeline corresponding to the source code based on the source code information; determining data information of each node in the pipeline; determining a target code flow, a target code resource and a target code service corresponding to the source code based on the data information of each node in the pipeline; and generating a target container image of the source code based on the target code flow, the target code resource and the target code service. Thus, the present disclosure decomposes and sequentially processes the construction task, thereby speeding up the source code construction speed through parallel processing and improving the code construction efficiency. Meanwhile, the present disclosure supports multiple hardware architectures and operating systems, so that the source code can run seamlessly on different platforms, reducing the workload of adapting to different platforms.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of pipeline, and in particular, to a source code construction method, system and storage medium. BACKGROUND

[0002] With the development of cloud computing and containerization technology, software can run on any platform supporting the technology. Specifically, by using a pipeline construction process, the construction, testing and packaging of code can be divided into multiple stages, and the above tasks can be executed in parallel on different hardware architectures and operating systems, thereby generating binary code or container images compatible with different architectures, and achieving cross-platform software running.

[0003] However, when cross-architecture pipelines process construction tasks of different architectures, the dependency relationship between different construction tasks can also cause the waiting time in the construction process to increase, thereby reducing the code construction efficiency. SUMMARY

[0004] To overcome the problems in the related art, the present disclosure provides a source code construction method, system and storage medium.

[0005] According to a first aspect of an embodiment of the present disclosure, a source code construction method is provided, the method comprising:

[0006] obtaining source code information, and determining each node of a pipeline corresponding to the source code based on the source code information;

[0007] determining data information of each node in the pipeline;

[0008] determining a target code process, target code resource and target code service corresponding to the source code based on the data information of each node in the pipeline;

[0009] generating a target container image of the source code based on the target code process, target code resource and target code service.

[0010] Optionally, in an embodiment of the present disclosure, the data information includes code process information, code resource information and code service information.

[0011] Optionally, in an embodiment of the present disclosure, the determination of the target code process, target code resource and target code service corresponding to the source code based on the data information of each node in the pipeline comprises:

[0012] simplifying the code process based on the code process information of each node in the pipeline to obtain a target code process;

[0013] match the code resources based on the code resource information of each node in the pipeline to obtain target code resources;

[0014] perform sequence processing on the code services based on the code service information of each node in the pipeline to obtain target code services.

[0015] Optionally, in the embodiments of the present disclosure, the code flow information includes source code information and weights of hidden layer vectors of each node; and the code flow is simplified based on the code flow information of each node in the pipeline to obtain target code flow, including:

[0016] determine the hidden layer vectors corresponding to each node in the pipeline based on the source code information;

[0017] obtain vector values of hidden layer state sequences of each node in the source code through calculation based on the hidden layer vectors and the weights of hidden layer vectors of each node;

[0018] obtain decoded code values of each node through a decoder based on the vector values of the hidden layer state sequences of each node;

[0019] simplify the code flow based on the decoded code values of each node to obtain target code flow.

[0020] Optionally, in the embodiments of the present disclosure, the code resource information includes source code information and standard code vectors; and the code resources are matched based on the code resource information of each node in the pipeline to obtain target code resources, including:

[0021] determine the hidden layer vectors corresponding to each node in the pipeline based on the source code information;

[0022] determine the maximum value in the hidden layer vectors of each node based on the hidden layer vectors;

[0023] obtain semantic vectors of each node after maximum pooling based on the maximum value in the hidden layer vectors of each node through global maximum pooling;

[0024] obtain cosine similarity of each node through calculation based on the standard code vectors and the semantic vectors of each node;

[0025] match the code resources based on the cosine similarity of each node to obtain target code resources.

[0026] Optionally, in this embodiment of the disclosure, the code service information includes the given generated code value for each node, the actual generated code value for each node, the given generated code length for each node, and the actual generated code length for each node; the step of performing sequence processing on the code service based on the code service information of each node in the pipeline to obtain the target code service includes:

[0027] Based on the given generated value of each node code, the actual generated value of each node code, and the given generated code length of each node, the precision of each node code sequence is calculated.

[0028] Based on the given generated value of each node code, the actual generated value of each node code, and the actual generated code length of each node, the recall rate of each node code sequence is calculated.

[0029] Based on the precision and recall of each node code sequence, the quality value of each node sequence is calculated.

[0030] Based on the sequence quality values ​​of each node, the code service is processed to obtain the target code service.

[0031] Optionally, in this embodiment of the disclosure, generating the target container image of the source code based on the target code flow, target code resources, and target code services includes:

[0032] Obtain the configuration file, wherein the configuration file includes instructions and configurations for building the image;

[0033] Based on the target code flow, target code resources, and target code services, a target container image of the source code is generated through the configuration file.

[0034] The target container image is stored locally and then pushed to a remote image repository.

[0035] According to a second aspect of the present disclosure, a source code building system is provided, the system comprising:

[0036] The first determining module is used to obtain source code information and, based on the source code information, determine each node of the pipeline corresponding to the source code;

[0037] The second determining module is used to determine the data information of each node in the pipeline;

[0038] The third determining module is used to determine the target code flow, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline;

[0039] The generation module is used to generate a target container image of the source code based on the target code flow, target code resources, and target code services.

[0040] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0041] processor;

[0042] Memory used to store processor-executable instructions;

[0043] The processor is configured to implement the method described in the first aspect above.

[0044] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, the computer storage medium storing computer-executable instructions; the computer-executable instructions, when executed by a processor, are capable of implementing the method described in the first aspect above.

[0045] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0046] This disclosure proposes a method, system, and storage medium for building source code. The method includes acquiring source code information and, based on this information, determining the corresponding pipeline nodes; determining the data information of each node in the pipeline; determining the target code flow, target code resources, and target code services corresponding to the source code based on the data information of each node in the pipeline; and generating a target container image of the source code based on the target code flow, target code resources, and target code services. Therefore, this disclosure can determine a simplified target code flow, match the built target code resources, and sequence-processed target code services based on the data information of each node in the pipeline, decomposing the build task and performing sequential processing. This allows for faster source code building through parallel processing, improving code building efficiency. Furthermore, this disclosure supports multiple hardware architectures and operating systems, enabling the source code to run seamlessly on different platforms, reducing the workload of platform adaptation.

[0047] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0048] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0049] Figure 1 This is a flowchart illustrating a method for constructing source code according to some embodiments of the present disclosure;

[0050] Figure 2 This is a schematic diagram illustrating the structure of a source code building system according to some embodiments of the present disclosure;

[0051] Figure 3 This is a block diagram illustrating an electronic device suitable for executing a source code construction method, according to some embodiments of the present disclosure. Detailed Implementation

[0052] Some embodiments of this disclosure will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. Various changes, modifications, and equivalents of the methods, systems, and / or systems described herein will become apparent upon understanding this disclosure. For example, the order of operations described herein is merely illustrative and is not limited to those orders set forth herein, but can be changed as will become apparent upon understanding this disclosure, except for operations that must be performed in a particular order. Furthermore, for clarity and brevity, descriptions of features known in the art may be omitted.

[0053] The embodiments described in the following examples of this disclosure are not representative of all embodiments consistent with this disclosure. Rather, they are merely examples of systems and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0054] Figure 1 This is a flowchart illustrating a method for constructing source code according to some embodiments of this disclosure, such as... Figure 1 As shown, the method may include the following steps:

[0055] Step 101: Obtain source code information and, based on the source code information, determine the corresponding pipeline nodes.

[0056] It should be noted that the execution entity of the above-mentioned source code construction method is the source code construction system, which can be implemented by software and / or hardware. In this embodiment, the source code construction system can be configured in an electronic device.

[0057] In this example embodiment, the electronic device may include devices such as terminal devices and servers, and this embodiment does not limit the electronic device.

[0058] In this embodiment of the disclosure, the source code information may include source code information for ARM architecture and x86 architecture.

[0059] In this embodiment of the disclosure, after obtaining the source code information, a database can be constructed based on the source code information, and the source code information can be stored in the database.

[0060] Furthermore, in this embodiment of the disclosure, after obtaining the source code information, the processing of the source code can be decomposed into n nodes based on the source code information, and each node in the n nodes can be determined as the corresponding pipeline node i, where i = 1, 2, 3, ..., i, ..., n, and the output of each node step is used as the input of the next node step.

[0061] Step 102: Determine the data information of each node in the pipeline.

[0062] In this embodiment of the disclosure, the aforementioned data information may include: code flow information, code resource information, and code service information.

[0063] In this embodiment of the disclosure, the code flow information may include source code information and the weights of the hidden layer vectors of each node; the code resource information may include source code information and standard code vectors; and the code service information may include the given generated value of each node's code, the actual generated value of each node's code, the given generated code length of each node, and the actual generated code length of each node.

[0064] Furthermore, in this embodiment of the disclosure, the data information of each node in the above-mentioned pipeline can be determined by expert experience or existing publicly available tools.

[0065] Step 103: Based on the data information of each node in the pipeline, determine the target code flow, target code resources and target code services corresponding to the source code.

[0066] In this embodiment of the disclosure, after obtaining the data information of each node in the pipeline through the above steps, the target code flow, target code resources and target code services corresponding to the source code can be determined based on the data information of each node in the pipeline.

[0067] Specifically, in this embodiment of the disclosure, the method for determining the target code flow, target code resources, and target code services corresponding to the source code based on the data information of each node in the pipeline may include the following steps:

[0068] Step 1031: Simplify the code flow based on the code flow information of each node in the pipeline to obtain the target code flow;

[0069] Step 1032: Match code resources based on code resource information of each node in the pipeline to obtain target code resources;

[0070] Step 1033: Perform sequence processing on the code service based on the code service information of each node in the pipeline to obtain the target code service.

[0071] In this embodiment of the disclosure, the method for simplifying the code flow based on the code flow information of each node in the pipeline to obtain the target code flow may include the following steps:

[0072] Step 10311: Based on the source code information, determine the hidden layer vector corresponding to each node in the pipeline;

[0073] Step 10312: Based on the hidden layer vector and the weights of the hidden layer vectors of each node, calculate the vector values ​​of the hidden layer state sequence of each node in the source code.

[0074] Step 10313: Based on the vector values ​​of the hidden layer state sequence of each node, obtain the decoded code values ​​of each node through the decoder;

[0075] Step 10314: Simplify the code flow based on the decoded code values ​​of each node to obtain the target code flow.

[0076] In this embodiment of the disclosure, the initial vectors x1, x2, ..., xn of each node in the pipeline can be determined based on source code information. i , ..., x n The initial vectors of each node in the pipeline are encoded into corresponding hidden layer vectors h1, h2, ..., hn. i , ..., h n .

[0077] Furthermore, in this embodiment of the disclosure, the method for calculating the vector value of the hidden layer state sequence of each node in the source code based on the hidden layer vector and the weights of the hidden layer vectors of each node may include: calculating the vector value of the hidden layer state sequence of each node in the source code using a first formula based on the hidden layer vector and the weights of the hidden layer vectors of each node, wherein the first formula is:

[0078] z i =ω i ×h i

[0079] Where, ω i Let z be the weight of the hidden layer vector of node i. i is the vector value of the hidden layer state sequence of node i.

[0080] Furthermore, in this embodiment of the present disclosure, the method for obtaining the decoded code value of each node based on the vector value of the hidden layer state sequence of each node through the decoder may include: obtaining the decoded code value of each node using a second formula based on the vector value of the hidden layer state sequence of each node, wherein the second formula is:

[0081] w i =log(yi-1 ×s i ×z i )

[0082] Among them, y i-1 Let s be the input vector of the previous node i-1 of node i. i w represents the hidden state of the decoder for node i. i This is the decoded code value of the i-node.

[0083] Furthermore, in this embodiment of the disclosure, after obtaining the decoded code values ​​of each node through the above steps, the decoded code values ​​of each node can be compared, and nodes with the same code values ​​can be deleted, thereby simplifying the code flow, and the simplified code flow can be determined as the target code flow.

[0084] Furthermore, in this embodiment of the disclosure, the method for matching code resources based on code resource information of each node in the pipeline to obtain the target code resource may include the following steps:

[0085] Step 10321: Based on the source code information, determine the hidden layer vector corresponding to each node in the pipeline;

[0086] Step 10322: Based on the hidden layer vector, determine the maximum value in the hidden layer vector of each node;

[0087] Step 10323: Based on the maximum value in the hidden layer vector of each node, obtain the max-pooled semantic vector of each node through global max pooling;

[0088] Step 10324: Based on the standard code vector and the semantic vector of each node, calculate the cosine similarity of each node;

[0089] Step 10325: Match the code resources based on the cosine similarity of each node to obtain the target code resources.

[0090] In this embodiment of the disclosure, the hidden layer vectors h1, h2, ..., h corresponding to the initial vectors of each node can be... i , ..., h n The maximum value in the hidden layer vectors of each node is determined as the maximum value in the hidden layer vectors of each node. For example, max(h i Let h be the hidden layer vector of node i. i The maximum value in.

[0091] Furthermore, in this embodiment of the disclosure, the method for obtaining the max-pooled semantic vector of each node based on the maximum value in the hidden layer vector of each node through global max pooling may include: obtaining the max-pooled semantic vector of each node through global max pooling using a third formula based on the maximum value in the hidden layer vector of each node, wherein the third formula is:

[0092]

[0093] in, The semantic vector of node i is the max-pooled vector.

[0094] Furthermore, in this embodiment of the disclosure, the method for calculating the cosine similarity of each node based on the standard code vector and the semantic vector of each node may include: calculating the cosine similarity of each node based on the standard code vector and the semantic vector of each node using a fourth formula, wherein the fourth formula is:

[0095]

[0096] in, The cosine similarity between the standard code and node i. This is a standard code vector.

[0097] Furthermore, in this embodiment of the present disclosure, after obtaining the cosine similarity of each node through the above steps, the cosine similarity of each node can be compared with a preset threshold, and the nodes with a cosine similarity greater than or equal to the preset threshold are automatically matched for resources to obtain the target code resources.

[0098] Furthermore, in this embodiment of the disclosure, the method for performing sequence processing on code services based on code service information of each node in the pipeline to obtain the target code service may include the following steps:

[0099] Step 10331: Based on the given generated value of each node code, the actual generated value of each node code, and the given generated code length of each node, the precision of the code sequence of each node is calculated.

[0100] Step 10332: Based on the given generated value of each node code, the actual generated value of each node code, and the actual generated code length of each node, the recall rate of each node code sequence is calculated.

[0101] Step 10333: Based on the precision and recall of each node code sequence, the quality value of each node sequence is calculated.

[0102] Step 10334: Perform sequence processing on the code service based on the sequence quality values ​​of each node to obtain the target code service.

[0103] In this embodiment of the disclosure, the method for calculating the precision of each node code sequence based on the given generated value of each node code, the actual generated value of each node code, and the given generated code length of each node may include: calculating the precision of each node code sequence using a fifth formula based on the given generated value of each node code, the actual generated value of each node code, and the given generated code length of each node, wherein the fifth formula is:

[0104]

[0105] in, X represents the precision of the i-node code sequence. i Given a generated value for the i-node code, Y i The actual value generated for the i-node code. Give the generated code length for the i-node.

[0106] Furthermore, in this embodiment of the disclosure, the method for calculating the recall rate of each node code sequence based on the given generated value of each node code, the actual generated value of each node code, and the actual generated code length of each node may include: calculating the recall rate of each node code sequence using a sixth formula based on the given generated value of each node code, the actual generated value of each node code, and the actual generated code length of each node, wherein the sixth formula is:

[0107]

[0108] in, For the recall rate of the i-node code sequence, The actual generated code length for the i-node.

[0109] Further, in this embodiment of the disclosure, the method for calculating the quality value of each node sequence based on the precision and recall of each node code sequence may include: calculating the quality value of each node sequence using a seventh formula based on the precision and recall of each node code sequence, wherein the seventh formula is:

[0110]

[0111] Among them, M i The quality value of the i-th node sequence.

[0112] Furthermore, in this embodiment of the disclosure, after obtaining the quality values ​​of each node sequence through the above steps, the node sequence quality values ​​can be reconstructed sequentially in descending order to obtain the target code service.

[0113] Step 104: Based on the target code flow, target code resources, and target code services, generate the target container image of the source code.

[0114] In this embodiment of the disclosure, after obtaining the target code flow, target code resources and target code services through the above steps, a target container image of the source code can be generated based on the target code flow, target code resources and target code services.

[0115] Specifically, in this embodiment of the disclosure, the method for generating a target container image of source code based on target code flow, target code resources, and target code services may include the following steps:

[0116] Step 1041: Obtain the configuration file, which includes the instructions and configuration for building the image.

[0117] Step 1042: Based on the target code flow, target code resources, and target code services, generate the target container image of the source code through the configuration file;

[0118] Step 1043: Store the target container image locally and push it to the remote image repository.

[0119] In this embodiment of the disclosure, the configuration file mentioned above can be a Dockerfile-based configuration file, where a Dockerfile is a text file that contains the instructions and configurations required to build the image.

[0120] Furthermore, in this embodiment of the disclosure, after obtaining the configuration file through the above steps, the target container image can be packaged based on the simplified target code flow, the matched and constructed target code resources, and the sequence-processed target code service as the starting point, and the target container image can be stored locally and pushed to a remote image repository.

[0121] Furthermore, in this embodiment of the disclosure, after obtaining the target container image through the above steps, the container can be installed and run on the target architecture. Then, the target container image is pulled from the container image repository, and after running the target container image using container commands, the application can start and run on the target architecture. The target architecture can be either ARM or x86, thus enabling the collaborative operation of ARM and x86 architectures through QEMU virtualization technology.

[0122] This disclosure proposes a method for constructing source code. The method includes acquiring source code information and, based on this information, determining the corresponding pipeline nodes; determining the data information of each node in the pipeline; determining the target code flow, target code resources, and target code services corresponding to the source code based on the data information of each node in the pipeline; and generating a target container image of the source code based on the target code flow, target code resources, and target code services. Therefore, this disclosure can determine a simplified target code flow, match the constructed target code resources, and sequence-processed target code services based on the data information of each node in the pipeline, decomposing the construction task and performing sequential processing. This allows for faster source code construction through parallel processing, improving code construction efficiency. Furthermore, this disclosure supports multiple hardware architectures and operating systems, enabling the source code to run seamlessly on different platforms, reducing the workload of platform adaptation.

[0123] Figure 2 This is a source code building system illustrated according to some embodiments of the present disclosure, such as Figure 2 As shown, the system may include:

[0124] The first determining module 201 is used to obtain source code information and, based on the source code information, determine each node of the pipeline corresponding to the source code.

[0125] The second determining module 202 is used to determine the data information of each node in the pipeline;

[0126] The third determination module 203 is used to determine the target code flow, target code resources and target code services corresponding to the source code based on the data information of each node in the pipeline.

[0127] Module 204 is used to generate a target container image of the source code based on the target code flow, target code resources, and target code services.

[0128] In this embodiment of the disclosure, the first determining module 201 includes a code database construction module and a pipeline instruction input module. The code database construction module is used to acquire source code information, construct a database based on the source code information, and store the source code information in the database. The pipeline instruction input module is used to determine each node of the pipeline corresponding to the source code based on the source code information.

[0129] Optionally, in this embodiment of the disclosure, the above-mentioned data information includes: code flow information, code resource information, and code service information.

[0130] Optionally, in this embodiment of the present disclosure, the third determining module 203 includes a code flow orchestration module, a code resource orchestration module, and a code service orchestration module. The code flow orchestration module simplifies the code flow based on the code flow information of each node in the pipeline to obtain a target code flow; the code resource orchestration module matches code resources based on the code resource information of each node in the pipeline to obtain target code resources; and the code service orchestration module performs sequence processing on code services based on the code service information of each node in the pipeline to obtain target code services.

[0131] Optionally, in this embodiment of the disclosure, the above-mentioned code flow information includes source code information and the weights of the hidden layer vectors of each node; the above-mentioned code flow orchestration module is specifically used for:

[0132] Based on the source code information, determine the hidden layer vector corresponding to each node in the pipeline;

[0133] Based on the hidden layer vector and the weights of the hidden layer vectors of each node, the vector values ​​of the hidden layer state sequence of each node in the source code are calculated.

[0134] Based on the vector values ​​of the hidden layer state sequences of each node, the decoded code values ​​of each node are obtained through the decoder;

[0135] The code flow is simplified based on the decoded code values ​​of each node to obtain the target code flow.

[0136] Optionally, in this embodiment of the disclosure, the above-mentioned code resource information includes source code information and standard code vectors; the above-mentioned code resource orchestration module is specifically used for:

[0137] Based on the source code information, determine the hidden layer vector corresponding to each node in the pipeline;

[0138] Based on the hidden layer vector, determine the maximum value in the hidden layer vector of each node;

[0139] Based on the maximum value in the hidden layer vector of each node, the semantic vector of each node is obtained by global max pooling;

[0140] Based on the standard code vector and the semantic vector of each node, the cosine similarity of each node is calculated.

[0141] The code resources are matched based on the cosine similarity of each node to obtain the target code resources.

[0142] Optionally, in this embodiment of the disclosure, the above-mentioned code service information includes the given generated code value for each node, the actual generated code value for each node, the given generated code length for each node, and the actual generated code length for each node; the above-mentioned code service orchestration module is specifically used for:

[0143] Based on the given generated value of each node code, the actual generated value of each node code, and the given generated code length of each node, the precision of the code sequence of each node is calculated.

[0144] Based on the given generated value of each node code, the actual generated value of each node code, and the actual generated code length of each node, the recall rate of each node code sequence is calculated.

[0145] Based on the precision and recall of each node's code sequence, the quality value of each node's sequence is calculated.

[0146] The code service is processed based on the sequence quality values ​​of each node to obtain the target code service.

[0147] Optionally, in this embodiment of the disclosure, the above-mentioned generation module includes a container image packaging module and a cross-architecture runtime module. Specifically, the container image packaging module is used for:

[0148] Obtain the configuration file, which includes the instructions and configuration for building the image;

[0149] Based on the target code flow, target code resources, and target code services, a target container image of the source code is generated through a configuration file.

[0150] Store the target container image locally and push it to a remote image repository.

[0151] Furthermore, the aforementioned cross-architecture runtime module is used to install and run containers on the target architecture, pull the target container image from the container image repository, and run the target container image using container commands, so that the application starts and runs on the target architecture.

[0152] In one or more embodiments of this disclosure, source code information is obtained, and based on the source code information, the corresponding pipeline nodes are determined; the data information of each node in the pipeline is determined; based on the data information of each node in the pipeline, the target code flow, target code resources, and target code services corresponding to the source code are determined; and based on the target code flow, target code resources, and target code services, a target container image of the source code is generated. Therefore, this disclosure can determine a simplified target code flow, match the constructed target code resources, and sequence-processed target code services based on the data information of each node in the pipeline, decompose the build task, and perform sequence processing, thereby accelerating the source code build speed through parallel processing and improving code build efficiency. Simultaneously, this disclosure can support multiple hardware architectures and operating systems, enabling the source code to run seamlessly on different platforms, reducing the workload of adapting to different platforms.

[0153] like Figure 3As shown, the electronic device 300 includes a computing unit 301, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 302 or a computer program loaded from a storage unit 308 into a random access memory (RAM) 303. The RAM 303 may also store various programs and data required for the operation of the electronic device 300. The computing unit 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0154] Multiple components in electronic device 300 are connected to I / O interface 305, including: input unit 308, such as keyboard, mouse, etc.; output unit 307, such as various types of monitors, speakers, etc.; storage unit 308, such as disk, optical disk, etc.; and communication unit 309, such as network card, modem, wireless transceiver, etc. Communication unit 309 allows electronic device 300 to exchange information / data with other electronic devices through computer networks such as the Internet and / or various telecommunications networks.

[0155] The computing unit 301 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 301 performs the various methods and processes described above, such as source code construction methods. For example, in some embodiments, the source code construction method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 308. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 300 via ROM 302 and / or communication unit 309. When the computer program is loaded into RAM 303 and executed by the computing unit 301, one or more steps of the source code construction method described above may be performed. Alternatively, in other embodiments, the computing unit 301 may be configured to perform source code construction methods by any other suitable means (e.g., by means of firmware).

[0156] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic electronic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input system, and at least one output system, and transferring data and instructions to the storage system, the at least one input system, and the at least one output system.

[0157] Program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing system, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0158] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, system, or electronic device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems, or electronic devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage electronics, magnetic storage electronics, or any suitable combination of the foregoing.

[0159] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display system (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing system (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of systems can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0160] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.

[0161] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.

[0162] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0163] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for constructing source code, characterized in that, The method includes: Obtain source code information, and based on the source code information, determine the pipeline nodes corresponding to the source code; The data information of each node in the pipeline is determined. The data information includes: code flow information, code resource information, and code service information. The code flow information includes source code information and the weights of the hidden layer vectors of each node. The code resource information includes source code information and standard code vectors. The code service information includes the given generated code value of each node, the actual generated code value of each node, the given generated code length of each node, and the actual generated code length of each node. Based on the data information of each node in the pipeline, the target code flow, target code resources, and target code services corresponding to the source code are determined, including: simplifying the code flow based on the code flow information of each node in the pipeline to obtain the target code flow; matching the code resources based on the code resource information of each node in the pipeline to obtain the target code resources; and performing sequence processing on the code services based on the code service information of each node in the pipeline to obtain the target code services. Based on the target code flow, target code resources, and target code services, a target container image of the source code is generated.

2. The method as described in claim 1, characterized in that, The step of simplifying the code flow based on the code flow information of each node in the pipeline to obtain the target code flow includes: Based on the source code information, determine the hidden layer vector corresponding to each node in the pipeline; Based on the hidden layer vector and the weights of the hidden layer vectors of each node, the vector values ​​of the hidden layer state sequences of each node in the source code are calculated. Based on the vector values ​​of the hidden layer state sequences of each node, the decoded code values ​​of each node are obtained through the decoder; The code flow is simplified based on the decoded code values ​​of each node to obtain the target code flow.

3. The method as described in claim 1, characterized in that, The process of matching code resources based on the code resource information of each node in the pipeline to obtain target code resources includes: Based on the source code information, determine the hidden layer vector corresponding to each node in the pipeline; Based on the hidden layer vector, determine the maximum value in the hidden layer vector of each node; Based on the maximum value in the hidden layer vector of each node, the semantic vector of each node is obtained by global max pooling; Based on the standard code vector and the semantic vector of each node, the cosine similarity of each node is calculated. The code resources are matched based on the cosine similarity of each node to obtain the target code resources.

4. The method as described in claim 1, characterized in that, The step of performing sequence processing on the code services based on the code service information of each node in the pipeline to obtain the target code service includes: Based on the given generated value of each node code, the actual generated value of each node code, and the given generated code length of each node, the precision of each node code sequence is calculated. Based on the given generated value of each node code, the actual generated value of each node code, and the actual generated code length of each node, the recall rate of each node code sequence is calculated. Based on the precision and recall of each node code sequence, the quality value of each node sequence is calculated. Based on the sequence quality values ​​of each node, the code service is processed to obtain the target code service.

5. The method as described in claim 1, characterized in that, The step of generating the target container image of the source code based on the target code flow, target code resources, and target code services includes: Obtain the configuration file, wherein the configuration file includes instructions and configurations for building the image; Based on the target code flow, target code resources, and target code services, a target container image of the source code is generated through the configuration file. The target container image is stored locally and then pushed to a remote image repository.

6. A source code building system, characterized in that, The system includes: The first determining module is used to obtain source code information and, based on the source code information, determine each node of the pipeline corresponding to the source code; The second determining module is used to determine the data information of each node in the pipeline. The data information includes: code flow information, code resource information, and code service information. The code flow information includes source code information and the weights of the hidden layer vectors of each node. The code resource information includes source code information and standard code vectors. The code service information includes the given generated code value of each node, the actual generated code value of each node, the given generated code length of each node, and the actual generated code length of each node. The third determining module is used to determine the target code flow, target code resources, and target code services corresponding to the source code based on the data information of each node in the pipeline. This includes: simplifying the code flow based on the code flow information of each node in the pipeline to obtain the target code flow; matching the code resources based on the code resource information of each node in the pipeline to obtain the target code resources; and performing sequence processing on the code services based on the code service information of each node in the pipeline to obtain the target code services. The generation module is used to generate a target container image of the source code based on the target code flow, target code resources, and target code services.

7. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor, wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.

8. A non-transitory computer-readable storage medium storing computer-executable instructions; wherein the computer-executable instructions, when executed by a processor, are capable of implementing the method of any one of claims 1-5.

Citation Information

Patent Citations

  • Source code cross-architecture synchronous construction method and device, equipment and storage medium

    CN113849159A