[go: up one dir, main page]

CN114047919B - Compilation method, storage medium and electronic device based on file differences - Google Patents

Compilation method, storage medium and electronic device based on file differences

Info

Publication number
CN114047919B
CN114047919B CN202111298956.0A CN202111298956A CN114047919B CN 114047919 B CN114047919 B CN 114047919B CN 202111298956 A CN202111298956 A CN 202111298956A CN 114047919 B CN114047919 B CN 114047919B
Authority
CN
China
Prior art keywords
file
source code
previous
compilation
current
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
CN202111298956.0A
Other languages
Chinese (zh)
Other versions
CN114047919A (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.)
Tencent Music Entertainment Technology Shenzhen Co Ltd
Original Assignee
Tencent Music Entertainment Technology Shenzhen 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 Tencent Music Entertainment Technology Shenzhen Co Ltd filed Critical Tencent Music Entertainment Technology Shenzhen Co Ltd
Priority to CN202111298956.0A priority Critical patent/CN114047919B/en
Publication of CN114047919A publication Critical patent/CN114047919A/en
Application granted granted Critical
Publication of CN114047919B publication Critical patent/CN114047919B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

本申请公开一种基于文件差异的编译方法,包括如下步骤:获取当前待编译文件;获取前次编译产物文件;识别所述当前待编译文件,获取当前版本标识;根据所述前次编译产物文件,获取前次版本标识和前次最终产物文件;将所述当前版本标识和前次版本标识进行比对,根据比对结果从所述当前待编译文件中获取差异文件集合;根据所述差异文件集合,获取差异文件最终产物文件;根据所述差异文件最终产物文件和前次最终产物文件,获取当前编译最终产物文件。绕过了完整编译流程,直接生成本次编译产物,从而达到极大提升编译速度的效果。

The present application discloses a compilation method based on file differences, comprising the following steps: obtaining a current file to be compiled; obtaining a previous compilation product file; identifying the current file to be compiled and obtaining a current version identifier; obtaining a previous version identifier and a previous final product file based on the previous compilation product file; comparing the current version identifier with the previous version identifier, and obtaining a difference file set from the current file to be compiled based on the comparison result; obtaining a difference file final product file based on the difference file set; and obtaining a current compilation final product file based on the difference file final product file and the previous final product file. This method bypasses the entire compilation process and directly generates the current compilation product, thereby greatly improving the compilation speed.

Description

