CN110795103A - Code compiling method and compiler - Google Patents

Code compiling method and compiler Download PDF

Info

Publication number
CN110795103A
CN110795103A CN201910927458.4A CN201910927458A CN110795103A CN 110795103 A CN110795103 A CN 110795103A CN 201910927458 A CN201910927458 A CN 201910927458A CN 110795103 A CN110795103 A CN 110795103A
Authority
CN
China
Prior art keywords
compiling
login
instruction
compiler
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910927458.4A
Other languages
Chinese (zh)
Inventor
要嵘赫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN201910927458.4A priority Critical patent/CN110795103A/en
Publication of CN110795103A publication Critical patent/CN110795103A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The application provides a code compiling method and a compiler, wherein the method comprises the following steps: receiving a packed file sent by a compiling cluster host, wherein the packed file comprises a source code file, and the source code file is placed in a code directory; decompressing the packed file to a temporary directory, wherein the directory structure of the temporary directory is the same as that of the code directory; sending a login instruction and a login two-dimensional code to the compiling cluster host, wherein the login instruction is used for indicating the compiling cluster host to display the login two-dimensional code; and compiling the source code file contained in the temporary directory to obtain an object code under the condition of receiving the login success instruction. Therefore, the compiling environment can be unified, and the condition that the program compiling possibly fails when the compiling environment is changed is avoided.

Description

