Search in sources :

Example 1 with TaskInputPropertySpec

use of org.gradle.api.internal.tasks.TaskInputPropertySpec in project gradle by gradle.

the class GetInputPropertiesVisitor method getPropertyValuesFactory.

public Factory<Map<String, Object>> getPropertyValuesFactory() {
    return new Factory<Map<String, Object>>() {

        @Override
        public Map<String, Object> create() {
            Map<String, Object> result = new HashMap<String, Object>();
            for (TaskInputPropertySpec inputProperty : inputProperties) {
                String propertyName = inputProperty.getPropertyName();
                try {
                    Object value = prepareValue(inputProperty.getValue());
                    result.put(propertyName, value);
                } catch (Exception ex) {
                    throw new InvalidUserDataException(String.format("Error while evaluating property '%s' of %s", propertyName, beanName), ex);
                }
            }
            return result;
        }
    };
}
Also used : HashMap(java.util.HashMap) InvalidUserDataException(org.gradle.api.InvalidUserDataException) TaskInputPropertySpec(org.gradle.api.internal.tasks.TaskInputPropertySpec) Factory(org.gradle.internal.Factory) GString(groovy.lang.GString) InvalidUserDataException(org.gradle.api.InvalidUserDataException)

Aggregations

GString (groovy.lang.GString)1 HashMap (java.util.HashMap)1 InvalidUserDataException (org.gradle.api.InvalidUserDataException)1 TaskInputPropertySpec (org.gradle.api.internal.tasks.TaskInputPropertySpec)1 Factory (org.gradle.internal.Factory)1