CN109828759B - Code compiling method, device, computer device and storage medium - Google Patents

Code compiling method, device, computer device and storage medium Download PDF

Info

Publication number
CN109828759B
CN109828759B CN201811537742.2A CN201811537742A CN109828759B CN 109828759 B CN109828759 B CN 109828759B CN 201811537742 A CN201811537742 A CN 201811537742A CN 109828759 B CN109828759 B CN 109828759B
Authority
CN
China
Prior art keywords
code
module
compiling
function
dependent
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.)
Active
Application number
CN201811537742.2A
Other languages
Chinese (zh)
Other versions
CN109828759A (en
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.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China 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 Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN201811537742.2A priority Critical patent/CN109828759B/en
Publication of CN109828759A publication Critical patent/CN109828759A/en
Application granted granted Critical
Publication of CN109828759B publication Critical patent/CN109828759B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention provides a code compiling method, which comprises the following steps: receiving a compiling instruction of a project code, and acquiring a compiling code module contained in the compiling instruction; acquiring a dependency header file and a dependency function of the compiled code module; determining a dependent code module of the dependent header file of the compiled code module according to the code module of each header file in the project code; creating a null function of the dependent function under a module catalog of the dependent code module, and removing a function implementation of the dependent function; and compiling the compiling code module. The invention also discloses a code compiling device, a computer device and a computer readable storage medium. The invention can selectively compile the code in the code development process, shortens the code compiling time, is beneficial to improving the code debugging efficiency and saves the development time.

Description

Code compiling method, device, computer device and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a code compiling method, a device, a computer device, and a storage medium.
Background
In the code development process, code compilation is generally performed, so that an executable program is generated through the code compilation to perform running debugging on written code. When the code is huge, the code modules contained in the code are more, and more mutual reference situations can exist among the modules, so that only some modules are required to be debugged at any time, the code is always completely compiled in the prior art so as to be run and debugged, the time spent on compiling the code is longer, and the code debugging efficiency is not high.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a code compiling method, apparatus, computer apparatus, and storage medium, which can selectively compile a code, shorten the code compiling time, facilitate improving the code debugging efficiency, and save the development time.
The invention provides a code compiling method, which comprises the following steps:
receiving a compiling instruction of a project code, and acquiring a compiling code module contained in the compiling instruction;
acquiring a dependency header file and a dependency function of the compiled code module;
determining a dependent code module of the dependent header file of the compiled code module according to the code module of each header file in the project code;
Creating a null function of the dependent function under a module catalog of the dependent code module, and removing a function implementation of the dependent function;
and compiling the compiling code module.
In an alternative implementation of the present invention, the creating the null function of the dependent function under the module catalog of the dependent code modules includes:
creating a compiling folder under a module catalog of the dependent code module;
creating a null function of the dependent function in the compiled file.
In an alternative embodiment of the present invention, the method further comprises:
displaying a compiling configuration interface, and acquiring the code module name of the item code selected or input in the compiling configuration interface;
triggering the compiling instruction for the project code according to the code module name selected or input in the compiling configuration interface.
In an optional implementation of the present invention, after the acquiring the compiled code module included in the compiled instruction, the method further includes:
determining whether the compiled code module is a code module which is compiled for the first time;
and if the compiled code module is not the code module compiled for the first time, directly executing the step of compiling the compiled code module.
In an alternative implementation of the present invention, the method further includes:
and scanning the project code, and storing the dependency header files and the dependency functions of each code module in the project code in an array.
In an optional embodiment of the present invention, before the determining, according to the code module to which each header file in the project code belongs, the dependent code module to which the dependent header file of the compiled code module belongs, the method further includes:
and acquiring at least two header files contained in the project code, and acquiring a code module to which each header file belongs, so as to obtain the code module to which each header file belongs in the project code.
In an alternative embodiment of the present invention, the method further comprises:
and storing the names of all the header files in the project codes and the names of code modules to which all the header files belong in a key value database.
The invention also provides a code compiling device, which comprises:
the receiving module is used for receiving a compiling instruction of the project code and acquiring a compiling code module contained in the compiling instruction;
the acquisition module is used for acquiring the dependency header file and the dependency function of the compiled code module;
the determining module is used for determining a dependent code module of the dependent header file of the compiling code module according to the code module of each header file in the project code;
The creating module is used for creating a null function of the dependent function under the module catalog of the dependent code module and removing the function implementation of the dependent function;
and the compiling module is used for compiling the compiling code module.
In an alternative embodiment of the present invention, the creating module creates a null function of the dependent function under a module catalog of the dependent code modules, including:
creating a compiling folder under a module catalog of the dependent code module;
creating a null function of the dependent function in the compiled file.
In an alternative embodiment of the present invention, the apparatus further includes a first triggering module, where the first triggering module is configured to:
displaying a compiling configuration interface, and acquiring the code module name of the item code selected or input in the compiling configuration interface;
triggering the compiling instruction for the project code according to the code module name selected or input in the compiling configuration interface.
In an alternative embodiment of the present invention, the apparatus further includes a second triggering module, where the second triggering module is configured to:
after acquiring a compiled code module contained in the compiling instruction, determining whether the compiled code module is a code module for initial compiling;
If the compiling code module is not the code module for the first compiling, directly triggering the compiling module to compile the compiling code module.
In an alternative embodiment of the present invention, the apparatus further comprises:
and the storage module is used for scanning the project codes and storing the dependency header files and the dependency functions of each code module in the project codes in an array.
In an alternative embodiment of the present invention, the obtaining module is further configured to:
before determining the dependent code module of the dependent header file of the compiling code module according to the code module of each header file in the project code, acquiring at least two header files contained in the project code, and acquiring the code module of each header file to obtain the code module of each header file in the project code.
In an alternative embodiment of the present invention, the saving module is further configured to:
and storing the names of all the header files in the project codes and the names of code modules to which all the header files belong in a key value database.
The present invention also provides a computer apparatus comprising a memory for storing at least one instruction and a processor for executing the at least one instruction to implement the code compiling method according to any embodiment.
The present invention also provides a computer readable storage medium storing at least one instruction that when executed by a processor implements the code compiling method according to any embodiment.
According to the technical scheme, the compiling code module contained in the compiling instruction is obtained by receiving the compiling instruction of the project code; acquiring a dependency header file and a dependency function of the compiled code module; determining a dependent code module of the dependent header file of the compiled code module according to the code module of each header file in the project code; creating a null function of the dependent function under a module catalog of the dependent code module, and removing a function implementation of the dependent function; and compiling the compiling code module. Because the relying head file and the relying function of the compiling code module are acquired firstly, and then the null function of the relying function is created under the module catalog of the relying code module to which the relying head file belongs, when the compiling code module is required to be compiled, the problem that the relying head file and the relying function cannot be compiled without completely compiling the project code is avoided, and the purpose of selective compiling is achieved.
In addition, the dependence function is a null function during compiling, and the compiling efficiency of the null function is extremely high, so that the compiling speed of the code can be greatly improved by the method, the aim of shortening the compiling time of the code is fulfilled, the debugging efficiency of the code is improved, and the development time is saved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a code compiling method according to an embodiment of the present invention;
FIG. 2 is a functional block diagram of a code compiling apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a computer device for implementing a code compiling method according to a preferred embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
As shown in fig. 1, fig. 1 is a flowchart of a code compiling method according to an embodiment of the present invention. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
S11, receiving a compiling instruction of the project code, and acquiring a compiling code module contained in the compiling instruction.
In the software development process, the project code refers to a code program written by a developer, the project code can comprise a plurality of code modules, and different code modules can be written by a plurality of different developers. For example, the project code may include a plurality of modules, such as an image acquisition and image processing module, an image recognition module, a machine learning module, and the like.
The above-described compiling instruction for the item code is an instruction for compiling the item code. Specifically, compiling refers to changing a high-level language (such as java language, c++ language, and object-C language) into a 2-ary language recognizable by a computer.
The above-described compiled code module is a code module for which the compiling instruction indicates compiling, and the compiled code module may be one code module, or two code modules, or two or more code modules. For example, if a certain item code includes an a module, a B module, a C module, a D module, an E module, and an F module, the compiling instruction is indicated to compile the E module if the compiling code module included in the compiling instruction is the E module.
In one possible embodiment, the compiling instruction for the item may be triggered by:
displaying a compiling configuration interface, and acquiring the code module name of the item code selected or input in the compiling configuration interface;
triggering the compiling instruction for the project code according to the code module name selected or input in the compiling configuration interface.
The compiling configuration interface can be displayed on a man-machine interaction interface.
In the compiling configuration interface, any code module in the project code can be selected by a user, or the module name of any code module in the project code is input, after the input, a confirmation button is clicked, and a compiling instruction of the project code is triggered, wherein the instruction is used for compiling the code module selected or input by the user.
In this embodiment, the configuration interface is displayed, and the code module selected or input by the user is obtained, so as to trigger the compiling instruction of the project code, so that the project code can be selectively compiled according to the needs of the user.
S12, obtaining the dependency header file and the dependency function of the compiled code module.
Wherein, the header file is a carrier file containing function and data interface statement.
For example, the header file "math.h" includes commonly used mathematical functions, such as a sine function double sin (double), an inverse trigonometric function double fan (double), an absolute value function double fan (double), and when the commonly used mathematical functions need to be used in the code, the "math.h" is generally introduced into the beginning part of the code according to the corresponding grammar rule statement (for example, in the IOS application development, the header file may be referenced through three grammar formats of #include, # import, @ class), and after the "math.h" is introduced, the mathematical functions included in the header file may be directly called in the code (for example, the inverse trigonometric functions need not be directly used) and the implementation method of each mathematical function in the header file "math.h" need not be defined again.
The dependency header file of the compiled code module refers to the header file referenced in the compiled code module.
Specifically, the dependency header file of the compiled code module may be identified by a corresponding keyword according to a high-level program language used by the compiled code module, for example, if the code in the compiled code module is developed for IOS, the ". H" file included after "# import" is identified, or the ". H" file included after "@ class" is identified.
The above-described dependency function of the compiled code module is defined in the dependency header file, and is a function used in the compiled code module.
That is, there is a certain association between the dependency header file and the dependency function, i.e. the dependency header file contains the dependency function. For example, the introduction of a "test.h" header is declared in the compiled code module, but only a portion of the functions in the "test.h" header are used when specifically used.
In specific implementation, the new classes, objects and used functions in the compiled code module can be scanned and matched with the content (such as class declaration, function declaration and other information) in the header file, so that which functions in the compiled code module are the functions declared in the referenced header file can be identified, and the functions are determined to be dependent functions.
In one possible embodiment, the dependency header file and the dependency function of all or part of the modules in the project code may be obtained and saved in advance, and the method further includes:
and scanning the project code, and storing the dependency header files and the dependency functions of each code module in the project code in an array.
By storing the dependency header files and the dependency functions of each code module in the project code in the array in advance, the method is beneficial to quickly acquiring the dependency header files and the dependency functions of the compiled code modules from the array. For example, the project code is scanned to obtain a project code which comprises a relying header file and a relying function of an A module, a B module, a C module, a D module, an E module and an F module respectively, wherein the relying functions of the E module are a function funcA in the test.h and a function funcB in the test.h respectively, and the relying functions are a function funcD in the math.h respectively, and then the names of the relying header files of the E module and the relying functions are saved in an array. After the compiling instruction of the E module of the project code is obtained, the dependency header file of the E module and the dependency function of the E module can be directly obtained.
S13, determining the dependent code module of the dependent header file of the compiled code module according to the code module of each header file in the project code.
Typically, the project code includes several header files, and each header file is written in a different code module according to the actual requirement of the developer in development.
The code module to which each header file in the project code belongs refers to the code module to which each header file in the project code belongs.
Because the dependent header file is also a header file contained in the project code, the dependent code module to which the dependent header file belongs can be determined according to the code module to which each header file belongs in the project code.
For example, the project code includes 10 header files such as "test.h", "graphic.h", and the ten header files respectively belong to modules such as an a module, a B module, and a C module in the project code, and the code module to which "graphic.h" belongs is the a module, and if the compiled code module is the C module and the dependent header file of the C module is "graphic.h", the dependent code module to which the dependent header file belongs is the a module.
In a possible embodiment, the code module to which each header file in the project code belongs may be determined according to the following manner, and the method further includes:
And acquiring at least two header files contained in the project code, and acquiring a code module to which each header file belongs, so as to obtain the code module to which each header file belongs in the project code.
Specifically, the file name and the file type included in the project file to which the project code belongs may be scanned, so as to obtain the header files included in the project code, and after the header files are obtained, the code module to which each header file belongs is obtained.
Preferably, the method further comprises:
and storing the names of all the header files in the project codes and the names of code modules to which all the header files belong in a key value database.
Among them, the key-value database is also called a kv (key-value) store database. The kv database is a non-relational database in which data is organized, indexed, and stored in the form of key-value pairs.
Because the header file names and the code module names of the header files are also in a one-to-one correspondence data organization form, in the embodiment, the key value database is used for storing, and the key value database is matched with the organization form of the data to be stored, and after the key value database is used for storing, the key value database can be used for quickly searching from the kv database, so that the header files contained in the project codes and the code modules of the header files can be quickly acquired.
S14, creating a null function of the dependent function under the module catalog of the dependent code module, and removing the function implementation of the dependent function.
Wherein, the null function is a complete function, which has a function body, but no statement in the function body.
The function implementation of the dependency function refers to a specific implementation of the dependency function.
Because the compiled code module has the dependent functions, the dependent functions need to be compiled, otherwise, the abnormality such as the functions cannot be found out. According to the embodiment, the realization of compiling specific dependent functions is not needed, only the compiling of the null function is needed, and the compiling speed is greatly improved.
Meanwhile, the function implementation of the dependent function may depend on other functions, so that more compiling time is consumed when compiling is performed in the original compiling method, and in the embodiment, other functions depending on the dependent function are not required to be compiled, so that the compiling speed is further improved.
In the implementation, if the number of the dependent code modules is multiple, the corresponding relation between the dependent code modules and the dependent functions is determined, namely, which dependent code module the dependent functions belong to is determined, and then a null function of the dependent function corresponding to each dependent code module is created under a module catalog of each dependent code module.
In one possible embodiment, the creating the null function of the dependent function under the module catalog of the dependent code modules may include:
creating a compiling folder under a module catalog of the dependent code module;
creating a null function of the dependent function in the compiled file.
In particular, the code module may include other files in addition to the source code, and the files included in the code module exist in a unified directory, that is, the files included in each code module exist in the module directory of the code module.
Therefore, the compiling folder is created under the module directory of the dependent code module, and when compiling, the file is obtained from the compiling folder under the module directory of the dependent code module for compiling.
For example, a folder named PaddingFunc is created, and an empty function of the dependent function is created in the PaddingFunc folder.
In this embodiment, the empty functions of the dependent functions are managed by a single compiled folder, so that file confusion and poor management when the empty functions of the dependent functions are more can be avoided.
And S15, compiling the compiling code module.
Compiling the compiled code module is specifically compiling the source code in the compiled code module.
And when compiling the empty function of the dependent function, the compiling speed is extremely high, and the speed of the dependent function is improved.
In one possible embodiment, after the acquiring the compiled code module included in the compiled instruction, the method further includes:
determining whether the compiled code module is a code module which is compiled for the first time;
and if the compiled code module is not the code module compiled for the first time, directly executing the step of compiling the compiled code module.
When the compiled code module is the code module for the first time, the compiled code module is indicated to be the code module for the first time, and when the compiled code module is not the code module for the first time, the compiled code module is indicated to have been compiled, then there is an empty function of the function on which the compiled code module depends, and the creation is not needed again, and at this time, the operation of step S15 is directly executed.
Or, whether the compiled code module is compiled after the last modification can be specifically judged, if the compiled code module is not compiled after the last modification, the compiled code module is determined to be the code module which is compiled for the first time; if the compiled code module is compiled after the last modification, determining that the compiled code module is not the code module which is compiled for the first time.
By the embodiment, whether the compiling code module is compiled or not is judged, under the condition that the compiling code module is compiled, the dependency head file and the dependency function of the compiling code module and the empty function of the dependency function of the compiling code module are not repeatedly obtained, so that the compiling time can be further shortened, and the compiling efficiency is improved.
The method provided by the invention receives a compiling instruction of a project code and acquires a compiling code module contained in the compiling instruction; acquiring a dependency header file and a dependency function of the compiled code module; determining a dependent code module of the dependent header file of the compiled code module according to the code module of each header file in the project code; creating a null function of the dependent function under a module catalog of the dependent code module, and removing a function implementation of the dependent function; and compiling the compiling code module. Because the relying head file and the relying function of the compiling code module are acquired firstly, and then the null function of the relying function is created under the module catalog of the relying code module to which the relying head file belongs, when the compiling code module is required to be compiled, the problem that the relying head file and the relying function cannot be compiled without completely compiling the project code is avoided, and the purpose of selective compiling is achieved.
In addition, the dependence function is a null function during compiling, and the compiling efficiency of the null function is extremely high, so that the compiling speed of the code can be greatly improved by the method, the aim of shortening the compiling time of the code is fulfilled, the debugging efficiency of the code is improved, and the development time is saved.
Fig. 2 is a functional block diagram of a code compiling apparatus according to an embodiment of the present invention. The code compiling apparatus includes a receiving module 210, an obtaining module 220, a determining module 230, a creating module 240, and a compiling module 250. The module referred to by the present invention refers to a series of computer program segments capable of being executed by a processor and of performing a fixed function, which are stored in the memory of the android mobile terminal. In the present embodiment, the functions of the respective modules will be described in detail in the following embodiments.
The receiving module 210 is configured to receive a compiling instruction for the project code, and obtain a compiling code module included in the compiling instruction.
In the software development process, the project code refers to a code program written by a developer, the project code can comprise a plurality of code modules, and different code modules can be written by a plurality of different developers. For example, the project code may include a plurality of modules, such as an image acquisition and image processing module, an image recognition module, a machine learning module, and the like.
The above-described compiling instruction for the item code is an instruction for compiling the item code. Specifically, compiling refers to changing a high-level language (such as java language, c++ language, and object-C language) into a 2-ary language recognizable by a computer.
The above-described compiled code module is a code module for which the compiling instruction indicates compiling, and the compiled code module may be one code module, or two code modules, or two or more code modules. For example, if a certain item code includes an a module, a B module, a C module, a D module, an E module, and an F module, the compiling instruction is indicated to compile the E module if the compiling code module included in the compiling instruction is the E module.
In a possible embodiment, the compiling instruction of the item can be triggered by a first triggering module included in the device, and the first triggering module is used for:
displaying a compiling configuration interface, and acquiring the code module name of the item code selected or input in the compiling configuration interface;
triggering the compiling instruction for the project code according to the code module name selected or input in the compiling configuration interface.
The compiling configuration interface can be displayed on a man-machine interaction interface.
In the compiling configuration interface, any code module in the project code can be selected by a user, or the module name of any code module in the project code is input, after the input, a confirmation button is clicked, and a compiling instruction of the project code is triggered, wherein the instruction is used for compiling the code module selected or input by the user.
In this embodiment, the configuration interface is displayed, and the code module selected or input by the user is obtained, so as to trigger the compiling instruction of the project code, so that the project code can be selectively compiled according to the needs of the user.
And the obtaining module 220 is configured to obtain the dependency header file and the dependency function of the compiled code module.
Wherein, the header file is a carrier file containing function and data interface statement.
For example, the header file "math.h" includes commonly used mathematical functions, such as a sine function double sin (double), an inverse trigonometric function double fan (double), an absolute value function double fan (double), and when the commonly used mathematical functions need to be used in the code, the "math.h" is generally introduced into the beginning part of the code according to the corresponding grammar rule statement (for example, in the IOS application development, the header file may be referenced through three grammar formats of #include, # import, @ class), and after the "math.h" is introduced, the mathematical functions included in the header file may be directly called in the code (for example, the inverse trigonometric functions need not be directly used) and the implementation method of each mathematical function in the header file "math.h" need not be defined again.
The dependency header file of the compiled code module refers to the header file referenced in the compiled code module.
Specifically, the dependency header file of the compiled code module may be identified by a corresponding keyword according to a high-level program language used by the compiled code module, for example, if the code in the compiled code module is developed for IOS, the ". H" file included after "# import" is identified, or the ". H" file included after "@ class" is identified.
The above-described dependency function of the compiled code module is defined in the dependency header file, and is a function used in the compiled code module.
That is, there is a certain association between the dependency header file and the dependency function, i.e. the dependency header file contains the dependency function. For example, the introduction of a "test.h" header is declared in the compiled code module, but only a portion of the functions in the "test.h" header are used when specifically used.
In specific implementation, the new classes, objects and used functions in the compiled code module can be scanned and matched with the content (such as class declaration, function declaration and other information) in the header file, so that which functions in the compiled code module are the functions declared in the referenced header file can be identified, and the functions are determined to be dependent functions.
In a possible embodiment, a saving module included in the apparatus of the present invention may pre-acquire and save the dependency header files and the dependency functions of all or part of the modules in the project code, where the saving module is configured to:
and scanning the project code, and storing the dependency header files and the dependency functions of each code module in the project code in an array.
By storing the dependency header files and the dependency functions of each code module in the project code in the array in advance, the method is beneficial to quickly acquiring the dependency header files and the dependency functions of the compiled code modules from the array. For example, the project code is scanned to obtain a project code which comprises a relying header file and a relying function of an A module, a B module, a C module, a D module, an E module and an F module respectively, wherein the relying functions of the E module are a function funcA in the test.h and a function funcB in the test.h respectively, and the relying functions are a function funcD in the math.h respectively, and then the names of the relying header files of the E module and the relying functions are saved in an array. After the compiling instruction of the E module of the project code is obtained, the dependency header file of the E module and the dependency function of the E module can be directly obtained.
And the determining module 230 is configured to determine, according to the code modules to which each header file in the project code belongs, the dependent code module to which the dependent header file of the compiled code module belongs.
Typically, the project code includes several header files, and each header file is written in a different code module according to the actual requirement of the developer in development.
The code module to which each header file in the project code belongs refers to the code module to which each header file in the project code belongs.
Because the dependent header file is also a header file contained in the project code, the dependent code module to which the dependent header file belongs can be determined according to the code module to which each header file belongs in the project code.
For example, the project code includes 10 header files such as "test.h", "graphic.h", and the ten header files respectively belong to modules such as an a module, a B module, and a C module in the project code, and the code module to which "graphic.h" belongs is the a module, and if the compiled code module is the C module and the dependent header file of the C module is "graphic.h", the dependent code module to which the dependent header file belongs is the a module.
In a possible embodiment, the device of the invention can include an acquisition module for acquiring a code module to which each header file in the project code belongs, where the acquisition module is configured to:
Before determining the dependent code module of the dependent header file of the compiling code module according to the code module of each header file in the project code, acquiring at least two header files contained in the project code, and acquiring the code module of each header file to obtain the code module of each header file in the project code.
Specifically, the file name and the file type included in the project file to which the project code belongs may be scanned, so as to obtain the header files included in the project code, and after the header files are obtained, the code module to which each header file belongs is obtained.
Preferably, the device of the present invention may further store, by a storage module, names of each header file in the project code and names of code modules to which each header file belongs, where the storage module is further configured to: and storing the names of all the header files in the project codes and the names of code modules to which all the header files belong in a key value database.
Among them, the key-value database is also called a kv (key-value) store database. The kv database is a non-relational database in which data is organized, indexed, and stored in the form of key-value pairs.
Because the header file names and the code module names of the header files are also in a one-to-one correspondence data organization form, in the embodiment, the key value database is used for storing, and the key value database is matched with the organization form of the data to be stored, and after the key value database is used for storing, the key value database can be used for quickly searching from the kv database, so that the header files contained in the project codes and the code modules of the header files can be quickly acquired.
A creating module 240, configured to create a null function of the dependent function under the module catalog of the dependent code module, and remove a function implementation of the dependent function.
Wherein, the null function is a complete function, which has a function body, but no statement in the function body.
The function implementation of the dependency function refers to a specific implementation of the dependency function.
Because the compiled code module has the dependent functions, the dependent functions need to be compiled, otherwise, the abnormality such as the functions cannot be found out. According to the embodiment, the realization of compiling specific dependent functions is not needed, only the compiling of the null function is needed, and the compiling speed is greatly improved.
Meanwhile, the function implementation of the dependent function may depend on other functions, so that more compiling time is consumed when compiling is performed in the original compiling method, and in the embodiment, other functions depending on the dependent function are not required to be compiled, so that the compiling speed is further improved.
In the implementation, if the number of the dependent code modules is multiple, the corresponding relation between the dependent code modules and the dependent functions is determined, namely, which dependent code module the dependent functions belong to is determined, and then a null function of the dependent function corresponding to each dependent code module is created under a module catalog of each dependent code module.
In one possible embodiment, the creating module creates a null function of the dependent function under a module catalog of the dependent code modules may include:
creating a compiling folder under a module catalog of the dependent code module;
creating a null function of the dependent function in the compiled file.
In particular, the code module may include other files in addition to the source code, and the files included in the code module exist in a unified directory, that is, the files included in each code module exist in the module directory of the code module.
Therefore, the compiling folder is created under the module directory of the dependent code module, and when compiling, the file is obtained from the compiling folder under the module directory of the dependent code module for compiling.
For example, a folder named PaddingFunc is created, and an empty function of the dependent function is created in the PaddingFunc folder.
In this embodiment, the empty functions of the dependent functions are managed by a single compiled folder, so that file confusion and poor management when the empty functions of the dependent functions are more can be avoided.
And the compiling module 250 is used for compiling the compiling code module.
Compiling the compiled code module is specifically compiling the source code in the compiled code module.
And when compiling the empty function of the dependent function, the compiling speed is extremely high, and the speed of the dependent function is improved.
In a possible embodiment, the device of the present invention further includes a second triggering module, where the second triggering module is configured to:
after acquiring a compiled code module contained in the compiling instruction, determining whether the compiled code module is a code module for initial compiling;
if the compiling code module is not the code module for the first compiling, directly triggering the compiling module to compile the compiling code module.
When the compiled code module is the code module for the first time, the compiled code module is indicated to be the code module for the first time, when the compiled code module is not the code module for the first time, the compiled code module is indicated to have been compiled, then the empty function of the function on which the compiled code module depends exists, the creation is not needed again, and the compiled code module is directly triggered to compile the compiled code module. .
Or, whether the compiled code module is compiled after the last modification can be specifically judged, if the compiled code module is not compiled after the last modification, the compiled code module is determined to be the code module which is compiled for the first time; if the compiled code module is compiled after the last modification, determining that the compiled code module is not the code module which is compiled for the first time.
By the embodiment, whether the compiling code module is compiled or not is judged, under the condition that the compiling code module is compiled, the dependency head file and the dependency function of the compiling code module and the empty function of the dependency function of the compiling code module are not repeatedly obtained, so that the compiling time can be further shortened, and the compiling efficiency is improved.
The code compiling device provided by the invention receives a compiling instruction for project codes through a receiving module, and obtains a compiling code module contained in the compiling instruction; the acquisition module acquires a relying header file and a relying function of the compiling code module; the determining module determines a dependent code module of the dependent header file of the compiling code module according to the code module of each header file in the project code; the creation module creates a null function of the dependent function under the module catalog of the dependent code module, and removes the function implementation of the dependent function; and the compiling module compiles the compiling code module. Because the relying head file and the relying function of the compiling code module are acquired firstly, and then the null function of the relying function is created under the module catalog of the relying code module to which the relying head file belongs, when the compiling code module is required to be compiled, the problem that the relying head file and the relying function cannot be compiled without completely compiling the project code is avoided, and the purpose of selective compiling is achieved.
In addition, the dependence function is a null function during compiling, and the compiling efficiency of the null function is extremely high, so that the compiling speed of the code can be greatly improved by the method, the aim of shortening the compiling time of the code is fulfilled, the debugging efficiency of the code is improved, and the development time is saved.
The integrated units implemented in the form of software functional modules described above may be stored in a computer readable storage medium. The software functional modules described above are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform some of the steps of the methods described in the various embodiments of the invention.
Fig. 3 is a schematic structural diagram of a computer device according to a preferred embodiment of the present invention for implementing a code compiling method. The computer means comprise at least one transmitting means 31, at least one memory 32, at least one processor 33, at least one receiving means 34 and at least one communication bus. Wherein the communication bus is used to enable connection communication between these components.
The computer apparatus is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable gate array (Field-Programmable Gate Array, FPGA), a digital processor (Digital Signal Processor, DSP), an embedded device, and the like. The computer apparatus may also include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network server, a server group composed of a plurality of network servers, or a Cloud based Cloud Computing (Cloud Computing) composed of a large number of hosts or network servers, wherein Cloud Computing is one of distributed Computing, and is a super virtual computer composed of a group of loosely coupled computer sets.
The computer device may be, but is not limited to, any electronic product that can perform man-machine interaction with a user through a keyboard, a touch pad, or a voice control device, for example, a terminal such as a tablet computer, a smart phone, or a monitoring device.
The network in which the computer device is located includes, but is not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), and the like.
The receiving means 34 and the transmitting means 31 may be wired transmission ports, or may be wireless devices, for example, including antenna means for performing data communication with other devices.
The memory 32 is used for storing program codes. The Memory 32 may be a circuit with a Memory function, such as a RAM (Random-Access Memory), a FIFO (First In First Out, first-in first-out Memory), etc., which is not in physical form in the integrated circuit. Alternatively, the memory 32 may be a physical memory, such as a memory bank, a TF Card (Trans-flash Card), a smart media Card (smart media Card), a secure digital Card (secure digital Card), a flash memory Card (flash Card), or the like.
The processor 33 may comprise one or more microprocessors, digital processors. The processor 33 may call program code stored in the memory 32 to perform the relevant functions. For example, the respective modules described in fig. 2 are program codes stored in the memory 32 and executed by the processor 33 to implement a code compiling method. The processor 33 is also called a central processing Unit (CPU, central Processing Unit), which is a very large scale integrated circuit and is an operation Core (Core) and a Control Unit (Control Unit).
In the several embodiments provided in the present invention, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned. Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (9)

1. A method of compiling code, the method comprising:
receiving a compiling instruction of a project code, and acquiring a compiling code module contained in the compiling instruction;
acquiring a dependency header file and a dependency function of the compiled code module, wherein the dependency function is defined in the dependency header file and is a function used in the compiled code module;
determining a dependent code module of the dependent header file of the compiled code module according to the code module of each header file in the project code;
creating a null function of the dependent function under the module catalog of the dependent code module, and removing the function implementation of the dependent function, wherein creating the null function of the dependent function under the module catalog of the dependent code module comprises: creating a compiling folder under a module catalog of the dependent code module; creating a null function of the dependent function in the compiling folder;
And compiling the compiling code module.
2. The method of claim 1, wherein the method further comprises:
displaying a compiling configuration interface, and acquiring the code module name of the item code selected or input in the compiling configuration interface;
triggering the compiling instruction of the project code according to the code module name selected or input in the compiling configuration interface.
3. The method of claim 1, wherein after the acquiring the compiled code module included in the compiled instruction, further comprising:
determining whether the compiled code module is a code module which is compiled for the first time;
and if the compiled code module is not the code module compiled for the first time, directly executing the step of compiling the compiled code module.
4. The method of claim 1, wherein the method further comprises:
and scanning the project code, and storing the dependency header files and the dependency functions of each code module in the project code in an array.
5. The method according to any one of claims 1 to 2, wherein before the determining, from the code modules to which the respective header files in the project code belong, the dependent code modules to which the dependent header files of the compiled code modules belong, the method further comprises:
And acquiring each header file contained in the project code, and acquiring a code module to which each header file belongs to obtain the code module to which each header file belongs in the project code.
6. The method of claim 5, wherein the method further comprises:
and storing the names of all the header files in the project codes and the names of code modules to which all the header files belong in a key value database.
7. A code compiling apparatus, the apparatus comprising:
the receiving module is used for receiving a compiling instruction of the project code and acquiring a compiling code module contained in the compiling instruction;
the acquisition module is used for acquiring a dependency header file and a dependency function of the compiled code module, wherein the dependency function is defined in the dependency header file and is a function used in the compiled code module;
the determining module is used for determining a dependent code module of the dependent header file of the compiling code module according to the code module of each header file in the project code;
a creating module, configured to create a null function of the dependent function under a module directory of the dependent code module, and remove a function implementation of the dependent function, where the creating the null function of the dependent function under the module directory of the dependent code module includes: creating a compiling folder under a module catalog of the dependent code module; creating a null function of the dependent function in the compiling folder;
And the compiling module is used for compiling the compiling code module.
8. A computer apparatus comprising a memory for storing at least one instruction and a processor for executing the at least one instruction to implement the code compiling method of any one of claims 1 to 6.
9. A computer-readable storage medium having stored thereon computer instructions, characterized by: the computer instructions, when executed by a processor, implement the code compilation method of any of claims 1 to 6.
CN201811537742.2A 2018-12-15 2018-12-15 Code compiling method, device, computer device and storage medium Active CN109828759B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811537742.2A CN109828759B (en) 2018-12-15 2018-12-15 Code compiling method, device, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811537742.2A CN109828759B (en) 2018-12-15 2018-12-15 Code compiling method, device, computer device and storage medium

Publications (2)

Publication Number Publication Date
CN109828759A CN109828759A (en) 2019-05-31
CN109828759B true CN109828759B (en) 2023-07-18

Family

ID=66858867

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811537742.2A Active CN109828759B (en) 2018-12-15 2018-12-15 Code compiling method, device, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN109828759B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112394942B (en) * 2020-11-24 2021-06-04 深圳君南信息***有限公司 Distributed software development compiling method and software development platform based on cloud computing
CN112882720B (en) * 2021-03-15 2024-03-22 抖音视界有限公司 Compiling method and device
CN114003834A (en) * 2021-10-19 2022-02-01 山东百盟信息技术有限公司 Method and device for optimizing Trace _ Log of Log module in webpage rendering engine

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0463583A2 (en) * 1990-06-25 1992-01-02 Hewlett-Packard Company Architecture neutral distribution format (ANDF) compiler using an intermediate language
US6106574A (en) * 1997-12-04 2000-08-22 Unisys Corp. Computer-implemented object-oriented method for relating objects in a compiler to locations in the source program and to inlined call histories
CN101281488A (en) * 2007-04-06 2008-10-08 上海宇梦通信科技有限公司 Inner core debug method of Linux operating system
CN102402452A (en) * 2011-12-12 2012-04-04 深圳市共进电子股份有限公司 Compiling method and device
CN105183571A (en) * 2015-09-22 2015-12-23 小米科技有限责任公司 Function calling method and device
CN106325970A (en) * 2016-10-17 2017-01-11 宁德时代新能源科技股份有限公司 Compiling method and compiling system
CN106843995A (en) * 2017-01-25 2017-06-13 杭州迪普科技股份有限公司 A kind of file compiling method and device
CN107643893A (en) * 2016-07-22 2018-01-30 腾讯科技(深圳)有限公司 A kind of program detecting method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0463583A2 (en) * 1990-06-25 1992-01-02 Hewlett-Packard Company Architecture neutral distribution format (ANDF) compiler using an intermediate language
US6106574A (en) * 1997-12-04 2000-08-22 Unisys Corp. Computer-implemented object-oriented method for relating objects in a compiler to locations in the source program and to inlined call histories
CN101281488A (en) * 2007-04-06 2008-10-08 上海宇梦通信科技有限公司 Inner core debug method of Linux operating system
CN102402452A (en) * 2011-12-12 2012-04-04 深圳市共进电子股份有限公司 Compiling method and device
CN105183571A (en) * 2015-09-22 2015-12-23 小米科技有限责任公司 Function calling method and device
CN107643893A (en) * 2016-07-22 2018-01-30 腾讯科技(深圳)有限公司 A kind of program detecting method and device
CN106325970A (en) * 2016-10-17 2017-01-11 宁德时代新能源科技股份有限公司 Compiling method and compiling system
CN106843995A (en) * 2017-01-25 2017-06-13 杭州迪普科技股份有限公司 A kind of file compiling method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘玉良 ; 贾子申 ; 刘丽辉 ; 杨伟明 ; .基于MSP430单片机的软件代码快速开发.天津科技大学学报.2010,第25卷(第03期),全文. *
谢羽威 等.基于模板的粗粒度可重构处理器编译环境设计.《微电子学与计算机》.2013,第第30卷卷(第第30卷期),全文. *

Also Published As

Publication number Publication date
CN109828759A (en) 2019-05-31

Similar Documents

Publication Publication Date Title
CN107943691B (en) Method and device for automatically generating function test page of intelligent contract
CN111026470B (en) System and method for verification and conversion of input data
CN109828759B (en) Code compiling method, device, computer device and storage medium
CN112015430A (en) JavaScript code translation method and device, computer equipment and storage medium
CN112559354A (en) Front-end code specification detection method and device, computer equipment and storage medium
CN110928802A (en) Test method, device, equipment and storage medium based on automatic generation of case
CN104679500B (en) Method and device for realizing automatic generation of entity class
CN112486490B (en) Front-end code packaging method and device, electronic equipment and storage medium
CN113268500B (en) Service processing method and device and electronic equipment
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN110688096A (en) Method, device, medium and electronic equipment for constructing application program containing plug-in
CN107391528B (en) Front-end component dependent information searching method and equipment
CN111240772A (en) Data processing method and device based on block chain and storage medium
CN108595178B (en) Hook-based data acquisition method, device and equipment
CN111290996A (en) Document format conversion method, device, equipment and readable storage medium
CN110941655A (en) Data format conversion method and device
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
CN115705294B (en) Method, device, electronic equipment and medium for acquiring function call information
CN108628909B (en) Information pushing method and device
CN113656044B (en) Android installation package compression method and device, computer equipment and storage medium
CN114385155A (en) vue project visualization tool generation method, device, equipment and storage medium
CN110347471B (en) Hierarchical display component system, display component calling method and device
CN112835901A (en) File storage method and device, computer equipment and computer readable storage medium
CN110737431A (en) Software development method, development platform, terminal device and storage medium
CN111488286A (en) Method and device for independently developing Android module

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
GR01 Patent grant
GR01 Patent grant