CN110737437A - compiling method and device based on code integration - Google Patents

compiling method and device based on code integration Download PDF

Info

Publication number
CN110737437A
CN110737437A CN201910228017.5A CN201910228017A CN110737437A CN 110737437 A CN110737437 A CN 110737437A CN 201910228017 A CN201910228017 A CN 201910228017A CN 110737437 A CN110737437 A CN 110737437A
Authority
CN
China
Prior art keywords
compiling
module
modules
file
files
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910228017.5A
Other languages
Chinese (zh)
Inventor
赫昆迎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Ingenic Semiconductor Co Ltd
Original Assignee
Beijing Ingenic Semiconductor Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Ingenic Semiconductor Co Ltd filed Critical Beijing Ingenic Semiconductor Co Ltd
Publication of CN110737437A publication Critical patent/CN110737437A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Abstract

The invention provides compiling methods and devices based on code integration, wherein the method comprises the steps of obtaining development files of all modules in a target project, extracting modules depended on by compiling and files depended on by compiling from the development files of all modules, generating total sets of the modules depended on by compiling and the files depended on by compiling of all the modules, cooperating the total sets into a compiling dependency relationship set of the target project, and compiling the target project according to the compiling dependency relationship set.

Description

compiling method and device based on code integration
Technical Field
The invention relates to the technical field of computers, in particular to compiling methods and devices based on code integration.
Background
In order to achieve the correct and orderly compilation of code, the generally requires Makefile organization compilation, wherein Makefile defines series of rules to specify which files need to be compiled first, which files need to be compiled later, which files need to be recompiled, or other more complex operations.
These two dependencies are explained below:
1) dependence on running:
for example, the A module is compiled to generate an a program, the B module is compiled to generate a B program, and the compiling processes of the A module and the B module are not dependent on each other, but the a program runs by requiring the B program to create certain environments in advance, and if the B program does not create the environments in advance, the a program can be mistaken or cannot be executed in the running process.
2) Dependencies in compilation:
this dependency condition mostly occurs in the dependency between the running program and the library, and two modules A, B are still taken as an example: some functions in the module a are implemented in the module B, that is, the module a needs to link the target file compiled by the module B when compiling and linking, so as to find the implementation of all functions.
However, in the actual implementation, because some projects are huge and often use libraries or programs of third parties, the programs of the third parties often have dependency relationship of , in order to solve the dependency problem in the compilation, two sets of systems are often needed to be used simultaneously, the dependency problem between modules is solved through a system similar to menuconfig, and the problem of the compilation is solved through Makefile.
Aiming at the problem that two sets of systems are needed, an effective solution is not provided at present.
Disclosure of Invention
The embodiment of the invention provides compiling methods based on code integration, so as to achieve the purpose of simply and efficiently solving the dependency problem among modules, and the method comprises the following steps:
acquiring development files of all modules in a target project, wherein the development files carry compiling dependency information of the modules;
extracting modules and files which are depended on by compiling of each module from development files of the modules;
compiling modules depended on by the modules and files depended on by the compiling modules to generate total sets, and combining the total sets into a compiling dependency relationship set of the target project;
and compiling the target project according to the compiling dependency relationship set.
In implementations, compiling the target project according to the set of compilation dependencies includes:
in the compiling process, searching whether a file and a module which are depended on by the current compiling exist in the compiling dependency relationship set;
if not, the non-existent dependent file and the non-existent dependent module are compiled first.
In embodiments, the compiling dependency information of the module comprises a file generated after compiling, a method for generating the file, a file on which compiling depends, and a module on which compiling depends.
In embodiments, the development file exists in a.mk file format.
In embodiments, the method is applied to embedded Linux development.
The embodiment of the invention also provides compiling devices based on code integration, so as to achieve the purpose of simply and efficiently solving the dependency problem among the modules, and the device comprises:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring development files of all modules in a target project, and the development files carry compiling dependency information of the modules;
the extraction module is used for extracting modules and files which are depended on by compiling of each module from the development files of the modules;
the generation module is used for generating total sets of modules depended on by compiling of the modules and files depended on by compiling, and the total sets are used as compiling dependency relationship sets of the target project;
and the compiling module is used for compiling the target engineering according to the compiling dependency relationship set.
In embodiments, the compiling module includes:
the searching unit is used for searching whether a file and a module which are depended on by the current compiling exist in the compiling dependency relationship set in the compiling process;
and the preprocessing unit is used for compiling to obtain a non-existent dependent file and a non-existent dependent module under the condition of determining non-existent.
In embodiments, the compiling dependency information of the module comprises a file generated after compiling, a method for generating the file, a file on which compiling depends, and a module on which compiling depends.
In embodiments, the development file exists in a.mk file format.
In embodiments, the method is applied to embedded Linux development.
In the embodiment of the invention, development files carrying compiling dependency information of modules are set, then the modules on which each module is compiled and the files on which each module is compiled are added into sets before compiling, and target engineering is compiled based on the sets.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and constitute a part of this application and not limiting of the invention, are illustrated in the accompanying drawings, in which:
FIG. 1 is a method flow diagram of a method of compilation based on code integration according to an embodiment of the invention;
fig. 2 is a block diagram of a compiling apparatus based on code integration according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further with reference to the following embodiments and accompanying drawings.
Aiming at the dependency problem in the existing compiling process, the method can be realized by the following steps:
1) dependence on running:
for this case, describes the dependency relationship in Kconfig to ensure that when Makefile is used to compile and generate a program, B program will be generated.
The method comprises the steps that a Kconfig file is a configuration interface presented by Menuconfig, and is presented by reading the Kconfig file, the Kconfig can describe and express the dependency relationship among modules through syntax description, so that the Menuconfig presents the dependency relationship among the modules when the interface is presented, the Menuconfig is menu type configuration, and when a plurality of modules exist in projects, the Menuconfig can select which files are compiled and which files are not compiled in cooperation with Makefile configuration.
2) Dependencies in compilation:
in order to solve the dependency relationship, a config.in (similar to Kconfig in function) is introduced into the buildrop, and the dependency relationship is clarified in the interface description, so that the dependent module is compiled preferentially in the compiling process, that is, the B module in the above example is compiled preferentially, and when the a module is compiled, the content of the dependent B module is completely ready and can be compiled normally.
Therefore, in order to solve the dependency problem in the compiling, two sets of systems need to be used at the same time, that is, the dependency problem between the modules needs to be solved through a system similar to menuconfig, and the compiling problem needs to be solved through Makefile.
To this end, in this example, compilation methods based on code integration are provided.
Where the context permits, reference to element or component or step(s), etc. should not be construed as limited to only of the elements, components, or steps, but may be or more of the elements, components, or steps, etc.
Although the flow described below includes operations that occur in a particular order, it should be appreciated that the processes may include more or less operations that may be performed sequentially or in parallel (e.g., using parallel processors or a multi-threaded environment). As shown in FIG. 1, the method includes:
step 101: acquiring development files of all modules in a target project, wherein the development files carry compiling dependency information of the modules;
step 102: extracting modules and files which are depended on by compiling of each module from development files of the modules;
103, generating total sets of modules depended on by the modules and files depended on by the modules, and combining the total sets into a compiling dependency relationship set of the target project;
step 104: and compiling the target project according to the compiling dependency relationship set.
In the above example, a development file carrying compiling dependency information of a module is set for each module, then before compiling, the module on which each module is compiled and the file on which each module is compiled are added to sets, and a target project is compiled based on the sets.
Specifically, the compiling the target project according to the compiling dependency relationship set in step 104 may include:
s1: in the compiling process, searching whether a file and a module which are depended on by the current compiling exist in the compiling dependency relationship set;
s2: if not, the non-existent dependent file and the non-existent dependent module are compiled first.
For example, when Makefile executes compilation of the general object, it may first find a dependent file, that is, an object file compiled by all modules, and if the total object-dependent file does not exist or some files do not exist, Makefile may automatically generate the lacking file according to a generation rule (command) of previously collecting the lacking file, in this way, all modules may be efficiently compiled.
The compiling dependency information of the modules carried in the development file may include, but is not limited to: a file generated after compilation, a method of generating a file, a file on which compilation depends, and a module on which compilation depends. The development file may exist in a file format of.
In the embodiments, the method can be applied to embedded Linux development.
The above method is described below with reference to specific examples, however, it should be noted that the specific examples are only for better describing the present application and should not be construed as limiting the present application.
In this example, ways are provided, and the compiling dependency and compiling problem between modules can be solved at the same time only by sets of Makefile systems.
Specifically, the Makefile compiling rule is described as follows:
Target......:prerequisites......
command
wherein, Target represents the Target file, prerequisites represents the Target or file on which the Target needs to be generated, and Command represents the Command to be executed to generate the Target.
The code indicates the dependency relationship of files or modules, that is, or more target files of target depend on files in prequiries, the generation rule is defined in command, Makefile judges whether prequiries exist before compiling target, if no target exists in prequiries, the generation rule of the target which does not exist in prequiries is preferably searched for so as to generate the target which depends on the target first, moreover, if more than files in prequiries are newer than the target file, the command defined by command is executed, which is the rule of Makefile and is the core content of Makefile.
In this example, it is considered that the rule of Makefile itself can be used to perform systematic and ordered processing on a plurality of modules, and all modules are compiled one by using the dependency rule of Makefile.
However, there are two problems to be solved by the above solution: 1) relationships between all modules; 2) the problem of coupling among a plurality of modules is specifically:
1) the relationship between all modules is mainly divided into two directions: and (3) the collection of module information, how to promote the compiling of all modules.
For this purpose, files with mk as a suffix name can be defined in each module in the project as a development file of Makefile, so as to be subsequently defined as a build.mk file by . information of a name for only identification, a target file generated after compiling, a method of compiling and the like is defined in the file.
In this way, when Makefile executes compilation of the total target, it may first find a dependent file, that is, a target file compiled by all modules, and if the file on which the total target depends does not exist, or some files do not exist, Makefile may automatically generate the deleted file according to a generation rule (command) previously collected for the deleted file, and according to this way, all modules may be effectively compiled.
2) There is a problem of coupling between the plurality of modules.
That is, if modules depend on other modules or a plurality of modules in the compiling process, the dependency needs to be declared in the build.mk of the modules, so that the dependency between the modules can be analyzed in the information collection stage of all the modules.
In this example, the dependency and compilation problem between modules in the engineering can be completed only by using the Makefile method for processing the dependency relationship, so that the method is very convenient when a third-party module is assembled in engineering use.
Based on the same inventive concept as , compiling devices based on code integration are further provided in the embodiments of the present invention, as described in the following embodiments, since the principle of solving the problem of the compiling devices based on code integration is similar to that of the compiling method based on code integration, the implementation of the compiling devices based on code integration can refer to the implementation of the compiling method based on code integration, and the repeated description is omitted.
An obtaining module 201, configured to obtain a development file of each module in a target project, where the development file carries compilation dependency information of the module;
an extraction module 202, configured to extract a module on which each module depends for compilation and a file on which each module depends for compilation from the development files of the modules;
a generating module 203, configured to generate total sets from the modules depended on by compiling each module and the files depended on by compiling, and cooperate the total sets as a compiling dependency relationship set of the target project;
and the compiling module 204 is configured to compile the target project according to the compiling dependency relationship set.
In embodiments, compiling module 204 may include a searching unit configured to search, in the compiling process, whether a file and a module that are depended on by the current compiling exist in the compiling dependency relationship set, and a preprocessing unit configured to, in a case where it is determined that the file and the module that are depended on do not exist, compile the file and the module that are depended on without existence.
In embodiments, the compilation dependency information for a module may include, but is not limited to, a file generated after compilation, a method of generating a file, a file on which compilation depends, and a module on which compilation depends.
In embodiments, the development file may exist in a.mk file format.
In embodiments, the device can be applied to embedded Linux development.
In another embodiments, software is provided, which is used to implement the technical solutions described in the above embodiments and preferred embodiments.
In another embodiments, storage media are provided, which store the above software, including but not limited to optical disks, floppy disks, hard disks, removable memory, and the like.
From the above description, it can be seen that the technical effects of the embodiment of the present invention are achieved by setting a development file carrying compilation dependency information of modules, then adding the modules on which each module is compiled and the files on which each module is compiled to sets before compilation, and compiling a target project based on the sets.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes may be made to the embodiment of the present invention by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1, A compiling method based on code integration, comprising:
acquiring development files of all modules in a target project, wherein the development files carry compiling dependency information of the modules;
extracting modules and files which are depended on by compiling of each module from development files of the modules;
compiling modules depended on by the modules and files depended on by the compiling modules to generate total sets, and combining the total sets into a compiling dependency relationship set of the target project;
and compiling the target project according to the compiling dependency relationship set.
2. The method of claim 1, wherein compiling the target project according to the set of compilation dependencies comprises:
in the compiling process, searching whether a file and a module which are depended on by the current compiling exist in the compiling dependency relationship set;
if not, the non-existent dependent file and the non-existent dependent module are compiled first.
3. The method of claim 1, wherein compiling dependency information for a module comprises: a file generated after compilation, a method of generating a file, a file on which compilation depends, and a module on which compilation depends.
4. The method of claim 1, wherein the development file exists in a.mk file format.
5. The method according to claim 1, applied in embedded Linux development.
The compiling device based on code integration is 6, , which is characterized by comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring development files of all modules in a target project, and the development files carry compiling dependency information of the modules;
the extraction module is used for extracting modules and files which are depended on by compiling of each module from the development files of the modules;
the generation module is used for generating total sets of modules depended on by compiling of the modules and files depended on by compiling, and the total sets are used as compiling dependency relationship sets of the target project;
and the compiling module is used for compiling the target engineering according to the compiling dependency relationship set.
7. The apparatus of claim 6, wherein the compiling module comprises:
the searching unit is used for searching whether a file and a module which are depended on by the current compiling exist in the compiling dependency relationship set in the compiling process;
and the preprocessing unit is used for compiling to obtain a non-existent dependent file and a non-existent dependent module under the condition of determining non-existent.
8. The apparatus of claim 6, wherein the compilation dependency information for a module comprises: a file generated after compilation, a method of generating a file, a file on which compilation depends, and a module on which compilation depends.
9. The apparatus of claim 6, wherein the development file exists in a file format of.mk.
10. The apparatus according to claim 9, applied in embedded Linux development.
CN201910228017.5A 2018-07-20 2019-03-25 compiling method and device based on code integration Pending CN110737437A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810802692X 2018-07-20
CN201810802692 2018-07-20

