CN115904393B - Condition compiling realization method, device, medium and equipment - Google Patents

Condition compiling realization method, device, medium and equipment Download PDF

Info

Publication number
CN115904393B
CN115904393B CN202310011431.7A CN202310011431A CN115904393B CN 115904393 B CN115904393 B CN 115904393B CN 202310011431 A CN202310011431 A CN 202310011431A CN 115904393 B CN115904393 B CN 115904393B
Authority
CN
China
Prior art keywords
compiling
file
code
client
dimension
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
CN202310011431.7A
Other languages
Chinese (zh)
Other versions
CN115904393A (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.)
Lazas Network Technology Shanghai Co Ltd
Original Assignee
Lazas Network Technology Shanghai 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 Lazas Network Technology Shanghai Co Ltd filed Critical Lazas Network Technology Shanghai Co Ltd
Priority to CN202310011431.7A priority Critical patent/CN115904393B/en
Publication of CN115904393A publication Critical patent/CN115904393A/en
Application granted granted Critical
Publication of CN115904393B publication Critical patent/CN115904393B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Stored Programmes (AREA)

Abstract

The application provides a conditional compiling implementation method, device, medium and equipment, aiming at multi-terminal codes applied to different clients, determining conditional compiling strategies among the clients, wherein the method comprises the following steps: analyzing the difference of the code logic and/or the code flow executed by each client, and determining a corresponding conditional compiling strategy according to the difference analysis result; and determining that the conditional compiling strategy is conditional compiling based on a code dimension or conditional compiling based on a file dimension according to a difference analysis result. According to the method, the efficiency of adapting the multi-terminal code to each client is improved through optimizing the condition compiling implementation method.

Description

