CN114691141A - Method, apparatus, device and medium for code compiling - Google Patents

Method, apparatus, device and medium for code compiling Download PDF

Info

Publication number
CN114691141A
CN114691141A CN202011592280.1A CN202011592280A CN114691141A CN 114691141 A CN114691141 A CN 114691141A CN 202011592280 A CN202011592280 A CN 202011592280A CN 114691141 A CN114691141 A CN 114691141A
Authority
CN
China
Prior art keywords
code
target
programming language
component
call
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011592280.1A
Other languages
Chinese (zh)
Inventor
蔡剑飞
刘家强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mobility Asia Smart Technology Co Ltd
Original Assignee
Mobility Asia Smart 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 Mobility Asia Smart Technology Co Ltd filed Critical Mobility Asia Smart Technology Co Ltd
Priority to CN202011592280.1A priority Critical patent/CN114691141A/en
Publication of CN114691141A publication Critical patent/CN114691141A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Landscapes

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

Abstract

Embodiments of the present disclosure relate to methods, apparatuses, devices, and media for code compilation. The method proposed herein comprises: obtaining first code written in a reference programming language, the first code including a first call for a first component associated with the reference programming language, the first component corresponding to a plurality of second components associated with different application platforms; converting the first code into second code written in a target programming language associated with a target application platform of the plurality of application platforms, the second code including a second call to a target second component of the plurality of second components associated with the target application platform; and compiling the second code into an application adapted to the target application platform. Based on the mode, a uniform development environment can be provided for the applications to be deployed on different application platforms, and therefore the burden of developers is relieved.

Description

