CN113031963A - Conditional compiling implementation method, device, equipment and storage medium - Google Patents

Conditional compiling implementation method, device, equipment and storage medium Download PDF

Info

Publication number
CN113031963A
CN113031963A CN202110315401.6A CN202110315401A CN113031963A CN 113031963 A CN113031963 A CN 113031963A CN 202110315401 A CN202110315401 A CN 202110315401A CN 113031963 A CN113031963 A CN 113031963A
Authority
CN
China
Prior art keywords
condition
import
assignment
dart
code
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.)
Granted
Application number
CN202110315401.6A
Other languages
Chinese (zh)
Other versions
CN113031963B (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 ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network 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 ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202110315401.6A priority Critical patent/CN113031963B/en
Publication of CN113031963A publication Critical patent/CN113031963A/en
Priority to PCT/CN2022/078554 priority patent/WO2022199337A1/en
Application granted granted Critical
Publication of CN113031963B publication Critical patent/CN113031963B/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
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • 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
    • G06F8/315Object-oriented languages

Abstract

The embodiment of the disclosure relates to a method, a device, equipment and a storage medium for implementing conditional compilation, wherein a Dart code of a project is compiled, when the Dart code is compiled into an import statement for importing a non-native library file, information of an import condition in the import statement is acquired, an assignment of the import condition is searched and obtained from a condition assignment in the Dart code, and when the assignment of the import condition meets a preset condition, a non-native library file pointed when the assignment of the import condition meets the preset condition is imported into the Dart code for compilation, so that the conditional compilation based on a Dart programming language is implemented, the Dart compilation can be conducted into the non-native library file for compilation, the flexibility of the Dart programming is improved, and the limitation of the application of the Dart technology is reduced.

Description

Conditional compiling implementation method, device, equipment and storage medium
Technical Field
The embodiment of the disclosure relates to the technical field of computers, and in particular, to a method, an apparatus, a device and a storage medium for implementing conditional compilation.
Background
Dart is a commonly used computer programming language in the related art. When the Dart code is compiled, the Dart compiler can only detect and judge the local library file related in the code, does not support conditional compilation, and cannot introduce a non-local library file through the conditional compilation, so that the flexibility of the Dart programming and the application of the Dart technology are greatly limited.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, embodiments of the present disclosure provide a method, an apparatus, a device, and a storage medium for implementing conditional compilation.
A first aspect of the embodiments of the present disclosure provides a method for implementing conditional compilation, where the method includes:
compiling a Dart code of the project, wherein the Dart code comprises an import statement for importing the non-local library file; when the import statement is compiled, acquiring the information of the import condition in the import statement; searching the assignment of the import condition from the previously obtained assignment of the condition in the Dart code; if the assignment of the import condition meets the preset condition, importing the non-local library file pointed when the import condition meets the preset condition into the Dart code for compiling.
In one embodiment, the obtaining information of the import condition in the import statement includes:
and acquiring an import condition beginning with a preset character string in the import sentence.
In one embodiment, before searching for the assignment of the import condition from the previously obtained assignments of the conditions in the Dart code, the method includes:
and reading the assignment of the condition in the Dart code from a configuration file of the project obtained in advance.
In one embodiment, before searching for the assignment of the import condition from the previously obtained assignments of the conditions in the Dart code, the method includes:
displaying a command input interface to a user; and obtaining the assignment of the condition in the Dart code configured on the command input interface by the user.
In one embodiment, after obtaining the assignment of the condition in the Dart code configured by the user on the command input interface, the method further includes:
and updating the assignment of the condition acquired from the command input interface into the configuration file of the project.
A second aspect of an embodiment of the present disclosure provides a compiling apparatus including:
the compiling module is used for compiling a Dart code of the project, wherein the Dart code comprises an import statement used for importing the non-local library file;
the first acquisition module is used for acquiring the information of the import condition in the import statement when the import statement is compiled;
the searching module is used for searching the assignment of the import condition from the assignment of the condition in the Dart code obtained in advance;
and the import module is used for importing the non-local library file pointed when the import condition meets the preset condition into the Dart code for compiling when the assignment of the import condition meets the preset condition.
In an embodiment, the first obtaining module may be configured to:
and acquiring an import condition beginning with a preset character string in the import sentence.
In one embodiment, the compiling apparatus further comprises:
and the second acquisition module is used for reading the assignment of the condition in the Dart code from the configuration file of the project obtained in advance.
In one embodiment, the compiling apparatus further comprises:
the display module is used for displaying a command input interface to a user;
and the third obtaining module is used for obtaining the assignment of the condition in the Dart code configured on the command input interface by the user.
In one embodiment, the apparatus further comprises:
and the file management module is used for updating the assignment of the condition acquired from the command input interface into the configuration file of the project.
A third aspect of embodiments of the present disclosure provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method of the first aspect may be implemented.
A fourth aspect of embodiments of the present disclosure provides a computer-readable storage medium having a computer program stored therein, which, when executed by a processor, may implement the method of the first aspect described above.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
according to the method and the device, by compiling the Dart code of the project, when the import statement used for importing the non-local library file is compiled, the information of the import condition in the import statement is obtained, the assignment of the import condition is searched and obtained from the pre-obtained assignment of the condition in the Dart code, and when the assignment of the import condition meets the preset condition, the non-local library file pointed when the assignment of the import condition meets the preset condition is imported into the Dart code for compiling, so that conditional compiling based on a Dart programming language is realized, the Dart compiling can be imported into the non-local library file for compiling, the flexibility of Dart programming is improved, and the limitation of application of the Dart technology is reduced.
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.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a flowchart of a method for implementing conditional compilation according to an embodiment of the present disclosure;
FIG. 2 is a flowchart of a method for obtaining assignments of conditions in a Dart code according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a command input interface provided by an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a compiling apparatus according to an embodiment of the disclosure;
fig. 5 is a schematic structural diagram of a computer device in an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
Fig. 1 is a flowchart of a method for implementing conditional compilation, which may be executed by a Dart compiler, according to an embodiment of the present disclosure, as shown in fig. 1, where the method provided in this embodiment includes the following steps:
step 101, compiling a Dart code of a project, wherein the Dart code comprises an import statement for importing a non-local library file.
The term item in this embodiment may be understood as a function or a collection of functions implemented based on the Dart programming language. For convenience of understanding, items may be exemplarily understood as application programs having certain functions in the present embodiment.
The Dart code of an item refers to a collection of statements written based on the Dart programming language to represent the implementation logic of the item.
Unlike the related art, the Dart code of the item referred to in this embodiment may include an import statement for importing a non-native library file. The import statement may generally be a statement that begins with an "import" string, but is not limited to an "import" string. The statement includes a judgment of an import condition of a non-local library file, for example, but not limited to, an if statement. For example, the following is an exemplary piece of import statements provided by embodiments of the present disclosure:
import'package:bd_hook_coverage/empty.dart'
if(condition.hooked)'package:bd_hook_coverage/bd_hook_coverage.dart';
as shown above, when the Dart compiler compiles the "import" character string, it is determined that the import statement is compiled for importing the non-native library file, at this time, if the condition "condition.homed" in the if statement is true (that is, the assignment meets the preset condition), the non-native library file of "package: bd _ hook _ coverage/bd _ hook _ coverage.dart" is imported into the current Dart code for compilation, and if the condition "condition.homed" is false (that is, the assignment does not meet the preset condition), the non-native library file of "package: bd _ hook _ coverage/expression.dart" is imported into the current Dart code for compilation. Of course, this is merely an example and is not the only limitation on the import statements referred to by the embodiments of the present disclosure.
Step 102, when compiling to an import statement for importing a non-local library file, acquiring information of an import condition in the import statement.
In this embodiment, the import condition in the import sentence referred to in this embodiment may be exemplarily understood as a sentence that starts or ends with a preset character string in the import sentence. For example, in the above example, "condition.visited" in the parenthesis of the if statement is understood as an introduction condition starting with the preset character string "condition. When the Dart compiler compiles the "condition" in the if statement, the lead-in condition "condition. That is, in one implementation of the embodiment of the present disclosure, the method of acquiring information of an import condition in an import sentence includes acquiring an import condition beginning with a preset character string in the import sentence. Of course, the foregoing is illustrative only and is not limiting of the disclosure.
And 103, searching the assignment of the import condition from the previously obtained assignments of the conditions in the Dart code.
Wherein the assignment of the condition in the Dart code can be declared in the macro condition of the Dart code. After the import condition in the import statement is obtained based on step 102, the assignment of the import condition can be searched and obtained from the macro condition of the Dart code. For example, when statement information included in macro conditions of the Dart code is "condition.visited: true", the condition "condition.visited" in the if statement in the foregoing example meets a preset condition (that is, the condition "condition.visited" in the if statement is true), and the non-local library file "package: bd _ hook _ coverage/bd _ hook _ coverage.dart" is imported into the Dart code for compiling; on the contrary, if the declaration information in the macro condition is "condition.visited: false", the condition "condition.visited" in the if statement in the foregoing example does not meet the preset condition (i.e., the condition "condition.visited" in the if statement is false, then the non-local library file "package: bd _ hook _ coverage/empty.dart" will be imported into the Dart code for compiling.
And 104, if the assignment of the import condition meets a preset condition, importing the non-local library file, which is pointed when the import condition meets the preset condition, into a Dart code for compiling.
According to the method and the device, by compiling the Dart code of the project, when the import statement used for importing the non-local library file is compiled, the information of the import condition in the import statement is obtained, the assignment of the import condition is searched and obtained from the pre-obtained assignment of the condition in the Dart code, and when the assignment of the import condition meets the preset condition, the non-local library file pointed when the assignment of the import condition meets the preset condition is imported into the Dart code for compiling, so that conditional compiling based on a Dart programming language is realized, the Dart compiling can be imported into the non-local library file for compiling, the flexibility of Dart programming is improved, and the limitation of application of the Dart technology is reduced.
Fig. 2 is a flowchart of a method for obtaining an assignment of a condition in a Dart code according to an embodiment of the present disclosure, and as shown in fig. 2, before step 103 of the foregoing embodiment, the method may further include the following steps:
step 201, displaying a command input interface to a user.
Step 202, obtaining the assignment of the condition in the Dart code configured on the command input interface by the user.
For example, fig. 3 is a schematic diagram of a command input interface provided in an embodiment of the present disclosure, on which a user may assign a value to each import condition included in Dart code, for example, a character string "flute-conditions" in fig. 3 is used to indicate that a character string following the character string declares the assignment of the import condition in Dart code, and a character string "condition. When the Dart compiler compiles to the import condition "condition. homed", the library file pointed to when the "condition. homed" is assigned as "true" will be imported into the Dart code for compilation. The character string "conditions. xxxx ═ false" in fig. 3 is used to indicate that the value of the import condition "conditions. xxxx" is "false". When the Dart compiler compiles to the import condition "condition. xxxx", the library file pointed to when "condition. xxxx" is assigned as "false" will be imported into the Dart code for compilation. Of course, this is only an example illustration in fig. 3 and is not the only limitation on the embodiments of the present disclosure.
Optionally, in a possible implementation manner of this embodiment, after obtaining the assignments of the conditions in the Dart code from the command input interface, the assignments of the conditions may be updated into the configuration file of the project, so that the data in the configuration file is always the latest data. According to the method and the device, the command input interface is displayed for the user, so that the user can assign the import condition in the Dart code on the command input interface, and the flexibility of the assignment mode of the import condition is improved.
It should be noted that the method in the above-described embodiment of fig. 2 is only one method, but not all methods, that can be used to obtain the assignments of the import conditions in the Dart code. In fact, in other embodiments, the assignment corresponding to each import condition in the Dart code may also be directly read from a configuration file (for example, but not limited to, a "pubspec.yaml" file) of the project corresponding to the Dart code.
Fig. 4 is a schematic structural diagram of a compiling apparatus provided by an embodiment of the present disclosure, which may be understood as a Dart compiler or a part of functional modules in the Dart compiler in the above embodiments by way of example. As shown in fig. 4, the compiling apparatus 40 includes:
a compiling module 41, configured to compile a Dart code of a project, where the Dart code includes an import statement for importing a non-local library file;
a first obtaining module 42, configured to obtain information of an import condition in the import statement when the import statement is compiled;
a searching module 43, configured to search the assignment of the import condition from the assignment of the condition in the Dart code obtained in advance;
and the importing module 44 is configured to, when the assignment of the importing condition meets a preset condition, import the non-local library file pointed by the importing condition meeting the preset condition into the Dart code for compiling.
In an embodiment, the first obtaining module 42 may be configured to:
and acquiring an import condition beginning with a preset character string in the import sentence.
In one embodiment, the compiling apparatus further comprises:
and the second acquisition module is used for reading the assignment of the condition in the Dart code from the configuration file of the project obtained in advance.
In one embodiment, the compiling apparatus further comprises:
the display module is used for displaying a command input interface to a user;
and the third obtaining module is used for obtaining the assignment of the condition in the Dart code configured on the command input interface by the user.
In one embodiment, the apparatus further comprises:
and the file management module is used for updating the assignment of the condition acquired from the command input interface into the configuration file of the project.
The apparatus provided in this embodiment can execute the method of any of the above method embodiments, and the execution manner and the beneficial effect are similar, which are not described herein again.
The embodiment of the present disclosure further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and when the computer program is executed by the processor, the method of any one of the above-mentioned fig. 1 to fig. 3 may be implemented.
For example, fig. 5 is a schematic structural diagram of a computer device in an embodiment of the present disclosure. Referring now specifically to FIG. 5, a schematic diagram of a computer device 1000 suitable for use in implementing embodiments of the present disclosure is shown. The computer device 1000 in the embodiments of the present disclosure may include, but is not limited to, devices with certain computing and processing capabilities, such as a notebook computer, desktop computer, and the like. The computer device shown in fig. 5 is only an example and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
As shown in fig. 5, the computer apparatus 1000 may include a processing device (e.g., a central processing unit, a graphic processor, etc.) 1001 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1002 or a program loaded from a storage device 1008 into a Random Access Memory (RAM) 1003. In the RAM 1003, various programs and data necessary for the operation of the computer apparatus 1000 are also stored. The processing device 1001, the ROM1002, and the RAM 1003 are connected to each other by a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
Generally, the following devices may be connected to the I/O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, or the like; an output device 1007 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 1008 including, for example, magnetic tape, hard disk, and the like; and a communication device 1009. The communication means 1009 may allow the computer device 1000 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 illustrates a computer device 1000 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 1009, or installed from the storage means 1008, or installed from the ROM 1002. The computer program, when executed by the processing device 1001, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, 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), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the computer device; or may exist separately and not be incorporated into the computer device.
The computer readable medium carries one or more programs which, when executed by the computing device, cause the computing device to: compiling a Dart code of the project, wherein the Dart code comprises an import statement for importing the non-local library file; when the import statement is compiled, acquiring the information of the import condition in the import statement; searching the assignment of the import condition from the previously obtained assignment of the condition in the Dart code; if the assignment of the import condition meets the preset condition, importing the non-local library file pointed when the import condition meets the preset condition into the Dart code for compiling.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Dart, Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code 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).
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 code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, 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.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, 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), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The embodiments of the present disclosure further provide a computer-readable storage medium, where a computer program is stored in the storage medium, and when the computer program is executed by a processor, the method of any one of the embodiments in fig. 1 to fig. 3 may be implemented, where the execution manner and the beneficial effects are similar, and are not described herein again.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (12)