Condition compiling realization method, device, medium and equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a medium, and a device for implementing conditional compilation.
Background
In general, each line of code in a source program is compiled, but in some cases, it is desirable to compile only a part of the content from the viewpoint of optimizing the program code, and in this case, it is necessary to add a condition to the program, to make the compiler compile only the code satisfying the condition, and to discard the code not satisfying the condition, that is, to compile the condition (conditional compile). It can be seen that conditional compilation is a mechanism for compiling different codes and generating different target files according to different situations, and the conditional compilation can make a program easier to migrate, for example, multi-end codes suitable for multiple clients (APPs or applets) are realized through conditional compilation. Those skilled in the art find how to optimize a conditional compilation implementation, thereby improving the efficiency of adapting multi-terminal codes to individual clients, which is a technical problem to be solved.
Disclosure of Invention
In view of this, the present application provides a method, an apparatus, a medium, and an electronic device for implementing conditional compilation, which are mainly aimed at improving the efficiency of adapting multi-terminal codes to each client by optimizing the implementing method for conditional compilation.
According to one aspect of the present application, there is provided a conditional compilation implementation method for determining conditional compilation policies between clients for multi-end codes applied to different clients, the method comprising: analyzing the difference of the code logic and/or the code flow executed by each client, and determining a corresponding conditional compiling strategy according to the difference analysis result; if the difference analysis result accords with a preset first difference result, the first difference result is that the code difference of each client is smaller than or equal to a preset minimum difference threshold value, and the condition compiling strategy is determined to be based on the code dimension; and if the difference analysis result accords with a preset second difference result, wherein the second difference result is that the code difference of each client is larger than a preset maximum difference threshold value, and the conditional compiling strategy is determined to be conditional compiling based on file dimensions.
According to one aspect of the present application, there is provided a conditional compilation implementation apparatus for determining conditional compilation policies between clients for multi-terminal codes applied to different clients, the apparatus comprising: the difference analysis unit is used for analyzing the difference of the code logic and/or the code flow executed by each client; the strategy determining unit is used for determining a corresponding conditional compiling strategy according to the difference analysis result; if the difference analysis result accords with a preset first difference result, the first difference result is that the code difference of each client is smaller than or equal to a preset minimum difference threshold value, and the condition compiling strategy is determined to be based on the code dimension; and if the difference analysis result accords with a preset second difference result, wherein the second difference result is that the code difference of each client is larger than a preset maximum difference threshold value, and the conditional compiling strategy is determined to be conditional compiling based on file dimensions.
According to an aspect of the present application, there is provided a storage medium having a computer program stored therein, wherein the computer program is configured to execute the above conditional compilation implementation method at runtime.
According to one aspect of the present application, there is provided an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the conditional compilation implementation method described above.
By means of the technical scheme, the method, the device, the medium and the equipment for realizing the conditional compiling are provided, in the application, different conditional compiling strategies are selected based on the difference analysis results of all clients, so that the efficiency of the code compatible with a plurality of clients can be effectively improved, when the difference is smaller, the conditional compiling based on the code dimension is adopted, when the difference is larger, the conditional compiling based on the file dimension is adopted, and in addition, the two-dimensional conditional compiling of the file dimension and the code dimension is supported, and the code or file loading operation efficiency can be improved according to the mode of distinguishing different conditional compiling strategies according to the code difference.
In the condition compiling implementation process based on the code dimension, the comment sentences are respectively compiled by adopting the condition compiling grammar for different types of files, the comment sentences are inserted into the codes, and different codes corresponding to different clients are distinguished according to the variables in the comment sentences, so that after the regular expression is hit, the codes corresponding to the variables corresponding to the current client are executed, and the codes with different functions are realized for different clients, thereby achieving the purpose of condition compiling. The method adopts the comment statement to realize conditional compiling, does not occupy code operation resources, and can empty codes meeting the conditions after compiling, thereby achieving the effect of compressing the code volume.
In the realization process of compiling based on file dimension conditions, firstly, setting conditional compiling variables for distinguishing different client specific files in a configuration file; and then modifying the file name by the configured special suffix, and selecting the corresponding file by the special suffix to compile during compiling, thereby realizing the conditional compiling based on the file dimension. Therefore, under the condition that a large number of differential codes are arranged between the clients, the condition compiling of file dimension is directly carried out on the files, special suffix specifications are specified for the respective clients, and when compiling and outputting, special suffix identifiers of the corresponding clients under the output catalogue are preferentially used for generating version source files of the corresponding clients, so that the method has better readability and expandability.
The foregoing description is only an overview of the technical solutions of the present application, and may be implemented according to the content of the specification in order to make the technical means of the present application more clearly understood, and in order to make the above-mentioned and other objects, features and advantages of the present application more clearly understood, the following detailed description of the present application will be given.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
Fig. 1 shows a schematic diagram of a conditional compilation implementation method according to an embodiment of the present application;
fig. 2 shows a code dimension-based conditional compilation implementation flowchart in a conditional compilation implementation method according to an embodiment of the present application;
fig. 3 shows a flow chart of a conditional compilation implementation based on file dimensions in a conditional compilation implementation method according to an embodiment of the present application;
fig. 4 shows a two-dimensional conditional compilation implementation flowchart based on file dimensions and code dimensions in a conditional compilation implementation method according to an embodiment of the present application;
fig. 5 shows a schematic structural diagram of a conditional compilation implementing apparatus according to an embodiment of the present application;
fig. 6 illustrates a schematic diagram of a code dimension conditional compilation structure in a conditional compilation implementation apparatus according to an embodiment of the present application;
fig. 7 is a schematic diagram of a file dimension conditional compilation structure in a conditional compilation implementation device according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application. It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other.
Referring to fig. 1, a schematic diagram of a conditional compilation implementation method provided in an embodiment of the present application is shown. According to the conditional compiling implementation method, conditional compiling strategies among clients are determined aiming at multi-terminal codes applied to different clients.
First, differences in the code logic and/or code flow executed by each client are analyzed.
As previously described, conditional compilation is a mechanism for compiling different codes and generating different target files according to different situations, and can make a program easier to migrate, for example, multi-end codes suitable for a plurality of clients are realized through conditional compilation.
Therefore, in order to realize conditional compiling among a plurality of clients, it is necessary to clarify code differences among the respective clients. Code variability includes code logic variability and code flow variability. The code logic differences refer to differences among the code logic, and the code logic can be simply understood as 'executing a first operation if a certain condition is met or executing a second operation if the certain condition is met', namely what the code needs to do; code flow variability refers to the difference between code flows, which can be understood simply as the order in which each logical task is processed, i.e., in what order the code is to be made.
In general, multi-terminal codes are compatible with multiple clients, so that a large part of codes with the same logic or flow exist among the clients, and code difference analysis is performed to find out a small part of codes with different logic or flow, and then different conditional compiling strategies are selected differently based on the difference.
And then, according to the differential analysis result, determining a corresponding conditional compiling strategy.
The different differential analysis results represent the size of the code differences between the individual clients. For example, a simple and easy-to-understand scenario may be that if there are only a few lines of codes that distinguish between different clients, the variability may be considered small, whereas if there are tens or even hundreds of codes that distinguish between different clients, the variability may be considered large. Different conditional compiling strategies are adopted according to the difference.
Wherein,,
if the difference analysis result accords with a preset first difference result, the first difference result is that the code difference of each client is smaller than or equal to a preset minimum difference threshold value, and the condition compiling strategy is determined to be based on the condition compiling of the code dimension;
if the difference analysis result accords with a preset second difference result, the second difference result is that the code difference of each client is larger than a preset maximum difference threshold value, and the condition compiling strategy is determined to be based on the condition compiling of the file dimension;
If the difference analysis result accords with a preset third difference result, the third difference result is that the code difference of each client is larger than a preset minimum difference threshold value and smaller than a preset maximum difference threshold value, and the condition compiling strategy is determined to be the two-dimensional condition compiling based on the file dimension and the code dimension.
The minimum variance threshold and the maximum variance threshold may be set empirically in advance, and may represent code variances from multiple dimensions, including, for example, a code logic variance dimension and a code flow variance dimension.
It can be seen that under the condition that the code difference between the clients is small, a conditional compiling strategy based on the code dimension is adopted, namely, different codes are constructed and operated according to the environments of different clients; under the condition that the code difference between the clients is large, adopting a conditional compiling strategy based on file dimension, namely loading and running different files; in the rest of the cases, conditional compilation of code dimensions may be written in support of conditional compilation of file dimensions, i.e. loading runs different files and running different code inside the file runs.
The method for selecting different condition compiling strategies based on the difference analysis results of the clients can effectively improve the efficiency of code compatibility with a plurality of clients, adopts the condition compiling based on the code dimension when the difference is small, adopts the condition compiling based on the file dimension when the difference is large, and also supports the two-dimensional condition compiling of the file dimension and the code dimension.
The following description will be made by way of example for conditional compilation based on a code dimension, conditional compilation based on a file dimension, and bi-dimensional conditional compilation based on a code dimension and a file dimension, respectively.
Referring to fig. 2, a flow chart of a conditional compilation implementation based on code dimensions in a conditional compilation implementation method according to an embodiment of the present application is shown.
S201: determining a code dimension conditional compiling grammar, and compiling a regular expression of the code dimension conditional compiling, wherein the regular expression comprises hit rules of the code dimension conditional compiling grammar.
S202: the annotation statement is written in a code dimension conditional compilation grammar and inserted into the multi-end code.
S203: aiming at the current client, in the running process of the multi-terminal code, determining whether the regular expression is hit or not according to the annotation statement, and executing the conditional compiling code hitting the regular expression.
The code dimension conditional compiling grammar is a grammar for compiling a conditional compiling annotation statement, the annotation statement compiled by the code dimension conditional compiling grammar is inserted into a code, and in the code running process, a regular expression is hit according to the annotation statement, so that the code meeting the regular expression is executed.
For example, the syntax supported by code dimension conditional compilation includes, but is not limited to, the following four:
# if (judgment variable value)
# ifdef (judging whether there is a variable)
# ifndef (judging whether there is no variable)
# endif (end statement, must be present)
The above grammar is inserted into the code in the manner of annotation, and since the annotation code is inserted, the function of the code is not affected, and if the annotation code is of the four types mentioned above, a preset regular expression is hit in the runtime flow, thereby realizing a specific conditional compiling flow.
The variable refers to a code dimension condition compiling variable, and different values are given to the variable for different clients, so that conditions executed by the different clients are distinguished.
In one implementation, S201 further includes:
s2011: determining file types supporting code dimension conditional compilation;
s2012: aiming at different file types, respectively setting hit rules of code dimension conditional compiling grammar, and integrating the hit rules of all file types to form a regular expression.
First, a regular expression example is written as follows:
Figure BDA0004038822930000061
for example, in the above regular expression, hit rules of the regular expression are written for files of file types xml and js, respectively.
Since the embodiment of the application realizes conditional compiling based on the code dimension by annotating the code, the file type supporting conditional compiling of the code dimension can be understood as the file type supporting the annotated code.
In an implementation, file types that support code dimension conditional compilation may be predetermined, including, for example, but not limited to: js, ts, wxss, acss, less, scss, wxml, axml, jsonc, json5. Some file types may not support code dimension conditional compilation, e.g., json does not support annotation code, and thus code dimension conditional compilation, for which file type extensions may be made. For example, currently, code latitude conditional compilation may be implemented for conditional compilation of json files using the extension file type jsonc or json5, since json files do not support annotation statements.
Thus, in one implementation, the determining of the file type supporting code dimension conditional compilation in S2011 above may further include the steps of:
(1) Determining file types supported by Domain-specific language (Domain-Specific Language, DSL) of the multi-terminal code;
(2) Determining file types supporting annotation sentences and file types not supporting annotation sentences based on file types supported by the domain-specific language of the multi-terminal codes;
(3) Expanding the file types which do not support the annotation sentences to obtain the file types which support the annotation sentences after expansion;
(4) The file types supporting the annotation statement are collected as file types supporting the code dimension conditional compilation.
Then, performing conditional compiling during compiling, determining codes conforming to regular expressions in source codes, and deleting missed codes;
and finally, returning the processed code, and continuously executing the subsequent compiling flow.
In one implementation, S202 further includes:
s202-1: declaring code dimension condition compiling variables for distinguishing each client;
s202-2: an annotation statement is written that includes code dimension conditional compilation variables in a code dimension conditional compilation grammar.
In this embodiment of the present application, the code dimension conditional compiled variable refers to a variable for distinguishing different clients corresponding to different codes, for example, "name" is used as a code dimension conditional compiled variable for distinguishing different client names, for example, name: 'client-1' represents the first client, name: 'client-2' represents a second client. It should be noted that, in some cases, if the naming of the variable is required to meet the preset requirement (including, but not limited to, the specification of the applet platform, etc.), the variable may be named according to the preset requirement.
In particular implementations, the manner in which the code dimension conditional compilation variables are obtained or set may include a variety of manners, for example, in one implementation, the specific manner in which S202-1 "declares the code dimension conditional compilation variables for distinguishing clients" may be: in the domain specific language of the multi-terminal code, code dimension condition compiling variables are injected, or in the configuration file of the domain specific language of the multi-terminal code, the code dimension condition compiling variables are customized through condition compiling configuration sentences.
For the manner of injecting variables, such as name (name configured by each item in mor. Config. Js), [ name ]: true (configured name will be turned into a key), for example, name: 'client-1', then there will be a client-1:true, mainly for the scene of the ifdef statement; for example, the production is a configuration variable of the production environment, the default is true in the production environment, and the default is undefined in the development environment.
For custom condition compiling variables, if the default injected variables cannot meet requirements, the code dimension condition compiling variables can be customized and assigned in mor.config.js (configuration file of domain specific language), please refer to the conditional rule.context configuration in the following code example.
Figure BDA0004038822930000081
Figure BDA0004038822930000091
The mor.config.ts is a configuration file of a domain-specific language, the configuration file can adapt to different requirements of different compiling modes of different channels, wherein 'defineConfig' is a configuration shortcut method, one configuration attribute conditional compiler can be used for configuration condition compiling in the configuration shortcut method, and a variable needing condition judgment is declared in the configuration file, so that the condition compiling of multiple types and multiple scenes under the same set of codes can be realized.
In the configuration variable example described above, where the test variable value of the first client (name: client-1 ') is 123 and the test variable value of the second client (name: client-2') is 456, then if the portion of code or function is to be set to be invoked only at the first client and not at the second client, then the code dimension conditional compilation syntax may be written as:
/*#ifdef test===123*/
code that is invoked only at a first client and not at a second client
/*#endif*/
Thus, in one implementation, S202-2 "write an annotation statement that includes code dimension conditional compilation variables" may include the steps of:
(1) Invoking a code dimension conditional compilation grammar, and compiling a code dimension conditional compilation statement comprising a code dimension conditional compilation variable, wherein different variable values are given to the code dimension conditional compilation variable for each client in the code dimension conditional compilation statement;
(2) And inserting the code dimension conditional compiling statement into the multi-end code in the form of comments to obtain the comment statement.
As described previously, the supported syntax of the code dimension conditional compilation includes, but is not limited to, # if (judging variable value), # ifdef (judging whether there is a variable), # ifndef (judging whether there is no variable), # endif (ending sentence, must be), and the supported file types include, but are not limited to js, ts, wxss, acss, less, scss, wxml, axml, jsonc, json5, and the specific use of various syntax in different types of files is described below in an exemplary form.
Grammar 1: # if (judgment variable value)
For example, annotating statements are written for js/ts file types using grammar 1 as follows:
/*#if name=='client-1'*/
console. Log ('only displayed on first client')
/*#endif*/
/*#if name=='client-2'*/
Console. Log ('display on second client only')
/*#endif*/
Grammar 2: # ifdef (judging whether there is a variable)
For example, for js/ts file types, the grammar writes annotation statements:
/*#ifdef client-1*/
console. Log ('only displayed on first client')
/*#endif*//*#ifdef client-2*/
Console. Log ('display on second client only')
/*#endif*/
Grammar 3: # ifndef (judging whether there is no variable)
For example, for js/ts file types, the grammar writes annotation statements:
/*#ifndef client-2*/
console. Log ('all shown except at the second client')
/*#endif*/
For another example, for the wxs/acss/less/scs file type, write the annotation statement:
index-page {/# ifndef client-2 x/back group: red; /(x#endif) (-end except second client, background red)
Therefore, in the implementation process of conditional compiling based on code dimension, the embodiment of the application writes the annotation statement by adopting conditional compiling grammar for different types of files respectively, inserts the annotation statement into the code, and distinguishes different codes corresponding to different clients according to the variables in the annotation statement, so that after the regular expression is hit, the code corresponding to the variable corresponding to the current client is executed, and therefore the code with different functions is realized for different clients, and the purpose of conditional compiling is achieved. In the embodiment of the application, grammar such as judging variable values, whether variables exist or not, whether no variables exist or not and the like is supported, and the extensive file types including js, ts, wxss, acss, less, scss, wxml, axml, jsonc, json5 and the like are supported; and, support the code dimension condition of the user-definition to compile the variable, can meet the personalized condition and compile the appeal.
In a specific implementation, the comment statement (which can be understood as a special comment mark) is used to implement conditional compiling, and the code conforming to the condition can be directly emptied after compiling, because the comment code is invalid and nonsensical, only the comment code is provided for distinguishing the compiling condition at the compiling time, and the comment codes are not consumed at the running time, so that when the compiling is finished to generate a specific target file, the codes which are not used later are emptied, the code volume can be compressed, and the normal code flow is not influenced.
Referring to fig. 3, a flow chart of a conditional compilation implementation based on file dimensions in a conditional compilation implementation method according to an embodiment of the present application is shown.
S301: in a configuration component of the code compiling tool, configuring a file processing path analysis flow based on file dimension;
s302: determining a client specific suffix corresponding to the current client based on the file processing path analysis flow;
s303: in a preset client specific suffix file set, a specific suffix file corresponding to a client specific suffix is matched to be a conditional compiling file;
s304: loading a conditional compilation file.
In the embodiment of the application, when the configuration of a code compiling tool (such as weback) is completed based on the configuration of a user, a processing path analysis flow is added, and for suffix files (conditional compiling files) compiled based on file dimension conditions, the suffix files have higher priority than common suffix files, so that the files conforming to the file dimension condition compiling specifications can be compiled.
In one implementation, S302 "determining the client-specific suffix corresponding to the current client" may further include:
s3021: declaring file dimension condition compiling variables for distinguishing clients;
s3022: and according to the file dimension condition compiling variable, determining the client specific suffix corresponding to the current client.
In one implementation, the S3021 "declaring a file dimension conditional compilation variable for distinguishing clients" may further include:
(1) In a configuration file of a domain specific language of the multi-terminal code, a configuration statement is compiled through conditions, and a file dimension condition compiling variable is customized;
(2) And giving different variable values for the file dimension condition compiling variables for each client, so as to declare the file dimension condition compiling variables of each client.
For example, in a configuration file, custom file dimension condition compilation variables are as follows:
import{defineConfig}from'@ali/mor-cli'
export default defineConfig([
{
name:'client-1',
conditionalCompile:{
the// fileExt support configuration single or multiple,
such as { fileExt: '.my' or { fileExt: [ '.my','. Share' ] }
If the file is configured into a plurality of files, the file addressing and resolving priorities are based on the actual configuration sequence
Takes { fileExt [ '.mymin','.share' ] }, as an example
Preferably, the file is found by/(m) < xx > < my > < xx >, e.g. no-case-finding xx < share > < xx >, e.g. no-more-finding xx >
Figure BDA0004038822930000121
In the above example, the two clients take the first client-1 and the second client-2 as examples, where the first client is set to have file ext as. My, when the compiling channel is the first client, files with the same name but with the same my as the pseudo suffix, such as three files of index. Js, index. My. Js and index. Wx.js under the same directory, and the first client can preferentially read the index. My. Js and ignore the index. Js, and the second client can preferentially read the index. Wx.js and compile because the file ext is also configured as. Wx, so that the conditional compiling capability of the file dimension is realized.
In one implementation, the method further comprises: setting the set of client-specific suffix files, wherein,
(1) Determining the style file type, the template file type, the script file type and/or the configuration file type of each client;
(2) Configuring client-specific suffixes for each client for any type of file respectively;
(3) The set of types of files configured with client-specific suffixes results in a set of client-specific suffix files.
For example, supported file types include, but are not limited to:
the style files of each end are wxss, acss, css, qss, ttss and the like;
template files at each end, wxml or axml or swan or qml or ttml, etc.;
script files of each end are js or ts, etc.;
each end profile. Json or. Jsonc or. Json5, etc.
Specific suffixes of the clients are configured for any type of file, respectively, for example: with the index. Js file example, the rules of other files are the same, and each end default configuration is as follows:
a first client applet (. My): index. My. Js;
a second client applet (. Wx): index. Wx. Js;
a third client applet (.bd): index.
In practice, one client may be designated as a default client (default client), and thus, conditional compilation based on file dimensions mainly refers to conditional compilation for clients other than the default client.
For example, the (first client) applet is set as the default client, so conditional compilation is mainly directed to applets outside the domain (e.g., second client applet). At this time, the components can be customized, so that the distinction between the two ends can be performed. For example, custom component code is:
{'usingComponents':{'demo':'../../components/demo/index'}}
by default, the components all contain four types of files, axml/acss/js/json. Since the logical differences are larger under the second client applet, we can directly use wx to suffix the following files:
-components-demo-index. Axml (first client version)
Index. Acss (first client version)
Index. Js (first client version)
Index. Json-index. Wx. Axml (second client version)
Index, wx, acss (second client version)
Index, wx, js (second client version)
When compiling the output, under the output directory, _client-2, the corresponding second client version source file will be generated with the version of.wx preferentially.
Thus, in one implementation, the method further comprises the steps of: setting a default client suffix corresponding to a default client; at this time, the determining the client specific suffix corresponding to the current client "based on the file processing path parsing flow" S3022 "may include: in the file processing path analysis flow, judging whether the current client is configured with a corresponding client specific suffix, if not, determining that the default client suffix is the client specific suffix corresponding to the current client. For example, if the second client applet sets a corresponding specific suffix ". Wx", then in the file processing path parsing flow, the file of the specific suffix ". Wx" is searched for the second client applet client, and for example, for a certain client that does not set a specific suffix, the suffix file of the default client may be adopted, for example, if the default client is the first client, then the suffix file corresponding to the default client is adopted by default.
In the implementation process of compiling based on file dimension conditions, firstly, setting condition compiling variables (such as fileExt:. Wx) for distinguishing different client specific files in a configuration file; and then modifying the file name (such as index. Wx. Js) by the configured special suffix, and selecting the corresponding file for compiling by the special suffix during compiling, thereby realizing conditional compiling based on file dimension. Therefore, under the condition that a large number of differential codes are arranged between the clients, the condition compiling of file dimension is directly carried out on the files, special suffix specifications are specified for the respective clients, and when compiling and outputting, special suffix identifiers of the corresponding clients under the output catalogue are preferentially used for generating version source files of the corresponding clients, so that the method has better readability and expandability.
In the embodiment of the application, the conditional compilation of the code dimension and the file dimension can be implemented respectively, the usage and the scene are different, the code dimension is distinguished according to some special sentences in the code annotation, the file dimension is distinguished according to special suffixes of the code file, meanwhile, the code dimension and the file dimension can be mixed, and the conditional compilation of the code dimension is supported in the conditional compilation of the file dimension.
Referring to fig. 4, a two-dimensional conditional compilation implementation flowchart based on file dimensions and code dimensions in a conditional compilation implementation method provided in an embodiment of the present application is shown.
S401: determining a condition compiling file corresponding to the current client, and performing condition compiling based on file dimensions on the condition compiling file;
s402: and judging whether any condition compiling file comprises comment codes corresponding to the condition compiling of the code dimension, and if so, performing the condition compiling based on the code dimension based on the comment codes in the running process of the condition compiling file.
It can be seen that the multidimensional conditional compilation includes conditional compilation of a file dimension and conditional compilation of a code dimension, and for the conditional compilation of the file dimension, reference may be made to fig. 3 and related description, and for the conditional compilation of the code dimension, reference may be made to fig. 2 and related description, which are not repeated herein.
Corresponding to the above condition compiling implementation method, the embodiment of the present application further provides a condition compiling implementation device. Referring to fig. 5, a schematic structural diagram of a conditional compilation implementation apparatus provided in an embodiment of the present application is shown. The apparatus determines a conditional compilation strategy between clients for multi-end codes applied to different clients, the apparatus comprising:
A variability analysis unit 501, configured to analyze variability of code logic and/or code flow executed by each client;
a policy determining unit 502, configured to determine a corresponding conditional compiling policy according to the differential analysis result;
wherein,,
if the difference analysis result accords with a preset first difference result, wherein the first difference result is that the code difference of each client is smaller than or equal to a preset minimum difference threshold value, and the condition compiling strategy is determined to be based on the code dimension; specifically, the code dimension-based conditional compilation is implemented by the code dimension conditional compilation unit 503;
if the difference analysis result accords with a preset second difference result, the second difference result is that the code difference of each client is larger than a preset maximum difference threshold value, and the conditional compiling strategy is determined to be conditional compiling based on file dimensions; specifically, the file dimension-based conditional compilation is implemented by the file dimension conditional compilation unit 504.
Referring to fig. 6, a schematic diagram of a code dimension condition compiling structure in a condition compiling implementation device according to an embodiment of the application is shown, and fig. 6 may be understood as further refinement of the foregoing code dimension condition compiling unit 503.
The code dimension condition compiling unit 503 may further include:
a compilation grammar determination module 5031 for determining a code dimension conditional compilation grammar;
a regular expression module 5032 for writing a regular expression of code dimension conditional compilation, the regular expression comprising hit rules of the code dimension conditional compilation grammar;
an annotation statement module 5033 for compiling an annotation statement in the code dimension conditional compilation grammar and inserting into the multi-terminal code;
the hit module 5034 is configured to determine, for a current client, whether to hit the regular expression according to the annotation statement in the running process of the multi-end code, and execute a conditional compiled code that hits the regular expression.
In one implementation, regular expression module 5032 further includes:
a file type determination submodule 50321 for determining a file type supporting code dimension conditional compilation;
a hit rule setting sub-module 50322, configured to set hit rules of the code dimension conditional compilation grammar for different file types, respectively;
the regular expression set submodule 50323 is used for gathering hit rules of all file types and forming the regular expression.
In one implementation, the file type determination submodule 50321 is specifically configured to determine a file type supported by a domain-specific language of the multi-terminal code; determining the file types supporting the annotation sentences and the file types not supporting the annotation sentences based on the file types supported by the domain-specific language of the multi-terminal codes; expanding the file types which do not support the annotation sentences to obtain the file types which support the annotation sentences after expansion; and collecting all file types supporting annotation sentences as the file types supporting code dimension conditional compilation.
In one implementation, the annotation statement module 5033 further includes:
a compiled variable declaration submodule 50331 for declaring a code dimension condition compiled variable for distinguishing each client;
an annotation statement compilation submodule 50332 configured to compile an annotation statement including the code dimension conditional compilation variable with the code dimension conditional compilation grammar.
In one implementation, the compiling variable declaration submodule 50331 is specifically configured to inject the code dimension conditional compiling variable in a domain-specific language of the multi-terminal code, or to customize the code dimension conditional compiling variable in a configuration file of the domain-specific language of the multi-terminal code through a conditional compiling configuration sentence.
In one implementation manner, the annotation statement writing submodule 50332 is specifically configured to call the code dimension conditional compiling grammar and write a code dimension conditional compiling statement including the code dimension conditional compiling variable, where in the code dimension conditional compiling statement, different variable values are given to the code dimension conditional compiling variable for each client; and inserting the code dimension conditional compiling statement into the multi-terminal code in a comment form to obtain the comment statement.
Referring to fig. 7, a schematic diagram of a file dimension condition compiling structure in a condition compiling implementation device according to an embodiment of the present application is shown, and fig. 7 may be understood as further refinement of the foregoing file dimension condition compiling unit 504.
The file dimension condition compiling unit 504 may further include:
the path analysis flow configuration module 5041 is configured to configure a file processing path analysis flow based on a file dimension in a configuration component of the code compiling tool;
a specific suffix determining module 5042, configured to determine a client specific suffix corresponding to a current client based on the file processing path parsing flow;
a conditional compiled file matching module 5043, configured to match, in a preset client specific suffix file set, a specific suffix file corresponding to the client specific suffix to a conditional compiled file;
A file description module 5044 for loading the conditional compilation file.
In one implementation, the specific suffix determination module 5042 further includes:
a compiled variable declaration submodule 50421 for declaring file dimension condition compiled variables for distinguishing each client;
and the specific suffix corresponding sub-module 50422 is configured to determine a client specific suffix corresponding to the current client according to the file dimension condition compiling variable.
In one implementation manner, the compiling variable declaration submodule 50421 is specifically configured to customize the file dimension conditional compiling variable in a configuration file of the domain-specific language of the multi-terminal code through conditional compiling configuration statements; and giving different variable values for the file dimension condition compiling variables for each client, so as to declare the file dimension condition compiling variables of each client.
In one implementation, the file dimension conditional compilation unit 504 further includes:
a specific suffix file set setting module 5045 for setting the client specific suffix file set;
the specific suffix file set setting module 5045 further includes:
a file type determining submodule 50451, configured to determine a style file type, a template file type, a script file type, and/or a configuration file type of each client;
A specific suffix setting sub-module 50452, configured to configure a client specific suffix for each client for any type of file;
a specific suffix file set submodule 50453, configured to set each type of file configured with a client specific suffix, to obtain the client specific suffix file set.
In one implementation, the file dimension conditional compilation unit 504 further includes: a default suffix setting module 5046, configured to set a default client suffix corresponding to a default client; in this case, the specific suffix determination module 5042 is specifically configured to determine, in the file processing path analysis flow, whether the current client is configured with a corresponding client specific suffix, and if not, determine that the default client suffix is the client specific suffix corresponding to the current client.
In an implementation manner, the policy determining unit 502 is further configured to determine that the conditional compiling policy is a two-dimensional conditional compiling based on a file dimension and a code dimension if the difference analysis result meets a preset third difference result, where the third difference result is that a difference between each client code is greater than a preset minimum difference threshold and less than a preset maximum difference threshold, and the two-dimensional conditional compiling is implemented by the two-dimensional conditional compiling unit 505.
In one implementation, the two-dimensional conditional compiling unit 505 further includes:
the file dimension condition compiling module is used for determining a condition compiling file corresponding to the current client and carrying out condition compiling based on file dimension on the condition compiling file;
and the code dimension condition compiling module is used for judging whether the comment code corresponding to the condition compiling of the code dimension is included for any condition compiling file, and if the comment code is included, the condition compiling based on the code dimension is carried out based on the comment code in the running process of the condition compiling file.
Embodiments of the present application also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
Alternatively, in the present embodiment, the above-described storage medium may be configured to store a computer program for performing the steps of:
1. analyzing the difference of the code logic and/or the code flow executed by each client;
2. determining a corresponding conditional compiling strategy according to the differential analysis result;
wherein,,
if the difference analysis result accords with a preset first difference result, wherein the first difference result is that the code difference of each client is smaller than or equal to a preset minimum difference threshold value, and the condition compiling strategy is determined to be based on the code dimension;
And if the difference analysis result accords with a preset second difference result, wherein the second difference result is that the code difference of each client is larger than a preset maximum difference threshold value, and the conditional compiling strategy is determined to be conditional compiling based on file dimensions.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random AccessMemory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Embodiments of the present application also provide an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Optionally, the electronic device may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
1. analyzing the difference of the code logic and/or the code flow executed by each client;
2. Determining a corresponding conditional compiling strategy according to the differential analysis result;
wherein,,
if the difference analysis result accords with a preset first difference result, wherein the first difference result is that the code difference of each client is smaller than or equal to a preset minimum difference threshold value, and the condition compiling strategy is determined to be based on the code dimension;
and if the difference analysis result accords with a preset second difference result, wherein the second difference result is that the code difference of each client is larger than a preset maximum difference threshold value, and the conditional compiling strategy is determined to be conditional compiling based on file dimensions.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments and optional implementations, and this embodiment is not described herein.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology content may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application and are intended to be comprehended within the scope of the present application.

Claims (28)

1. A conditional compilation implementation method, characterized by determining a conditional compilation policy between clients for multi-terminal codes applied to different clients, the method comprising:
analyzing the code logic difference and/or the code flow difference executed by each client, and determining a corresponding conditional compiling strategy according to the difference analysis result;
wherein,,
if the difference analysis result accords with a preset first difference result, wherein the first difference result is that the code difference of each client is smaller than or equal to a preset minimum difference threshold value, and the condition compiling strategy is determined to be based on the code dimension condition compiling, and the code dimension condition compiling is realized according to annotation sentences;
if the difference analysis result accords with a preset second difference result, the second difference result is that the code difference of each client is larger than a preset maximum difference threshold value, and the conditional compiling strategy is determined to be conditional compiling based on file dimension, wherein the conditional compiling based on the file dimension is realized according to a specific suffix;
If the difference analysis result accords with a preset third difference result, the third difference result is that the code difference of each client is larger than a preset minimum difference threshold value and smaller than a preset maximum difference threshold value, and the conditional compiling strategy is determined to be a two-dimensional conditional compiling based on file dimensions and code dimensions;
the minimum difference threshold and the maximum difference threshold are empirically set in advance and reflect the code logic difference and/or the code flow difference.
2. The method of claim 1, wherein the implementing the code dimension based conditional compilation according to annotation statements comprises:
determining a code dimension conditional compiling grammar, and compiling a regular expression of the code dimension conditional compiling, wherein the regular expression comprises hit rules of the code dimension conditional compiling grammar;
compiling annotation sentences according to the code dimension condition compiling grammar and inserting the annotation sentences into the multi-terminal codes;
and aiming at the current client, determining whether the regular expression is hit or not according to the annotation statement in the running process of the multi-terminal code, and executing the conditional compiling code for hitting the regular expression.
3. The method of claim 2, wherein writing the code dimension conditional compiled regular expression comprises:
determining file types supporting code dimension conditional compilation;
and aiming at different file types, respectively setting hit rules of the code dimension conditional compiling grammar, and integrating the hit rules of all file types to form the regular expression.
4. The method of claim 3, wherein the determining a file type that supports code dimension conditional compilation comprises:
determining file types supported by the domain-specific language of the multi-terminal code;
determining the file types supporting the annotation sentences and the file types not supporting the annotation sentences based on the file types supported by the domain-specific language of the multi-terminal codes;
expanding the file types which do not support the annotation sentences to obtain the file types which support the annotation sentences after expansion;
and collecting all file types supporting annotation sentences as the file types supporting code dimension conditional compilation.
5. The method of claim 2, wherein the writing of annotation statements in the code dimension conditional compilation grammar comprises:
Declaring code dimension condition compiling variables for distinguishing each client;
and compiling annotation sentences comprising the code dimension conditional compiling variables according to the code dimension conditional compiling grammar.
6. The method of claim 5, wherein the declaring is used to distinguish code dimension conditional compilation variables for each client, comprising:
and injecting the code dimension condition compiling variable in the domain-specific language of the multi-terminal code, or customizing the code dimension condition compiling variable in a configuration file of the domain-specific language of the multi-terminal code through a conditional compiling configuration statement.
7. The method of claim 5, wherein writing an annotation statement comprising the code dimension conditional compilation variable in the code dimension conditional compilation grammar comprises:
invoking the code dimension conditional compiling grammar, and compiling a code dimension conditional compiling statement comprising the code dimension conditional compiling variable, wherein in the code dimension conditional compiling statement, different variable values are given to the code dimension conditional compiling variable for each client;
and inserting the code dimension conditional compiling statement into the multi-terminal code in an annotation form to obtain the annotation statement.
8. The method of claim 1, wherein the implementing the file dimension based conditional compilation according to a particular suffix comprises:
in a configuration component of the code compiling tool, configuring a file processing path analysis flow based on file dimension;
determining a client specific suffix corresponding to the current client based on the file processing path analysis flow;
in a preset client specific suffix file set, matching a specific suffix file corresponding to the client specific suffix to obtain a conditional compiled file;
and loading the conditional compiling file.
9. The method of claim 8, wherein the determining the client-specific suffix corresponding to the current client comprises:
declaring file dimension condition compiling variables for distinguishing clients;
and according to the file dimension condition compiling variable, determining a client specific suffix corresponding to the current client.
10. The method of claim 9, wherein the declaring is used to distinguish file dimension conditional compilation variables for each client, comprising:
in the configuration file of the domain specific language of the multi-terminal code, the dimension condition compiling variable of the file is defined by conditional compiling configuration sentences;
And giving different variable values for the file dimension condition compiling variables for each client, so as to declare the file dimension condition compiling variables of each client.
11. The method as recited in claim 8, further comprising:
setting the set of client-specific suffix files, wherein,
determining the style file type, the template file type, the script file type and/or the configuration file type of each client;
configuring client-specific suffixes for each client for any type of file respectively;
and aggregating the files of each type configured with the client-specific suffix to obtain the client-specific suffix file aggregate.
12. The method as recited in claim 8, further comprising: setting a default client suffix corresponding to a default client;
the determining the client specific suffix corresponding to the current client based on the file processing path parsing flow includes:
in the file processing path analysis flow, judging whether the current client is configured with a corresponding client specific suffix, if not, determining that the default client suffix is the client specific suffix corresponding to the current client.
13. The method of claim 1, further comprising implementing the two-dimensional conditional compilation, comprising:
determining a condition compiling file corresponding to the current client, and performing condition compiling based on file dimensions on the condition compiling file;
and judging whether any condition compiling file comprises comment codes corresponding to the condition compiling of the code dimension, and if so, carrying out the condition compiling based on the code dimension based on the comment codes in the running process of the condition compiling file.
14. A conditional compilation implementation apparatus that determines conditional compilation policies between clients for multi-terminal codes that are applied to different clients, the apparatus comprising:
the difference analysis unit is used for analyzing the code logic difference and/or the code flow difference executed by each client;
the strategy determining unit is used for determining a corresponding conditional compiling strategy according to the difference analysis result;
wherein,,
if the difference analysis result accords with a preset first difference result, wherein the first difference result is that the code difference of each client is smaller than or equal to a preset minimum difference threshold value, and the condition compiling strategy is determined to be based on the code dimension condition compiling, and the code dimension condition compiling is realized according to annotation sentences;
If the difference analysis result accords with a preset second difference result, the second difference result is that the code difference of each client is larger than a preset maximum difference threshold value, and the conditional compiling strategy is determined to be conditional compiling based on file dimension, wherein the conditional compiling based on the file dimension is realized according to a specific suffix;
if the difference analysis result accords with a preset third difference result, the third difference result is that the code difference of each client is larger than a preset minimum difference threshold value and smaller than a preset maximum difference threshold value, and the conditional compiling strategy is determined to be a two-dimensional conditional compiling based on file dimensions and code dimensions;
the minimum difference threshold and the maximum difference threshold are empirically set in advance and reflect the code logic difference and/or the code flow difference.
15. The apparatus as recited in claim 14, further comprising:
the code dimension condition compiling unit is used for realizing the condition compiling based on the code dimension according to the annotation statement;
the code dimension condition compiling unit further includes:
the compiling grammar determining module is used for determining a code dimension condition compiling grammar;
The regular expression module is used for compiling a regular expression compiled by the code dimension condition, and the regular expression comprises hit rules of the code dimension condition compiling grammar;
the annotation statement module is used for compiling annotation statements according to the code dimension condition compiling grammar and inserting the annotation statements into the multi-terminal codes;
and the hit module is used for determining whether the regular expression is hit or not according to the annotation statement in the running process of the multi-terminal code aiming at the current client, and executing the conditional compiling code for hitting the regular expression.
16. The apparatus of claim 15, wherein the regular expression module further comprises:
a file type determining sub-module for determining a file type supporting code dimension conditional compilation;
the hit rule setting submodule is used for setting hit rules of the code dimension conditional compilation grammar for different file types respectively;
and the regular expression set submodule is used for gathering hit rules of all file types and forming the regular expression.
17. The apparatus of claim 16, wherein the file type determination submodule is operable to determine file types supported by a domain-specific language of the multi-terminal code; determining the file types supporting the annotation sentences and the file types not supporting the annotation sentences based on the file types supported by the domain-specific language of the multi-terminal codes; expanding the file types which do not support the annotation sentences to obtain the file types which support the annotation sentences after expansion; and collecting all file types supporting annotation sentences as the file types supporting code dimension conditional compilation.
18. The apparatus of claim 15, wherein the annotation statement module further comprises:
the compiling variable sound submodule is used for declaring a code dimension condition compiling variable for distinguishing each client;
and the annotation statement writing sub-module is used for writing the annotation statement comprising the code dimension condition compiling variable according to the code dimension condition compiling grammar.
19. The apparatus of claim 18, wherein the compilation variable declaration submodule is specifically configured to inject the code dimension conditional compilation variable in a domain-specific language of the multi-terminal code or to customize the code dimension conditional compilation variable by conditional compilation configuration statements in a configuration file of the domain-specific language of the multi-terminal code.
20. The apparatus of claim 18, wherein the annotation statement writing submodule is specifically configured to invoke the code dimension conditional compilation grammar to write a code dimension conditional compilation statement that includes the code dimension conditional compilation variable, wherein in the code dimension conditional compilation statement, different variable values are assigned to the code dimension conditional compilation variable for each client; and inserting the code dimension conditional compiling statement into the multi-terminal code in a comment form to obtain the comment statement.
21. The apparatus as recited in claim 14, further comprising:
the file dimension condition compiling unit is used for realizing the condition compiling based on the file dimension according to the specific suffix;
the file dimension condition compiling unit further includes:
the path analysis flow configuration module is used for configuring a file processing path analysis flow based on file dimension in a configuration component of the code compiling tool;
the specific suffix determining module is used for determining a specific suffix of the client corresponding to the current client based on the file processing path analysis flow;
the conditional compiling file matching module is used for matching a specific suffix file corresponding to the specific suffix of the client from a preset client specific suffix file set to obtain a conditional compiling file;
and the file recording module is used for loading the conditional compiling file.
22. The apparatus of claim 21, wherein the particular suffix determination module further comprises:
the compiling variable sound submodule is used for declaring a file dimension condition compiling variable for distinguishing each client;
and the specific suffix corresponding sub-module is used for determining the specific suffix of the client corresponding to the current client according to the compiling variable of the file dimension condition.
23. The apparatus of claim 22, wherein the compiling variable declaration submodule is specifically configured to customize the file dimension conditional compiling variable in a configuration file of the domain specific language of the multi-terminal code by conditional compiling a configuration statement; and giving different variable values for the file dimension condition compiling variables for each client, so as to declare the file dimension condition compiling variables of each client.
24. The apparatus as recited in claim 21, further comprising:
a specific suffix file set setting module configured to set the client specific suffix file set;
the specific suffix file set setting module further includes:
the file type determining submodule is used for determining the style file type, the template file type, the script file type and/or the configuration file type of each client;
a specific suffix setting sub-module, configured to configure a client specific suffix for each client for any type of file;
and the specific suffix file collection sub-module is used for collecting various types of files configured with the client specific suffix to obtain the client specific suffix file collection.
25. The apparatus of claim 21, wherein the device comprises a plurality of sensors,
further comprises: the default suffix setting module is used for setting a default client suffix corresponding to the default client;
the specific suffix determining module is specifically configured to determine, in the file processing path parsing flow, whether the current client is configured with a corresponding client specific suffix, and if not, determine that the default client suffix is the client specific suffix corresponding to the current client.
26. The apparatus as recited in claim 14, further comprising:
the two-dimensional condition compiling unit is used for realizing the two-dimensional condition compiling;
the two-dimensional conditional compiling unit further includes:
the file dimension condition compiling module is used for determining a condition compiling file corresponding to the current client and carrying out condition compiling based on file dimension on the condition compiling file;
and the code dimension condition compiling module is used for judging whether the comment code corresponding to the condition compiling of the code dimension is included for any condition compiling file, and if the comment code is included, the condition compiling based on the code dimension is carried out based on the comment code in the running process of the condition compiling file.
27. A storage medium having a computer program stored therein, wherein the computer program is arranged to perform the method of any of claims 1 to 13 when run.
28. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of claims 1 to 13.
CN202310011431.7A 2023-01-05 2023-01-05 Condition compiling realization method, device, medium and equipment Active CN115904393B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310011431.7A CN115904393B (en) 2023-01-05 2023-01-05 Condition compiling realization method, device, medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310011431.7A CN115904393B (en) 2023-01-05 2023-01-05 Condition compiling realization method, device, medium and equipment

Publications (2)

Publication Number Publication Date
CN115904393A CN115904393A (en) 2023-04-04
CN115904393B true CN115904393B (en) 2023-06-30

Family

ID=86494006

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310011431.7A Active CN115904393B (en) 2023-01-05 2023-01-05 Condition compiling realization method, device, medium and equipment

Country Status (1)

Country Link
CN (1) CN115904393B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117406996B (en) * 2023-10-20 2024-04-16 北京市辰至半导体科技有限公司 Semantic analysis method and device for hardware description code
CN117555535B (en) * 2024-01-09 2024-05-14 云筑信息科技(成都)有限公司 Method for realizing multi-environment code multiplexing in compact framework

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102566993A (en) * 2010-12-17 2012-07-11 北京北方微电子基地设备工艺研究中心有限责任公司 Method and device for editing interface
CN104536797A (en) * 2015-01-14 2015-04-22 大唐微电子技术有限公司 Java program precompiling method and precompiler
CN113031963A (en) * 2021-03-24 2021-06-25 北京字节跳动网络技术有限公司 Conditional compiling implementation method, device, equipment and storage medium
CN113672224A (en) * 2021-08-20 2021-11-19 上海哔哩哔哩科技有限公司 Method and device for generating small program page code and computer equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10216500B2 (en) * 2012-02-10 2019-02-26 Oracle International Corporation Method and apparatus for synchronization annotation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102566993A (en) * 2010-12-17 2012-07-11 北京北方微电子基地设备工艺研究中心有限责任公司 Method and device for editing interface
CN104536797A (en) * 2015-01-14 2015-04-22 大唐微电子技术有限公司 Java program precompiling method and precompiler
CN113031963A (en) * 2021-03-24 2021-06-25 北京字节跳动网络技术有限公司 Conditional compiling implementation method, device, equipment and storage medium
CN113672224A (en) * 2021-08-20 2021-11-19 上海哔哩哔哩科技有限公司 Method and device for generating small program page code and computer equipment

Also Published As

Publication number Publication date
CN115904393A (en) 2023-04-04

Similar Documents

Publication Publication Date Title
CN115904393B (en) Condition compiling realization method, device, medium and equipment
CN110162296B (en) Method and device for generating application programming interface document and terminal equipment
CN109800175B (en) Ether house intelligent contract reentry vulnerability detection method based on code instrumentation
US8239823B2 (en) Generating libraries for reflection without project compilation
CN110944048B (en) Service logic configuration method and device
US9454467B2 (en) Method and apparatus for mining test coverage data
US8549502B2 (en) Compiler with user-defined type inference rules
US8707252B1 (en) Techniques for automatic generation of parsing code
US9965257B2 (en) Automatic configuration of project system from project capabilities
US20090150859A1 (en) Dynamic validation of models using constraint targets
Ladd et al. Programming the Web: An application-oriented language for hypermedia service programming
US10809985B2 (en) Instrumenting program code
CN112558984A (en) Code compiling method and device, electronic equipment and server
CN115238138A (en) Graph data query method and device
CN115237805A (en) Test case data preparation method and device
US8694978B1 (en) Function side-effect modeling by prototyping
US20110055814A1 (en) Compiler-assisted program source code filter
US7406681B1 (en) Automatic conversion of source code from 32-bit to 64-bit
US20180260304A1 (en) Mapping dynamic analysis data to source code
CN107810474B (en) Automatic import and dependency in large-scale source code repository
US9063744B2 (en) Modifying a file written in a formal language
CN115599388B (en) API (application program interface) document generation method, storage medium and electronic equipment
CN111722849B (en) JAVA language virtual compiling realization method, system and device
CN114911541A (en) Configuration information processing method and device, electronic equipment and storage medium
Irwin Understanding and improving object-oriented software through static software analysis

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