Code compiling method and compiler
Technical Field
The present application relates to the field of communications technologies, and in particular, to a code compiling method and a compiler.
Background
In developing programs, each company developer typically develops programs according to a program service line corresponding to the company service. With the development of company business, a plurality of program business lines may exist in the same company at the same time, and correspondingly, personnel with different roles participate in developing, testing and publishing programs. For each program, the relevant personnel need to compile the program and then view the development results. In the related art, the source code to be compiled can be acquired only by giving the authority to related personnel. After the source code to be compiled is acquired from the code library, the acquired source code to be compiled needs to be compiled in a manual mode, so that a corresponding object code is acquired.
Because different compiling environments used by different people to compile codes may be different, different character processing modes may exist in different compiling environments. Thus, in a compilation environment, a program can be successfully compiled; when the compiling environment changes, the program may fail to be compiled. For example, in the process of program development, a program is compiled in a compiling environment; in the online process of the product, the program may be compiled in another completely different compiling environment, and it is likely that the compiling is successful in the development process, and an error is reported in the online compiling process of the product, and the error is unpredictable.
Disclosure of Invention
The application provides a code compiling method and a compiler, which are used for solving the problem that program compiling fails when a compiling environment is changed in the related art.
In a first aspect, the present invention provides a code compiling method applied to a compiler, where the method includes:
receiving a packed file sent by a compiling cluster host, wherein the packed file comprises a source code file, and the source code file is placed in a code directory;
decompressing the packed file to a temporary directory, wherein the directory structure of the temporary directory is the same as the directory structure of the code directory;
sending a login instruction and a login two-dimensional code to the compiling cluster host, wherein the login instruction is used for indicating the compiling cluster host to display the login two-dimensional code;
and compiling the source code file contained in the temporary directory to obtain an object code under the condition of receiving a login success instruction, wherein the login success instruction is sent to the compiler under the condition that a server for generating the login two-dimensional code receives a login request message sent by a user terminal and determines that the user terminal has login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
Further, before or after the step of receiving the packed file sent by the compiled cluster host, the method further includes:
receiving a first digital abstract and a second digital abstract of the packed file sent by the compiling cluster host, wherein the first digital abstract and the second digital abstract have different generation algorithms;
prior to the step of decompressing the packed file to a temporary directory, the method further comprises:
generating a third digital abstract and a fourth digital abstract of the packaged file, wherein the third digital abstract and the first digital abstract have the same generation algorithm, and the fourth digital abstract and the second digital abstract have the same generation algorithm;
performing the step of decompressing the packed file to a temporary directory if the first digital digest matches the third digital digest and the second digital digest matches the fourth digital digest;
and under the condition that the first digital abstract and the third digital abstract are not matched and/or the second digital abstract and the fourth digital abstract are not matched, sending a first error instruction and first error information to the compiling cluster host, so that the compiling cluster host displays the first error information and releases the compiler according to the first error instruction.
Further, before or after the step of receiving the packed file sent by the compiled cluster host, the method further includes:
receiving compiling type information sent by the compiling cluster host;
compiling the source code file contained in the temporary directory to obtain an object code, wherein the compiling comprises:
compiling the source code file contained in the temporary directory to obtain an object code under the condition that the compiling type information is preview information; acquiring a preview two-dimensional code and a first success instruction; sending the preview two-dimensional code and the first success instruction to the compiling cluster host so that the compiling cluster host displays the preview two-dimensional code according to the first success instruction;
or, when the compiling type information is release information, compiling the source code file contained in the temporary directory to obtain an object code; uploading the object code to a server; generating a second power instruction; and sending the second power forming instruction to the compiling cluster host to enable the compiling cluster host to display prompt information according to the second power forming instruction.
Further, after the step of obtaining the preview two-dimensional code and the first successful instruction, and before the step of sending the preview two-dimensional code and the first successful instruction to the compiling cluster host, the method further includes:
deleting the temporary directory;
alternatively, after the step of uploading the object code to a server, and before the step of generating second work instructions, the method further comprises:
and deleting the temporary directory.
Further, after the step of sending the login instruction and the login two-dimensional code to the compiling cluster host, the method further includes:
generating a second error instruction and second error information under the condition of receiving a login failure instruction, wherein the login failure instruction is sent to the compiler under the condition that a server for generating the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal does not have login authority on the basis of the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
and sending the second error instruction and the second error information to the compiling cluster host, so that the compiling cluster host displays the second error information and releases the compiler according to the second error instruction.
In a second aspect, the present invention further provides a code compiling method, applied to compiling a cluster host, where the method includes:
acquiring a source code file;
packaging the source code file according to a code directory to obtain a packaged file;
sending the packaged file to a compiler;
receiving a login instruction and a login two-dimensional code sent by the compiler;
and displaying the login two-dimensional code according to the indication of the login instruction, so that the compiler compiles the source code file to obtain an object code under the condition that the compiler receives a login success instruction, wherein the login success instruction is a login request message sent by a user terminal when a server generating the login two-dimensional code receives the login request message, the login request message is sent to the compiler under the condition that the user terminal is determined to have login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
Further, the method further comprises:
generating a first digital abstract and a second digital abstract of the packaged file, wherein the first digital abstract and the second digital abstract are generated by different algorithms;
before or after the step of sending the packaged file to a compiler, the method further comprises:
sending the first digital digest and the second digital digest to the compiler.
Further, the method further comprises:
under the condition that the first digital abstract and the third digital abstract do not match and/or the second digital abstract and the fourth digital abstract do not match, receiving a first error instruction and first error information sent by the compiler;
and displaying the first error information and releasing the compiler according to the first error instruction.
Further, before or after the step of sending the packaged file to the compiler, the method further comprises:
sending compiling type information to the compiler;
after the step of displaying the login two-dimensional code according to the instruction of the login instruction, the method further comprises:
receiving a first success instruction and a preview two-dimensional code sent by the compiler under the condition that the compiling type information is preview information, wherein the preview two-dimensional code is obtained under the condition that the target code is obtained by compiling the source code file according to the preview information after the preview information is received by the compiler; displaying the preview two-dimensional code according to the first success instruction;
receiving a second power instruction sent by the compiler under the condition that the compiling type information is release information, wherein the second power instruction is generated after the compiler receives the release information, compiling the source code file according to the release information to obtain the object code, and uploading the object code to a server; and displaying prompt information according to the second success command.
Further, after the step of displaying the login two-dimensional code according to the instruction of the login instruction, the method further includes:
receiving a second error instruction and second error information sent by the compiler, wherein the second error instruction and the second error information are generated by the compiler under the condition that the compiler receives a login failure instruction, the login failure instruction is a login request message sent by a server which generates the login two-dimensional code after receiving the user terminal, and is sent to the compiler under the condition that the user terminal is determined not to have login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
and displaying the second error information and releasing the compiler according to the second error instruction.
In a third aspect, the present invention further provides a compiler, including:
the system comprises a first receiving module, a second receiving module and a compiling module, wherein the first receiving module is used for receiving a packed file sent by a compiling cluster host, the packed file comprises a source code file, and the source code file is placed in a code directory;
the decompression module is used for decompressing the packed file to a temporary directory, wherein the directory structure of the temporary directory is the same as that of the code directory;
the first sending module is used for sending a login instruction and a login two-dimensional code to the compiling cluster host, wherein the login instruction is used for indicating the compiling cluster host to display the login two-dimensional code;
and the compiling module is used for compiling the source code file contained in the temporary directory to obtain an object code under the condition of receiving a login success instruction, wherein the login success instruction is a login request message sent by a user terminal by a server for generating the login two-dimensional code, the login request message is sent to the compiler under the condition that the user terminal is determined to have login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
Further, the compiler further includes:
the second receiving module is used for receiving a first digital abstract and a second digital abstract of the packed file sent by the compiling cluster host, wherein the first digital abstract and the second digital abstract have different generation algorithms;
the first generation module is used for generating a third digital abstract and a fourth digital abstract of the packaged file, wherein the generation algorithms of the third digital abstract and the first digital abstract are the same, and the generation algorithms of the fourth digital abstract and the second digital abstract are the same;
an execution module, configured to perform the step of decompressing the packed file to a temporary directory if the first digital digest matches the third digital digest and the second digital digest matches the fourth digital digest;
and the second sending module is used for sending a first error instruction and first error information to the compiling cluster host computer under the condition that the first digital abstract and the third digital abstract are not matched and/or the second digital abstract and the fourth digital abstract are not matched, so that the compiling cluster host computer displays the first error information and releases the compiler according to the first error instruction.
Further, the compiler further includes:
the third receiving module is used for receiving the compiling type information sent by the compiling cluster host;
the compiling module comprises:
the first compiling sub-module is used for compiling the source code file contained in the temporary directory to obtain an object code under the condition that the compiling type information is preview information; the acquisition submodule is used for acquiring the preview two-dimensional code and the first success instruction; the first sending submodule is used for sending the preview two-dimensional code and the first success instruction to the compiling cluster host computer so that the compiling cluster host computer displays the preview two-dimensional code according to the first success instruction;
or, the second compiling sub-module is configured to compile the source code file included in the temporary directory to obtain an object code when the compiling type information is release information; the uploading sub-module is used for uploading the target code to a server; the generating submodule is used for generating a second success instruction; and the second sending submodule is used for sending the second success forming instruction to the compiling cluster host so that the compiling cluster host can display prompt information according to the second success forming instruction.
Further, the compiler further includes:
the first deleting module is used for deleting the temporary directory;
or, the second deleting module is configured to delete the temporary directory.
Further, the compiler further includes:
the second generation module is used for generating a second error instruction and second error information under the condition that a login failure instruction is received, wherein the login failure instruction is sent to the compiler under the condition that a server which generates the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal does not have login authority on the basis of the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
and a third sending module, configured to send the second error instruction and the second error information to the compiling cluster host, so that the compiling cluster host displays the second error information according to the second error instruction and releases the compiler.
In a fourth aspect, the present invention further provides a compiling cluster host, including:
the acquisition module is used for acquiring a source code file;
the packaging module is used for packaging the source code file according to the code directory to obtain a packaged file;
the first sending module is used for sending the packed file to a compiler;
the first receiving module is used for receiving the login instruction and the login two-dimensional code sent by the compiler;
the first display module is used for displaying the login two-dimensional code according to the indication of the login instruction, so that the compiler compiles the source code file to obtain an object code under the condition that the compiler receives a login success instruction, wherein the login success instruction is a login request message sent by a user terminal when a server which generates the login two-dimensional code receives the login request message, the login request message is sent to the compiler under the condition that the user terminal is determined to have login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
Further, the compiling cluster host further includes:
the generating module is used for generating a first digital abstract and a second digital abstract of the packaged file, wherein the generating algorithm of the first digital abstract is different from that of the second digital abstract;
and the second sending module is used for sending the first digital abstract and the second digital abstract to the compiler.
Further, the compiling cluster host further includes:
the second receiving module is used for receiving a first error instruction and first error information sent by the compiler under the condition that the first digital abstract and the third digital abstract are not matched and/or the second digital abstract and the fourth digital abstract are not matched;
and the second display module is used for displaying the first error information and releasing the compiler according to the first error instruction.
Further, the compiling cluster host further includes:
the third sending module is used for sending the compiling type information to the compiler;
a third receiving module, configured to receive a first success instruction and a preview two-dimensional code sent by the compiler when the compilation type information is preview information, where the preview two-dimensional code is a preview two-dimensional code obtained when the compiler compiles the source code file according to the preview information after receiving the preview information, and obtains the target code; the third display module is used for displaying the preview two-dimensional code according to the first success instruction;
a fourth receiving module, configured to receive a second power instruction sent by the compiler when the compilation type information is release information, where the second power instruction is generated after the compiler receives the release information, compiles the source code file according to the release information to obtain the object code, and uploads the object code to a server; and the display module is used for displaying prompt information according to the second success command.
Further, the compiling cluster host further includes:
a fifth receiving module, configured to receive a second error instruction and second error information sent by the compiler, where the second error instruction and the second error information are generated by the compiler when the compiler receives a login failure instruction, the login failure instruction is a login request message sent by the user terminal when the server that generates the login two-dimensional code receives the login request message sent by the user terminal, and is sent to the compiler when it is determined that the user terminal does not have login permission based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
and the fourth display module is used for displaying the second error information and releasing the compiler according to the second error instruction.
In a fifth aspect, the present invention further provides an electronic device, including:
a memory for storing program instructions;
and the processor is used for calling and executing the program instructions in the memory so as to realize the code compiling method.
In a sixth aspect, the present invention further provides a readable storage medium, in which a computer program is stored, and when at least one processor of a compiler executes the computer program, the compiler executes the code compiling method.
In a seventh aspect, the present invention further provides a readable storage medium, where a computer program is stored, and when at least one processor of the compiling cluster host executes the computer program, the compiling cluster host executes the code compiling method.
As can be seen from the foregoing technical solutions, in the code compiling method and the compiler provided in the embodiments of the present invention, a packed file sent by a compiling cluster host is received, where the packed file includes a source code file, and the source code file is placed in a code directory; decompressing the packed file to a temporary directory, wherein the directory structure of the temporary directory is the same as the directory structure of the code directory; sending a login instruction and a login two-dimensional code to the compiling cluster host, wherein the login instruction is used for indicating the compiling cluster host to display the login two-dimensional code; and compiling the source code file contained in the temporary directory to obtain an object code under the condition of receiving a login success instruction, wherein the login success instruction is sent to the compiler under the condition that a server for generating the login two-dimensional code receives a login request message sent by a user terminal and determines that the user terminal has login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code. Therefore, the compiling environment can be unified, and the condition that the program compiling possibly fails when the compiling environment is changed is avoided.
Drawings
In order to more clearly explain the technical solution of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart of a code compiling method provided by the invention;
FIG. 2 is a flow chart of another code compiling method provided by the invention;
FIG. 3 is a flow chart of another code compiling method provided by the invention;
FIG. 4 is a flow chart of another code compiling method provided by the invention;
FIG. 5 is a block diagram of a compiler according to the present invention;
FIG. 6 is a block diagram of another compiler provided in accordance with the present invention;
FIG. 7 is a block diagram of another compiler provided in accordance with the present invention;
FIG. 8 is a block diagram of another compiler provided in accordance with the present invention;
FIG. 9 is a block diagram of another compiler provided in accordance with the present invention;
FIG. 10 is a block diagram of a compiling cluster host provided by the invention;
FIG. 11 is a block diagram of another compiling cluster host provided by the invention;
FIG. 12 is a block diagram of another compiling cluster host provided by the invention;
FIG. 13 is a block diagram of another compiling cluster host provided by the invention;
FIG. 14 is a block diagram of another compiling cluster host provided by the invention;
fig. 15 is a schematic diagram of a hardware structure of the electronic device provided in the present invention.
Detailed Description
Reference will now be made in detail to embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following examples do not represent all embodiments consistent with the present application. But merely as exemplifications of systems and methods consistent with certain aspects of the application, as recited in the claims.
Referring to fig. 1, fig. 1 is a flowchart of a code compiling method provided by the present invention, which is applied to a compiler. As shown in fig. 1, the method comprises the following steps:
step 101, receiving a packed file sent by a compiling cluster host, wherein the packed file comprises a source code file, and the source code file is placed in a code directory.
In step 101, the compiler may receive a packed file sent by the compiling cluster host. The package file may include a source code file, and the source code file may be placed in a code directory.
And 102, decompressing the packed file to a temporary directory, wherein the directory structure of the temporary directory is the same as that of the code directory.
In step 102, the compiler may decompress the received packed file to a temporary directory. Wherein the directory structure of the temporary directory may be the same as the directory structure of the code directory. Next, the compiler may open the temporary directory and obtain a login instruction and a login two-dimensional code.
103, sending a login instruction and a login two-dimensional code to the compiling cluster host, wherein the login instruction is used for indicating the compiling cluster host to display the login two-dimensional code.
In step 103, the compiler may send a login instruction and a login two-dimensional code to the compiling cluster host. The login instruction is used for indicating the compiling cluster host to display the login two-dimensional code. For example, the compiler may send a login (login) instruction and a login two-dimensional code to the compilation cluster host in a socket manner.
After the compiling cluster host receives the login instruction and the login two-dimensional code sent by the compiler, the login two-dimensional code can be displayed according to the instruction of the login instruction.
And 104, compiling the source code file contained in the temporary directory to obtain an object code under the condition that a login success instruction is received, wherein the login success instruction is sent to the compiler under the condition that a server for generating the login two-dimensional code receives a login request message sent by a user terminal and determines that the user terminal has login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
In step 104, the compiler may compile the source code file included in the temporary directory to obtain the object code when receiving the login success instruction. The login success instruction is sent to the compiler when the server which generates the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal has login authority based on the login request message. And the login request message is sent to the server after the user terminal scans the login two-dimensional code.
According to the technical scheme, the code compiling method provided by the embodiment of the invention is applied to a compiler. Receiving a packed file sent by a compiling cluster host, wherein the packed file comprises a source code file, and the source code file is placed in a code directory; decompressing the packed file to a temporary directory, wherein the directory structure of the temporary directory is the same as the directory structure of the code directory; sending a login instruction and a login two-dimensional code to the compiling cluster host, wherein the login instruction is used for indicating the compiling cluster host to display the login two-dimensional code; and compiling the source code file contained in the temporary directory to obtain an object code under the condition of receiving a login success instruction, wherein the login success instruction is sent to the compiler under the condition that a server for generating the login two-dimensional code receives a login request message sent by a user terminal and determines that the user terminal has login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code. Therefore, the compiling environment can be unified, and the condition that the program compiling possibly fails when the compiling environment is changed is avoided.
Referring to fig. 2, fig. 2 is a flowchart of another code compiling method provided by the present invention, which is applied to a compiler. As shown in fig. 2, the method comprises the following steps:
step 201, receiving a packed file sent by a compiling cluster host, wherein the packed file comprises a source code file, and the source code file is placed in a code directory.
In step 201, the compiler may receive a packed file sent by the compiling cluster host. The package file may include a source code file, and the source code file may be placed in a code directory.
Step 202, receiving a first digital abstract and a second digital abstract of the packaged file sent by the compiling cluster host, wherein the first digital abstract and the second digital abstract have different generation algorithms.
In step 202, the compiler may also receive a first digital digest and a second digital digest of the packed file sent by the compiling cluster host. And the first digital abstract and the second digital abstract are generated by different algorithms. For example, the first digital Digest may be a Message Digest Algorithm (Message Digest Algorithm MD5) and the second digital Digest may be sha256 information.
And 203, generating a third digital abstract and a fourth digital abstract of the packaged file, wherein the third digital abstract and the first digital abstract have the same generation algorithm, and the fourth digital abstract and the second digital abstract have the same generation algorithm.
In step 203, the compiler may generate a third digital digest and a fourth digital digest of the packaged file. And the third digital abstract and the first digital abstract have the same generation algorithm, and the fourth digital abstract and the second digital abstract have the same generation algorithm. That is, the third digital digest may be MD5 and the fourth digital digest may be sha256 information. The compiler may then compare the generated third digital digest of the packaged file with the received first digital digest and compare the generated fourth digital digest of the packaged file with the received second digital digest.
Step 204, when the first digital abstract and the third digital abstract match and the second digital abstract and the fourth digital abstract match, performing the step of decompressing the packed file to a temporary directory, where a directory structure of the temporary directory is the same as a directory structure of the code directory.
In step 204, the compiler may decompress the packaged file to the temporary directory if the first digital digest matches the third digital digest and the second digital digest matches the fourth digital digest. Wherein the directory structure of the temporary directory is the same as the directory structure of the code directory. Next, the compiler may open the temporary directory and obtain a login instruction and a login two-dimensional code. It should be noted that the first digital abstract is matched with the third digital abstract, and the second digital abstract is matched with the fourth digital abstract, which indicates that the packaged file received by the compiler is an undamaged, tampered, complete packaged file, and then the following steps are performed again. The packed file received by the compiler can be guaranteed to be the packed file originally sent by the compiling cluster host, the packed file is prevented from being maliciously tampered in the transmission process, and the file transmission safety is guaranteed.
Step 205, under the condition that the first digital digest and the third digital digest are not matched and/or the second digital digest and the fourth digital digest are not matched, sending a first error instruction and first error information to the compiling cluster host, so that the compiling cluster host displays the first error information and releases the compiler according to the first error instruction.
In step 205, in the case that the first digital digest and the third digital digest do not match and/or the second digital digest and the fourth digital digest do not match, the compiler may send a first error instruction and first error information to the compiling cluster host, so that the compiling cluster host displays the first error information according to the first error instruction and releases the compiler. For example, the compiler may send the first error instruction and the first error information to the compiling cluster host in a socket manner. It should be noted that the first digital abstract and the third digital abstract do not match and/or the second digital abstract and the fourth digital abstract do not match, which indicates that the packed file received by the compiler is a damaged or tampered packed file, and at this time, the compiler may send a first error instruction and first error information to the compiling cluster host. Therefore, the compiler can timely know whether the received packed file is the packed file originally sent by the compiling cluster host. The packed file is prevented from being maliciously tampered in the transmission process, and the file transmission safety is guaranteed.
And step 206, sending a login instruction and a login two-dimensional code to the compiling cluster host, wherein the login instruction is used for indicating the compiling cluster host to display the login two-dimensional code.
In step 206, after the compiler acquires the login instruction and the login two-dimensional code, the compiler may send the login instruction and the login two-dimensional code to the compiling cluster host. The login instruction is used for indicating the compiling cluster host to display the login two-dimensional code. For example, the compiler may send a logic instruction and the login two-dimensional code to the compilation cluster host in a socket manner.
After the compiling cluster host receives the login instruction and the login two-dimensional code sent by the compiler, the login two-dimensional code can be displayed according to the instruction of the login instruction.
Optionally, after the step of sending the login instruction and the login two-dimensional code to the compiling cluster host, the method further includes:
generating a second error instruction and second error information under the condition of receiving a login failure instruction, wherein the login failure instruction is sent to the compiler under the condition that a server for generating the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal does not have login authority on the basis of the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
and sending the second error instruction and the second error information to the compiling cluster host, so that the compiling cluster host displays the second error information and releases the compiler according to the second error instruction.
The compiler may generate a second error instruction and second error information when receiving the login failure instruction. The login failure instruction is sent to the compiler when the server generating the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal does not have login authority based on the login request message. And the login request message is sent to the server after the user terminal scans the login two-dimensional code. Next, the compiler may send a second error instruction and second error information to the compiling cluster host, so that the compiling cluster host displays the second error information according to the second error instruction and releases the compiler. For example, the compiler may send the second error instruction and the second error information to the compiling cluster host in a socket manner.
And step 207, compiling the source code file contained in the temporary directory to obtain an object code under the condition that a login success instruction is received, wherein the login success instruction is sent to the compiler under the condition that a server for generating the login two-dimensional code receives a login request message sent by a user terminal and determines that the user terminal has login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
In step 207, the compiler may compile the source code file included in the temporary directory to obtain the object code when receiving the login success instruction. The login success instruction is sent to the compiler when the server which generates the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal has login authority based on the login request message. And the login request message is sent to the server after the user terminal scans the login two-dimensional code.
Optionally, before or after the step of receiving the packed file sent by the compiled cluster host, the method further includes:
receiving compiling type information sent by the compiling cluster host;
compiling the source code file contained in the temporary directory to obtain an object code, wherein the compiling comprises:
compiling the source code file contained in the temporary directory to obtain an object code under the condition that the compiling type information is preview information; acquiring a preview two-dimensional code and a first success instruction; sending the preview two-dimensional code and the first success instruction to the compiling cluster host so that the compiling cluster host displays the preview two-dimensional code according to the first success instruction;
or, when the compiling type information is release information, compiling the source code file contained in the temporary directory to obtain an object code; uploading the object code to a server; generating a second power instruction; and sending the second power forming instruction to the compiling cluster host to enable the compiling cluster host to display prompt information according to the second power forming instruction.
Further, the compiler may receive compilation type information sent by the compilation cluster host.
When the compiling type information is preview information, the compiler may compile a source code file included in the temporary directory to obtain an object code, and the compiler may upload the object code to the server. Next, the server may generate a preview two-dimensional code, the compiler may obtain the preview two-dimensional code generated by the server, and the compiler may further obtain the first success instruction. Then, the compiler may send the preview two-dimensional code and the first success instruction to the compiling cluster host, so that the compiling cluster host displays the preview two-dimensional code according to the first success instruction. For example, the compiler may send the preview two-dimensional code and the first success instruction to the compilation cluster host in a socket manner. The compiling cluster host can display the preview two-dimensional code to the user and release the compiler according to the first success instruction. It should be noted that, after the user scans the preview two-dimensional code using the terminal and successfully logs in the webpage corresponding to the preview two-dimensional code, the user can see the effect after compiling the source code file.
Or, in the case that the compiling type information is release information, the compiler may compile a source code file included in the temporary directory to obtain an object code, and then the compiler may upload the object code to the server. The compiler can also generate a second power forming instruction and send the second power forming instruction to the compiling cluster host, so that the compiling cluster host displays prompt information according to the second power forming instruction. For example, the compiler may send the second success instruction to the compilation cluster host in a socket manner. And the compiling cluster host can display prompt information and release the compiler according to the second success instruction. It should be noted that the prompt may be "successful uploading of the object code to the server".
Optionally, after the step of obtaining the preview two-dimensional code and the first successful instruction, and before the step of sending the preview two-dimensional code and the first successful instruction to the compiling cluster host, the method further includes:
deleting the temporary directory;
alternatively, after the step of uploading the object code to a server, and before the step of generating second work instructions, the method further comprises:
and deleting the temporary directory.
It should be noted that after the compiler acquires the first successful instruction and the preview two-dimensional code generated by the server, the compiler may delete the temporary directory; or, after the compiler compiles the source code file included in the temporary directory to obtain the object code and uploads the object code to the server, the compiler may delete the temporary directory. Therefore, leakage of the source code file can be avoided, and storage space can be saved.
It should be noted that, in the related art, since the compiling environments used when different persons compile codes may be different, there may be a difference in the processing manner of characters in different compiling environments. Thus, in a compilation environment, a program can be successfully compiled; when the compiling environment changes, the program may fail to be compiled.
In the application, the compiling environment can be unified, and the situation that program compiling may fail when the compiling environment is changed is avoided.
According to the technical scheme, the code compiling method provided by the embodiment of the invention is applied to a compiler. The compiling environment can be unified, and the condition that program compiling possibly fails when the compiling environment is changed is avoided. Further, the compiler may determine whether the first digital digest and the third digital digest are matched and whether the second digital digest and the fourth digital digest are matched, and further determine whether the received packed file is complete, damaged, or tampered. Therefore, the compiler can timely know whether the received packed file is the packed file originally sent by the compiling cluster host. The packed file is prevented from being maliciously tampered in the transmission process, and the file transmission safety is guaranteed. Further, after the compiler acquires the first success instruction and the preview two-dimensional code generated by the server, the compiler may delete the temporary directory; or the compiler compiles the source code file contained in the temporary directory to obtain the object code, and after uploading the object code to the server, the compiler may delete the temporary directory. Therefore, leakage of the source code file can be avoided, and storage space can be saved.
Referring to fig. 3, fig. 3 is a flowchart of another code compiling method provided by the present invention, which is applied to compiling a cluster host. As shown in fig. 3, the method comprises the following steps:
step 301, obtaining a source code file.
In step 301, a user may trigger a compilation process, and the user may select two compilation processes: "preview" and "publish". The compiling cluster host can be entered, if compiling resources exist, namely, if a compiler exists, the next stage is entered; if the resource is not compiled, the user is prompted to wait.
If there is a compilation resource, the compilation cluster host may obtain the source code file.
And 302, packaging the source code file according to the code directory to obtain a packaged file.
In step 302, the compiling cluster host may package the source code file according to the code directory to obtain a packaged file. For example, a source code file may contain multiple code files that may be placed in a code directory. A code directory containing a plurality of code files may be packaged to obtain a packaged file.
Step 303, sending the packaged file to a compiler.
In step 303, the compiling cluster host may send the above-mentioned packed file to the compiler, and the compiling cluster host may mark the compiler as a use state. For example, the compiling cluster host may send the above packed file to the compiler in a socket manner.
The compiler may decompress the received packed file to a temporary directory. Wherein the directory structure of the temporary directory may be the same as the directory structure of the code directory. Next, the compiler may open the temporary directory and obtain a login instruction and a login two-dimensional code. The compiler can send a login instruction and a login two-dimensional code to the compiling cluster host.
And step 304, receiving a login instruction and a login two-dimensional code sent by the compiler.
In step 304, the compiling cluster host may receive the login instruction and the login two-dimensional code sent by the compiler.
And 305, displaying the login two-dimensional code according to the instruction of the login instruction, so that the compiler compiles the source code file to obtain an object code under the condition that the compiler receives a login success instruction, wherein the login success instruction is sent to the compiler when a server which generates the login two-dimensional code receives a login request message sent by a user terminal, and the user terminal is determined to have login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
In step 305, the compiling cluster host may display the login two-dimensional code according to the instruction of the login instruction, so that the compiler compiles the source code file to obtain the object code when receiving the instruction of successful login. The login success instruction is sent to the compiler when the server which generates the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal has login authority based on the login request message. And the login request message is sent to the server after the user terminal scans the login two-dimensional code.
According to the technical scheme, the code compiling method provided by the embodiment of the invention is applied to compiling the cluster host. Acquiring a source code file; packaging the source code file according to a code directory to obtain a packaged file; sending the packaged file to a compiler; receiving a login instruction and a login two-dimensional code sent by the compiler; and displaying the login two-dimensional code according to the indication of the login instruction, so that the compiler compiles the source code file to obtain an object code under the condition that the compiler receives a login success instruction, wherein the login success instruction is a login request message sent by a user terminal when a server generating the login two-dimensional code receives the login request message, the login request message is sent to the compiler under the condition that the user terminal is determined to have login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code. Therefore, the compiling environment can be unified, and the condition that the program compiling possibly fails when the compiling environment is changed is avoided.
Referring to fig. 4, fig. 4 is a flowchart of another code compiling method provided by the present invention, which is applied to compiling a cluster host. As shown in fig. 4, the method comprises the following steps:
step 401, obtaining a source code file.
In step 401, a user may trigger a compilation process, and the user may select two compilation processes: "preview" and "publish". The compiling cluster host can be entered, if compiling resources exist, namely, if a compiler exists, the next stage is entered; if the resource is not compiled, the user is prompted to wait.
If there is a compilation resource, the compilation cluster host may obtain the source code file.
And 402, packaging the source code file according to the code directory to obtain a packaged file.
In step 402, the compiling cluster host may package the source code file according to the code directory to obtain a packaged file. For example, a source code file may contain multiple code files that may be placed in a code directory. A code directory containing a plurality of code files may be packaged to obtain a packaged file.
And 403, generating a first digital abstract and a second digital abstract of the packaged file, wherein the first digital abstract and the second digital abstract have different generation algorithms.
In step 403, the compiling cluster host may generate a first digital digest and a second digital digest of the packaged file, where the first digital digest is generated by a different algorithm than the second digital digest. For example, the first digital Digest may be a Message Digest Algorithm (Message Digest Algorithm MD5) and the second digital Digest may be sha256 information.
Step 404, sending the packaged file to a compiler.
In step 404, the compiling cluster host may send the above-mentioned packed file to the compiler, and the compiling cluster host may mark the compiler as a use state. For example, the compiling cluster host may send the above packed file to the compiler in a socket manner.
Step 405, sending the first digital summary and the second digital summary to the compiler.
In step 405, the compiling cluster host may send the first digital digest and the second digital digest to the compiler.
It should be noted that, after receiving the first digital digest and the second digital digest of the packaged file sent by the compiling cluster host, the compiler may further generate a third digital digest and a fourth digital digest of the packaged file. And the third digital abstract and the first digital abstract have the same generation algorithm, and the fourth digital abstract and the second digital abstract have the same generation algorithm. That is, the third digital digest may be MD5 and the fourth digital digest may be sha256 information. The compiler may then compare the generated third digital digest of the packaged file with the received first digital digest and compare the generated fourth digital digest of the packaged file with the received second digital digest.
Optionally, the method further includes:
under the condition that the first digital abstract and the third digital abstract do not match and/or the second digital abstract and the fourth digital abstract do not match, receiving a first error instruction and first error information sent by the compiler;
and displaying the first error information and releasing the compiler according to the first error instruction.
Under the condition that the first digital abstract and the third digital abstract are not matched and/or the second digital abstract and the fourth digital abstract are not matched, the compiling machine can send a first error instruction and first error information to the compiling cluster host machine, the compiling cluster host machine can receive the first error instruction and the first error information sent by the compiling machine at the moment, and then the first error information can be displayed and the compiling machine can be released according to the first error instruction. It should be noted that the first digital abstract and the third digital abstract do not match and/or the second digital abstract and the fourth digital abstract do not match, which indicates that the packed file received by the compiler is a damaged or tampered packed file, and at this time, the compiler may send a first error instruction and first error information to the compiling cluster host. Therefore, the compiler can timely know whether the received packed file is the packed file originally sent by the compiling cluster host. The packed file is prevented from being maliciously tampered in the transmission process, and the file transmission safety is guaranteed.
And step 406, receiving a login instruction and a login two-dimensional code sent by the compiler.
In step 406, the compiler may decompress the packaged file to the temporary directory if the first digital digest matches the third digital digest and the second digital digest matches the fourth digital digest. Next, the compiler may open the temporary directory and obtain a login instruction and a login two-dimensional code. It should be noted that the first digital abstract is matched with the third digital abstract, and the second digital abstract is matched with the fourth digital abstract, which indicates that the packaged file received by the compiler is an undamaged, tampered, complete packaged file, and then the following steps are performed again. The packed file received by the compiler can be guaranteed to be the packed file originally sent by the compiling cluster host, the packed file is prevented from being maliciously tampered in the transmission process, and the file transmission safety is guaranteed.
After the compiler acquires the login instruction and the login two-dimensional code, the login instruction and the login two-dimensional code can be sent to the compiling cluster host. At this time, the compiling cluster host may receive the login instruction and the login two-dimensional code sent by the compiler.
Step 407, displaying the login two-dimensional code according to the instruction of the login instruction, so that the compiler compiles the source code file to obtain an object code when receiving a login success instruction, wherein the login success instruction is sent to the compiler when a server which generates the login two-dimensional code receives a login request message sent by a user terminal and determines that the user terminal has login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
In step 407, the compiling cluster host may display the login two-dimensional code according to the instruction of the login instruction, so that the compiler compiles the source code file to obtain the object code when receiving the instruction of successful login. The login success instruction is sent to the compiler when the server which generates the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal has login authority based on the login request message. And the login request message is sent to the server after the user terminal scans the login two-dimensional code.
Optionally, before or after the step of sending the packaged file to the compiler, the method further includes:
sending compiling type information to the compiler;
after the step of displaying the login two-dimensional code according to the instruction of the login instruction, the method further comprises:
receiving a first success instruction and a preview two-dimensional code sent by the compiler under the condition that the compiling type information is preview information, wherein the preview two-dimensional code is obtained under the condition that the target code is obtained by compiling the source code file according to the preview information after the preview information is received by the compiler; displaying the preview two-dimensional code according to the first success instruction;
receiving a second power instruction sent by the compiler under the condition that the compiling type information is release information, wherein the second power instruction is generated after the compiler receives the release information, compiling the source code file according to the release information to obtain the object code, and uploading the object code to a server; and displaying prompt information according to the second success command.
It should be noted that the compiling cluster host may also send compiling type information to the compiler.
And under the condition that the compiling type information is preview information, the compiling cluster host can receive the first success instruction and the preview two-dimensional code sent by the compiler. And the previewing two-dimensional code is obtained under the condition that the compiler receives the preview information, and then compiles the source code file according to the preview information to obtain the target code. Next, the compiling cluster host may display the preview two-dimensional code according to the first success instruction. After the user scans the preview two-dimensional code by using the terminal and successfully logs in the webpage corresponding to the preview two-dimensional code, the user can see the effect after compiling the source code file.
Or, in the case that the compiling type information is the release information, the compiling cluster host may receive the second success instruction sent by the compiler. And the second power instruction is generated after the compiler receives the release information, compiles the source code file according to the release information to obtain the object code and uploads the object code to the server. Next, the compiling cluster host may display a prompt according to the second success instruction. It should be noted that the prompt may be "successful uploading of the object code to the server".
Optionally, after the step of displaying the login two-dimensional code according to the instruction of the login instruction, the method further includes:
receiving a second error instruction and second error information sent by the compiler, wherein the second error instruction and the second error information are generated by the compiler under the condition that the compiler receives a login failure instruction, the login failure instruction is a login request message sent by a server which generates the login two-dimensional code after receiving the user terminal, and is sent to the compiler under the condition that the user terminal is determined not to have login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
and displaying the second error information and releasing the compiler according to the second error instruction.
It should be noted that, the compiling cluster host may further receive a second error instruction and second error information sent by the compiler. And the second error instruction and the second error information are generated by the compiler under the condition that the login failure instruction is received. The login failure instruction is sent to the compiler when the server generating the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal does not have login authority based on the login request message. And the login request message is sent to the server after the user terminal scans the login two-dimensional code. Next, the compiling cluster host may display second error information according to the second error instruction and release the compiler.
According to the technical scheme, the code compiling method provided by the embodiment of the invention is applied to compiling the cluster host. The compiling environment can be unified, and the condition that program compiling possibly fails when the compiling environment is changed is avoided. Further, the compiling cluster host may send the first digital digest and the second digital digest of the packaged file to the compiler. And then, the compiler can judge whether the first digital abstract is matched with the third digital abstract and whether the second digital abstract is matched with the fourth digital abstract, so as to judge whether the received packed file is complete, damaged or tampered. Therefore, the compiler can timely know whether the received packed file is the packed file originally sent by the compiling cluster host. The packed file is prevented from being maliciously tampered in the transmission process, and the file transmission safety is guaranteed.
Referring to fig. 5, fig. 5 is a block diagram of a compiler according to the present invention. As shown in fig. 5, the compiler 500 includes a first receiving module 501, a decompressing module 502, a first sending module 503, and a compiling module 504, wherein:
a first receiving module 501, configured to receive a packed file sent by a compiling cluster host, where the packed file includes a source code file, and the source code file is placed in a code directory;
a decompressing module 502, configured to decompress the packed file to a temporary directory, where a directory structure of the temporary directory is the same as a directory structure of the code directory;
a first sending module 503, configured to send a login instruction and a login two-dimensional code to the compiling cluster host, where the login instruction is used to instruct the compiling cluster host to display the login two-dimensional code;
the compiling module 504 is configured to compile the source code file included in the temporary directory to obtain an object code when a login success instruction is received, where the login success instruction is a login request message sent by a user terminal when a server that generates the login two-dimensional code receives the login request message, and the login request message is sent to the compiler when it is determined that the user terminal has a login right based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
Optionally, as shown in fig. 6, the compiler further includes:
a second receiving module 505, configured to receive a first digital digest and a second digital digest of the packed file sent by the compiling cluster host, where a generation algorithm of the first digital digest is different from a generation algorithm of the second digital digest;
a first generating module 506, configured to generate a third digital abstract and a fourth digital abstract of the packaged file, where a generating algorithm of the third digital abstract is the same as that of the first digital abstract, and a generating algorithm of the fourth digital abstract is the same as that of the second digital abstract;
an executing module 507, configured to perform the step of decompressing the packed file to a temporary directory if the first digital digest matches the third digital digest and the second digital digest matches the fourth digital digest;
a second sending module 508, configured to send a first error instruction and first error information to the compiling cluster host when the first digital digest and the third digital digest are not matched and/or the second digital digest and the fourth digital digest are not matched, so that the compiling cluster host displays the first error information and releases the compiler according to the first error instruction.
Optionally, as shown in fig. 7, the compiler further includes:
a third receiving module 509, configured to receive the compiling type information sent by the compiling cluster host;
the compiling module 504 includes:
a first compiling sub-module 5041, configured to compile the source code file included in the temporary directory to obtain an object code when the compiling type information is preview information; the obtaining submodule 5042 is configured to obtain the preview two-dimensional code and the first success instruction; the first sending submodule 5043 is configured to send the preview two-dimensional code and the first success instruction to the compiling cluster host, so that the compiling cluster host displays the preview two-dimensional code according to the first success instruction;
or, the second compiling sub-module 5044 is configured to, when the compiling type information is release information, compile the source code file included in the temporary directory to obtain an object code; an upload sub-module 5045, configured to upload the object code to a server; a generation submodule 5046 for generating a second success instruction; the second sending sub-module 5047 is configured to send the second success forming instruction to the compiling cluster host, so that the compiling cluster host displays prompt information according to the second success forming instruction.
Optionally, as shown in fig. 8, the compiler further includes:
a first deletion module 5010 for deleting the temporary directory;
alternatively, the second deleting module 5011 is configured to delete the temporary directory.
Optionally, as shown in fig. 9, the compiler further includes:
a second generating module 5012, configured to generate a second error instruction and second error information when receiving a login failure instruction, where the login failure instruction is sent to the compiler when the server that generates the login two-dimensional code receives a login request message sent by the user terminal, and determines that the user terminal does not have login permission based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
a third sending module 5013, configured to send the second error instruction and the second error information to the compiling cluster host, so that the compiling cluster host displays the second error information according to the second error instruction and releases the compiler.
The compiler 500 can implement each process implemented by the compiler in the method embodiments of fig. 1-2, and is not described herein again to avoid repetition. Moreover, the compiler 500 can implement a unified compiling environment, thereby avoiding the situation that the program compiling may fail when the compiling environment is changed.
Referring to fig. 10, fig. 10 is a structural diagram of a compiling cluster host provided by the present invention. As shown in fig. 10, the compiling cluster host 1000 includes an obtaining module 1001, a packing module 1002, a first sending module 1003, a first receiving module 1004, and a first showing module 1005, where:
an obtaining module 1001 configured to obtain a source code file;
a packaging module 1002, configured to package the source code file according to a code directory to obtain a packaged file;
a first sending module 1003, configured to send the packaged file to a compiler;
a first receiving module 1004, configured to receive a login instruction and a login two-dimensional code sent by the compiler;
a first display module 1005, configured to display the login two-dimensional code according to the instruction of the login instruction, so that the compiler compiles the source code file to obtain an object code when receiving a login success instruction, where the login success instruction is a login request message sent by a user terminal when a server that generates the login two-dimensional code receives the login request message, and the login request message is sent to the compiler when determining that the user terminal has a login permission, where the login request message is sent to the server after the user terminal scans the login two-dimensional code.
Optionally, as shown in fig. 11, the compiling cluster host further includes:
a generating module 1006, configured to generate a first digital abstract and a second digital abstract of the packaged file, where a generating algorithm of the first digital abstract is different from that of the second digital abstract;
a second sending module 1007, configured to send the first digital digest and the second digital digest to the compiler.
Optionally, as shown in fig. 12, the compiling cluster host further includes:
a second receiving module 1008, configured to receive a first error instruction and first error information sent by the compiler if the first digital digest and the third digital digest do not match and/or the second digital digest and the fourth digital digest do not match;
a second displaying module 1009 is configured to display the first error information and release the compiler according to the first error instruction.
Optionally, as shown in fig. 13, the compiling cluster host further includes:
a third sending module 10010, configured to send compilation type information to the compiler;
a third receiving module 10011, configured to receive, when the compiling type information is preview information, a first success instruction and a preview two-dimensional code sent by the compiler, where the preview two-dimensional code is obtained when the preview information is received by the compiler, and the source code file is compiled according to the preview information after the preview information is received by the compiler, so as to obtain the preview two-dimensional code obtained under the condition of the target code; a third display module 10012, configured to display the preview two-dimensional code according to the first success instruction;
a fourth receiving module 10013, configured to receive a second power instruction sent by the compiler when the compilation type information is release information, where the second power instruction is a second power instruction generated after the compiler receives the release information, compiles the source code file according to the release information to obtain the object code, and uploads the object code to a server; the display module 10014 is configured to display a prompt message according to the second success instruction.
Optionally, as shown in fig. 14, the compiling cluster host further includes:
a fifth receiving module 10015, configured to receive a second error instruction and second error information sent by the compiler, where the second error instruction and the second error information are generated by the compiler when the compiler receives a login failure instruction, the login failure instruction is a login request message sent by the user terminal when the server that generates the login two-dimensional code receives the login request message sent by the user terminal, and is sent to the compiler when it is determined that the user terminal does not have login permission based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
a fourth displaying module 10016 is configured to display the second error information and release the compiler according to the second error instruction.
The compiling cluster host 1000 can implement each process implemented by the compiling cluster host in the method embodiments of fig. 3 to fig. 4, and is not described here again to avoid repetition. And the compiling cluster host 1000 can realize a uniform compiling environment, so that the condition that program compiling may fail when the compiling environment is changed is avoided.
Fig. 15 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. 15, the electronic apparatus includes:
a memory 1501 for storing program instructions;
the processor 1502 is configured to call and execute the program instructions in the memory to implement the code compiling method in the above embodiments. Reference may be made in particular to the description in relation to the preceding embodiments.
In this embodiment, the processor 1502 and the memory 1501 may be connected by a bus or other means. The processor may be a general-purpose processor, such as a central processing unit, a digital signal processor, an application specific integrated circuit, or one or more integrated circuits configured to implement embodiments of the present invention. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk.
An embodiment of the present invention further provides a readable storage medium, where a computer program is stored in the readable storage medium, and when at least one processor of a compiler executes the computer program, the compiler executes the code compiling method.
The embodiment of the present invention further provides a readable storage medium, where a computer program is stored in the readable storage medium, and when at least one processor of the compiling cluster host executes the computer program, the compiling cluster host executes the code compiling method.
The readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The same and similar parts in the various embodiments in this specification may be referred to each other. In particular, for the compiler, the compiling cluster host, the electronic device and the readable storage medium embodiments, since they are substantially similar to the method embodiments, the description is simple, and the relevant points can be referred to the description in the method embodiments.
The above-described embodiments of the present invention should not be construed as limiting the scope of the present invention.

