public final class ConfigManager extends Object
IProjectConfigVariables
class that contains information to be used by the parser to properly
take config variables into consideration.Constructor and Description |
---|
ConfigManager() |
Modifier and Type | Method and Description |
---|---|
void |
addConfigVariable(String namespace,
String expression)
Adds a config variable and expression to this mapping
|
void |
addConfigVariables(Map<String,String> variables)
Syntax:
-define=<name>,<value>
where name is NAMESPACE::name and value is a legal definition value
(e.g. |
IProjectConfigVariables |
getProjectConfig(CompilerProject project)
Returns the
IProjectConfigVariables object for the given project. |
public void addConfigVariable(String namespace, String expression)
namespace
- The config variable.expression
- The expression.public void addConfigVariables(Map<String,String> variables)
-define=<name>,<value>
where name is NAMESPACE::name
and value is a legal definition value
(e.g. true
or 1
or !CONFIG::debugging
)
Example: -define=CONFIG::debugging,true
In flex-config.xml
:Values:... CONFIG::debugging true
-define=TEST::oneGreaterTwo,"1>2"
will getCompiler coerced and evaluated, at compile-time, to false
.
It is good practice to wrap values with double-quotes,
so that MXMLC correctly parses them as a single argument:-define=TEST::oneShiftRightTwo,"1 >> 2"
Values may contain compile-time constants and other configuration values:-define=CONFIG::bool2,false -define=CONFIG::and1,"CONFIG::bool2 && false" TestApp.mxml
String values on the command-line must be surrounded by double-quotes, and either
escape-quoted ("\"foo\""
or "\'foo\'"
) or single-quoted
("'foo'"
).
String values in configuration files need only be single- or double- quoted:Empty strings must be passed asNAMES::Organization 'Apache Software Foundation' ... NAMES::Application "Flex 4.8.0"
"''"
on the command-line, and
''
or ""
in configuration files.
Finally, if you have existing definitions in a configuration file, and you would
like to add to them with the command-line (let's say most of your build setCompilertings
are in the configuration, and that you are adding one temporarily using the
command-line), you use the following syntax:
-define+=TEST::temporary,false
(noting the plus sign)
Note that definitions can be overridden/redefined if you use the append ("+=") syntax
(on the commandline or in a user config file, for instance) with the same namespace
and name, and a new value.
Definitions cannot be removed/undefined. You can undefine ALL existing definitions
from (e.g. from flex-config.xml) if you do not use append syntax ("=" or append="false").
IMPORTANT FOR FLEXBUILDER
If you are using "Additional commandline arguments" to "-define", don't use the following
syntax though I suggest it above:
-define+=CONFIG::foo,"'value'"
The trouble is that FB parses the double quotes incorrectly as <"'value'> -- the trailing
double-quote is dropped. The solution is to avoid inner double-quotes and put them around the whole expression:
-define+="CONFIG::foo,'value'"variables
- the mapping of config names to expressionspublic IProjectConfigVariables getProjectConfig(CompilerProject project)
IProjectConfigVariables
object for the given project. Each value returned will be a new object, but could possibly share
the same signature as other variablesproject
- the ICompilerProject
to pull our config data fromIProjectConfigVariables
objectCopyright © 2016 The Apache Software Foundation. All rights reserved.