Publications (1)

Publication Number Publication Date
CN110737437A true CN110737437A (en) 2020-01-31

Family

ID=69236632

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910228017.5A Pending CN110737437A (en) 2018-07-20 2019-03-25 compiling method and device based on code integration

Country Status (1)

Country Link
CN (1) CN110737437A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367510A (en) * 2020-02-24 2020-07-03 腾讯音乐娱乐科技(深圳)有限公司 Android function module development method and device
CN111722851A (en) * 2020-04-22 2020-09-29 深圳市伟文无线通讯技术有限公司 Device and method for supporting multi-cloud platform connection based on single chip microcomputer
CN113821486A (en) * 2021-11-22 2021-12-21 北京金堤科技有限公司 Method and device for determining dependency relationship between pod libraries and electronic equipment
CN115562719A (en) * 2022-12-06 2023-01-03 中国人民解放军国防科技大学 Interface-aware compiling configuration item completion method, system and medium
CN117251165A (en) * 2023-08-24 2023-12-19 上海合芯数字科技有限公司 Method, device, terminal and medium for compiling building

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101697135A (en) * 2009-10-28 2010-04-21 北京东方网力科技有限公司 Method and device for compiling program
CN103870310A (en) * 2014-02-18 2014-06-18 小米科技有限责任公司 Program compilation method and relevant device
US20160283218A1 (en) * 2013-09-18 2016-09-29 G-Cloud Technology Ltd Method for distributing large-sized Linux software packages
CN106202450A (en) * 2016-07-11 2016-12-07 南京大学 A kind of source code relied on based on makefile file analyzes method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101697135A (en) * 2009-10-28 2010-04-21 北京东方网力科技有限公司 Method and device for compiling program
US20160283218A1 (en) * 2013-09-18 2016-09-29 G-Cloud Technology Ltd Method for distributing large-sized Linux software packages
CN103870310A (en) * 2014-02-18 2014-06-18 小米科技有限责任公司 Program compilation method and relevant device
CN106202450A (en) * 2016-07-11 2016-12-07 南京大学 A kind of source code relied on based on makefile file analyzes method

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367510A (en) * 2020-02-24 2020-07-03 腾讯音乐娱乐科技(深圳)有限公司 Android function module development method and device
CN111367510B (en) * 2020-02-24 2024-03-19 腾讯音乐娱乐科技(深圳)有限公司 Android function module development method and device
CN111722851A (en) * 2020-04-22 2020-09-29 深圳市伟文无线通讯技术有限公司 Device and method for supporting multi-cloud platform connection based on single chip microcomputer
CN113821486A (en) * 2021-11-22 2021-12-21 北京金堤科技有限公司 Method and device for determining dependency relationship between pod libraries and electronic equipment
CN115562719A (en) * 2022-12-06 2023-01-03 中国人民解放军国防科技大学 Interface-aware compiling configuration item completion method, system and medium
CN115562719B (en) * 2022-12-06 2023-04-07 中国人民解放军国防科技大学 Interface-aware compiling configuration item completion method, system and medium
CN117251165A (en) * 2023-08-24 2023-12-19 上海合芯数字科技有限公司 Method, device, terminal and medium for compiling building

Similar Documents

Publication Publication Date Title
CN110737437A (en) compiling method and device based on code integration
KR101687213B1 (en) Dynamically loading graph-based computations
CN106843840B (en) Source code version evolution annotation multiplexing method based on similarity analysis
US20240045850A1 (en) Systems and methods for database orientation transformation
CN111144839B (en) Project construction method, continuous integration system and terminal equipment
CN111813412B (en) Method and system for constructing test data set for evaluating binary code comparison tool
US10013242B2 (en) Distributed compilation of statically typed languages
CN107015904B (en) Stack protection method and device
WO2014056371A1 (en) Method and apparatus for determining range of files to be migrated
CN111984264B (en) Static library generation method and device
CN114138281A (en) Compiling method, device, equipment and medium of software engineering
CN111124872A (en) Branch detection method and device based on difference code analysis and storage medium
US9116714B2 (en) Methods and systems for file processing
Fazzini et al. Apimigrator: an api-usage migration tool for android apps
WO2015003452A1 (en) Methods and systems for file processing
Ormenisan et al. Implicit provenance for machine learning artifacts
CN113495728A (en) Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium
CN110737438A (en) data processing method and device
CN111796855B (en) Incremental version updating method and device, storage medium and computer equipment
US9396239B2 (en) Compiling method, storage medium and compiling apparatus
CN105550575A (en) Method and device for obtaining un-exported function address and data structure offset
CN110765078B (en) File management method and device and computer readable storage medium
CN110737429A (en) modular compiling method and device utilizing Makefile self-dependent relationship
CN116578282A (en) Code generation method, device, electronic equipment and medium
CN113821486B (en) Method and device for determining dependency relationship between pod libraries and electronic equipment

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200131