CN113342355B - Code compiling method and device, electronic equipment and storage medium - Google Patents

Code compiling method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113342355B
CN113342355B CN202110899136.0A CN202110899136A CN113342355B CN 113342355 B CN113342355 B CN 113342355B CN 202110899136 A CN202110899136 A CN 202110899136A CN 113342355 B CN113342355 B CN 113342355B
Authority
CN
China
Prior art keywords
code
bin
sub
compiling
main
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
CN202110899136.0A
Other languages
Chinese (zh)
Other versions
CN113342355A (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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110899136.0A priority Critical patent/CN113342355B/en
Publication of CN113342355A publication Critical patent/CN113342355A/en
Application granted granted Critical
Publication of CN113342355B publication Critical patent/CN113342355B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • 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 disclosure relates to a code compiling method, device, electronic device and storage medium, including: responding to a preset compiling command, and acquiring sub codes contained in a plurality of sub code bins which have an association relation with a main code bin according to a first configuration file generated in advance; the first configuration file is used for recording information of the sub-code bins which are determined in the historical compiling process and have incidence relation with the main code bins; and adding the subcodes into the main code bin, so that in the compiling process, an intermediate compiling result corresponding to the subcodes is converted into a source code, and compiling and packaging the converted source code through the main code bin to generate a corresponding running file. In the method and the device, in the process of compiling the running file of the client application program, the associated subcodes can be obtained according to the first configuration file obtained in the previous compiling process and added into the main code bin, so that the subcodes can be automatically added and modified, code processing errors caused by manual modification are reduced, and the compiling efficiency is effectively improved.

Description

Code compiling method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of code compilation, and in particular, to a code compilation method and apparatus, an electronic device, and a storage medium.
Background
In order to facilitate code development and maintenance, the terminal application code can be subjected to module splitting, the split code is respectively processed by a plurality of independent sub-code bins to obtain a plurality of intermediate compilation products, and the intermediate compilation products are integrated into a main code bin to compile a final application program. But the ease of debugging the code is somewhat reduced.
In order to reduce the inconvenience of code compiling and debugging, the code corresponding to the sub-code bin can be added into the main code bin by means of an interface provided by the script tool, the script tool can assist the main code bin to convert an intermediate compiling product generated by the sub-code bin into source code in the running process, and then compiling and debugging can be performed based on the source code.
However, when source code compiling is performed by using an interface provided by a script tool, developers need to manually add codes of sub-code bins to modify engineering codes, and the problem of low compiling efficiency exists.
Disclosure of Invention
The present disclosure provides a code compiling method, apparatus, electronic device and storage medium, so as to at least solve the problem of low code compiling efficiency in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided a code compiling method, including:
responding to a preset compiling command, and acquiring sub codes contained in a plurality of sub code bins which have an association relation with a main code bin according to a first configuration file generated in advance; the configuration file is used for recording information of the sub-code bins which are determined in a historical compiling process and have incidence relation with the main code bins;
and adding the subcodes into the main code bin so as to convert intermediate compiling results corresponding to the subcodes into source codes in the compiling process, and compiling and packaging the converted source codes through the main code bin to generate corresponding running files.
In an exemplary embodiment, the obtaining, in response to a preset compiling command, the subcodes included in the plurality of subcode bins associated with the main code bin according to a pre-generated first configuration file includes:
responding to a preset compiling command, and acquiring configuration parameters corresponding to all the sub-code bins in incidence relation with the main code bin from a pre-generated second configuration file; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
according to the configuration parameters, if the target sub-code bin with the source code compiling function opened is determined to exist, the information of the target sub-code bin is obtained based on a first configuration file generated in advance, and the sub-codes contained in the target sub-code bin are obtained based on the information.
In an exemplary embodiment, the information includes identification information corresponding to the target sub-code bin, and the obtaining the sub-code included in the target sub-code bin based on the information includes:
judging whether a directory corresponding to the target sub-code bin is stored in the first configuration file or not based on the identification information;
and if the first configuration file is determined to store the directory, acquiring the subcode based on the directory.
In an exemplary embodiment, after the determining whether there is a directory corresponding to the target sub-code bin stored in the first configuration file, the method further includes:
if the configuration file is determined not to store the directory corresponding to the target sub-code bin, acquiring a code download address corresponding to the target sub-code bin from the first configuration file;
and downloading the subcodes of the target subcode bin according to the code downloading address.
In an exemplary embodiment, the association relationship includes a dependency relationship, and the method further includes:
acquiring the dependency relationship between a main code bin and a sub code bin in the historical compiling process;
acquiring information of a sub-code bin meeting a preset condition based on a dependency relationship between a main code bin and the sub-code bin, wherein the preset condition is that the sub-code bin having the dependency relationship with the main code bin has a source code compiling function; the information comprises identification information of the sub-code bin and at least one of a sub-code or a code download address corresponding to the sub-code bin;
and generating the first configuration file based on the information of the main code bin and the sub code bins which have the dependency relationship with the main code and meet the preset condition.
In an exemplary embodiment, the method further comprises:
acquiring identification information and configuration parameters corresponding to the sub-code bins meeting the preset conditions; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
and generating a second configuration file based on the identification information and the configuration parameters.
In an exemplary embodiment, the adding the sub-code to the main-code bin includes:
if the compiling command is a remote compiling command, determining a server side for remote compiling;
acquiring a main code contained in a main code bin;
and sending the subcodes and the main codes to the server, wherein the server obtains the main code bin based on the main codes, adds the subcodes into the main code bin to convert intermediate compiling results corresponding to the subcodes into source codes in the server, and compiles and packages a plurality of source codes obtained by conversion through the main code bin in the server to generate the running file.
In an exemplary embodiment, further comprising:
and receiving the running file returned by the server.
In an exemplary embodiment, the compiling and packaging the converted source code through the main code bin to generate a corresponding run file includes:
acquiring a source code corresponding to the main code bin;
and compiling and packaging the source code obtained by conversion and the source code corresponding to the main code bin to generate a corresponding running file.
According to a second aspect of the embodiments of the present disclosure, there is provided a code compiling apparatus including:
the sub-code acquisition unit is configured to execute a first configuration file which is generated in advance and responds to a preset compiling command, and acquire sub-codes contained in a plurality of sub-code bins which are in association with the main code bin; the first configuration file is used for recording information of sub-code bins which are determined in a historical compiling process and have incidence relation with the main code bin;
and the sub-code adding unit is configured to add the sub-codes to the main code bin, so that in the compiling process, an intermediate compiling result corresponding to the sub-codes is converted into a source code, and the converted source code is compiled and packaged through the main code bin to generate a corresponding running file.
In an exemplary embodiment, the sub-code obtaining unit includes:
the configuration parameter acquisition module is configured to execute and respond to a preset compiling command, and acquire configuration parameters corresponding to all the sub-code bins in incidence relation with the main code bin from a pre-generated second configuration file; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
and the information reading module is configured to execute, according to the configuration parameters, if it is determined that a target sub-code bin with the source code compiling function being started exists, acquiring information of the target sub-code bin based on a first configuration file generated in advance, and acquiring a sub-code contained in the target sub-code bin based on the information.
In an exemplary embodiment, the information includes identification information corresponding to the target sub-code bin, and the information obtaining module includes:
a subcode search module configured to execute, based on the identification information, determining whether a directory corresponding to the target subcode bin is stored in the first configuration file;
a file subcode acquisition module configured to perform, if it is determined that the first configuration file stores the directory, acquiring the subcode based on the directory.
In an exemplary embodiment, the information obtaining module further includes:
a download address obtaining module configured to execute, if it is determined that the directory corresponding to the target sub-code bin is not stored in the first configuration file, obtaining a code download address corresponding to the target sub-code bin from the first configuration file;
and the subcode downloading module is configured to execute the subcode downloading of the target subcode bin according to the code downloading address.
In an exemplary embodiment, the association relationship includes a dependency relationship, and the apparatus further includes:
a dependency relationship obtaining unit configured to obtain a dependency relationship between a main code bin and a sub code bin in the history compiling process;
the information acquisition unit is configured to acquire information of a sub-code bin meeting a predetermined condition based on a dependency relationship between a main code bin and the sub-code bin, wherein the predetermined condition is that the sub-code bin having the dependency relationship with the main code bin has a source code compiling function; the information comprises identification information of the sub-code bin and at least one of a sub-code or a code download address corresponding to the sub-code bin;
and the configuration file generating unit is configured to execute the generation of the first configuration file based on the information of the main code bin and the sub code bins which have the dependency relationship with the main code and meet the preset condition.
In an exemplary embodiment, the apparatus further comprises:
the configuration parameter acquisition unit is configured to execute acquisition of identification information and configuration parameters corresponding to the sub-code bins meeting the preset conditions; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
a second configuration file generation unit configured to perform generating a second configuration file based on the identification information and the configuration parameters.
In an exemplary embodiment, the sub-code adding unit includes:
the server determining module is configured to execute the server for remote compiling if the compiling command is a remote compiling command;
a main code acquisition module configured to execute acquisition of a main code contained in a main code bin;
and the code synchronization module is configured to execute sending of the sub-codes and the main codes to the server, the server obtains the main code bin based on the main codes and adds the sub-codes to the main code bin so as to convert intermediate compiling results corresponding to the sub-codes into source codes in the server, and the converted source codes are compiled and packaged through the main code bin in the server to generate the running file.
In an exemplary embodiment, further comprising:
and the operation file receiving unit is configured to receive the operation file returned by the server.
In an exemplary embodiment, the sub-code adding unit includes:
a main bin source code acquiring module configured to execute acquiring a source code corresponding to the main code bin;
and the compiling and packaging module is configured to execute compiling and packaging the converted source code and the source code corresponding to the main code bin to generate a corresponding running file.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement a code compilation method as defined in any one of the preceding claims.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform a code compiling method according to any one of the above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising computer programs/instructions which, when executed by a processor, implement a code compilation method as defined in any one of the preceding claims.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
in the scheme of the disclosure, in the process of compiling the running file of the client application program, the associated subcodes can be obtained according to the first configuration file obtained in the previous compiling process and added into the main code bin, so that the automatic addition and modification of the subcodes are realized, the code processing errors caused by manual modification are reduced, and the compiling efficiency is effectively improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flow diagram illustrating a method of code compilation according to an exemplary embodiment.
Fig. 2 is a flowchart illustrating a method of code compilation according to another exemplary embodiment.
Fig. 3 is a flowchart illustrating a method of code compilation according to another exemplary embodiment.
Fig. 4 is a flowchart illustrating a method of code compilation according to another exemplary embodiment.
Fig. 5 is a block diagram illustrating a code compiling apparatus according to an example embodiment.
FIG. 6 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The code compiling method provided by the disclosure can be applied to an electronic device, and the electronic device can automatically acquire the subcodes contained in the subcode bins according to a pre-generated configuration file and add the subcodes to the main code bins. The electronic device may be a terminal, and the terminal may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices; of course, the electronic device may also be a server, and the server may be implemented by an independent server or a server cluster composed of a plurality of servers; or the system consisting of the terminal and the server is realized through the interaction of the terminal and the server.
Fig. 1 is a flowchart illustrating a code compiling method according to an exemplary embodiment, and the method is illustrated in fig. 1, and may include the following steps, for example, when the method is applied to an electronic device.
In step S110, in response to a preset compiling command, according to a first configuration file generated in advance, sub-codes included in a plurality of sub-code bins associated with a main code bin are acquired.
As an example, a main code bin, which may also be referred to as a main bin, may be an application program project used to compile and package out a running file.
The sub-code bin may also be referred to as a sub-bin, and may be an application program project for compiling an intermediate compilation result, and the intermediate compilation result may be further processed in the main code bin to generate an operating file. When a sub-code bin is composed of a plurality of sub-bin modules, the sub-code bin referred to in this disclosure may also be a sub-bin module.
The subcodes included in the subcode bins may refer to the codes constituting the subcode bins, and the subcodes may be stored in the form of a file directory, and thus, the subcodes may also be referred to as a subcobin directory. When a sub-code bin is a sub-bin module, the sub-code may be the code corresponding to that sub-bin module.
The first configuration file may be used to record information of sub-code bins that are determined to be associated with the main code bin in a historical compilation process, the compilation process of the run file may involve multiple compilation processes, and the historical compilation process may be a compilation process before the sub-code is obtained.
In practical applications, a developer or other equipment may send a preset compiling instruction to the electronic equipment, where the compiling instruction may trigger the electronic equipment to compile the code. After receiving the preset compiling instruction, the electronic device may respond to the compiling instruction, obtain a first configuration file generated in advance, and obtain the subcodes included in the plurality of subcode bins associated with the main code bin according to the first configuration file.
Specifically, the first configuration file may be generated by the electronic device and then stored locally, or the electronic device may obtain the first configuration file from another terminal or a server. After the first configuration file is obtained, the electronic device can search and/or obtain the sub-codes corresponding to the plurality of sub-code bins by reading the information of the sub-code bins which are recorded in the first configuration file and have the association relation with the main code bin.
In step S120, the sub-code is added to the main code bin, so that in the compiling process, the intermediate compiling result corresponding to the sub-code is converted into a source code, and the converted source code is compiled and packaged by the main code bin, so as to generate a corresponding running file.
As an example, the intermediate compilation result may be a file generated by the sub-code bin after compiling the code in the sub-code bin, and the intermediate compilation result may include, but is not limited to, a code, a picture, a character string, and other resources. For example, for an Android system, after the sub-code bins are compiled and packaged, an AAR file may be generated, and the AAR file may be used in a process of compiling and packaging an APK (Android application package) file.
The running file may be a final compilation result generated after the main code bin is compiled and packaged based on the intermediate compilation result or the source code, and the running file may include resources related to the running of the client application program, such as codes, pictures, character strings, and the like. For example, for an android system, after the main code bin is compiled and packaged, an APK file can be finally generated. The APK may be a binary file of an Android client Application, and the main code bin may compile and package an APK file that can directly run in an Android system based on an intermediate compilation result or a source code in the main code bin, so as to obtain an App (Application, client Application).
In a specific implementation, after acquiring the sub-codes corresponding to each of the plurality of sub-code bins, the sub-codes may be added to the main code bin. Further, during the compiling process, the sub-code may be run to process a code provided by a developer (for example, a code developed for a client application), and an intermediate compiling result corresponding to the sub-code may be generated, and the intermediate compiling result may be converted into a source code.
Therefore, by performing source code conversion on the intermediate compiling results corresponding to each sub-code in the main code bin, source codes corresponding to a plurality of intermediate compiling results can be integrated in the main code bin, and the main code bin can perform compiling and packaging based on the converted source codes to generate corresponding running texts.
In the disclosure, in response to a preset compiling command, the electronic device may obtain, according to a first configuration file generated in advance, sub-codes included in a plurality of sub-code bins having an association relationship with the main code bin, add the sub-codes to the main code bin, and further may convert an intermediate compiling result corresponding to the sub-codes into a source code in a compiling process, and compile and package the converted source code through the main code bin to generate a corresponding running file. In the scheme of the disclosure, in the process of compiling the running file of the client application program, the associated subcodes can be obtained according to the first configuration file obtained in the previous compiling process and added into the main code bin, so that the automatic addition and modification of the subcodes are realized, the code processing errors caused by manual modification are reduced, and the compiling efficiency is effectively improved.
In an exemplary embodiment, as shown in fig. 2, in step S110, in response to a preset compiling command, acquiring sub-codes included in a plurality of sub-code bins associated with a main code bin according to a first configuration file generated in advance, may include the following steps:
in step S111, in response to a preset compiling command, configuration parameters corresponding to each sub-code bin associated with the main code bin are acquired from a second configuration file generated in advance.
As an example, the source code compiling function may refer to that intermediate compiling results corresponding to the sub-code bins may be converted into source codes; the configuration parameter may be used to indicate whether the source code compilation function for the corresponding sub-code bin is turned on.
In practical applications, the second configuration file may be generated in advance. Specifically, a sub-code bin having a source code compiling function may be determined in advance, and a configuration parameter corresponding to the sub-code bin may be obtained, and further, a second configuration file may be generated based on the sub-code bin having the source code compiling function and the configuration parameter corresponding to the sub-code bin, where the second configuration file may be generated by the electronic device or by another device.
After receiving a preset compiling instruction, the electronic device may obtain a second configuration file generated in advance, obtain, from the second configuration file, configuration parameters corresponding to each sub-code bin in an association relationship with the main code bin, and determine whether a source code compiling function corresponding to each sub-code bin is started.
In step S112, according to the configuration parameters, if it is determined that there is a target sub-code bin in which the source code compiling function is started, information of the target sub-code bin is obtained based on a first configuration file generated in advance, and a sub-code included in the target sub-code bin is obtained based on the information.
The configuration parameters can be used for indicating whether a source code compiling function corresponding to the sub-code bins is started or not, the electronic device can determine whether a target sub-code bin with the source code compiling function started exists or not according to the configuration parameters, if the target sub-code bin with the source code compiling function started exists, the electronic device can obtain a first configuration file generated in advance, obtain information of the target sub-code bin from the first configuration file, and further obtain sub-codes contained in the target sub-code bin based on the information. If it is determined that there is no target sub-code bin with the source code compiling function already opened, the code compiling process may be ended.
In the disclosure, in response to a preset compiling command, the electronic device may obtain, from a pre-generated second configuration file, configuration parameters corresponding to each sub-code bin in an association relationship with the main code bin, and according to the configuration parameters, if it is determined that there is a target sub-code bin in which the source code compiling function is already started, obtain information of the target sub-code bin based on the pre-generated configuration file, and obtain, based on the information, a sub-code included in the target sub-code bin, and may automatically obtain, based on the second configuration file and the configuration file, a sub-code included in the sub-code bin in which the source code compiling function is started, so as to simplify a compiling and packing process of integrating the sub-code into the main code bin, reduce manual processing links of multi-bin compiling, shorten time consumption of multi-bin compiling, and improve code compiling efficiency.
In an exemplary embodiment, the information of the target sub-code bin in the configuration file may include identification information corresponding to the target sub-code bin; in step S112, based on the information, acquiring the subcodes contained in the target subcode bin, which may include the following steps:
judging whether a directory corresponding to the target sub-code bin is stored in the first configuration file or not based on the identification information; and if the first configuration file is determined to store the directory, acquiring the subcode based on the directory.
As an example, the identification information may be information used to distinguish or identify different sub-code bins or sub-bin modules, and may be, for example, a name corresponding to a sub-code bin, which may be referred to as a module name. The directory may be a file directory, and specifically, the codes corresponding to the sub-code bins may be stored in a directory form.
In a specific implementation, after the target sub-code bin is determined to exist, the identification information corresponding to the target sub-code bin may be obtained, and the first configuration file is searched based on the identification information, so as to determine whether the directory corresponding to the target sub-code bin is stored in the first configuration file. If it is determined that the directory corresponding to the target sub-code bin is stored in the first configuration file, the sub-code of the target sub-code bin may be obtained based on the directory.
In the disclosure, the electronic device may determine whether the first configuration file has a directory corresponding to the target sub-code bin stored therein based on the identification information, and if it is determined that the first configuration file stores the directory corresponding to the target sub-code bin, the sub-code is obtained based on the directory, so that automatic obtaining of the sub-code is realized, manual addition by a developer is not required, and the code compiling efficiency is improved.
In an exemplary embodiment, after determining whether there is a subcode corresponding to the target subcode bin stored in the first configuration file, the method may further include:
if the fact that the directory corresponding to the target sub-code bin is not stored in the first configuration file is determined, a code downloading address corresponding to the target sub-code bin is obtained from the first configuration file; and downloading the subcodes of the target subcode bin according to the code downloading address.
As an example, when code management is performed by a code management tool, the code download address may be a download address generated by the code management tool for a specific code, wherein the code management tool may upload the code to a server for storage, or may pull the stored code from the server. For example, if the code management tool is Git, the code download address may be a Git address.
In practical application, when searching is performed according to the identification information, if it is determined that the directory corresponding to the target sub-code bin is not stored in the first configuration file, the code download address corresponding to the target sub-code bin may be obtained from the first configuration file, and the sub-code of the target sub-code bin is downloaded according to the code download address.
In the disclosure, if it is determined that the directory corresponding to the target sub-code bin is not stored in the first configuration file, the code download address corresponding to the target sub-code bin is obtained from the first configuration file, and the sub-code of the target sub-code bin is downloaded according to the code download address, so that automatic obtaining of the sub-code is realized, manual addition by a developer is not needed, and the code compiling efficiency is improved.
In an exemplary embodiment, the association relationship may include a dependency relationship, and the method may further include the steps of:
acquiring the dependency relationship between a main code bin and a sub code bin in the historical compiling process; acquiring information of the sub-code bins meeting preset conditions based on the dependency relationship between the main code bins and the sub-code bins; and generating the first configuration file based on the main code bin and the sub code bins which have the dependency relationship with the main code and meet the preset condition.
As an example, the predetermined condition may be that a sub-code bin having a dependency relationship with the main code bin has a source code compiling function, and the information of the sub-code bin may include identification information of the sub-code bin and at least one of a sub-code or a code download address corresponding to the sub-code bin.
In practical applications, the dependency relationship between the main code bin and the sub code bin may be obtained in a historical compiling process, for example, the main code contained in the main code bin may be analyzed to obtain the dependency relationship when the network resource is downloaded in the compiling process.
Specifically, the dependency relationship may be a concept in android application development, one main code bin may have a dependency relationship with one or more sub-code bins, one dependency relationship may all correspond to one intermediate compilation result, one intermediate compilation result may correspond to one sub-code bin, that is, there may be a one-to-one relationship between the dependency relationship, the intermediate compilation result, and the sub-code bins, and by analyzing and processing the dependency relationship of the main code bin, the sub-code bins associated with the main code bin may be determined.
After the dependency relationship between the main code bin and the sub code bin is obtained, the information of the sub code bin meeting the predetermined condition may be obtained based on the dependency relationship between the main code bin and the sub code bin. After information of a sub-code bin meeting a predetermined condition is obtained, a first configuration file may be generated based on the main code bin and the information.
In one example, the sub-code bins meeting the predetermined condition may be determined and corresponding information may be obtained as follows: the electronic device can judge whether the dependency relationship has a corresponding preset label, and when the dependency relationship has the corresponding preset label, it can be determined that the sub-code bin under the dependency relationship has a source code compiling function, and an intermediate compiling result corresponding to the sub-code bin can be converted into a source code, so that information corresponding to the sub-code bin can be acquired.
If the dependency does not have the corresponding preset label, the dependency can be ignored, and the next dependency is continuously analyzed. By analyzing the multi-segment dependency relationship, the information of the sub-code bin with the source code compiling function can be continuously written into the first configuration file.
In the disclosure, in a history compiling process, the electronic device may obtain a dependency relationship between a main code bin and a sub code bin, obtain information of the sub code bin meeting a predetermined condition based on the dependency relationship between the main code bin and the sub code bin, generate a first configuration file based on the main code bin and the information of the sub code bin meeting the predetermined condition and having a dependency relationship with the main code, provide information for automatically obtaining a sub code, provide a query basis for automatically adding the sub code to the main code bin, and can improve code compiling efficiency.
In an exemplary embodiment, the method may further include the steps of:
acquiring identification information and configuration parameters corresponding to the sub-code bins meeting the preset conditions; and generating a second configuration file based on the identification information and the configuration parameters.
In a specific implementation, for a sub-code bin meeting a predetermined condition, corresponding identification information may be acquired for the sub-code bin in the dependency relationship, and the identification may be a globally unique identification. And moreover, the configuration parameters corresponding to the sub-code bins under the dependency relationship can be acquired. For example, the default value of the configuration parameter may be "false", which indicates that the source code integration function of this sub-bin is turned off, and when set to "true", it indicates that the source code compilation function of the sub-bin is turned on. The developer can modify the configuration parameters according to actual needs. After the identification information and the configuration parameters are obtained, a second configuration file can be generated by using the identification information and the configuration parameters.
In practical application, for a script tool Gradle capable of compiling Android application program products such as Apk and AAR, analysis of the dependency relationship can be achieved by analyzing the expansion parameters written in the Gradle Ext, and a second configuration file is generated.
In an example, when the second configuration file is generated, the dependency relationship may also be analyzed by parsing a Project Object Model (POM) table of Maven dependencies or putting the dependencies into a JSON file to analyze the JSON file.
In the disclosure, the electronic device may obtain identification information and configuration parameters corresponding to the sub-code bins meeting the predetermined condition, generate a second configuration file based on the identification information and the configuration parameters, and automatically generate the second configuration file by analyzing the dependency relationship, so that the electronic device may automatically determine whether the sub-codes included in the sub-code bins are to be added to the main code bins, thereby improving the code compiling efficiency, and may quickly switch between the intermediate compiling result dependency and the source code dependency (i.e., compiling the operation file using the intermediate compiling result and compiling the operation file using the source code) by changing the second configuration file.
In an example, the electronic device may execute a pre-written script (e.g., Python script), and perform the above steps of generating the configuration file and the second configuration file based on the script.
In an exemplary embodiment, adding the sub-code to the main code bin in step S120 may include the steps of:
if the compiling command is a remote compiling command, determining a server side for remote compiling; acquiring a main code contained in a main code bin; and sending the subcodes and the main codes to the server, wherein the server obtains the main code bin based on the main codes, adds the subcodes into the main code bin so as to convert intermediate compiling results corresponding to the subcodes into source codes in the server, and compiles and packs a plurality of source codes obtained by conversion through the main code bin to generate the running file.
As an example, the main code included in the main code bin may refer to a code constituting the main code bin, and the main code may be stored in a file directory, so the main code may also be referred to as a main bin directory.
In the conventional method, if multi-bin source code compilation is performed by using an original interface provided by a script tool, an intermediate compilation result can only be converted into source codes on a local device, and cannot be performed in a remote server. Specifically, when the multi-bin source code is compiled by using a script tool in the conventional manner, a user needs to manually add codes corresponding to the sub-code bins, for example, for a "settings.
In the disclosure, after receiving the compiling command, the electronic device may further obtain the type of the compiling command, and if the compiling command is a local compiling command, the sub-code may be added to the main code bin in the electronic device. If the compiling command is a remote compiling command, a server side for remote compiling can be determined. Specifically, for example, the remote compiling command may include a server identifier corresponding to the server, and the electronic device may determine the server for remote compiling according to the server identifier.
After the compiling command is determined to be the remote compiling command, the electronic equipment can also acquire the main code contained in the main code bin and send the sub-code and the main code to the server through a file transfer tool, so that the sub-code and the main code can be synchronized to the server. The File Transfer tool may be a File Transfer Protocol implemented based on TCP or UDP, such as SFTP (secure File Transfer Protocol), scp (secure copy), rsync (data mirror backup tool), and the like.
After receiving the sub-codes and the main codes sent by the electronic device, the server can acquire the main code bin based on the main codes, add the sub-codes into the main code bin, convert intermediate compiling results corresponding to the sub-codes into source codes in the server, and compile and package a plurality of converted source codes through the main code bin in the server to generate an operating file.
In the disclosure, if the remote compiling command is a remote compiling command, the electronic device may determine a server for remote compiling, obtain a main code included in a main code bin, and send a sub code and the main code to the server; the server side can obtain a main code bin based on the main codes and add the sub codes into the main code bin, so that intermediate compiling results corresponding to the sub codes can be converted into source codes in the server side, the plurality of source codes obtained through conversion are compiled and packaged through the main code bin in the server side, an operation file is generated, multi-bin source code compiling can be achieved on remote equipment, and multi-bin source code compiling efficiency and convenience are improved.
In an exemplary embodiment, the method may further include the steps of:
and receiving the running file returned by the server.
In practical application, if the server performs remote compiling, after the server generates the running file, the running file generated by the server can be sent to the electronic device through the file transmission tool, so that the electronic device can receive the running file returned by the server, and the corresponding final compiling product can be obtained after the remote compiling.
In the disclosure, the electronic device may receive the running file returned by the server, and may synchronize corresponding compilation products after remote compilation, thereby implementing remote multi-bin source code integrated compilation.
In an exemplary embodiment, in step S120, the compiling and packaging the converted source code through the main code bin to generate a corresponding run file may include the following steps:
acquiring a source code corresponding to the main code bin; and compiling and packaging the source code obtained by conversion and the source code corresponding to the main code bin to generate a corresponding running file.
In particular implementations, after the subcode is added to the main code bin, the subcode bin may generate intermediate compilation results in the main code bin that may be converted into source code. And after the main code bin acquires the source codes corresponding to the intermediate compiling results, the source codes corresponding to the main code bin can be acquired, and the converted source codes and the source codes corresponding to the main code bin are compiled and packaged to generate the running file.
According to the method and the device, the electronic equipment compiles and packs the converted source codes and the source codes corresponding to the main code bins by acquiring the source codes corresponding to the main code bins, and generates the corresponding running files, so that the compiling and debugging convenience in the development process is improved.
In order to enable those skilled in the art to better understand the above steps, the embodiment of the present disclosure is illustrated below by an example, but it should be understood that the embodiment of the present disclosure is not limited thereto.
As shown in FIG. 3, when multi-bin source code compilation is performed using the scripting tool Gradle, a first-stage flow and a second-stage flow may be triggered sequentially when the Sync flow of Gradle is executed. Wherein, the Sync is a compiling flow of the Gradle which runs before the APK compiling flow and is used for loading network resources which are depended by the Gradle.
Specifically, in the first stage of the process, the electronic device may analyze all the dependency relationships between the main bin and the sub-bins, determine whether a preset label indicating "source code integration (conversion)" exists in the dependency relationships, and obtain the sub-bins meeting the predetermined condition. If not, the first section of flow can be ended, and the second section of flow is ignored; if the sub-bin information meeting the preset condition exists, the sub-bin information meeting the preset condition can be written into a first configuration file, unique identification information is generated aiming at the sub-bin, the corresponding configuration parameter is obtained and written into a second configuration file, and the first section of process can be ended.
In the second flow, a second configuration file generated in advance may be imported, and after the second configuration file is read, whether a sub-bin source code integration function (corresponding to the source code conversion function in the above embodiment of the present disclosure) is started may be determined according to configuration parameters in the second configuration file, and if not, the second flow may be ended; if so, further reading the information of the specified sub-bin from the first configuration file, and determining whether the electronic device can locally read the code corresponding to the sub-bin according to the information, for example, whether a directory corresponding to the sub-code bin is found locally; if not, downloading the subcodes corresponding to the sub-bins from the server; if yes, the sub-code of the sub-bin can be directly read from the local.
After the sub-code of the sub-bin is obtained, the sub-bin can be added into the main bin through the include interface and the obtained sub-code, and further, in the compiling process, the AAR file generated by the sub-bin can be converted into the source code by using the interface provided by the Gradle, so that the source code switching is completed. In one example, Gradle internally provides an interface to replace AAR dependencies with Project, and the interface can be used to implement multi-bin compilation.
For adding the sub-bin codes into the main bin, as shown in fig. 4, after the electronic device obtains the compiling command, whether the compiling command is a remote compiling command or not can be determined, if not, multi-bin source code integration can be performed through the code compiling scheme provided by the present disclosure, and after the main bin compiles and packages, an APK product is output. If yes, the sub-bin codes and the main bin codes can be synchronized to a remote machine, the sub-bin codes are added into the main bin by the remote machine to be compiled and packaged, and after an APK product is generated, the APK product is synchronized to the local electronic equipment.
It should be understood that although the various steps in the flow charts of fig. 1-4 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1-4 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
Fig. 5 is a block diagram illustrating a code compilation apparatus according to an example embodiment. Referring to fig. 5, the apparatus includes a sub-code obtaining unit 501, a sub-code adding unit 502.
A sub-code obtaining unit 501 configured to execute, in response to a preset compilation command, obtaining a sub-code included in a plurality of sub-code bins having an association relationship with a main code bin according to a first configuration file generated in advance; the configuration file is used for recording information of the sub-code bins which are determined in a historical compiling process and have incidence relation with the main code bins;
a sub-code adding unit 502 configured to add the sub-code to the main code bin, so as to convert an intermediate compilation result corresponding to the sub-code into a source code in a compilation process, and compile and package the converted source code through the main code bin, thereby generating a corresponding run file.
In an exemplary embodiment, the sub-code obtaining unit includes:
the configuration parameter acquisition module is configured to execute and respond to a preset compiling command, and acquire configuration parameters corresponding to all the sub-code bins in incidence relation with the main code bin from a pre-generated second configuration file; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
and the information reading module is configured to execute, according to the configuration parameters, if it is determined that a target sub-code bin with the source code compiling function being started exists, acquiring information of the target sub-code bin based on a first configuration file generated in advance, and acquiring a sub-code contained in the target sub-code bin based on the information.
In an exemplary embodiment, the information includes identification information corresponding to the target sub-code bin, and the information obtaining module includes:
a subcode search module configured to execute, based on the identification information, determining whether a directory corresponding to the target subcode bin is stored in the first configuration file;
a file subcode acquisition module configured to perform, if it is determined that the first configuration file stores the directory, acquiring the subcode based on the directory.
In an exemplary embodiment, the information obtaining module further includes:
a download address obtaining module configured to execute, if it is determined that the directory corresponding to the target sub-code bin is not stored in the first configuration file, obtaining a code download address corresponding to the target sub-code bin from the first configuration file;
and the subcode downloading module is configured to execute the subcode downloading of the target subcode bin according to the code downloading address.
In an exemplary embodiment, the association relationship includes a dependency relationship, and the apparatus further includes:
a dependency relationship obtaining unit configured to obtain a dependency relationship between a main code bin and a sub code bin in the history compiling process;
the information acquisition unit is configured to acquire information of a sub-code bin meeting a predetermined condition based on a dependency relationship between a main code bin and the sub-code bin, wherein the predetermined condition is that the sub-code bin having the dependency relationship with the main code bin has a source code compiling function; the information comprises identification information of the sub-code bin and at least one of a sub-code or a code download address corresponding to the sub-code bin;
a configuration file generating unit configured to execute generating the configuration file based on the information of the sub-code bins in the dependency relationship.
In an exemplary embodiment, the apparatus further comprises:
the configuration parameter acquisition unit is configured to execute acquisition of identification information and configuration parameters corresponding to the sub-code bins meeting the preset conditions; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
a second configuration file generation unit configured to perform generating a second configuration file based on the identification information and the configuration parameters.
In an exemplary embodiment, the sub-code adding unit includes:
the server determining module is configured to execute the server for remote compiling if the compiling command is a remote compiling command;
a main code acquisition module configured to execute acquisition of a main code contained in a main code bin;
and the code synchronization module is configured to execute sending of the sub-codes and the main codes to the server, the server obtains the main code bin based on the main codes and adds the sub-codes to the main code bin so as to convert intermediate compiling results corresponding to the sub-codes into source codes in the server, and the converted source codes are compiled and packaged through the main code bin in the server to generate the running file.
In an exemplary embodiment, further comprising:
and the operation file receiving unit is configured to receive the operation file returned by the server.
In an exemplary embodiment, the sub-code adding unit includes:
a main bin source code acquiring module configured to execute acquiring a source code corresponding to the main code bin;
and the compiling and packaging module is configured to execute compiling and packaging the converted source code and the source code corresponding to the main code bin to generate a corresponding running file.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 6 is a block diagram illustrating an apparatus 600 for performing a code compilation method according to an example embodiment. For example, the device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a gaming console, a tablet device, a medical device, an exercise device, a personal digital assistant, and so forth.
Referring to fig. 6, device 600 may include one or more of the following components: processing component 602, memory 604, power component 606, multimedia component 608, audio component 610, interface to input/output (I/O) 612, sensor component 614, and communication component 616.
The processing component 602 generally controls the overall operation of the device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is configured to store various types of data to support operation at the device 600. Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 604 may be implemented by any type or combination of volatile or non-volatile storage devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
A power supply component 606 provides power to the various components of the device 600. The power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 600.
The multimedia component 608 includes a screen that provides an output interface between the device 600 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 600 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is configured to output and/or input audio signals. For example, the audio component 610 includes a Microphone (MIC) configured to receive external audio signals when the device 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing status assessment of various aspects of the device 600. For example, the sensor component 614 may detect an open/closed state of the device 600, the relative positioning of components, such as a display and keypad of the device 600, the sensor component 614 may also detect a change in the position of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, orientation or acceleration/deceleration of the device 600, and a change in the temperature of the device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communications between the device 600 and other devices in a wired or wireless manner. The device 600 may access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory 604 comprising instructions, executable by the processor 620 of the device 600 to perform the above-described method is also provided. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program product comprising computer programs/instructions which, when executed by a processor, implement the above-described method.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (19)

1. A code compiling method, comprising:
responding to a preset compiling command, and acquiring configuration parameters corresponding to all the sub-code bins in incidence relation with the main code bin from a pre-generated second configuration file; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
according to the configuration parameters, if the target sub-code bin with the source code compiling function opened is determined to exist, acquiring information of the target sub-code bin based on a first configuration file generated in advance, and acquiring sub-codes contained in the target sub-code bin based on the information; the first configuration file is used for recording information of sub-code bins which are determined in a historical compiling process and have incidence relation with the main code bin;
and adding the subcodes into the main code bin so as to convert intermediate compiling results corresponding to the subcodes into source codes in the compiling process, and compiling and packaging the converted source codes through the main code bin to generate corresponding running files.
2. The method according to claim 1, wherein the information includes identification information corresponding to the target sub-code bin, and the obtaining the sub-code included in the target sub-code bin based on the information includes:
judging whether a directory corresponding to the target sub-code bin is stored in the first configuration file or not based on the identification information;
and if the first configuration file is determined to store the directory, acquiring the subcode based on the directory.
3. The method according to claim 2, wherein after determining whether there is a directory corresponding to the target sub-code bin stored in the first configuration file, further comprising:
if the fact that the directory corresponding to the target sub-code bin is not stored in the first configuration file is determined, a code downloading address corresponding to the target sub-code bin is obtained from the first configuration file;
and downloading the subcodes of the target subcode bin according to the code downloading address.
4. The method of claim 1, wherein the associative relationship comprises a dependency relationship, the method further comprising:
acquiring the dependency relationship between a main code bin and a sub code bin in the historical compiling process;
acquiring information of a sub-code bin meeting a preset condition based on a dependency relationship between a main code bin and the sub-code bin, wherein the preset condition is that the sub-code bin having the dependency relationship with the main code bin has a source code compiling function; the information comprises identification information of the sub-code bin and at least one of a sub-code or a code download address corresponding to the sub-code bin;
and generating the first configuration file based on the information of the main code bin and the sub code bins which have the dependency relationship with the main code and meet the preset condition.
5. The method of claim 4, further comprising:
acquiring identification information and configuration parameters corresponding to the sub-code bins meeting the preset conditions; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
and generating a second configuration file based on the identification information and the configuration parameters.
6. The method of claim 1, wherein adding the subcode to a main code bin comprises:
if the compiling command is a remote compiling command, determining a server side for remote compiling;
acquiring a main code contained in a main code bin;
and sending the subcodes and the main codes to the server, wherein the server obtains the main code bin based on the main codes, adds the subcodes into the main code bin to convert intermediate compiling results corresponding to the subcodes into source codes in the server, and compiles and packages a plurality of source codes obtained by conversion through the main code bin in the server to generate the running file.
7. The method of claim 6, further comprising:
and receiving the running file returned by the server.
8. The method of claim 1, wherein compiling and packaging the converted source code through the main code bin to generate a corresponding run file comprises:
acquiring a source code corresponding to the main code bin;
and compiling and packaging the source code obtained by conversion and the source code corresponding to the main code bin to generate a corresponding running file.
9. A code compiling apparatus characterized by comprising:
the configuration parameter acquisition module is configured to execute and respond to a preset compiling command, and acquire configuration parameters corresponding to all the sub-code bins in incidence relation with the main code bin from a pre-generated second configuration file; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
the information reading module is configured to execute, according to the configuration parameters, if it is determined that a target sub-code bin with the source code compiling function being started exists, acquiring information of the target sub-code bin based on a first configuration file generated in advance, and acquiring a sub-code contained in the target sub-code bin based on the information; the first configuration file is used for recording information of sub-code bins which are determined in a historical compiling process and have incidence relation with the main code bin;
and the sub-code adding unit is configured to add the sub-codes to the main code bin, so that in the compiling process, an intermediate compiling result corresponding to the sub-codes is converted into a source code, and the converted source code is compiled and packaged through the main code bin to generate a corresponding running file.
10. The apparatus of claim 9, wherein the information comprises identification information corresponding to the target sub-code bin, and wherein the information obtaining module comprises:
a subcode search module configured to execute, based on the identification information, determining whether a directory corresponding to the target subcode bin is stored in the first configuration file;
a file subcode acquisition module configured to perform, if it is determined that the first configuration file stores the directory, acquiring the subcode based on the directory.
11. The apparatus of claim 10, wherein the information obtaining module further comprises:
a download address obtaining module configured to obtain a code download address corresponding to the target sub-code bin from the first configuration file if it is determined that the directory corresponding to the target sub-code bin is not stored in the configuration file;
and the subcode downloading module is configured to execute the subcode downloading of the target subcode bin according to the code downloading address.
12. The apparatus of claim 9, wherein the association comprises a dependency, the apparatus further comprising:
a dependency relationship obtaining unit configured to obtain a dependency relationship between a main code bin and a sub code bin in the history compiling process;
the information acquisition unit is configured to acquire information of a sub-code bin meeting a predetermined condition based on a dependency relationship between a main code bin and the sub-code bin, wherein the predetermined condition is that the sub-code bin having the dependency relationship with the main code bin has a source code compiling function; the information comprises identification information of the sub-code bin and at least one of a sub-code or a code download address corresponding to the sub-code bin;
and the configuration file generating unit is configured to execute the generation of the first configuration file based on the information of the main code bin and the sub code bins which have the dependency relationship with the main code and meet the preset condition.
13. The apparatus of claim 12, further comprising:
the configuration parameter acquisition unit is configured to execute acquisition of identification information and configuration parameters corresponding to the sub-code bins meeting the preset conditions; the configuration parameter is used for indicating whether a source code compiling function of the corresponding sub-code bin is started or not;
a second configuration file generation unit configured to perform generating a second configuration file based on the identification information and the configuration parameters.
14. The apparatus of claim 9, wherein the sub-code adding unit comprises:
the server determining module is configured to execute the server for remote compiling if the compiling command is a remote compiling command;
a main code acquisition module configured to execute acquisition of a main code contained in a main code bin;
and the code synchronization module is configured to execute sending of the sub-codes and the main codes to the server, the server obtains the main code bin based on the main codes and adds the sub-codes to the main code bin so as to convert intermediate compiling results corresponding to the sub-codes into source codes in the server, and the converted source codes are compiled and packaged through the main code bin in the server to generate the running file.
15. The apparatus of claim 14, further comprising:
and the operation file receiving unit is configured to receive the operation file returned by the server.
16. The apparatus of claim 9, wherein the sub-code adding unit comprises:
a main bin source code acquiring module configured to execute acquiring a source code corresponding to the main code bin;
and the compiling and packaging module is configured to execute compiling and packaging the converted source code and the source code corresponding to the main code bin to generate a corresponding running file.
17. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement a code compilation method as claimed in any one of claims 1 to 8.
18. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform a method of code compilation according to any of claims 1-8.
19. A computer program product comprising computer programs/instructions which, when executed by a processor, implement a method of code compilation according to any one of claims 1 to 8.
CN202110899136.0A 2021-08-06 2021-08-06 Code compiling method and device, electronic equipment and storage medium Active CN113342355B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110899136.0A CN113342355B (en) 2021-08-06 2021-08-06 Code compiling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110899136.0A CN113342355B (en) 2021-08-06 2021-08-06 Code compiling method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113342355A CN113342355A (en) 2021-09-03
CN113342355B true CN113342355B (en) 2021-12-07

Family

ID=77481026

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110899136.0A Active CN113342355B (en) 2021-08-06 2021-08-06 Code compiling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113342355B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114461217A (en) * 2021-12-23 2022-05-10 北京达佳互联信息技术有限公司 Code compiling method and device, electronic equipment and storage medium
CN114281343A (en) * 2021-12-29 2022-04-05 上海华大九天信息科技有限公司 Code packet generation method and device, computer storage medium and electronic equipment
CN114356342A (en) * 2022-01-05 2022-04-15 北京字节跳动网络技术有限公司 Compiling method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110554876A (en) * 2018-05-31 2019-12-10 北京京东尚科信息技术有限公司 Method and device for compiling android project
CN112114865A (en) * 2020-08-27 2020-12-22 微民保险代理有限公司 Version data processing method and device, storage medium and electronic device
CN112579097A (en) * 2020-12-21 2021-03-30 广州博冠信息科技有限公司 Software project construction method and device, storage medium and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8615747B2 (en) * 2007-04-18 2013-12-24 Apple Inc. Method and apparatus for dynamic code optimization
CN109491662A (en) * 2018-10-31 2019-03-19 珠海市筑巢科技有限公司 Code packaging method, computer installation and computer readable storage medium, code packaging system
CN112835587B (en) * 2021-02-03 2022-08-09 宁波均联智行科技股份有限公司 Compiling integration method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110554876A (en) * 2018-05-31 2019-12-10 北京京东尚科信息技术有限公司 Method and device for compiling android project
CN112114865A (en) * 2020-08-27 2020-12-22 微民保险代理有限公司 Version data processing method and device, storage medium and electronic device
CN112579097A (en) * 2020-12-21 2021-03-30 广州博冠信息科技有限公司 Software project construction method and device, storage medium and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《A framework for building type-safe configurations for JVM using code generation techniques》;Hussachai Puripunpinyo et al.;《2017 Systems and Information Engineering Design Symposium (SIEDS)》;20170601;全文 *
《编译型PLC编译系统的研究与实现》;李慧强;《万方智搜》;20110531;全文 *

Also Published As

Publication number Publication date
CN113342355A (en) 2021-09-03

Similar Documents

Publication Publication Date Title
CN113342355B (en) Code compiling method and device, electronic equipment and storage medium
CN111273899B (en) Code processing method, device, electronic equipment and storage medium
CN111221559B (en) Application updating method, device, storage medium, terminal and server
CN111736916A (en) Dynamic expansion method and device based on Java language, electronic equipment and storage medium
CN104539476A (en) Data package obtaining method and device
CN109344051B (en) Data processing method and device, electronic equipment and storage medium
CN111913756B (en) Application program optimizing method, device and system, electronic equipment and storage medium
CN111538502A (en) Installation package processing method and device, electronic equipment and storage medium
CN111209195A (en) Method and device for generating test case
CN112114814A (en) Compiled file determining method and device and application program generating method and device
CN111596980B (en) Information processing method and device
CN110851370B (en) Program testing method and device and storage medium
CN110689377B (en) Data detection method and device and electronic equipment
CN112631695A (en) Data verification method and device, electronic equipment and storage medium
CN107193622B (en) Code compiling processing method and device and terminal
CN111597106A (en) Point burying management method and device
CN111831292A (en) Method and device for generating installation package, storage medium and electronic equipment
CN112711420B (en) Code conversion method and device
CN111596949B (en) Method and device for developing application program
CN113377370B (en) File processing method and device, electronic equipment and storage medium
CN115202762B (en) Application program control method and device, electronic equipment and storage medium
CN110647351B (en) Source code map file restoration method, device and storage medium
CN116954713A (en) Component generation method, device, electronic equipment and storage medium
CN110311968B (en) Method and device for loading file in streaming mode and intelligent equipment
CN110659081B (en) File processing method and device for program object 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
GR01 Patent grant
GR01 Patent grant