Claims (12)

1. A code compiling method applied to a compiler is characterized by comprising the following steps:
receiving a packed file sent by a compiling cluster host, wherein the packed file comprises a source code file, and the source code file is placed in a code directory;
decompressing the packed file to a temporary directory, wherein the directory structure of the temporary directory is the same as the directory structure of the code directory;
sending a login instruction and a login two-dimensional code to the compiling cluster host, wherein the login instruction is used for indicating the compiling cluster host to display the login two-dimensional code;
and compiling the source code file contained in the temporary directory to obtain an object code under the condition of receiving a login success instruction, wherein the login success instruction is sent to the compiler under the condition that a server for generating the login two-dimensional code receives a login request message sent by a user terminal and determines that the user terminal has login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
2. The method of claim 1, wherein before or after the step of receiving the packed file sent by the compiled cluster host, the method further comprises:
receiving a first digital abstract and a second digital abstract of the packed file sent by the compiling cluster host, wherein the first digital abstract and the second digital abstract have different generation algorithms;
prior to the step of decompressing the packed file to a temporary directory, the method further comprises:
generating a third digital abstract and a fourth digital abstract of the packaged file, wherein the third digital abstract and the first digital abstract have the same generation algorithm, and the fourth digital abstract and the second digital abstract have the same generation algorithm;
performing the step of decompressing the packed file to a temporary directory if the first digital digest matches the third digital digest and the second digital digest matches the fourth digital digest;
and under the condition that the first digital abstract and the third digital abstract are not matched and/or the second digital abstract and the fourth digital abstract are not matched, sending a first error instruction and first error information to the compiling cluster host, so that the compiling cluster host displays the first error information and releases the compiler according to the first error instruction.
3. The method of claim 2, wherein before or after the step of receiving the packed file sent by the compiled cluster host, the method further comprises:
receiving compiling type information sent by the compiling cluster host;
compiling the source code file contained in the temporary directory to obtain an object code, wherein the compiling comprises:
compiling the source code file contained in the temporary directory to obtain an object code under the condition that the compiling type information is preview information; acquiring a preview two-dimensional code and a first success instruction; sending the preview two-dimensional code and the first success instruction to the compiling cluster host so that the compiling cluster host displays the preview two-dimensional code according to the first success instruction;
or, when the compiling type information is release information, compiling the source code file contained in the temporary directory to obtain an object code; uploading the object code to a server; generating a second power instruction; and sending the second power forming instruction to the compiling cluster host to enable the compiling cluster host to display prompt information according to the second power forming instruction.
4. The method of claim 3, wherein after the step of obtaining the preview two-dimensional code and the first successful instruction, and before the step of sending the preview two-dimensional code and the first successful instruction to the compiling cluster host, the method further comprises:
deleting the temporary directory;
alternatively, after the step of uploading the object code to a server, and before the step of generating second work instructions, the method further comprises:
and deleting the temporary directory.
5. The method of any of claims 1 to 4, wherein after the step of sending a login instruction and a login two-dimensional code to the compiled cluster host, the method further comprises:
generating a second error instruction and second error information under the condition of receiving a login failure instruction, wherein the login failure instruction is sent to the compiler under the condition that a server for generating the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal does not have login authority on the basis of the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
and sending the second error instruction and the second error information to the compiling cluster host, so that the compiling cluster host displays the second error information and releases the compiler according to the second error instruction.
6. A compiler, comprising:
the system comprises a first receiving module, a second receiving module and a compiling module, wherein the first receiving module is used for receiving a packed file sent by a compiling cluster host, the packed file comprises a source code file, and the source code file is placed in a code directory;
the decompression module is used for decompressing the packed file to a temporary directory, wherein the directory structure of the temporary directory is the same as that of the code directory;
the first sending module is used for sending a login instruction and a login two-dimensional code to the compiling cluster host, wherein the login instruction is used for indicating the compiling cluster host to display the login two-dimensional code;
and the compiling module is used for compiling the source code file contained in the temporary directory to obtain an object code under the condition of receiving a login success instruction, wherein the login success instruction is a login request message sent by a user terminal by a server for generating the login two-dimensional code, the login request message is sent to the compiler under the condition that the user terminal is determined to have login authority based on the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code.
7. The compiler of claim 6, wherein the compiler further comprises:
the second receiving module is used for receiving a first digital abstract and a second digital abstract of the packed file sent by the compiling cluster host, wherein the first digital abstract and the second digital abstract have different generation algorithms;
the first generation module is used for generating a third digital abstract and a fourth digital abstract of the packaged file, wherein the generation algorithms of the third digital abstract and the first digital abstract are the same, and the generation algorithms of the fourth digital abstract and the second digital abstract are the same;
an execution module, configured to perform the step of decompressing the packed file to a temporary directory if the first digital digest matches the third digital digest and the second digital digest matches the fourth digital digest;
and the second sending module is used for sending a first error instruction and first error information to the compiling cluster host computer under the condition that the first digital abstract and the third digital abstract are not matched and/or the second digital abstract and the fourth digital abstract are not matched, so that the compiling cluster host computer displays the first error information and releases the compiler according to the first error instruction.
8. The compiler of claim 7, wherein the compiler further comprises:
the third receiving module is used for receiving the compiling type information sent by the compiling cluster host;
the compiling module comprises:
the first compiling sub-module is used for compiling the source code file contained in the temporary directory to obtain an object code under the condition that the compiling type information is preview information; the acquisition submodule is used for acquiring the preview two-dimensional code and the first success instruction; the first sending submodule is used for sending the preview two-dimensional code and the first success instruction to the compiling cluster host computer so that the compiling cluster host computer displays the preview two-dimensional code according to the first success instruction;
or, the second compiling sub-module is configured to compile the source code file included in the temporary directory to obtain an object code when the compiling type information is release information; the uploading sub-module is used for uploading the target code to a server; the generating submodule is used for generating a second success instruction; and the second sending submodule is used for sending the second success forming instruction to the compiling cluster host so that the compiling cluster host can display prompt information according to the second success forming instruction.
9. The compiler of claim 8, wherein the compiler further comprises:
the first deleting module is used for deleting the temporary directory;
or, the second deleting module is configured to delete the temporary directory.
10. The compiler of any one of claims 6 to 9, wherein the compiler further comprises:
the second generation module is used for generating a second error instruction and second error information under the condition that a login failure instruction is received, wherein the login failure instruction is sent to the compiler under the condition that a server which generates the login two-dimensional code receives a login request message sent by the user terminal and determines that the user terminal does not have login authority on the basis of the login request message, and the login request message is sent to the server after the user terminal scans the login two-dimensional code;
and a third sending module, configured to send the second error instruction and the second error information to the compiling cluster host, so that the compiling cluster host displays the second error information according to the second error instruction and releases the compiler.
11. An electronic device, comprising:
a memory for storing program instructions;
a processor for calling and executing the program instructions in the memory to implement the code compiling method of any one of claims 1 to 5.
12. A readable storage medium, wherein a computer program is stored in the readable storage medium, and when the computer program is executed by at least one processor of a compiler, the compiler executes the code compiling method according to any one of claims 1 to 5.
CN201910927458.4A 2019-09-27 2019-09-27 Code compiling method and compiler Pending CN110795103A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910927458.4A CN110795103A (en) 2019-09-27 2019-09-27 Code compiling method and compiler

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910927458.4A CN110795103A (en) 2019-09-27 2019-09-27 Code compiling method and compiler

