Code compiling method and device, storage medium and electronic device
By sending code compilation tasks to remote nodes for execution, the problem of low local compilation efficiency is solved, and a more efficient compilation and release process is achieved, which is suitable for smart home and smart home application scenarios.
Patent Information
- Application Number
- CN202410682599.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-08-27
AI Technical Summary
When compiling code locally, the compilation efficiency is low and is limited by computing resources and hardware performance, resulting in long compilation time and inflexibility.
Send the code compilation task to a remote node with compilation capabilities, execute the compilation task, and obtain the compilation results, including obtaining the code from the target address, parsing dependencies, installing dependencies and running the compilation script, and processing the results of compilation success or failure, such as Binary file signatures and error messages.
Through distributed computing, local resource limitations are avoided, compilation efficiency is improved, faster code compilation and release processes are achieved, and the complexity of development and delivery is reduced.
Smart Images

Figure CN118550544A
Abstract
Description
Technical Field
[0001] The present application relates to the field of smart home technology, and more specifically, to a code compilation method and device, a storage medium, and an electronic device. Background Art
[0002] The development of iOS applications usually requires the use of Xcode tools to compile on the macOS operating system. Traditionally, this compilation process is usually performed on the local developer's computer, but this may cause some difficulties in code management and reduce the developer's development and delivery efficiency. First, the performance of the local computer may be limited, especially for larger projects, which may cause the compilation time to be too long. Second, local compilation may be limited by hardware resources and may require a large amount of computing resources, which may not be flexible enough for some developers.
[0003] In the related technology, there is no effective solution to the problem that the compilation efficiency is low when the code is compiled locally.
[0004] Therefore, it is necessary to improve the related technology to overcome the above-mentioned defects in the related technology. Summary of the invention
[0005] The embodiments of the present application provide a code compilation method and device, a storage medium, and an electronic device to at least solve the problem of low compilation efficiency caused by local code compilation.
[0006] According to one aspect of an embodiment of the present application, a code compilation method is provided, comprising: when a specified event is detected, sending a compilation task to a target node and instructing the target node to execute the compilation task, wherein the target node has compilation capability, a target address is recorded in the compilation task, and a code to be compiled is stored in the target address; and obtaining a compilation result sent by the target node when executing the compilation task.
[0007] In an exemplary embodiment, instructing the target node to perform the compilation task includes: instructing the target node to obtain the code to be compiled from the target address; instructing the target node to parse the code to be compiled and determine the dependencies corresponding to the code to be compiled; instructing the target node to install the dependencies and run a pre-installed compilation script to compile the code to be compiled.
[0008] In an exemplary embodiment, instructing the target node to obtain the code to be compiled from the target address includes: when a target branch is also recorded in the compilation task, instructing the target node to obtain the code to be compiled from the target branch of the code repository corresponding to the target address.
[0009] In an exemplary embodiment, after obtaining the compilation result sent by the target node when executing the compilation task, the method further includes: when the compilation result is used to indicate successful compilation and carries a binary file, sending the binary file to a signature server; obtaining a package file sent by the signature server after digitally signing the binary file; and publishing the package file to a publishing platform.
[0010] In an exemplary embodiment, after obtaining the compilation result sent by the target node when executing the compilation task, the method further includes: when the compilation result is used to indicate a compilation failure, determining the cause of the compilation failure from the compilation result; when the cause of the compilation failure is an error in the code to be compiled, displaying an error prompt message at a target position of a target page, wherein the target page is used to display the code to be compiled, and the target position is the location where the code error occurs.
[0011] In an exemplary embodiment, after obtaining the compilation result sent by the target node when executing the compilation task, the method further includes: when the compilation result is used to indicate a compilation failure, determining the cause of the compilation failure from the compilation result; when the cause of the compilation failure is an error in the code to be compiled, and the cause of the compilation failure also includes a code modification plan, displaying the modification plan at a designated location.
[0012] In an exemplary embodiment, after obtaining the compilation result sent by the target node when executing the compilation task, the method further includes: when the compilation result is used to indicate a compilation failure, determining the cause of the compilation failure from the compilation result; when the cause of the compilation failure is an error in the compilation script in the target node, sending an updated compilation script to the target node to instruct the target node to install the updated compilation script and execute the compilation task again.
[0013] According to another aspect of an embodiment of the present application, a code compilation device is also provided, including: a sending module, used to send a compilation task to a target node and instruct the target node to execute the compilation task when a specified event is detected, wherein the target node has compilation capability, and a target address is recorded in the compilation task, and a code to be compiled is stored in the target address; an acquisition module, used to obtain the compilation result sent by the target node when executing the compilation task.
[0014] In an exemplary embodiment, the sending module is also used to instruct the target node to obtain the code to be compiled from the target address; instruct the target node to parse the code to be compiled and determine the dependencies corresponding to the code to be compiled; instruct the target node to install the dependencies and run a pre-installed compilation script to compile the code to be compiled.
[0015] In an exemplary embodiment, the sending module is further used to instruct the target node to obtain the code to be compiled from the target branch of the code repository corresponding to the target address when a target branch is also recorded in the compilation task.
[0016] In an exemplary embodiment, the device also includes: a processing module, which is used to send the binary file to the signature server after obtaining the compilation result sent by the target node when executing the compilation task, if the compilation result is used to indicate that the compilation is successful and carries the binary file; obtain the package file sent by the signature server after digitally signing the binary file; and publish the package file to the publishing platform.
[0017] In an exemplary embodiment, the processing module is further used to obtain the compilation result sent by the target node when executing the compilation task, and when the compilation result is used to indicate a compilation failure, determine the cause of the compilation failure from the compilation result; when the cause of the compilation failure is an error in the code to be compiled, display an error prompt message at a target position of a target page, wherein the target page is used to display the code to be compiled, and the target position is the location where the code error occurs.
[0018] In an exemplary embodiment, the processing module is further used to obtain the compilation result sent by the target node when executing the compilation task, and when the compilation result is used to indicate a compilation failure, determine the cause of the compilation failure from the compilation result; when the cause of the compilation failure is an error in the code to be compiled, and the cause of the compilation failure also includes a code modification plan, display the modification plan at a designated location.
[0019] In an exemplary embodiment, the processing module is further used to obtain the compilation result sent by the target node when executing the compilation task, and when the compilation result is used to indicate a compilation failure, determine the cause of the compilation failure from the compilation result; when the cause of the compilation failure is an error in the compilation script in the target node, send an updated compilation script to the target node to instruct the target node to install the updated compilation script and execute the compilation task again.
[0020] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned code compilation method when running.
[0021] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the code compilation method through the computer program.
[0022] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, and the computer program is executed by a processor to perform the above-mentioned target detection method.
[0023] Through this application, the code compilation task is placed on a remote node for execution, thereby avoiding the problem of limited local computing resources and the inability to compile the code quickly, making it possible to give full play to the advantages of distributed computing and allow the compilation task to be executed more efficiently on the remote node, solving the problem of low compilation efficiency caused by compiling the code locally. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0025] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0026] Figure 1 is a schematic diagram of a hardware environment of a code compilation method according to an embodiment of the present application;
[0027] Figure 2 is a flowchart of a code compilation method according to an embodiment of the present application;
[0028] Figure 3 is a timing diagram of pipeline management according to an embodiment of the present application;
[0029] Figure 4 is a timing diagram of a pipeline execution process according to an embodiment of the present application;
[0030] Figure 5 is a structural block diagram of a code compiling device according to an embodiment of the present application;
[0031] Figure 6 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] According to one aspect of an embodiment of the present application, a code compilation method is provided. The code compilation method is widely used in smart home (Smart Home), smart home, smart home device ecology, smart residential (IntelligenceHouse) ecology and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the above code compilation method can be applied to Figure 1 In the hardware environment composed of the terminal device 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal device 102 via a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data computing services for the server 104.
[0035] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may be but is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing device, a smart dishwasher, a smart projection device, a smart TV, a smart clothes drying rack, a smart curtain, a smart audio and video, a smart socket, a smart speaker, a smart speaker, a smart fresh air device, a smart kitchen and bathroom device, a smart bathroom device, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification device, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.
[0036] In order to solve the above problems, a code compilation method is provided in this embodiment, including but not limited to being applied to a local node (i.e., a node for code writing), Figure 2 : is a flowchart of a code compilation method according to an embodiment of the present application, the process includes the following steps:
[0037] Step S202: When a specified event is detected, a compile task is sent to a target node, and the target node is instructed to execute the compile task, wherein the target node has a compile capability, the compile task records a target address, and the target address stores a code to be compiled;
[0038] Optionally, the designated event may be a code submission event, and the code to be compiled is iOS application code.
[0039] Optionally, you need to install an Agent on the target node as an execution engine to receive and execute compilation tasks. In addition, you need to ensure that the target node has an appropriate version of Xcode installed, relevant command line tools installed, and scripts for executing compilation tasks pre-installed.
[0040] Step S204: Obtain the compilation result sent by the target node when executing the compilation task.
[0041] Optionally, a secure transmission channel may be pre-determined with the target node, and then the compilation task is sent and the compilation result is received through the transmission channel.
[0042] The above steps place the code compilation task on the remote node for execution, thereby avoiding the problem of limited local computing resources and the inability to quickly compile the code. This allows the advantages of distributed computing to be fully utilized, allowing the compilation task to be executed more efficiently on the remote node, solving the problem of low compilation efficiency caused by local code compilation.
[0043] In an exemplary embodiment, instructing the target node to execute the compilation task includes the following steps S11-S13:
[0044] Step S11: instructing the target node to obtain the code to be compiled from the target address;
[0045] It should be noted that the target address is the address of the code repository, that is, the target node can obtain all the codes in the code repository for compilation.
[0046] In an exemplary embodiment, the above step S11 includes: when a target branch is also recorded in the compilation task, instructing the target node to obtain the code to be compiled from the target branch of the code repository corresponding to the target address.
[0047] It should be noted that different branches in the code repository correspond to different requirements, that is, only the code in the target branch corresponding to the target requirement can be compiled.
[0048] Step S12: instructing the target node to parse the code to be compiled, and determining dependencies corresponding to the code to be compiled;
[0049] It should be noted that code dependencies refer to other code modules or programs that a code module or program depends on during the programming process. These dependencies can include external libraries, frameworks, plug-ins, or other code files that provide necessary functions or resources to enable the code to run normally or achieve specific functions.
[0050] Step S13: instruct the target node to install the dependencies and run a pre-installed compilation script to compile the code to be compiled.
[0051] It should be noted that, through the above steps, the target node can quickly execute the compilation task, and then quickly compile the code to be compiled.
[0052] In an exemplary embodiment, after the above step S204, the method further includes the following steps S21-S23:
[0053] Step S21: When the compilation result indicates that the compilation is successful and carries a binary file, the binary file is sent to the signature server;
[0054] Optionally, the binary file can be a ".app" file.
[0055] Step S22: Obtaining the package file sent by the signature server after digitally signing the binary file;
[0056] Step S23: publishing the package file to a publishing platform.
[0057] Optionally, the signature server will use the developer's digital certificate to sign the binary file, and then distribute the signed package file to the user. When the user installs the application corresponding to the package file, the system will verify the signature of the application. If the signature is valid, the application can be installed, otherwise it will be blocked. This prevents unauthorized applications from being installed on the device, thereby protecting the user's security and privacy.
[0058] In an exemplary embodiment, after the above step S204, the method further includes steps S31-S32:
[0059] Step S31: when the compilation result indicates a compilation failure, determining a compilation failure cause from the compilation result;
[0060] Step S32: when the reason for the compilation failure is an error in the code to be compiled, displaying error prompt information at a target position of a target page, wherein the target page is used to display the code to be compiled, and the target position is a position where the code error occurs.
[0061] It should be noted that the above method allows developers to quickly know where the code errors occur and then quickly modify them.
[0062] In an exemplary embodiment, after step S31, the method further includes: when the cause of the compilation failure is an error in the code to be compiled, and the cause of the compilation failure also includes a code modification plan, displaying the modification plan at a designated location.
[0063] It should be noted that the designated location may be a display area pre-designated by the administrator in the target page.
[0064] It should be noted that, through the above method, the user can determine the modification plan as quickly as possible to quickly modify the code.
[0065] In an exemplary embodiment, after step S31, the method further includes: when the cause of the compilation failure is an error in the compilation script in the target node, sending an updated compilation script to the target node to instruct the target node to install the updated compilation script and execute the compilation task again.
[0066] It should be noted that, through the above method, the code to be compiled can be compiled quickly, saving compilation time and improving compilation efficiency.
[0067] Obviously, the embodiments described above are only some embodiments of the present application, not all embodiments. In order to better understand the above method, the above process is described below in conjunction with the embodiments, but it is not intended to limit the technical solutions of the embodiments of the present application. Optionally:
[0068] This application provides a technical solution for the mobile iOS build and release process, which uses the Tekton framework to perform iOS project compilation tasks on a remote macOS node. Through this solution, developers can develop, compile and release iOS applications more flexibly and efficiently.
[0069] 1) Pipeline management, including pipeline creation and pipeline query, Figure 3 The timing diagram of pipeline management is illustrated, wherein the main purpose of pipeline creation is to create the above-mentioned compilation task, and the main purpose of pipeline query is to query the created compilation task and the compilation result corresponding to the compilation task.
[0070] A) Pipeline creation: Users enter the necessary parameters required for customizing the pipeline through page configuration, such as the code repository address, pipeline branch to be executed, code build environment, code build command, notification object, etc. The code repository address and branch provide the basis for checking out the source code; the build command supports custom build code; the notification object allows designated members to receive notifications of the pipeline execution results for timely processing. All of the above parameters except the code repository address and branch are provided by the management end of this technical solution in the form of templates. Users can complete the input of the pipeline configuration content requirements by simply clicking and modifying.
[0071] a) Verification: The management end verifies whether the code repository address is valid and whether the branch exists by requesting the Git lab interface. If the verification is successful, the submission process of the illegal form will be terminated as early as possible. Optionally, the management end is the above-mentioned local node or a module for generating the compilation task corresponding to the code written in the local node.
[0072] b) Activate the code repository: The management end activates the triggerability of the code repository pipeline by requesting the Tekton interface, and configures the required Secrets into Tekton, such as the image repository username and password. The activation process of the code repository actually uses the tasks provided by Tekton, configures the webhook of the Git lab repo, and sets the destruction address to the specified Tekton webhook address.
[0073] c) Storage: After verification and activation are successfully completed, the management service stores the pipeline configuration content in MySQL for query, update, etc.
[0074] B) Pipeline query: Users can view the created and stored pipeline information and perform simple searches based on the pipeline name or code repository. The management end of this technology can assemble and output static data and build data.
[0075] a) Basic static data: query MySQL to obtain complete pipeline configuration information based on input parameters.
[0076] b) Build data: query build records, build logs, build results and other information through the Tekton interface.
[0077] c) Git lab version information: query the code repository branch and version information through the Git lab interface.
[0078] e) Data assembly on the management side: Based on the basic configuration data, static data and execution generation data are assembled through pipeline name, code repository address, branch, etc., and finally a matching list of build versions and build results is formed to view the build version and build results in the branch dimension, so as to facilitate the classification and quick viewing of the execution data of pipelines applied to different branches, without the need to obtain key data by searching the build log, where the key data includes but is not limited to the execution results of the pipeline (i.e. the above-mentioned compilation results).
[0079] 2) Remote node deployment:
[0080] a) Install Agent on the remote node as the execution engine, which is responsible for receiving and executing the pipeline workflow.
[0081] b) Ensure that the appropriate version of Xcode is installed on the remote node, and that the relevant command line tools are installed.
[0082] c) Preset build command execution script on remote node.
[0083] 3) Pipeline execution: Tekton triggers the scheduling of Tekton workflows through Webhook when a specified event occurs. The management end is responsible for generating and scheduling Tekton workflows to remote macOS nodes to execute compilation tasks. The following is a detailed scheduling process:
[0084] a) Workflow transfer to remote nodes: The management end transfers the generated Tekton workflow to the remote macOS node to ensure that the workflow can be correctly interpreted and executed.
[0085] b) The remote node executes the compilation task: After receiving the Tekton workflow, the remote node executes the iOS project compilation task according to the tasks defined in the workflow, which includes obtaining the source code, installing dependencies, and the compilation process.
[0086] c) Execution results are returned to the management end: After the compilation task is completed, the remote node returns the compilation results to the management end through a secure channel, including whether the compilation is successful or not, the generated binary files, etc.
[0087] 4) Upload and publish: After the management end receives the pipeline execution results, the product package calls the certificate signature, generates a release package for enterprise release, and uploads it to the publishing platform.
[0088] For better understanding, Figure 4 The timing diagram of the pipeline execution process is shown.
[0089] It should be noted that this application uses a remote node MacOS to build and publish, which does not rely on the local environment, simplifying the local environment configuration and maintenance. Remote macOS nodes allow for more flexible management and execution of compilation tasks in a distributed environment. Developers can dynamically assign compilation tasks to different nodes according to project requirements to ensure maximum resource utilization, which is an important advantage, especially for large projects or tasks that require a lot of computing resources. At the same time, the pipeline for executing compilation tasks is configured as a visual interface, and users can execute compilation and upload tasks by configuring some parameters, reducing learning costs.
[0090] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0091] In this embodiment, a code compilation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0092] Figure 5 : is a structural block diagram of a code compiling device according to an embodiment of the present application, the device comprising:
[0093] The sending module 52 is used to send a compile task to a target node and instruct the target node to execute the compile task when a specified event is detected, wherein the target node has a compile capability, the compile task records a target address, and the target address stores a code to be compiled;
[0094] The acquisition module 54 is used to acquire the compilation result sent by the target node when executing the compilation task.
[0095] The above-mentioned device places the code compilation task on the remote node for execution, thereby avoiding the problem of limited local computing resources and the inability to compile the code quickly, making full use of the advantages of distributed computing, allowing the compilation task to be executed more efficiently on the remote node, and solving the problem of low compilation efficiency caused by local code compilation.
[0096] In an exemplary embodiment, the sending module 52 is also used to instruct the target node to obtain the code to be compiled from the target address; instruct the target node to parse the code to be compiled and determine the dependencies corresponding to the code to be compiled; instruct the target node to install the dependencies and run a pre-installed compilation script to compile the code to be compiled.
[0097] In an exemplary embodiment, the sending module 52 is further configured to, when a target branch is recorded in the compilation task, instruct the target node to obtain the code to be compiled from the target branch of the code repository corresponding to the target address.
[0098] In an exemplary embodiment, the device also includes: a processing module, which is used to send the binary file to the signature server after obtaining the compilation result sent by the target node when executing the compilation task, if the compilation result is used to indicate that the compilation is successful and carries the binary file; obtain the package file sent by the signature server after digitally signing the binary file; and publish the package file to the publishing platform.
[0099] In an exemplary embodiment, the processing module is further used to obtain the compilation result sent by the target node when executing the compilation task, and when the compilation result is used to indicate a compilation failure, determine the cause of the compilation failure from the compilation result; when the cause of the compilation failure is an error in the code to be compiled, display an error prompt message at a target position of a target page, wherein the target page is used to display the code to be compiled, and the target position is the location where the code error occurs.
[0100] In an exemplary embodiment, the processing module is further used to obtain the compilation result sent by the target node when executing the compilation task, and when the compilation result is used to indicate a compilation failure, determine the cause of the compilation failure from the compilation result; when the cause of the compilation failure is an error in the code to be compiled, and the cause of the compilation failure also includes a code modification plan, display the modification plan at a designated location.
[0101] In an exemplary embodiment, the processing module is further used to obtain the compilation result sent by the target node when executing the compilation task, and when the compilation result is used to indicate a compilation failure, determine the cause of the compilation failure from the compilation result; when the cause of the compilation failure is an error in the compilation script in the target node, send an updated compilation script to the target node to instruct the target node to install the updated compilation script and execute the compilation task again.
[0102] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0103] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0104] S1, when a specified event is detected, sending a compilation task to a target node and instructing the target node to execute the compilation task, wherein the target node has a compilation capability, the compilation task records a target address, and the target address stores a code to be compiled;
[0105] S2, obtaining a compilation result sent by the target node when executing the compilation task.
[0106] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0107] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0108] The embodiment of the present application also provides an electronic device, such as Figure 6 As shown, the electronic device includes a memory 602 and a processor 604. The memory 602 stores a computer program, and the processor 604 is configured to execute the steps in any of the above method embodiments through the computer program.
[0109] Optionally, in this embodiment, the processor 604 may be configured to perform the following steps through a computer program:
[0110] S1, when a specified event is detected, sending a compilation task to a target node and instructing the target node to execute the compilation task, wherein the target node has a compilation capability, the compilation task records a target address, and the target address stores a code to be compiled;
[0111] S2, obtaining a compilation result sent by the target node when executing the compilation task.
[0112] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0113] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0114] Alternatively, a person skilled in the art may understand that: Figure 6 The structure shown is for illustration only. Figure 6The structure of the electronic device is not limited. For example, the electronic device may also include Figure 6 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 6 Different configurations are shown.
[0115] Among them, the memory 602 can be used to store software programs and modules, such as the program instructions / modules corresponding to the code compilation method and device in the embodiment of the present application. The processor 604 executes various functional applications and data processing by running the software programs and modules stored in the memory 602, that is, realizing the above-mentioned code compilation method. The memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 602 may further include a memory remotely located relative to the processor 604, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 602 can be specifically, but not limited to, used to store information such as system configuration files. As an example, such as Figure 6 As shown, the memory 602 may include but is not limited to the sending module 52 and the acquiring module 54 in the code compiling device. In addition, it may also include but is not limited to other module units (such as a processing module) in the code compiling device, which will not be described in detail in this example.
[0116] Optionally, the transmission device 606 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 606 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 606 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0117] In addition, the electronic device further includes: a display 608; and a connection bus 610, which is used to connect various module components in the electronic device.
[0118] In other embodiments, the electronic device may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0119] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0120] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0121] The embodiments of the present application also provide a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.
[0122] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0123] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0124] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A code compilation method, characterized in that: include: When a specified event is detected, a compile task is sent to a target node, and the target node is instructed to execute the compile task, wherein the target node has a compile capability, the compile task records a target address, and the target address stores a code to be compiled; Obtain a compilation result sent by the target node when executing the compilation task.
2. The method according to claim 1, characterized in that Instructing the target node to execute the compilation task includes: Instructing the target node to obtain the code to be compiled from the target address; Instructing the target node to parse the code to be compiled and determine dependencies corresponding to the code to be compiled; The target node is instructed to install the dependency and run a pre-installed compilation script to compile the code to be compiled.
3. The method according to claim 2, characterized in that Instructing the target node to obtain the code to be compiled from the target address, comprising: In the case where a target branch is also recorded in the compilation task, the target node is instructed to obtain the code to be compiled from the target branch of the code repository corresponding to the target address.
4. The method according to claim 1, characterized in that: After obtaining the compilation result sent by the target node when executing the compilation task, the method further includes: When the compilation result indicates that the compilation is successful and carries a binary file, sending the binary file to the signature server; Obtaining a package file sent by the signature server after digitally signing the binary file; The package file is published to a publishing platform.
5. The method according to claim 1, characterized in that After obtaining the compilation result sent by the target node when executing the compilation task, the method further includes: In a case where the compilation result indicates a compilation failure, determining a compilation failure cause from the compilation result; When the reason for the compilation failure is that the code to be compiled has an error, error prompt information is displayed at a target position of a target page, wherein the target page is used to display the code to be compiled, and the target position is a position where the code error occurs.
6. The method according to claim 1, characterized in that After obtaining the compilation result sent by the target node when executing the compilation task, the method further includes: In a case where the compilation result indicates a compilation failure, determining a compilation failure cause from the compilation result; When the compilation failure reason is that the code to be compiled is wrong, and the compilation failure reason also includes a code modification plan, the modification plan is displayed at a designated position.
7. The method according to claim 1, characterized in that After obtaining the compilation result sent by the target node when executing the compilation task, the method further includes: In a case where the compilation result indicates a compilation failure, determining a compilation failure cause from the compilation result; In the case that the cause of the compilation failure is an error in the compilation script in the target node, an updated compilation script is sent to the target node to instruct the target node to install the updated compilation script and execute the compilation task again.
8. A code compiling device, characterized in that: include: A sending module, configured to send a compile task to a target node and instruct the target node to execute the compile task when a specified event is detected, wherein the target node has a compile capability, the compile task records a target address, and the target address stores a code to be compiled; The acquisition module is used to acquire the compilation result sent by the target node when executing the compilation task.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