Method, apparatus, device and medium for code compiling
Technical Field
Embodiments of the present disclosure relate to the field of computers, and more particularly, to a method, apparatus, device, and medium for code compilation.
Background
With the development of computer technology, application programs (e.g., travel applications, payment applications, map applications, etc.) have become important tools in people's lives. Often, applications may be deployed to different application platforms, which may require developers to develop independently for the different application platforms due to possible incompatibility of code between the different application platforms. There are currently many application platforms, such as the iOS (iPhone operating system) platform, the Android platform, the Blackberry platform, the WebOS platform, the Symbian platform, the wechat applet platform, and so on. Developers need to develop independently for each application platform, which consumes a lot of resources.
Disclosure of Invention
Embodiments of the present disclosure provide a scheme for code compilation.
According to a first aspect of the present disclosure, a method of code compilation is presented. The method comprises the following steps: obtaining first code written in a reference programming language, the first code including a first call for a first component associated with the reference programming language, the first component corresponding to a plurality of second components associated with different application platforms; converting the first code into second code written in a target programming language associated with a target application platform of the plurality of application platforms, the second code including a second call to a target second component of the plurality of second components associated with the target application platform; and compiling the second code into an application adapted to the target application platform.
According to a second aspect of the present disclosure, an apparatus for code compilation is presented. The device includes: an acquisition module configured to acquire first code written in a reference programming language, the first code including a first call for a first component associated with the reference programming language, the first component corresponding to a plurality of second components associated with different application platforms; a translation module configured to translate the first code into second code written in a target programming language associated with a target application platform of the plurality of application platforms, the second code including a second call to a target second component of the plurality of second components associated with the target application platform; and a compiling module configured to compile the second code into an application adapted to the target application platform.
According to a third aspect of the present disclosure, an apparatus for code compilation is presented. The apparatus comprises: at least one processing unit; at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions when executed by the at least one processing unit, cause the apparatus to perform any of the steps of the method described in accordance with the first aspect of the disclosure.
In a fourth aspect of the disclosure, a computer-readable storage medium is provided. The computer readable storage medium has stored thereon a computer program which, when executed by an apparatus, causes the apparatus to perform any of the steps of the method described according to the first aspect of the disclosure.
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the disclosure, nor is it intended to be used to limit the scope of the disclosure.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be apparent from the following more particular descriptions of exemplary embodiments of the disclosure as illustrated in the accompanying drawings wherein like reference numbers generally represent like parts throughout the exemplary embodiments of the disclosure.
FIG. 1 illustrates a schematic diagram of an example environment in which embodiments in accordance with the present disclosure can be implemented;
FIG. 2 illustrates a flow diagram of a process of code compilation according to an embodiment of the present disclosure;
FIG. 3 illustrates a flow diagram of a process of transcoding according to an embodiment of the present disclosure;
FIG. 4 illustrates a schematic block diagram of an example apparatus in accordance with an embodiment of the present disclosure; and
FIG. 5 illustrates a schematic block diagram of an example device that can be used to implement embodiments of the present disclosure.
Detailed Description
Preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While the preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The term "include" and variations thereof as used herein is meant to be inclusive in an open-ended manner, i.e., "including but not limited to". Unless specifically stated otherwise, the term "or" means "and/or". The term "based on" means "based at least in part on". The terms "one example embodiment" and "one embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first," "second," and the like may refer to different or the same object. Other explicit and implicit definitions are also possible below.
As discussed above, since the development programming languages supported by different application platforms may be different, when a developer desires to deploy an application to different application platforms, the developer may need to perform independent code development for the different application platforms. This would cost a lot of labor and development costs.
According to an embodiment of the present disclosure, a scheme of code compilation is provided. In this approach, first code written using a reference programming language is first obtained, where the first code includes a first call for a first component associated with the reference programming language, and the first component corresponds to a plurality of second components associated with different application platforms. The first code is then converted to second code written in a target programming language, wherein the target programming language is associated with a target application platform of the plurality of application platforms and the second code includes a second call to a target second component of the plurality of second components that is associated with the target application platform. The second code is then compiled into an application that is adapted to the target application platform. In this way, embodiments of the present disclosure can provide a unified development environment for different application platforms, so that a developer can use a unified programming language for development of an application and compilation of a second component to different application platforms. This can greatly reduce the burden on the developer and improve the efficiency of application development.
Various example implementations of this approach are described in further detail below in conjunction with the figures.
Referring initially to FIG. 1, a schematic diagram of an environment 100 is schematically illustrated in which an exemplary implementation according to the present disclosure may be implemented. As shown in fig. 1, environment 100 includes a computing device 120. Computing device 120 is configured to receive code 110 (referred to as first code 110 for ease of description) written in a reference programming language. The reference programming language is the programming language used by the user to write, and the computing device 120 is capable of automatically converting code written in the reference programming language to another programming language. It should be understood that the reference programming language may be any suitable programming language, examples of which include, but are not limited to: dart language, Java language, Python language, C programming language, and the like.
As shown in fig. 1, the first code 110 may include a call (referred to as a first call for ease of description) to the first component 130. In some implementations, the first component 130 may be part of a development Framework (also referred to as Framework) provided to developers. The development framework is to encapsulate the basic code and provide the developer with an API (application programming interface) that can be directly called. This can enable developers to omit writing of the base code, thereby improving development efficiency. The first component 130 herein may include one or more APIs provided by the development framework.
As shown in fig. 1, computing device 120 is also capable of obtaining a plurality of second components 140-1, 140-2 through 140-N (individually or collectively referred to as second components 140) corresponding to first component 130 written in a programming language (referred to as a target programming language for ease of description) corresponding to different application platforms. For example, when the application platform is an iOS application platform, the corresponding target programming language may include, for example, Object C programming language or Swift programming language; when the application platform is an Android application platform, the corresponding target programming language may include, for example, a Java programming language; when the application platform is Linux, the corresponding target programming language may include C programming language or C + + programming language, for example.
The computing device 120 can compile the first code 110 written in the reference programming language into applications 150-1, 150-2 through 150-N (individually or collectively referred to as applications 150) adapted to different application platforms based on the plurality of second components 140 to which the first components 130 correspond. For example, when the second component 140-1 is based on the Object C language, the corresponding application 150-1 may be an application 150-1 that is deployable on an iOS application platform. When the second component 140-2 is based on the Java language, the corresponding application 150-2 may be an application 150-2 that may be deployed on the Android application platform.
By the method, the first code written by the developer in the uniform programming language can be automatically compiled into the application adapted to different application platforms, so that the learning cost and the development cost of the developer are reduced. The specific process of code compilation will be described in detail below.
A process of code compilation according to an embodiment of the present disclosure will be described below with reference to fig. 2 to 3. FIG. 2 illustrates a flow diagram of a process 200 for storage management according to some embodiments of the present disclosure. Process 200 may be implemented, for example, by computing device 120 shown in FIG. 1.
As shown in fig. 2, at block 202, the computing device 120 obtains first code 110 written in a reference programming language, the first code 110 including a first call for a first component 130 associated with the reference programming language, the first component 130 corresponding to a plurality of second components 140 associated with different application platforms.
In some implementations, the computing device 120 can, for example, provide a developer with a development tool such that the developer can write the first code 110 in a reference programming language through the development tool. Such a development tool may, for example, allow a user to write code therein and alert the code of possible errors. The computing device 120 may obtain the first code 110, for example, through the development tool.
In some implementations, the computing device 120 can also provide a developer with a development framework written in a reference programming language (referred to as a first development framework), which enables the developer to invoke the first component 130 provided in the development framework in the process of writing the first code 110. As introduced above, the first component 130 may include, for example, one or more APIs encapsulated by the first development framework.
In some implementations, the computing device 120 can also provide development frameworks (referred to as second development frameworks) corresponding to different application platforms and establish correspondence between the first development framework for the reference programming language and the second development frameworks corresponding to other application platforms. In particular, the computing device 120 can provide, for example, an API in the first development framework for the reference programming language with a different second component corresponding to a different application platform. It should be appreciated that these different second components are written in a programming language corresponding to the application platform.
For example, for the example where the reference programming language is the Dart language, the computing device 120 may provide, for an API (referred to as a first API for convenience of description) in the Dart programming language development framework, a second component corresponding to the Object C language (corresponding to the iOS platform), a second component corresponding to the Java language (corresponding to the Android platform), a second component corresponding to the C language (corresponding to the Linux platform), and so on.
In some implementations, the different second components 140 provided by the computing device 120 may have been optimized for the corresponding application platform, for example. In particular, rather than simply converting code of a first API written in a reference programming language to code written in a target programming language, computing device 120 may, for example, use code in an existing development framework associated with a different application platform to build second component 140 corresponding to the first API.
Illustratively, if an API (referred to as a second API for convenience of description) corresponding to a first API function is already included in an existing development framework associated with another application platform, the code of the second API can be directly used as the second component 140 corresponding to the first API.
In another implementation, if an API corresponding to the first API function is not included in an existing development framework associated with another application platform, the plurality of APIs in the existing development framework may be packaged as the second component 140 corresponding to the first API.
In yet another implementation, the second component 140 corresponding to the first API may also include portions of code written in the corresponding target programming language, rather than just calls to existing APIs in an existing development framework.
At block 204, the computing device 120 converts the first code 110 into second code written in a target programming language, wherein the target programming language is associated with a target application platform of the plurality of application platforms, and the second code includes a second call to a target second component 140-1 of the plurality of second components 140 that is associated with the target application platform.
In some implementations, computing device 120 may utilize any suitable programming language conversion tool to convert first code 110 into second code written in a target programming language. For example, such programming language conversion tools may include a jsransc compiler that enables automatic conversion of Java, Kotlin, and Scala written code into JavaScript, C + +, D, C #, PHP, AS3, Dart, and Haxe programming languages. It should be understood that other suitable programming language conversion tools are also available.
Unlike traditional automatic translation of first code 110 into code written in a target programming language, computing device 120 may also allow for translation between different development frameworks in the translation of the present disclosure. The detailed process of block 204 will be described below with reference to fig. 3, which fig. 3 shows a flowchart of a process 300 of transcoding according to an embodiment of the present disclosure.
As shown in fig. 3, at block 302, computing device 120 may determine a target second component associated with the target application platform from the plurality of second components 140. For example, when the desired target application platform is an iOS application platform, the computing device 120 may determine from the plurality of second components 140 that the second component 140-1 written in the Object C programming language is the target second component.
In some implementations, the second component 140-1 can be included, for example, in a second development framework corresponding to the Object C programming language. The second development framework may be generated, for example, by the first development framework based on the reference programming language and include code written in the target programming language that corresponds to the API in the first development framework. Computing device 120 may, for example, retrieve second component 140-1 corresponding to first component 130 from a second development framework.
At block 304, the computing device 120 may convert the first call in the first code 110 written in the reference programming language to a second call in the target programming language based on the target second component 140-1. For example, the computing device 120 may automatically translate a first call to the first component 130 to a second call to a target second component 140-1 corresponding to the first component according to the definitions in the second component 140-1.
At block 306, the computing device 120 may determine second code written in the target programming language based on the translation of the first call into the second call. In particular, the computing device 120 may obtain the final second code written in the target programming language by combining the transcoding results of the automatic transcoding tool and the transformation results for the component calls in the development framework.
With continued reference to fig. 2, at block 206, the computing device 120 compiles the second code into an application that is adapted with the target application platform. In some implementations, because the computing device 120 is also capable of obtaining the target second component 140-1 corresponding to the second call in the second code, the computing device 120 may compile the second code as an application adapted to the target application platform, such as the application 150-1 adapted to the iOS platform, from the target second component 140-1.
By providing a development framework written in a uniform programming language for developers, the developers can quickly realize cross-application platform development. In addition, the development framework can be directly converted into the existing mature development framework, so that the same performance as that of the direct development based on the existing development framework corresponding to the target application platform can be obtained in the compiling process.
Embodiments of the present disclosure also provide corresponding apparatuses for implementing the above methods or processes. Fig. 4 illustrates a schematic block diagram of an apparatus 400 for code compilation according to some embodiments of the present disclosure.
As shown in fig. 4, the apparatus 400 includes an acquisition module 410 configured to acquire first code written in a reference programming language, the first code including a first call for a first component associated with the reference programming language, the first component corresponding to a plurality of second components associated with different application platforms. The apparatus 400 further includes a translation module 420 configured to translate the first code into second code written in a target programming language associated with a target application platform of the plurality of application platforms, the second code including a second call to a target second component of the plurality of second components associated with the target application platform. Furthermore, the apparatus 400 comprises a compiling module 430 configured to compile the second code into an application adapted to the target application platform.
In some implementations, the conversion module 420 includes: a target second component determination module configured to determine a target second component associated with the target application platform from the plurality of second components; a call conversion module configured to convert a first call written in a reference programming language in the first code into a second call written in a target programming language based on the target second component; and a second code determination module configured to determine second code written in the target programming language based on a translation of the first call into the second call.
In some implementations, the compiling module 430 includes: a target compiling module configured to compile the second code based on the target second component to obtain the application.
In some implementations, at least one of the plurality of second components has been optimized for a respective application platform.
In some implementations, the at least one second component includes an encapsulation of existing APIs associated with the respective application platforms.
The elements included in apparatus 400 may be implemented in a variety of ways including software, hardware, firmware, or any combination thereof. In some embodiments, one or more of the units may be implemented using software and/or firmware, such as machine executable instructions stored on a storage medium. In addition to, or in the alternative to, machine-executable instructions, some or all of the elements in apparatus 400 may be implemented at least in part by one or more hardware logic components. By way of example, and not limitation, exemplary types of hardware logic components that may be used include Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standards (ASSPs), system on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and so forth.
Fig. 5 illustrates a schematic block diagram of an example device 500 that may be used to implement embodiments of the present disclosure. For example, computing device 120 according to embodiments of the present disclosure may be implemented by device 500. As shown, device 500 includes a Central Processing Unit (CPU)501 that may perform various appropriate actions and processes in accordance with computer program instructions stored in a Read Only Memory (ROM)502 or loaded from a storage unit 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
A number of components in the device 500 are connected to the I/O interface 505, including: an input unit 506 such as a keyboard, a mouse, or the like; an output unit 507 such as various types of displays, speakers, and the like; a storage unit 508, such as a magnetic disk, optical disk, or the like; and a communication unit 509 such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
The various processes and processes described above, such as process 200 and/or process 300, may be performed by processing unit 501. For example, in some embodiments, process 200 and/or process 300 may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 500 via the ROM 502 and/or the communication unit 509. When loaded into RAM 503 and executed by CPU 501, the computer programs may perform one or more of the acts of process 200 and/or process 300 described above.
The present disclosure may be methods, apparatus, systems, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for carrying out various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processing unit of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (12)