Publications (1)

Publication Number Publication Date
CN110795103A true CN110795103A (en) 2020-02-14

Family

ID=69439966

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910927458.4A Pending CN110795103A (en) 2019-09-27 2019-09-27 Code compiling method and compiler

Country Status (1)

Country Link
CN (1) CN110795103A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012070935A1 (en) * 2010-11-24 2012-05-31 Greenflower Intercode Holding B.V. Method and system for handling a digital sample
CN106095522A (en) * 2016-06-03 2016-11-09 北京奇虎科技有限公司 A kind of method realizing distributed compilation and distributed compilation system
CN106095523A (en) * 2016-06-03 2016-11-09 北京奇虎科技有限公司 A kind of method and system realizing Android compiling isolation
CN106096381A (en) * 2016-06-06 2016-11-09 北京壹人壹本信息科技有限公司 The method and system of application file checking
CN107943486A (en) * 2017-12-19 2018-04-20 北京星河星云信息技术有限公司 A kind of multilingual code compiling method, distribution method, device and system
CN108121543A (en) * 2017-11-30 2018-06-05 北京奇安信科技有限公司 A kind of software code process of compilation method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012070935A1 (en) * 2010-11-24 2012-05-31 Greenflower Intercode Holding B.V. Method and system for handling a digital sample
CN106095522A (en) * 2016-06-03 2016-11-09 北京奇虎科技有限公司 A kind of method realizing distributed compilation and distributed compilation system
CN106095523A (en) * 2016-06-03 2016-11-09 北京奇虎科技有限公司 A kind of method and system realizing Android compiling isolation
CN106096381A (en) * 2016-06-06 2016-11-09 北京壹人壹本信息科技有限公司 The method and system of application file checking
CN108121543A (en) * 2017-11-30 2018-06-05 北京奇安信科技有限公司 A kind of software code process of compilation method and device
CN107943486A (en) * 2017-12-19 2018-04-20 北京星河星云信息技术有限公司 A kind of multilingual code compiling method, distribution method, device and system

