use of org.apache.tools.ant.property.ResolvePropertyMap in project ant by apache.
the class Property method resolveAllProperties.
/**
* resolve properties inside a properties hashtable
* @param props properties object to resolve
*/
private void resolveAllProperties(Map<String, Object> props) throws BuildException {
PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(getProject());
new ResolvePropertyMap(getProject(), propertyHelper, propertyHelper.getExpanders()).resolveAllProperties(props, getPrefix(), getPrefixValues());
}
use of org.apache.tools.ant.property.ResolvePropertyMap in project ant by apache.
the class Main method setProperties.
private void setProperties(final Project project) {
project.init();
// resolve properties
final PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(project);
@SuppressWarnings({ "rawtypes", "unchecked" }) final Map raw = new HashMap(definedProps);
@SuppressWarnings("unchecked") final Map<String, Object> props = raw;
final ResolvePropertyMap resolver = new ResolvePropertyMap(project, NOPROPERTIES, propertyHelper.getExpanders());
resolver.resolveAllProperties(props, null, false);
// set user-define properties
for (final Entry<String, Object> ent : props.entrySet()) {
final String arg = ent.getKey();
final Object value = ent.getValue();
project.setUserProperty(arg, String.valueOf(value));
}
project.setUserProperty(MagicNames.ANT_FILE, buildFile.getAbsolutePath());
project.setUserProperty(MagicNames.ANT_FILE_TYPE, MagicNames.ANT_FILE_TYPE_FILE);
// this list doesn't contain the build files default target,
// which may be added later unless targets have been specified
// on the command line. Therefore the property gets set again
// in Project#executeTargets when we can be sure the list is
// complete.
// Setting it here allows top-level tasks to access the
// property.
project.setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS, CollectionUtils.flattenToString(targets));
}
Aggregations