public class PreprocessTask extends org.apache.tools.ant.Task implements PreprocessorLogger, SpecialVariableProcessor
Modifier and Type | Class and Description |
---|---|
static class |
PreprocessTask.CfgFile
Inside class describes a "cfgfile" item, it has the only attribute "file", the attribute must be defined
|
static class |
PreprocessTask.Global
Inside class describes a "global" item, it describes a global variable which will be added into the preprocessor context It has attributes "name" and "value", be careful in
the value attribute usage because you have to use """ instead of \" symbol inside string values
|
Constructor and Description |
---|
PreprocessTask() |
Modifier and Type | Method and Description |
---|---|
PreprocessTask.CfgFile |
createCfgFile() |
PreprocessTask.Global |
createGlobal() |
void |
debug(String message)
Log a debug message
|
void |
error(String message)
Log an error message
|
void |
execute() |
Value |
getVariable(String varName,
PreprocessorContext context)
Get the value for the variable
|
String[] |
getVariableNames()
Get all variable names allowed by the processor as an array, all names must
be in lower case
|
void |
info(String message)
Log an information message
|
void |
setAllowWhitespace(boolean flag)
Set the "allowWhitespace", it allows to manage the mode to allow whitespace between the // and the #.
|
void |
setCareForLastNextLine(boolean flag)
Set the "careforlastnextline" attribute, it allows to make precise processing of last next line char
|
void |
setClear(boolean flag)
Set the "clear" attribute, it is a boolean attribute allows to make the preprocessor to clear the destination directory before its work
|
void |
setCompareDestiation(boolean flag)
Set the "compareDestination" attribute, it allows to turn on the mode to compare destination file content and to not override the file by generated one if there is the same
content.
|
void |
setCopyFileAttributes(boolean flag)
Set the "copyfileattributes", it turns on mode to copy file attributes if file generated or copied.
|
void |
setDestination(File dst)
Set the "destination" attribute, it allows to define the destination directory where the preprocessed files will be placed in
|
void |
setDisableOut(boolean flag)
Set the "disableOut" attribute, it is a boolean attribute allows to disable any output operations into the destination directory
|
void |
setExcluded(String ext)
Set the "excluded" attribute, it defines the excluded file extensions which will be ignored by the preprocessor in its work (also those files will not be copied)
|
void |
setExcludedFolders(String value)
Set the "excludedfolders" attribute, sub-folders in source folders to be excluded from preprocessing, ANT patterns allowed, ${path.separator} should be used for multiple items
|
void |
setInCharset(String charSet)
Set the "inCharset" attribute, it allows to define the text encoding for the reading text files
|
void |
setKeepLines(boolean flag)
Set the "keepLines" attribute, it is a boolean attribute to keep non-executing lines as commented ones in the output
|
void |
setOutCharset(String charSet)
Set the "outCharset" attribute, it allows to define the text encoding for the writing text files
|
void |
setPreserveIndent(boolean flag)
Set the "preserveident" attribute, to preserve spaces occupied by '//$' and '//$$' directives.
|
void |
setProcessing(String ext)
Set the "processing" attribute, it defines the file extensions to be processed
|
void |
setRemoveComments(boolean flag)
Set the "removeComments" attribute, it is a boolean attribute allows to make the preprocessor to remove all Java-like comments from the result files
|
void |
setSource(File src)
Set the "source" attribute, it allows to define the source directory to be preprocessed
|
void |
setUnknownVarAsFalse(boolean flag)
Set the "unknownVarAsFalse" attribute, it allows to interpret unknown variables as FALSE.
|
void |
setVariable(String varName,
Value value,
PreprocessorContext context)
Set a value to the variable
|
void |
setVerbose(boolean flag)
Set the "verbose" attribute, it is a boolean attribute allows to set the verbose level of preprocessor messages
|
void |
warning(String message)
Log a warning message
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
public void setCopyFileAttributes(boolean flag)
flag
- true if to copy attributes, false otherwisepublic void setAllowWhitespace(boolean flag)
flag
- true if whitespace is allowed, false otherwisepublic void setPreserveIndent(boolean flag)
flag
- true to preserve positions of tail chars in lines marked by '//$$' and '//$', false otherwisepublic void setCompareDestiation(boolean flag)
flag
- true if to compare destination file content, false otherwisepublic void setSource(File src)
src
- a directory to be used as the source one, must not be nullpublic void setCareForLastNextLine(boolean flag)
flag
- shows to turn on or turn off the modepublic void setDestination(File dst)
dst
- a directory to be used as the destination one, must not be nullpublic void setInCharset(String charSet)
charSet
- the character set to be used to decode read texts, must not be nullpublic void setOutCharset(String charSet)
charSet
- the character set to be used to encode written texts, must not be nullpublic void setUnknownVarAsFalse(boolean flag)
flag
- true to turn on the mode, false otherwise.public void setExcluded(String ext)
ext
- the list of ignored file extensions, must not be nullpublic void setProcessing(String ext)
ext
- the list of file extensions which should be preprocessed, must not be nullpublic void setExcludedFolders(String value)
value
- folder names as stringpublic void setClear(boolean flag)
flag
- true if the destination directory must be cleared before preprocessing, otherwise falsepublic void setRemoveComments(boolean flag)
flag
- true if the result file must be cleared from comments, otherwise falsepublic void setVerbose(boolean flag)
flag
- true if the verbose level must be set, otherwise falsepublic void setKeepLines(boolean flag)
flag
- true if preprocessor should keep the lines as commented ones, false otherwisepublic void setDisableOut(boolean flag)
flag
- true if the output operations must be disabled, otherwise false@ImplementationNote(value="Do not change because for ANT!") public PreprocessTask.Global createGlobal()
@ImplementationNote(value="Do not change because for ANT!") public PreprocessTask.CfgFile createCfgFile()
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
public void error(String message)
PreprocessorLogger
error
in interface PreprocessorLogger
message
- the text to be output into the error logpublic void info(String message)
PreprocessorLogger
info
in interface PreprocessorLogger
message
- the text to be output into the information logpublic void debug(String message)
PreprocessorLogger
debug
in interface PreprocessorLogger
message
- the text to be output into the information logpublic void warning(String message)
PreprocessorLogger
warning
in interface PreprocessorLogger
message
- the text to be output into the warning log@MustNotContainNull public String[] getVariableNames()
SpecialVariableProcessor
getVariableNames
in interface SpecialVariableProcessor
public Value getVariable(String varName, PreprocessorContext context)
SpecialVariableProcessor
getVariable
in interface SpecialVariableProcessor
varName
- the variable name, must not be nullcontext
- the preprocessor context, it can be nullpublic void setVariable(String varName, Value value, PreprocessorContext context)
SpecialVariableProcessor
setVariable
in interface SpecialVariableProcessor
varName
- the variable name, must not be nullvalue
- the value to be set to the variable, must not be nullcontext
- the preprocessor context, it can be nullCopyright © 2011–2020 Igor Maznitsa. All rights reserved.