1. A conditional compilation implementation method, comprising:
compiling a Dart code of a project, wherein the Dart code comprises an import statement for importing a non-local library file;
when the import statement is compiled, acquiring the information of the import condition in the import statement;
searching the assignment of the import condition from the previously obtained assignment of the condition in the Dart code;
if the assignment of the import condition meets the preset condition, importing the non-local library file pointed when the import condition meets the preset condition into the Dart code for compiling.
2. The method according to claim 1, wherein the obtaining of the information of the import condition in the import statement comprises:
and acquiring an import condition beginning with a preset character string in the import sentence.
3. The method according to claim 1 or 2, wherein before searching for the assignment of the import condition from the previously obtained assignments of the conditions in the Dart code, the method comprises:
and reading the assignment of the condition in the Dart code from a configuration file of the project obtained in advance.
4. The method according to claim 1 or 2, wherein before searching for the assignment of the import condition from the previously obtained assignments of the conditions in the Dart code, the method comprises:
displaying a command input interface to a user;
and obtaining the assignment of the condition in the Dart code configured on the command input interface by the user.
5. The method of claim 4, wherein after obtaining the assignment of the condition in the Dart code configured by the user on the command input interface, the method further comprises:
and updating the assignment of the condition acquired from the command input interface into the configuration file of the project.
6. A compiling apparatus characterized by comprising:
the compiling module is used for compiling a Dart code of the project, wherein the Dart code comprises an import statement used for importing the non-local library file;
the first acquisition module is used for acquiring the information of the import condition in the import statement when the import statement is compiled;
the searching module is used for searching the assignment of the import condition from the assignment of the condition in the Dart code obtained in advance;
and the import module is used for importing the non-local library file pointed when the import condition meets the preset condition into the Dart code for compiling when the assignment of the import condition meets the preset condition.
7. The apparatus of claim 6, wherein the first obtaining module is configured to:
and acquiring an import condition beginning with a preset character string in the import sentence.
8. The apparatus of claim 6 or 7, further comprising:
and the second acquisition module is used for reading the assignment of the condition in the Dart code from the configuration file of the project obtained in advance.
9. The apparatus of claim 6 or 7, further comprising:
the display module is used for displaying a command input interface to a user;
and the third obtaining module is used for obtaining the assignment of the condition in the Dart code configured on the command input interface by the user.
10. The apparatus of claim 9, further comprising:
and the file management module is used for updating the assignment of the condition acquired from the command input interface into the configuration file of the project.
11. A computer device, comprising:
a processor and a memory, wherein the memory has stored therein a computer program which, when executed by the processor, performs the method of any of claims 1-5.
12. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN202110315401.6A 2021-03-24 2021-03-24 Method, device, equipment and storage medium for realizing conditional compiling Active CN113031963B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110315401.6A CN113031963B (en) 2021-03-24 2021-03-24 Method, device, equipment and storage medium for realizing conditional compiling
PCT/CN2022/078554 WO2022199337A1 (en) 2021-03-24 2022-03-01 Method and apparatus for implementing conditional compilation, and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110315401.6A CN113031963B (en) 2021-03-24 2021-03-24 Method, device, equipment and storage medium for realizing conditional compiling