1. A code compilation method comprising:
obtaining first code written in a reference programming language, the first code including a first call for a first component associated with the reference programming language, the first component corresponding to a plurality of second components associated with a plurality of application platforms;
converting the first code to second code written in a target programming language associated with a target application platform of the plurality of application platforms, the second code including a second call to a target second component of the plurality of second components associated with the target application platform; and
compiling the second code into an application adapted to the target application platform.
2. The method of claim 1, wherein converting the first code to second code written in a target programming language comprises:
determining the target second component associated with the target application platform from the plurality of second components;
translating the first call in the first code written in the reference programming language to the second call in the target programming language based on the target second component; and
determining the second code written in the target programming language based on the translation of the first call to the second call.
3. The method of claim 1, wherein compiling the second code into an application that is adapted to the target application platform comprises:
compiling the second code based on the target second component to obtain the application.
4. The method of claim 1, wherein at least one of the plurality of second components has been optimized for a respective application platform.
5. The method of claim 4, wherein the at least one second component comprises a package of existing Application Programming Interface (API) associated with the respective application platform.
6. An apparatus for code compilation, comprising:
an acquisition module configured to acquire first code written in a reference programming language, the first code including a first call for a first component associated with the reference programming language, the first component corresponding to a plurality of second components associated with different application platforms;
a translation module configured to translate the first code into second code written in a target programming language associated with a target application platform of the plurality of application platforms, the second code including a second call to a target second component of the plurality of second components associated with the target application platform; and
a compilation module configured to compile the second code into an application adapted to the target application platform.
7. The apparatus of claim 6, wherein the conversion module comprises:
a target second component determination module configured to determine the target second component associated with the target application platform from the plurality of second components;
a call translation module configured to translate a first call in the first code written in the reference programming language to the second call written in the target programming language based on the target second component; and
a second code determination module configured to determine the second code written in the target programming language based on the translation of the first call to the second call.
8. The apparatus of claim 6, wherein the compiling module comprises:
a target compilation module configured to compile the second code based on the target second component to obtain the application.
9. The apparatus of claim 6, wherein at least one of the plurality of second components has been optimized for a respective application platform.
10. The apparatus of claim 9, wherein the at least one second component comprises an encapsulation of an existing API associated with the respective application platform.
11. An apparatus for code compilation, comprising:
at least one processing unit; and
at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions when executed by the at least one processing unit, cause the apparatus to perform the method of any of claims 1-5.
12. A computer-readable storage medium, on which a computer program is stored which, when executed by an apparatus, causes the apparatus to carry out the method according to any one of claims 1-5.
CN202011592280.1A 2020-12-29 2020-12-29 Method, apparatus, device and medium for code compiling Pending CN114691141A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011592280.1A CN114691141A (en) 2020-12-29 2020-12-29 Method, apparatus, device and medium for code compiling

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011592280.1A CN114691141A (en) 2020-12-29 2020-12-29 Method, apparatus, device and medium for code compiling