Compiling method based on file difference, storage medium and electronic equipment
Technical Field
The application relates to the technical field of computer networks, in particular to a compiling method based on file differences. In addition, the application also relates to a related device, electronic equipment and a computer readable storage medium.
Background
In Android software development, software compiling is an indispensable link, and along with the increase of software complexity, the compiling time consumption is also increased proportionally. Taking engineering of one million lines of source code as an example, a complete compilation typically takes more than 20 minutes. There are two common optimization methods, one is to disassemble the project into several small projects, and reduce the time consumption by parallel compiling. If the number of sub-projects disassembled is enough, the compiling time consumption can be greatly reduced. When the number of sub-projects is increased, the engineering is difficult to manage, the development efficiency is reduced, and in the final stage of compiling, the intermediate products of all the sub-projects need to be collected and combined, so that the time consumption of the step is greatly increased, and the amplitude reduction caused by part of compiling optimization is finally offset. The second is to reduce the total time consumption by optimizing the time consumption of compiling each link, but the final optimization efficiency upper limit is lower, and breakthrough efficiency optimization cannot be realized. Two traditional compilation optimizations can compress the complete time consumption to around 30%.
The description of the background art is only for the purpose of facilitating an understanding of the relevant art and is not to be taken as an admission of prior art.
Disclosure of Invention
Therefore, the embodiment of the invention aims to provide a compiling method based on file difference, and breakthrough optimization of compiling efficiency is realized on the premise that an engineering structure is not affected as much as possible. The embodiment of the invention provides a compiling method based on file differences, which comprises the following steps:
acquiring a current file to be compiled;
Acquiring a previous compiling product file;
Identifying the current file to be compiled, and obtaining a current version identifier;
Acquiring a previous version identifier and a previous final product file according to the previous compiling product file;
Comparing the current version identifier with the previous version identifier, and acquiring a difference file set from the current file to be compiled according to a comparison result;
Acquiring a difference file final product file according to the difference file set;
And acquiring a current compiling final product file according to the difference file final product file and the previous final product file.
In some embodiments of the present invention,
When the previous compilation product file is an initial compilation product file, the obtaining the previous compilation product file includes:
Compiling the source code file into an intermediate product file;
translating the intermediate product file to generate a source code end product file;
combining the source code final product file and a resource file to form the previous compiling product file;
When the previous compilation product file is not an initial compilation product file, the obtaining the previous compilation product file includes:
and taking the current compiling final product file obtained by executing the compiling method based on the file difference last time as the compiling final product file last time.
In some embodiments of the invention, the source code file comprises a plurality of source code subfiles, the previous compiling product file comprises a previous compiling index table, and the previous compiling index table comprises version number information and index names corresponding to the plurality of source code subfiles;
The compiling the source code file into the intermediate product file comprises:
compiling the plurality of source code subfiles to generate a plurality of intermediate product subfiles;
The translating the intermediate product file into a source code end product file includes:
Translating the plurality of intermediate product subfiles to generate a plurality of source code end product subfiles;
combining the source code end product file with a resource file to form the previous compilation product file includes:
according to the source code final product subfiles, version numbers and subfiles corresponding to the source code final product subfiles are obtained;
acquiring a version number and a resource file name corresponding to a resource file according to the resource file;
and generating the previous compiling index table according to the version numbers and the subfiles corresponding to the multiple source code final product subfiles and the version numbers and the resource file names corresponding to the resource files.
In some embodiments of the present invention, the current file to be compiled includes a plurality of current source code subfiles and a plurality of current resource files;
The comparing the current version identifier with the previous version identifier, and obtaining the difference file set from the current file to be compiled according to the comparison result includes:
Comparing the index names in the index table compiled last time with the file names of the current source code subfiles and the current resource files;
and when the comparison result is the same and the previous version identifier corresponding to the index name is different from the current version identifier, the current source code sub-file and/or the current resource file which have the same name as the index name in the current file to be compiled belong to the difference file set.
In some embodiments of the present invention, the obtaining a difference file end product file according to the difference file set includes:
compiling the difference file set to generate a difference intermediate file;
And translating the difference intermediate product file to generate the difference source code final product file.
In some embodiments of the present invention, the obtaining the current compiled end product file according to the difference file end product file and the previous end product file includes:
Acquiring a previous final product sub-file corresponding to the difference file final product file from the previous final product file;
Replacing the previous final product subfile with the difference file final product file;
and updating the previous compiling index table according to the current version identifier corresponding to the final product file of the difference file to generate a current compiling index table.
In some embodiments of the present invention, prior to obtaining the current file to be compiled and the previous compilation product file, comprising:
And monitoring the source code change information in the plurality of current source code subfiles, and updating the version identification corresponding to the source code subfiles with the source code change.
In some embodiments of the present invention, prior to obtaining the current file to be compiled and the previous compilation product file, comprising:
and monitoring the resource change information in the plurality of current resource files, and updating the version identification corresponding to the resource file with the resource change.
In some embodiments of the invention, compiling the source code file into an intermediate product file includes:
acquiring the length of a source code subfile input by a user;
splitting the source code file according to the length of the source code subfile to generate a source code subfile;
and compiling and generating the intermediate product file according to the source code subfile.
In an embodiment of the present invention, there is provided a computer-readable storage medium having stored thereon a computer program, wherein the program, when executed by a processor, implements any of the file difference-based compiling methods of the embodiments of the present invention.
In an embodiment of the invention, an electronic device is provided, comprising a processor and a memory storing a computer program, the processor being configured to perform any of the file difference based compiling methods of the embodiments of the invention when the computer program is run.
According to the compiling method, the previous compiling product and the change information of the current file to be compiled are combined, the change information of the current file to be compiled is positioned to the changed subfile, compiling and translating are carried out on the subfile to generate a final product subfile, the final product subfile and the corresponding subfile in the previous compiling product are replaced to generate the current compiling product, the complete compiling process is bypassed, the compiling product is directly generated, and therefore the effect of greatly improving the compiling speed is achieved, and the complete compiling time is compressed to be within 10% of the rest.
Additional optional features and technical effects of embodiments of the invention are described in part below and in part will be apparent from reading the disclosure herein.
Drawings
Embodiments of the present invention will hereinafter be described in conjunction with the appended drawings, wherein like or similar reference numerals denote like or similar elements, and wherein:
FIG. 1 illustrates an exemplary flow chart of a compilation method in accordance with an embodiment of the present invention;
FIG. 2 illustrates steps of a hybrid algorithm of a file difference based compilation method in accordance with an embodiment of the present invention;
FIG. 3 illustrates another exemplary flow chart of a file difference based compilation method in accordance with an embodiment of the present invention;
FIG. 4 illustrates an exemplary flow chart for obtaining a previous compilation product in a file-difference-based compilation method in accordance with an embodiment of the present invention;
FIG. 5 illustrates an exemplary flow chart for generating a previous compilation product in a file-difference-based compilation method in accordance with an embodiment of the present invention;
FIG. 6 illustrates an exemplary flow chart for obtaining a set of difference files in a file difference based compilation method in accordance with an embodiment of the present invention;
FIG. 7 illustrates an exemplary flow chart for generating a final product file based on a collection of difference files in a file difference based compilation method in accordance with embodiments of the present invention;
FIG. 8 illustrates an exemplary flowchart of updating a current compilation index table in a file-difference-based compilation method in accordance with embodiments of the present invention;
FIG. 9 illustrates an exemplary flow chart for split generation of source code subfiles in a file-difference-based compilation method in accordance with an embodiment of the present invention;
fig. 10 is a schematic view showing the structure of a compiling apparatus according to an embodiment of the invention;
fig. 11 shows an exemplary structural diagram of an electronic device capable of implementing a method according to an embodiment of the invention.
Detailed Description
The present invention will be described in further detail with reference to the following detailed description and the accompanying drawings, in order to make the objects, technical solutions and advantages of the present invention more apparent. The exemplary embodiments of the present invention and the descriptions thereof are used herein to explain the present invention, but are not intended to limit the invention.
In the embodiment of the invention, "compiling" refers to converting one language into another language with different grammar and abstraction degree, and the like, and is commonly performed by adopting a gcc compiler for compiling. "translate" refers to converting one language to a different version or language of the same degree of abstraction, such as babel translating es6 to es5.
The embodiment of the invention provides a compiling method based on file differences, which improves compiling efficiency. The compiling method in the embodiment of the invention is described below.
The Android software compiling process comprises the following steps of compiling a source code into an intermediate product, translating the intermediate product into a source code final product, and combining the source code final product with other resources to form a complete software application product. In step b, all intermediate products are collected for translation, and a final product file is output, wherein the final product file is a physical file stored on a disk.
Based on the compiling process, the embodiment of the invention provides a compiling method based on file differences, which comprises the following specific steps:
Judging that when the source code change range is not the whole between the present compiling and the previous compiling, executing the step a on the changed source code to obtain a corresponding intermediate product, and inserting the translation content into the final product of the previous compiling by using the same translation method of the step b to obtain the product result the same as the traditional method, but saving the time for integrally executing the step b.
The compiling environment of the compiling method in the embodiment of the invention needs to use source code management software with version control capability to manage source codes and resource files, and the compiling environment stores the final product files compiled before. The source code management software with version control capability is used to enable the scheme to have the capability of distinguishing the source code variation range, the unique identification corresponding to the source code version is written into the final product in one compiling, the identification is read out from the final product in the previous compiling in the next compiling, and the matching calculation is carried out with the current source code version, so that the variation range is obtained. The scheme only takes the previous compiling product as the dependence, so that the number of the dependence is reduced.
As shown in FIG. 1, the compiling method provided by the embodiment of the invention identifies a source code file to obtain a current compiling version identifier, extracts a previous compiling product to obtain a previous compiling source code version identifier and a source code end product portion, compares the current compiling version identifier with the previous compiling source code version identifier to obtain a corresponding difference source code file set, compiles the difference source code file set by utilizing a compiling tool to obtain an intermediate product file of the difference portion, translates the intermediate product file of the difference portion by utilizing a translating tool to obtain an end product of the difference portion, and mixes the source code end product portion and the end product of the difference portion by utilizing a mixing algorithm to obtain the end product.
The step of the mixing algorithm is shown in fig. 2, wherein the difference source code products comprise file a difference product, file B difference product and file C difference product, the file a product, the file B product and the file C product in the final product of previous compiling are replaced, and then the index table is updated based on the replaced file condition to obtain the final product file.
The compiling method in the embodiment of the invention solves the following technical problems which cannot be solved by the prior art method:
1. the large-scale splitting sub-engineering influences the development efficiency and cannot be optimized extremely;
2. The traditional process has limited optimizing income;
3. The increment compiling scheme is more dependent, and part of time-consuming links cannot be avoided;
the scheme does not need to disassemble large-scale sub-engineering, so that the problem 1 is avoided. The scheme thoroughly avoids redundant time-consuming links on the basis of incremental compiling, and can realize maximum time-consuming exemption, so that the problems 2 and 3 are avoided.
Under the optimal condition, when only one line of variable source codes exists, the scheme can realize that the output time of a final product is less than 30 seconds, and the time consumption of 60 seconds is greatly superior to that of other schemes.
The scheme mainly solves the problem of source code compiling optimization, and Android software comprises picture resources, text resources, built-in executable file resources and the like besides source codes. The concept of the scheme can be used for incremental change of other resources, and accurate difference replacement is implemented by combining the previous compiled products, so that the final product is output rapidly.
As shown in fig. 3, an embodiment of the present invention provides a compiling method based on a difference file, including the following steps:
s110, acquiring a current file to be compiled.
In some embodiments, the current file to be compiled includes a plurality of current source code subfiles and a plurality of resource files.
The previous compiling product file in the embodiment of the invention can be an initial compiling product file or an intermediate compiling product file.
S120, acquiring a previous compiling product file.
In some embodiments, the previous compilation product file is stored in a compilation environment, and the previous compilation product file may be obtained from an index identification.
In some implementations, as shown in fig. 4, when the previous compilation product file is an initial compilation product file, the step of obtaining the previous compilation file includes:
S121, compiling the source code file into an intermediate product file;
s122, translating the intermediate product file to generate a source code final product file;
s123, combining the source code final product file and the resource file to form the previous compiling product file.
In some embodiments, when the previous compilation product file is not an initial compilation product file, the previous compilation product file is an intermediate version of the compilation product file, and the current compilation final product file obtained by executing the compilation method based on the file difference last time is used as the previous compilation product file. The final product file based on the last compilation is used as the previous compilation product file. After the compiling method in the embodiment is executed each time, the generated current compiling final product file is saved, and the current compiling final product file is called when the current compiling final product file is compiled later.
In some embodiments, the saving of the multi-version end product file may be performed, with the previous compiled product file being obtained by each compiled version number. In other embodiments, the current compiled end product file may be replaced with the previously compiled end product file, or only one end product file may be maintained, with each compilation being an update to the end product file, thereby reducing storage space.
In some embodiments, the source code file may be divided into a plurality of source code sub-files based on actual file types, for example, a main file, a view file and a fun file are in a source code directory, the corresponding source code sub-files are a main file, a view file and a fun file, in some embodiments, the source code file may be further divided according to a source code length, for example, the main file may be divided into a main_a source code sub-file, a main_b source code sub-file and a mian _c source code sub-file, the view file may be divided into a view_a source code sub-file and a view_b source code sub-file, and the fun file may be divided into a source code sub-file and a fun_b source sub-file based on actual file types, and the main file may be divided into a main_a source code sub-file, a main_b source code sub-file and a fun_b source code sub-file, and a fun_b source code sub-file.
Based on the plurality of source code subfiles, the step S121 further includes:
and compiling the plurality of source code subfiles to generate a plurality of intermediate product subfiles, wherein the source code files comprise a source code subfile a, a source code subfile b and a source code subfile c, and compiling to generate an intermediate product subfile a, an intermediate product subfile b and an intermediate product subfile c.
In some embodiments, the step S121 further includes:
For example, the intermediate sub-file a, the intermediate sub-file b, and the intermediate sub-file c are translated to generate a source end product sub-file a, a source end product sub-file b, and a source end product sub-file c.
In some embodiments, as shown in fig. 5, the step S123 further includes:
S1231, according to the source code final product subfiles, version numbers and subfiles corresponding to the source code final product subfiles are obtained;
S1232, according to the resource file, acquiring a version number and a resource file name corresponding to the resource file;
S1233, generating the previous compiling index table according to the version numbers and the sub-file names corresponding to the sub-files of the final products of the source codes and the version numbers and the resource file names corresponding to the resource files.
In some embodiments, the version numbers of the source end product subfile a, the source end product subfile b, and the source end product subfile c are v1.1, and v1.2, the resource file is named source file, the corresponding version number is v1.0, and the corresponding generated previous compilation index table is as follows.
File name Version number
Source code end product subfile a v1.1
Source end product subfile b v1.1
Source end product subfile c v1.2
Source document v1.0
In an embodiment of the invention, when the final product is generated, a corresponding index table is generated.
In the embodiment of the invention, the steps of acquiring the current file to be compiled and acquiring the previous compiling product file can be independently operated or can be executed together.
S130, identifying the current source code file and obtaining a current source code version identifier.
In some embodiments, the source version identifier may be obtained from a compiler or a manager, and the compiler may set a version number for each subfile in each source file. In some embodiments, a source code file is split into a plurality of subfiles, a specific positioning code line in the source code file can be positioned, codes between the positioning code lines are divided into one subfile, codes added in the middle of the positioning code line belong to a current subfile, and meanwhile, a version number is changed, and the change of the version number is triggered by deleting the codes and changing the codes.
And S140, acquiring a previous version identifier and a previous final product file according to the previous compiling product file.
In some embodiments, the previous source version identification information may be obtained from the index table, and when the previous compiled product file includes a plurality of subfiles, the version identification, i.e., the version number, of each subfile may be obtained from the index table according to the name of the subfile.
And S150, comparing the current version identifier with the previous version identifier, and acquiring a difference file set from the current file to be compiled according to a comparison result.
In some embodiments, each subfile to be compiled has a version identification number, and by comparing the version identification numbers, it is confirmed which source subfiles have variations, forming a differential source code set.
In some embodiments, the current file to be compiled includes a plurality of current source code subfiles and a plurality of current resource files.
As shown in fig. 6, the step of obtaining the difference file set includes:
S151, comparing index names in a previous compiling index table with file names of the plurality of current source code subfiles and the plurality of current resource files;
and S152, judging that the comparison result is the same, and if the previous version identifier corresponding to the index name is different from the current version identifier, the current source code sub-file and/or the current resource file which are the same as the index name in the current file to be compiled belong to the difference file set.
For example, the information of the compiled product file recorded in the previous compiling index table comprises a final product file main with a version number of v1.01, a final product file view with a version number of v1.02, a final product file fun with a version number of v1.01 and a final product resource file resource with a version number of v1.0. When the compiling method of the embodiment of the invention runs for a certain time, the current file information to be compiled comprises a source code sub-file main with version number v1.01, a source code sub-file view with version number v1.03, a source code sub-file fun with version number v1.01, a resource file resource with version number v1.0, and the compiling process is completed by obtaining a differential file as a view file through name comparison and version number comparison, compiling and translating the view file, replacing the view of the final product file in the previous compiled file, and updating an index table. When the compiling method of the embodiment of the invention runs for a certain time, the current file information to be compiled comprises a source code sub-file main with a version number of v1.01, a source code sub-file view with a version number of v1.02, a source code sub-file fun with a version number of v1.01, a resource file resource with a version number of v1.01, obtaining a differential file as a resource file through name comparison and version number comparison, compiling and translating the resource file, replacing a final product resource file resource in the previous compiled file, and updating an index table to finish the compiling process.
S160, obtaining a difference file final product file according to the difference file set.
In some embodiments, as shown in fig. 7, the step S160 specifically includes the following steps:
s161, compiling the difference file set to generate a difference intermediate file;
s162, translating the difference intermediate product file to generate the difference file final product file.
Only compiling and translating the difference file saves a great amount of time for repeated compiling and translating, thereby improving the efficiency.
S170, acquiring a current compiling final product file according to the difference file final product file and the last final product file.
The final product file is replaced by the final product file of the previous time, and the index table is updated, so that the compiling engineering can be realized, and the total time consumption is low.
In some embodiments, the specific process of step S170 is shown in fig. 8, and the step of generating the current compiled final product file includes:
s171, acquiring a previous final product sub-file corresponding to the difference file final product file from the previous final product file;
S172, replacing the final product file of the difference file with the final product sub-file of the previous time;
And S173, updating the previous compiling index table according to the current version identifier corresponding to the final product file of the difference file, and generating a current compiling index table.
In some embodiments, before acquiring the current file to be compiled and the previous compilation product file, the compilation method further comprises:
s101, monitoring the source code change information in the plurality of current source code subfiles, and updating the source code version identification corresponding to the source code subfiles with the source code change.
In some embodiments, before acquiring the current file to be compiled and the previous compilation product file, the compilation method also includes:
S102, monitoring resource change information in the plurality of current resource files, and updating version identifiers corresponding to the resource files with resource changes.
The compiling environment software in the embodiment of the invention can monitor the source code or the resource change, thereby being capable of automatically updating the version identification. In some embodiments, the version identification change may be performed incrementally.
In order to meet the high-efficiency compiling requirement, a single source code file can be split, so that the compiling and translating efficiency of a single difference file is improved, when a compiling product file of the previous time is generated initially, a user can set the code length of a single compiling sub-file, locate locating code lines, and codes between adjacent locating code lines serve as a source code sub-file. Specifically, as shown in fig. 9, compiling the source code file into the intermediate product file further includes:
s1211, acquiring the length of a source code subfile input by a user;
s1212, splitting the source code file according to the length of the source code sub-file to generate a source code sub-file;
s1213, compiling and generating the intermediate product file according to the source code subfile.
According to the compiling method, the previous compiling product and the change information of the current file to be compiled are combined, the changed subfiles are positioned, the subfiles are compiled and translated, the final product subfiles are generated, the final product subfiles are replaced with the corresponding subfiles in the previous compiling product, the current compiling product is generated, the complete compiling process is bypassed, the compiling product is directly generated, the effect of greatly improving the compiling speed is achieved, and the complete compiling time is compressed to be within the remaining 10%.
In an embodiment of the present invention, as shown in fig. 10, there is shown a compiling apparatus 1000 based on a file difference, the compiling apparatus 1000 based on a file difference including:
an obtaining module 1010 configured to obtain a current file to be compiled and a previous compilation product file;
The identifying module 1020 is configured to identify the current file to be compiled, and obtain a current version identifier;
An extraction module 1030 configured to obtain a previous version identification and a previous final product file from the previous compilation product file;
The comparison module 1040 is configured to compare the current version identifier with the previous version identifier, and obtain a difference file set from the current file to be compiled according to a comparison result;
a generating module 1050 configured to obtain a difference file final product file from the set of difference files;
An updating module 1060 configured to obtain a current compiled end product file from the difference file end product file and a previous end product file.
In some embodiments, when the previous compile product file is an initial compile product file, the previous compile product file is generated by:
Compiling the source code file into an intermediate product file;
translating the intermediate product file to generate a source code end product file;
and combining the source code final product file with a resource file to form the previous compiling product file.
In some embodiments, when the previous compilation product file is not an initial compilation product file, the current compilation final product file obtained by previously executing the file difference-based compilation method is used as the previous compilation product file. The final product file is generated based on the last compilation as the previous compilation product file.
In some embodiments, the source code file comprises a plurality of source code subfiles, the previous compilation product file comprises a previous compilation index table, and the previous compilation index table comprises version number information and index names corresponding to the plurality of source code subfiles;
The compiling the source code file into the intermediate product file comprises:
compiling the plurality of source code subfiles to generate a plurality of intermediate product subfiles;
The translating the intermediate product file into a source code end product file includes:
Translating the plurality of intermediate product subfiles to generate a plurality of source code end product subfiles;
combining the source code end product file with a resource file to form the previous compilation product file includes:
according to the source code final product subfiles, version numbers and subfiles corresponding to the source code final product subfiles are obtained;
acquiring a version number and a resource file name corresponding to a resource file according to the resource file;
And generating the previous compiling index table according to version numbers and subfile names corresponding to the subfiles of the plurality of source code final products and version numbers and resource file names corresponding to the resource files.
When the final product is generated, a corresponding index table is generated.
In some embodiments, the version identification may be obtained from a compiler or a management tool.
In some embodiments, the previous version identification information may be obtained from an index table.
In some embodiments, the current file to be compiled includes a plurality of current source code subfiles and a plurality of current resource files;
the comparison module 1040 is specifically configured to:
comparing the index names in the index table compiled last time with the file names of the plurality of current source code subfiles and the plurality of current resource files;
and when the comparison result is the same and the previous source code version identification corresponding to the index name is different from the current source code version identification, the current source code sub-file and/or the current resource file which are the same as the index name in the current source code file belong to a difference file set.
In some embodiments, the generation module 1040 is specifically configured to:
compiling the difference file set to generate a difference intermediate file;
Translating the difference intermediate product file to generate the difference file end product file.
In some embodiments, the update module 1060 is specifically configured to:
Acquiring a previous final product sub-file corresponding to the difference file final product file from the previous final product file;
Replacing the previous final product subfile with the difference file final product file;
and updating the previous compiling index table according to the current version identifier corresponding to the final product file of the difference file to generate a current compiling index table.
In some embodiments, the compiling apparatus 1000 further comprises a listening module 1001. The monitoring module 1001 is configured to monitor the source code variation information in the plurality of current source code subfiles, and update the source code version identifier corresponding to the source code subfile with the source code variation. The monitoring module 1001 may be further configured to monitor resource variation information in the plurality of current resource files, and update a version identifier corresponding to the resource file with resource variation.
In some embodiments, in generating the previous compilation product file, compiling the source code file into the intermediate file includes:
acquiring the length of a source code subfile input by a user;
splitting the source code file according to the length of the source code subfile to generate a source code subfile;
and compiling and generating the intermediate product file according to the source code subfile.
In some embodiments, the compiling apparatus may combine features of the compiling method based on file differences of any embodiment, and vice versa, which is not described herein.
In an embodiment of the invention, an electronic device is provided, comprising a processor and a memory storing a computer program, the processor being configured to perform any of the file difference based compiling methods of the embodiments of the invention when the computer program is run.
FIG. 11 shows a schematic diagram of an electronic device 1100 that may implement or implement embodiments of the present invention, and in some embodiments may include more or fewer electronic devices than shown. In some embodiments, it may be implemented with a single or multiple electronic devices. In some embodiments, implementation may be with cloud or distributed electronic devices.
As shown in fig. 11, the electronic device 1100 includes a Central Processing Unit (CPU) 1101 that can perform various appropriate operations and processes according to programs and/or data stored in a Read Only Memory (ROM) 1102 or programs and/or data loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. The CPU 1101 may be one multi-core processor or may include a plurality of processors. In some embodiments, CPU 1101 may comprise a general purpose host processor and one or more special coprocessors such as, for example, a Graphics Processor (GPU), a neural Network Processor (NPU), a Digital Signal Processor (DSP), etc. In the RAM 1103, various programs and data necessary for the operation of the electronic device 1100 are also stored. The CPU 1101, ROM 1102, and RAM 1103 are connected to each other by a bus 1104. An input/output (I/O) interface 1105 is also connected to bus 1104.
The processor and the memory are used together to execute a program stored in the memory, which when executed by a computer, can implement the steps or functions of the training method, the high-resolution audio generation method, and the sound effect switching method of the high-resolution audio generation model described in the above embodiments.
Connected to the I/O interface 1105 are an input section 1106 including a keyboard, a mouse, a touch screen, and the like, an output section 1107 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like, a storage section 1108 including a hard disk, and the like, and a communication section 1109 including a network interface card such as a LAN card, a modem, and the like. The communication section 1109 performs communication processing via a network such as the internet. The drive 1110 is also connected to the I/O interface 1105 as needed. Removable media 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is installed as needed in drive 1110, so that a computer program read therefrom is installed as needed in storage section 1108. Only some of the components are schematically illustrated in fig. 11, which does not mean that the computer system 1100 includes only the components illustrated in fig. 11.
In some embodiments, the mobile terminal indicated by the electronic device 1100 includes a mobile phone, a vehicle-mounted terminal, a smart television, etc., and, taking the mobile phone as an example, the electronic device 1100 further includes a display screen with a touch function, an externally-placed sound box, a gyroscope, a camera, a 4G/5G antenna, etc.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer or its associated components. The computer may be, for example, a mobile terminal, a smart phone, a personal computer, a laptop computer, a car-mounted human-computer interaction device, a personal digital assistant, a media player, a navigation device, a game console, a tablet, a wearable device, a smart television, an internet of things system, a smart home, an industrial computer, a server, or a combination thereof.
Although not shown, in an embodiment of the present invention, there is provided a storage medium storing a computer program configured to, when executed, perform any of the file difference-based compiling methods of the embodiment of the present invention.
Storage media in embodiments of the invention include both permanent and non-permanent, removable and non-removable items that may be used to implement information storage by any method or technology. Examples of storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, read only compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium which can be used to store information that can be accessed by a computing device.
Methods, programs, systems, apparatus, etc. in accordance with embodiments of the invention may be implemented or realized in single or multiple networked computers, or in distributed computing environments. In the present description embodiments, tasks may be performed by remote processing devices that are linked through a communications network in such a distributed computing environment.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Thus, it will be apparent to those skilled in the art that the functional modules/units or controllers and associated method steps set forth in the above embodiments may be implemented in software, hardware, and a combination of software/hardware.
The acts of the methods, procedures, or steps described in accordance with the embodiments of the present invention do not have to be performed in a specific order and still achieve desirable results unless explicitly stated. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Various embodiments of the invention are described herein, but for brevity, description of each embodiment is not exhaustive and features or parts of the same or similar between each embodiment may be omitted. Herein, "one embodiment," "some embodiments," "example," "specific example," or "some examples" means that it is applicable to at least one embodiment or example, but not all embodiments, according to the present invention. The above terms are not necessarily meant to refer to the same embodiment or example. Those skilled in the art may combine and combine the features of the different embodiments or examples described in this specification and of the different embodiments or examples without contradiction.
The exemplary systems and methods of the present invention have been particularly shown and described with reference to the foregoing embodiments, which are merely examples of the best modes for carrying out the systems and methods. It will be appreciated by those skilled in the art that various changes may be made to the embodiments of the systems and methods described herein in practicing the systems and/or methods without departing from the spirit and scope of the invention as defined in the following claims.