Publications (2)

Publication Number Publication Date
CN113031963A true CN113031963A (en) 2021-06-25
CN113031963B CN113031963B (en) 2023-09-12

Family

ID=76473405

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110315401.6A Active CN113031963B (en) 2021-03-24 2021-03-24 Method, device, equipment and storage medium for realizing conditional compiling

Country Status (2)

Country Link
CN (1) CN113031963B (en)
WO (1) WO2022199337A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022199337A1 (en) * 2021-03-24 2022-09-29 北京字节跳动网络技术有限公司 Method and apparatus for implementing conditional compilation, and device and storage medium
CN115904393A (en) * 2023-01-05 2023-04-04 拉扎斯网络科技(上海)有限公司 Conditional compiling implementation method, device, medium and equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6983468B1 (en) * 1999-11-22 2006-01-03 International Business Machines Corporation Automated interface generation for computer programs in different environments
US20060224561A1 (en) * 2005-03-30 2006-10-05 International Business Machines Corporation Method and apparatus for associating logical conditions with the re-use of a database query execution strategy
CN101968736A (en) * 2010-09-13 2011-02-09 杭州元睿信息技术有限公司 Translation method for applying Java to external reference in C++ language program translation
CN106843996A (en) * 2017-03-08 2017-06-13 百富计算机技术(深圳)有限公司 Conditional compilation preprocess method and device
CN108139891A (en) * 2015-10-23 2018-06-08 微软技术许可有限责任公司 Include suggesting for the missing of external file
CN109241157A (en) * 2018-08-02 2019-01-18 中央电视台 Data calling method, device, communication equipment and storage medium
CN109324799A (en) * 2018-09-25 2019-02-12 珠海市筑巢科技有限公司 A kind of code compiling method, computer installation and computer readable storage medium
CN110531971A (en) * 2019-08-29 2019-12-03 深圳市今天国际物流技术股份有限公司 Fetcher code automatic generation method, device, computer equipment and storage medium
CN111880777A (en) * 2020-06-23 2020-11-03 北京三快在线科技有限公司 Program information issuing method and device and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113031963B (en) * 2021-03-24 2023-09-12 北京字节跳动网络技术有限公司 Method, device, equipment and storage medium for realizing conditional compiling

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6983468B1 (en) * 1999-11-22 2006-01-03 International Business Machines Corporation Automated interface generation for computer programs in different environments
US20060224561A1 (en) * 2005-03-30 2006-10-05 International Business Machines Corporation Method and apparatus for associating logical conditions with the re-use of a database query execution strategy
CN101968736A (en) * 2010-09-13 2011-02-09 杭州元睿信息技术有限公司 Translation method for applying Java to external reference in C++ language program translation
CN108139891A (en) * 2015-10-23 2018-06-08 微软技术许可有限责任公司 Include suggesting for the missing of external file
CN106843996A (en) * 2017-03-08 2017-06-13 百富计算机技术(深圳)有限公司 Conditional compilation preprocess method and device
CN109241157A (en) * 2018-08-02 2019-01-18 中央电视台 Data calling method, device, communication equipment and storage medium
CN109324799A (en) * 2018-09-25 2019-02-12 珠海市筑巢科技有限公司 A kind of code compiling method, computer installation and computer readable storage medium
CN110531971A (en) * 2019-08-29 2019-12-03 深圳市今天国际物流技术股份有限公司 Fetcher code automatic generation method, device, computer equipment and storage medium
CN111880777A (en) * 2020-06-23 2020-11-03 北京三快在线科技有限公司 Program information issuing method and device and electronic equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022199337A1 (en) * 2021-03-24 2022-09-29 北京字节跳动网络技术有限公司 Method and apparatus for implementing conditional compilation, and device and storage medium
CN115904393A (en) * 2023-01-05 2023-04-04 拉扎斯网络科技(上海)有限公司 Conditional compiling implementation method, device, medium and equipment
CN115904393B (en) * 2023-01-05 2023-06-30 拉扎斯网络科技(上海)有限公司 Condition compiling realization method, device, medium and equipment