Publications (1)

Publication Number Publication Date
CN114691141A true CN114691141A (en) 2022-07-01

Family

ID=82133317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011592280.1A Pending CN114691141A (en) 2020-12-29 2020-12-29 Method, apparatus, device and medium for code compiling

Country Status (1)

Country Link
CN (1) CN114691141A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991471A (en) * 2023-09-26 2023-11-03 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for processing installation package file

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991471A (en) * 2023-09-26 2023-11-03 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for processing installation package file
CN116991471B (en) * 2023-09-26 2024-01-05 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for processing installation package file

Similar Documents

Publication Publication Date Title
CN110096338B (en) Intelligent contract execution method, device, equipment and medium
US9678726B1 (en) Automatic generation of plugins for development tools
CN111290760B (en) Application program compiling method and device, electronic equipment and storage medium
CN111832736A (en) Method, apparatus and computer program product for processing machine learning models
CN110389786B (en) Kernel management method, electronic device and computer-readable storage medium
CN111399840B (en) Module development method and device
US9594559B2 (en) Binary file for computer program having multiple executable code variants for a function that are executable on a same processor architecture
CN109766099A (en) Front end source code Compilation Method, device, storage medium and computer equipment
CN111061489B (en) Multi-platform compiling detection method, device, equipment and medium
CN102955698A (en) Processing method and device based on multi-terminal software development
CN108595331B (en) Asynchronous interface testing method, medium, device and computing equipment
US10579366B2 (en) Data upgrade framework for distributed systems
CN114780100B (en) Compiling method, electronic device and storage medium
US9886251B2 (en) Optimized compiling of a template function
CN114691141A (en) Method, apparatus, device and medium for code compiling
CN112114789A (en) Service development method and equipment
CN113127000B (en) Compiling method, compiling device, compiling equipment and compiling storage medium for application program component
CN112269566B (en) Script generation processing method, device, equipment and system
CN109189591B (en) Method and device for calling application component
CN116841559A (en) Transcoding method, device, apparatus, medium and program product
CN111124541A (en) Configuration file generation method, device, equipment and medium
CN112162755B (en) Data processing method, device, medium and electronic equipment
US10289540B2 (en) Performing entropy-based dataflow analysis
US20220236982A1 (en) Software development device and software development program
CN110858140B (en) Compiling method of application program using Lua script and third party C module

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination