CN112269578A - Code compiling method and device and computer readable storage medium - Google Patents
Code compiling method and device and computer readable storage medium Download PDFInfo
- Publication number
- CN112269578A CN112269578A CN202011096006.5A CN202011096006A CN112269578A CN 112269578 A CN112269578 A CN 112269578A CN 202011096006 A CN202011096006 A CN 202011096006A CN 112269578 A CN112269578 A CN 112269578A
- Authority
- CN
- China
- Prior art keywords
- compiling
- code
- modules
- parameter
- module
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 238000004590 computer program Methods 0.000 claims description 10
- 238000004140 cleaning Methods 0.000 claims description 9
- 238000012795 verification Methods 0.000 description 4
- 230000003203 everyday effect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012356 Product development Methods 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000010979 ruby Substances 0.000 description 1
- 229910001750 ruby Inorganic materials 0.000 description 1
- 238000013515 script Methods 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses a code compiling method, a code compiling device and a computer readable storage medium, wherein the code compiling method comprises the following steps: analyzing the codes to obtain a compiling list; wherein, the compiling list records compiling parameters required by compiling the code; obtaining a plurality of compiling modules which can be freely compiled according to each functional module of the code; receiving a compiling parameter and checking the compiling parameter; if the compiling parameter is failed to be checked, the compiling process is terminated; if the compiling parameter is successfully verified, verifying the compiling environment; and compiling the selected compiling module after the compiling environment is successfully verified. According to the method and the device, the self functional module of the code is utilized, the compiling module is correspondingly divided, the code can be compiled according to the module, the uncompiled content can be continuously compiled after interruption, the compiling parameter and the compiling environment are verified before compiling, compiling errors caused by the two factors in the compiling process are reduced, and the stability and the reliability of a compiling system are improved.
Description
Technical Field
The present invention relates to the field of computers, and in particular, to a code compiling method and apparatus, and a computer-readable storage medium.
Background
During the development of software products, the compilation of code is essential every day. Meanwhile, for continuous code compilation every day, the stability of the compiling environment is also very important. Especially for large software systems, the compiling time is usually very long, so the compiling efficiency, the discovery of compiling problems and the continuous stability of the compiling environment have great influence on the product development time, the product quality and the like.
Especially, once an error occurs in the compiling process, all codes need to be recompiled, which seriously affects the compiling efficiency
Based on the above problems, it is necessary to provide a code compiling method with higher reliability and efficiency.
Disclosure of Invention
In view of the above, the present invention provides a code compiling method, apparatus and computer readable storage medium, which improve reliability and efficiency. The specific scheme is as follows:
a code compilation method comprising:
analyzing the codes to obtain a compiling list; wherein the compiling list records compiling parameters required for compiling the code;
obtaining a plurality of compiling modules which can be freely compiled according to the functional modules of the codes;
receiving the compiling parameters and checking the compiling parameters;
if the compiling parameter is failed to be checked, terminating the compiling process;
if the compiling parameter is successfully verified, verifying the compiling environment;
and compiling the selected compiling module after the compiling environment is successfully verified.
Optionally, the process of obtaining a plurality of compiling modules that can be freely compiled according to each functional module of the code includes:
and setting check boxes by using an Extended Choice Paramiko plug-in of jenkins, and setting each functional module of the code into a plurality of compiling modules which can be freely compiled.
Optionally, the process of verifying the compiling parameter includes:
and checking the parameter format and the range of the compiling parameters, and the association and the dependency relationship among the compiling parameters.
Optionally, after the compiling parameter verification fails, the method further includes:
through the AnsiColor plug-in of jenkins, the error content is identified and output to the jenkins console.
Optionally, the process of verifying the compiling environment includes:
detecting each compiling tool and dependence;
detecting whether the occupied space of the disk exceeds a preset storage threshold value or not;
and if so, cleaning the useless data according to a preset cleaning rule.
Optionally, the compiling the selected compiling module includes:
performing parallel compiling on the selected compiling modules to obtain compiling results of the compiling modules;
and gathering the compiling results of the compiling modules and carrying out unified compiling.
Optionally, the method further includes:
if any compiling module fails to compile, the whole compiling process is terminated.
Optionally, the method further includes:
archiving and backing up the compiling result of the compiling module to obtain a backup compiling result;
and gathering the compiling results or backup compiling results of all compiling modules, and performing unified compiling.
The invention also discloses a code compiling device, which comprises:
a memory for storing a computer program;
a processor for executing the computer program to implement the code compilation method as described above.
The invention also discloses a computer readable storage medium, on which a computer program is stored, which, when executed by a processor, implements a code compiling method as described above.
In the invention, the code compiling method comprises the following steps: analyzing the codes to obtain a compiling list; wherein, the compiling list records compiling parameters required by compiling the code; obtaining a plurality of compiling modules which can be freely compiled according to each functional module of the code; receiving a compiling parameter and checking the compiling parameter; if the compiling parameter is failed to be checked, the compiling process is terminated; if the compiling parameter is successfully verified, verifying the compiling environment; and compiling the selected compiling module after the compiling environment is successfully verified.
The invention correspondingly divides the compiling module by utilizing the self functional module of the code, can compile the code according to the module, can continuously compile the uncompiled content after interruption, and verifies the compiling parameter and the compiling environment before compiling, thereby reducing the compiling error caused by the two factors in the compiling process and improving the stability and the reliability of the compiling system.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flowchart illustrating a code compiling method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating another code compiling method according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a code compiling method, which is shown in figure 1 and comprises the following steps:
s11: and analyzing the codes to obtain a compiling list.
Specifically, firstly, analyzing the code to be compiled, and confirming the compiling parameters required for compiling the code, that is, for compiling the code, the number of functional modules of the code, the number of scripts to be compiled, and the like are also required to be manually input into what format the code is to be compiled into, for example, the format of # dpg, # exe or # ios, and the like.
S12: and obtaining a plurality of compiling modules which can be freely compiled according to the functional modules of the codes.
Specifically, the code can be divided into a plurality of independent functional modules according to functions at the beginning of writing, and in order to improve the reliability and efficiency of compiling in the subsequent process, a plurality of compiling modules capable of being freely selected and compiled are correspondingly divided from the whole compiling task of compiling the code according to the functional modules of the code, and the compiling modules correspond to the compiling tasks of the corresponding functional modules in the code.
Specifically, a checkbox can be set by using an Extended Choice Paramiko plug-in of jenkins, and each functional module of the code can be set into a plurality of compiling modules which can be freely compiled.
S13: and receiving the compiling parameters and checking the compiling parameters.
Specifically, after receiving the compiling parameters input by the user, verifying the compiling parameters, and judging whether obvious form and format errors exist in the compiling parameters, for example, the compiling parameters input by the user do not meet the preset parameter format requirements, performing range verification on the range of parameter setting, judging whether the parameter setting exceeds a reasonable range, judging whether the association and dependency relationship between the compiling parameters are correct and feasible, judging whether the input parameters are readable and recognizable, and performing one-to-one verification on the items.
S14: if the compiling parameter check fails, the compiling process is terminated.
Specifically, if the verification of the compiling parameter fails, the compiling process is directly terminated, that is, the compiling is not continued in the subsequent steps until the compiling parameter is successfully verified, and then the compiling can be continued.
Specifically, due to the particularity of the compiling process, once compiling is wrong, the content before the mistake is not used, and only recompilation can be performed, so that compiling failure caused by compiling parameter problems in the middle of compiling and time waste are avoided, compiling parameters are verified before compiling, compiling failure caused by compiling parameters in the compiling period is avoided, and compiling reliability is improved.
S15: and if the compiling parameter is successfully verified, verifying the compiling environment.
Specifically, if the compiling parameter is successfully verified, the compiling environment is further verified, and the compiling environment may include the compiling tool itself and the environment in which the compiling tool runs.
Specifically, the process of verifying the compiling environment may specifically include S151 to S153; wherein the content of the first and second substances,
s151: the compilation tools and dependencies are detected.
Specifically, the integrity of each compiling tool can be detected, whether each compiling tool is complete and not damaged or not is judged, and the compiling tool can run normally. The compiling tools may include ruby, jdk, make, and other tools.
S152: detecting whether the occupied space of the disk exceeds a preset storage threshold value or not;
s153: and if so, cleaning the useless data according to a preset cleaning rule.
It can be understood that the compilation result needs to be saved during the compilation, so to ensure that there is enough storage space in the disk, detect whether the disk occupation space exceeds a preset storage threshold, and clean the disk when the disk occupation space exceeds the storage threshold, for example, when the disk occupation space, i.e. the used storage space in the disk, exceeds 80%, the useless data can be cleaned according to a preset cleaning rule; the cleaning rule defines useless data, and the cleaning rule may determine a file whose creation time exceeds a preset time threshold as useless data, for example, define data stored for more than 36 hours as useless data, or may clean a file that is not related to the compiling process.
In addition, in order to avoid the data related to compilation from being deleted by mistake, a file directory which is specially used for storing the data related to compilation can be established, and the files in the file directory are not cleaned when the disk is cleaned.
It will be appreciated that if the storage threshold is not exceeded then compilation continues without cleanup.
S16: and compiling the selected compiling module after the compiling environment is successfully verified.
Specifically, after all the checks are completed, the selected compiling module may be compiled, and the selected compiling module may include all the compiling modules or may include a part of the compiling module, so as to implement a function of compiling a part of the code, and can implement a part of the compiling, for example, in the previous compiling process, the compiling process is temporarily interrupted or a certain compiling module fails to be compiled, and when the compiling needs to be performed again, a compiling module that has not been compiled before can be selected to continue the compiling, and finally, all the compiled modules are integrally compiled, and the whole compiling process of the code is completed.
Therefore, the embodiment of the invention utilizes the self functional module of the code to correspondingly divide the compiling module, can realize compiling the code according to the module, can realize continuously compiling the uncompiled content after interruption, and verifies the compiling parameter and the compiling environment before compiling, thereby reducing the compiling error caused by the two factors in the compiling process and improving the stability and the reliability of the compiling system.
The embodiment of the invention discloses a specific code compiling method, and compared with the previous embodiment, the embodiment further explains and optimizes the technical scheme. Referring to fig. 2, specifically:
s201: analyzing the codes to obtain a compiling list; wherein, the compiling list records compiling parameters required by compiling the code;
s202: obtaining a plurality of compiling modules which can be freely compiled according to each functional module of the code;
s203: receiving a compiling parameter and checking the compiling parameter;
s204: if the compiling parameter is failed to be checked, the compiling process is terminated;
s205: through the AnsiColor plug-in of jenkins, the error content is identified and output to the jenkins console.
Specifically, in order to facilitate the user to quickly correct the error, the detected error content is identified, for example, the error content may be identified by a red mark and output to a jenkins console for display to the user.
S206: if the compiling parameter is successfully verified, verifying the compiling environment;
s207: and after the compiling environment is successfully verified, performing parallel compiling on the selected compiling modules to obtain compiling results of the compiling modules.
Specifically, because the compiling process is modularized, in order to further improve the compiling efficiency, the selected multiple compiling modules can be compiled in parallel and distributed to other servers or environments for parallel compiling, and various modules are compiled in the background by utilizing the shell, and wait for the compiling of all the compiling modules by using the wait of the shell.
S208: and gathering the compiling results of the compiling modules and carrying out unified compiling.
Specifically, the compiling results of all compiling modules are finally collected to carry out final unified compiling, and complete and integral compiling of the codes is obtained.
S209: if any compiling module fails to compile, the whole compiling process is terminated.
Specifically, in the compiling process, if a compiling error of any compiling module is detected, the whole compiling process is terminated, and the compiling problem can be quickly and timely found without waiting for the problem to be found after the compiling is completed.
S210: and archiving and backing up the compiling result of the compiling module to obtain a backup compiling result.
Specifically, the compiling result and version number of each compiling module, md5 value, commit of git code base and other information are filed and backed up in the compiling process, and incremental compiling can be performed in the next compiling according to the backed-up compiling result. That is, the module that has been compiled last time and has not been modified is not compiled any more, and only the compiled module having the modification is compiled. Wherein, the backup can be performed by taking the compiling module as a unit.
S211: and gathering the compiling results or backup compiling results of all compiling modules, and performing unified compiling.
Specifically, the compiling result of the newly compiled compiling module and the backup compiling result compiled before for backup are compiled in a unified manner to obtain a complete compiling result.
Specifically, the code compiling method of the embodiment of the invention can be constructed based on Jenkins.
In addition, the embodiment of the invention also discloses a code compiling device, which comprises:
a memory for storing a computer program;
a processor for executing a computer program to implement the code compilation method as described above.
In addition, the embodiment of the invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the code compiling method is realized.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The technical content provided by the present invention is described in detail above, and the principle and the implementation of the present invention are explained in this document by applying specific examples, and the above description of the examples is only used to help understanding the method of the present invention and the core idea thereof; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. A code compiling method, comprising:
analyzing the codes to obtain a compiling list; wherein the compiling list records compiling parameters required for compiling the code;
obtaining a plurality of compiling modules which can be freely compiled according to the functional modules of the codes;
receiving the compiling parameters and checking the compiling parameters;
if the compiling parameter is failed to be checked, terminating the compiling process;
if the compiling parameter is successfully verified, verifying the compiling environment;
and compiling the selected compiling module after the compiling environment is successfully verified.
2. The code compiling method according to claim 1, wherein the process of obtaining a plurality of freely compilable compiling modules from the functional modules of the code comprises:
and setting check boxes by using an Extended Choice Paramiko plug-in of jenkins, and setting each functional module of the code into a plurality of compiling modules which can be freely compiled.
3. The code compiling method according to claim 1, wherein the process of checking the compiling parameter includes:
and checking the parameter format and the range of the compiling parameters, and the association and the dependency relationship among the compiling parameters.
4. The code compiling method according to claim 1, further comprising, if the compiling parameter fails to be checked:
through the AnsiColor plug-in of jenkins, the error content is identified and output to the jenkins console.
5. The code compiling method according to claim 1, wherein the process of verifying the compiling environment includes:
detecting each compiling tool and dependence;
detecting whether the occupied space of the disk exceeds a preset storage threshold value or not;
and if so, cleaning the useless data according to a preset cleaning rule.
6. The code compiling method according to any one of claims 1 to 5, wherein the compiling the selected compiling module includes:
performing parallel compiling on the selected compiling modules to obtain compiling results of the compiling modules;
and gathering the compiling results of the compiling modules and carrying out unified compiling.
7. The code compiling method according to claim 6, further comprising:
if any compiling module fails to compile, the whole compiling process is terminated.
8. The code compiling method according to claim 7, further comprising:
archiving and backing up the compiling result of the compiling module to obtain a backup compiling result;
and gathering the compiling results or backup compiling results of all compiling modules, and performing unified compiling.
9. A code compiling apparatus characterized by comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the code compilation method of any of claims 1 to 8.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, implements a code compiling method according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011096006.5A CN112269578A (en) | 2020-10-14 | 2020-10-14 | Code compiling method and device and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011096006.5A CN112269578A (en) | 2020-10-14 | 2020-10-14 | Code compiling method and device and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112269578A true CN112269578A (en) | 2021-01-26 |
Family
ID=74338521
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011096006.5A Pending CN112269578A (en) | 2020-10-14 | 2020-10-14 | Code compiling method and device and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112269578A (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101667134A (en) * | 2009-09-23 | 2010-03-10 | 中兴通讯股份有限公司 | Method for constructing compiling system, compiling system and constructing device thereof |
CN108121543A (en) * | 2017-11-30 | 2018-06-05 | 北京奇安信科技有限公司 | A kind of software code process of compilation method and device |
-
2020
- 2020-10-14 CN CN202011096006.5A patent/CN112269578A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101667134A (en) * | 2009-09-23 | 2010-03-10 | 中兴通讯股份有限公司 | Method for constructing compiling system, compiling system and constructing device thereof |
CN108121543A (en) * | 2017-11-30 | 2018-06-05 | 北京奇安信科技有限公司 | A kind of software code process of compilation method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102736978B (en) | A kind of method and device detecting the installment state of application program | |
US7185335B2 (en) | Programmatic application installation diagnosis and cleaning | |
US20110321007A1 (en) | Targeting code sections for correcting computer program product defects using records of a defect tracking system | |
CN106951345B (en) | Consistency test method and device for disk data of virtual machine | |
CN107315616B (en) | Firmware loading method and device and electronic equipment | |
US8863110B2 (en) | Firmware updating system and method | |
EP3474143B1 (en) | Method and apparatus for incremental recovery of data | |
US20130339780A1 (en) | Computing device and method for processing system events of computing device | |
CN109814873B (en) | Code publishing method and device | |
CN110727597A (en) | Method for completing use case based on log troubleshooting invalid codes | |
CN104346206A (en) | Method and system for recovering installation of unloaded software | |
CN108121774B (en) | Data table backup method and terminal equipment | |
CN105608150A (en) | Business data processing method and system | |
CN108073738B (en) | GPIO (general purpose input/output) verification system and method | |
US20090070626A1 (en) | Methods and systems for operating system bare-metal recovery | |
US20140156943A1 (en) | Information processing apparatus, information processing method, and program | |
CN112416379B (en) | Application program installation method and device, computing equipment and readable storage medium | |
CN111352631B (en) | Interface compatibility detection method and device | |
CN110865829A (en) | Database upgrading method, system, device and storage medium | |
CN112269578A (en) | Code compiling method and device and computer readable storage medium | |
KR100853941B1 (en) | Multimedia storage device and data recovering method of the device | |
US9396239B2 (en) | Compiling method, storage medium and compiling apparatus | |
CN115757099A (en) | Automatic test method and device for platform firmware protection recovery function | |
CN110795155B (en) | System starting method and device, electronic equipment and storage medium | |
US11429537B2 (en) | Method, device, and computer program product for managing storage system |
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: 20210126 |
|
RJ01 | Rejection of invention patent application after publication |