Also Published As

Publication number Publication date
WO2022199337A1 (en) 2022-09-29
CN113031963B (en) 2023-09-12

Similar Documents

Publication Publication Date Title
US9619211B2 (en) Code suggestion in a software development tool
CN109062563B (en) Method and device for generating page
CN107797820B (en) Method and device for generating patch
US11550599B2 (en) Method and apparatus for running applet
CN110990023B (en) Dependency uploading method and device of aar file, storage medium and electronic equipment
CN110764748B (en) Code calling method, device, terminal and storage medium
CN113031963B (en) Method, device, equipment and storage medium for realizing conditional compiling
CN112115153A (en) Data processing method, device, equipment and storage medium
CN110489162B (en) Method, device, medium and equipment for simplifying installation package SO (storage and retrieval) file
CN114153473A (en) Module integration method, device, storage medium and electronic equipment
CN111506904B (en) Method and device for online bug repair
CN108073401B (en) Method and device for executing business logic and electronic equipment
US9959101B2 (en) Conditional sequential selection of external reference solutions
CN115167822A (en) Branch code merging method, device, equipment and storage medium
CN111796865B (en) Byte code file modification method, device, terminal equipment and medium
US9244657B2 (en) System and method for an object instance acquirer
CN115145737B (en) Dynamic locking method, electronic device and computer readable storage medium
CN112711400B (en) View processing method, device and storage medium
CN115878091A (en) Data processing method, device, equipment and storage medium
CN116009951A (en) Code processing method, device, equipment and storage medium
CN116795371A (en) Condition compiling method, device, equipment and medium
CN117435203A (en) Code synchronization method, device, apparatus, storage medium, and program
CN114428615A (en) CSS compiling method, style updating method, device, medium and equipment
CN114153456A (en) File management method and device, electronic equipment and storage medium
CN116414444A (en) Dependency item detection method, device, equipment and storage medium for target application

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