Claims (10)

1.一种基于文件差异的编译方法,其特征在于,所述编译方法包括如下步骤:1. A compilation method based on file differences, characterized in that the compilation method comprises the following steps: 获取当前待编译文件;Get the current file to be compiled; 获取前次编译产物文件;Get the last compiled product file; 识别所述当前待编译文件,获取当前版本标识,其中,所述当前待编译文件包括多个当前源码子文件和多个当前资源文件;Identifying the current file to be compiled and obtaining a current version identifier, wherein the current file to be compiled includes a plurality of current source code sub-files and a plurality of current resource files; 根据所述前次编译产物文件,获取前次版本标识和前次最终产物文件,其中,所述前次编译产物文件包括前次编译索引表,所述前次编译索引表包括与多个源码子文件对应的版本号信息、索引名;Obtaining a previous version identifier and a previous final product file according to the previous compilation product file, wherein the previous compilation product file includes a previous compilation index table, and the previous compilation index table includes version number information and index names corresponding to multiple source code sub-files; 将所述当前版本标识和前次版本标识进行比对,根据比对结果从所述当前待编译文件中获取差异文件集合,包括:将前次编译索引表中的索引名与所述多个当前源码子文件和多个当前资源文件的文件名进行比较,判断比较结果相同,且与所述索引名对应的所述前次版本标识和所述当前版本标识不同时,则当前待编译文件中与所述索引名同名的当前源码子文件和/或当前资源文件属于所述差异文件集合;Comparing the current version identifier with the previous version identifier, and obtaining a difference file set from the current file to be compiled based on the comparison result, including: comparing the index name in the previous compilation index table with the file names of the multiple current source code sub-files and the multiple current resource files, and determining that if the comparison results are the same and the previous version identifier corresponding to the index name is different from the current version identifier, then the current source code sub-file and/or current resource file in the current file to be compiled that has the same name as the index name belongs to the difference file set; 根据所述差异文件集合,获取差异文件最终产物文件;Obtaining a final product file of the difference files according to the difference file set; 根据所述差异文件最终产物文件和前次最终产物文件,获取当前编译最终产物文件,包括:对前次最终产物文件进行最终产物文件的替换,并进行索引表更新。According to the difference file final product file and the previous final product file, the current compilation final product file is obtained, including: replacing the previous final product file with the final product file and updating the index table. 2.根据权利要求1所述的编译方法,其特征在于,2. The compiling method according to claim 1, wherein: 当所述前次编译产物文件为初始编译产物文件时,所述获取前次编译产物文件,包括:When the previous compilation product file is an initial compilation product file, obtaining the previous compilation product file includes: 将源码文件编译为中间产物文件;Compile source code files into intermediate product files; 将所述中间产物文件转译生成源码最终产物文件;Translating the intermediate product file to generate a source code final product file; 将所述源码最终产物文件与资源文件结合构成所述前次编译产物文件;Combining the source code final product file with the resource file to form the previous compilation product file; 当所述前次编译产物文件不为初始编译产物文件时,所述前次编译产物文件,包括:When the previous compilation product file is not an initial compilation product file, the previous compilation product file includes: 通过前次执行所述基于文件差异的编译方法获取的所述当前编译最终产物文件作为所述前次编译产物文件。The current compilation final product file obtained by the previous execution of the file difference-based compilation method is used as the previous compilation product file. 3.根据权利要求2所述的编译方法,其特征在于,所述源码文件包括多个源码子文件;3. The compiling method according to claim 2, wherein the source code file comprises a plurality of source code sub-files; 所述将源码文件编译为中间产物文件包括:Compiling the source code file into an intermediate product file includes: 将所述多个源码子文件编译生成多个中间产物子文件;Compiling the multiple source code sub-files to generate multiple intermediate product sub-files; 所述将所述中间产物产物文件转译生成源码最终产物文件包括:The step of translating the intermediate product file into a source code final product file includes: 将所述多个中间产物子文件转译生成多个源码最终产物子文件;Translating the plurality of intermediate product sub-files to generate a plurality of source code final product sub-files; 所述将所述源码最终产物文件与资源文件结合构成所述前次编译产物文件包括:The combining of the source code final product file and the resource file to form the previous compilation product file includes: 根据所述多个源码最终产物子文件,获取与所述多个源码最终产物子文件对应的版本号和子文件名;According to the multiple source code final product sub-files, obtaining version numbers and sub-file names corresponding to the multiple source code final product sub-files; 根据资源文件,获取与所述资源文件对应的版本号和资源文件名;According to the resource file, obtain the version number and resource file name corresponding to the resource file; 根据与所述多个源码最终产物子文件对应的版本号和子文件名及与所述资源文件对应的版本号和资源文件名,生成所述前次编译索引表。The previous compilation index table is generated according to the version numbers and subfile names corresponding to the multiple source code final product subfiles and the version numbers and resource file names corresponding to the resource files. 4.根据权利要求1所述的编译方法,其特征在于,所述根据所述差异文件集合,获取差异文件最终产物文件包括:4. The compilation method according to claim 1, wherein obtaining a final product file of the difference files according to the difference file set comprises: 编译所述差异文件集合,生成差异中间产物文件;Compiling the difference file set to generate a difference intermediate product file; 转译所述差异中间产物文件,生成所述差异源码最终产物文件。The difference intermediate product file is translated to generate the difference source code final product file. 5.根据权利要求1所述的编译方法,其特征在于,所述根据所述差异文件最终产物文件和前次最终产物文件,获取当前编译最终产物文件包括:5. The compilation method according to claim 1, wherein obtaining the current compilation final product file according to the difference file final product file and the previous final product file comprises: 从所述前次最终产物文件中,获取与所述差异文件最终产物文件对应的前次最终产物子文件;Obtaining, from the previous final product file, a previous final product subfile corresponding to the difference file final product file; 将所述差异文件最终产物文件替换所述前次最终产物子文件;Replace the previous final product sub-file with the final product file of the difference file; 根据所述差异文件最终产物文件对应的当前版本标识,更新所述前次编译索引表,生成当前编译索引表。According to the current version identifier corresponding to the final product file of the difference file, the previous compilation index table is updated to generate a current compilation index table. 6.根据权利要求1所述的编译方法,其特征在于,在获取当前待编译文件和前次编译产物文件之前,所述编译方法还包括:6. The compilation method according to claim 1, characterized in that before obtaining the current file to be compiled and the previous compilation product file, the compilation method further comprises: 监听到所述多个当前源码子文件中的源码变动信息,更新有源码变动的源码子文件对应的版本标识。Source code change information in the multiple current source code sub-files is monitored, and version identifiers corresponding to the source code sub-files with source code changes are updated. 7.根据权利要求1所述的编译方法,其特征在于,在获取当前待编译文件和前次编译产物文件之前,所述编译方法还包括:7. The compilation method according to claim 1, characterized in that before obtaining the current file to be compiled and the previous compilation product file, the compilation method further comprises: 监听到所述多个当前资源文件中的资源变动信息,更新有资源变动的资源文件对应的版本标识。Resource change information in the multiple current resource files is monitored, and version identifiers corresponding to the resource files with resource changes are updated. 8.根据权利要求2所述的编译方法,其特征在于,所述将源码文件编译为中间产物文件包括:8. The compilation method according to claim 2, wherein compiling the source code file into the intermediate product file comprises: 获取用户输入的源码子文件长度;Get the source code sub-file length entered by the user; 根据所述源码子文件长度对所述源码文件进行拆分,生成源码子文件;Splitting the source code file according to the length of the source code sub-file to generate source code sub-files; 根据所述源码子文件编译生成所述中间产物文件。The intermediate product file is generated by compiling the source code sub-file. 9.一种计算机可读存储介质,其上存储有计算机程序,其中,所述程序被处理器执行时实现如权利要求1-8中任一所述的方法。9. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented. 10.一种电子设备,其特征在于,包括:处理器和存储有计算机程序的存储器,所述处理器被配置为在运行计算机程序时执行权利要求1-8中任一所述的方法。10. An electronic device, comprising: a processor and a memory storing a computer program, wherein the processor is configured to execute the method according to any one of claims 1 to 8 when running the computer program.
CN202111298956.0A 2021-11-04 2021-11-04 Compilation method, storage medium and electronic device based on file differences Active CN114047919B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111298956.0A CN114047919B (en) 2021-11-04 2021-11-04 Compilation method, storage medium and electronic device based on file differences

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111298956.0A CN114047919B (en) 2021-11-04 2021-11-04 Compilation method, storage medium and electronic device based on file differences

Publications (2)

Publication Number Publication Date
CN114047919A CN114047919A (en) 2022-02-15
CN114047919B true CN114047919B (en) 2025-09-26

Family

ID=80207127

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111298956.0A Active CN114047919B (en) 2021-11-04 2021-11-04 Compilation method, storage medium and electronic device based on file differences

Country Status (1)

Country Link
CN (1) CN114047919B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114756239A (en) * 2022-03-22 2022-07-15 深圳壹账通创配科技有限公司 Code deployment method, apparatus, computer equipment and storage medium
CN115904394B (en) * 2023-03-02 2023-07-04 之江实验室 Neural network increment compiling method and device for many-core architecture
TWI852863B (en) * 2023-12-19 2024-08-11 技鋼科技股份有限公司 Code integration method and code integration system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107797819A (en) * 2017-06-12 2018-03-13 平安普惠企业管理有限公司 Delta package generation method, computer-readable recording medium and server
CN110673853A (en) * 2019-09-25 2020-01-10 中国工商银行股份有限公司 Compiling method, device and system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9535688B2 (en) * 2014-07-23 2017-01-03 Verizon Patent And Licensing Inc. Efficient deployment of application revisions and implementation of application rollbacks across multiple application servers
CN112783500B (en) * 2019-11-08 2024-01-05 Oppo广东移动通信有限公司 Method and device for generating compiling optimization information and electronic equipment
CN112148301A (en) * 2020-09-23 2020-12-29 深圳鑫想科技有限责任公司 Method, system and storage medium for integrated production of customized version of non-compiled Android system
CN112947991A (en) * 2021-03-30 2021-06-11 建信金融科技有限责任公司 Method and device for acquiring version difference code file, computer equipment and medium
CN113536717B (en) * 2021-07-14 2022-05-24 北京华大九天科技股份有限公司 Circuit simulation method based on incremental compilation

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107797819A (en) * 2017-06-12 2018-03-13 平安普惠企业管理有限公司 Delta package generation method, computer-readable recording medium and server
CN110673853A (en) * 2019-09-25 2020-01-10 中国工商银行股份有限公司 Compiling method, device and system