Similar Documents

Publication Publication Date Title
CN107391104B (en) Client and reactive native code update dependence management method, device and system
CN106873960B (en) Application software updating method and device
CN109800005B (en) Client hot update method and device
CN113326058A (en) Method, device, equipment and medium for updating version of application
CN111367531B (en) Code processing method and device
CN111026439A (en) Application program compatibility method, device, equipment and computer storage medium
CN111061489B (en) Multi-platform compiling detection method, device, equipment and medium
CN113138768B (en) Application package generation method and device, electronic equipment and readable storage medium
CN115658237A (en) Container application automatic deployment method, device, apparatus, equipment and medium
CN109032612B (en) Interface calling method and device of hybrid application and computer readable storage medium
CN111596920A (en) File compiling method and device, compiling equipment and storage medium
CN112732265A (en) Data processing method and related device
CN110795103A (en) Code compiling method and compiler
US20180373512A1 (en) Method and device for simulating synchronous blocking in asynchronous environment, storage medium, server and terminal
CN112667491B (en) Function test method and device for virtual machine
CN114791884A (en) Test environment construction method and device, storage medium and electronic equipment
CN112486511A (en) Method for generating operating system installation mirror image through web
CN114253595A (en) Code warehouse management method and device, computer equipment and storage medium
CN113032004A (en) Method, apparatus and program product for managing development jobs in a development environment
CN113127054B (en) File processing method and related device
JP2006146434A (en) Distributed application test method and distributed application test equipment
CN110704066B (en) Code compiling method, device, equipment and storage medium
CN115048313B (en) Automatic test method and device, computer readable storage medium and electronic equipment
CN112882720B (en) Compiling method and device
CN112558975B (en) Method and device for switching codes of components, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200214

RJ01 Rejection of invention patent application after publication