Also Published As

Publication number Publication date
CN114047919A (en) 2022-02-15

Similar Documents

Publication Publication Date Title
CN114047919B (en) Compilation method, storage medium and electronic device based on file differences
CN112104709B (en) Intelligent contract processing method, device, medium and electronic equipment
US7822710B1 (en) System and method for data collection
CN113419789B (en) Method and device for generating data model script
US9563650B2 (en) Migrating federated data to multi-source universe database environment
US9971794B2 (en) Converting data objects from multi- to single-source database environment
CN106445645B (en) Method and apparatus for executing distributed computing task
WO2023056946A1 (en) Data caching method and apparatus, and electronic device
CN115358397A (en) A parallel graph rule mining method and device based on data sampling
US10585647B2 (en) Program optimization by converting code portions to directly reference internal data representations
CN112955865B (en) Static coordination of the application view hierarchy
CN114138679A (en) Test data construction method and device, computer readable medium and electronic equipment
US20240256426A1 (en) Runtime error attribution for database queries specified using a declarative database query language
US9201937B2 (en) Rapid provisioning of information for business analytics
US10732946B2 (en) Simulation-based code duplication
CN118689757A (en) Information processing method, device, equipment and storage medium
CN112487111A (en) Data table association method and device based on KV database
US20230251958A1 (en) Code linting in dynamic application environments
JP7519927B2 (en) Common infrastructure system for achieving DX
Ponce et al. Extension of a Task-based model to Functional programming
CN120336373B (en) A query optimization method, device, storage medium and electronic device for Text-to-SQL tasks
US20250124032A1 (en) Data reading and writing method, electronic device and medium
CN110134691B (en) Data verification method, device, equipment and medium
Kong et al. Improvement of Association Rule Algorithm Based on Hadoop for Medical Data
CN119576341A (en) Structural domain optimization method, device and related 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
GR01 Patent grant