Search in sources :

Example 1 with UnmanagedModelProjection

use of org.gradle.model.internal.core.UnmanagedModelProjection in project gradle by gradle.

the class DefaultTaskContainer method addPlaceholderAction.

public <T extends TaskInternal> void addPlaceholderAction(final String placeholderName, final Class<T> taskType, final Action<? super T> configure) {
    if (!modelNode.hasLink(placeholderName)) {
        final ModelType<T> taskModelType = ModelType.of(taskType);
        ModelPath path = MODEL_PATH.child(placeholderName);
        modelNode.addLink(ModelRegistrations.of(path).action(ModelActionRole.Create, new TaskCreator<T>(placeholderName, taskType, configure, taskModelType)).withProjection(new UnmanagedModelProjection<T>(taskModelType)).descriptor(new SimpleModelRuleDescriptor("tasks.addPlaceholderAction(" + placeholderName + ")")).build());
    }
    if (findByNameWithoutRules(placeholderName) == null) {
        placeholders.add(placeholderName);
    }
}
Also used : ModelPath(org.gradle.model.internal.core.ModelPath) UnmanagedModelProjection(org.gradle.model.internal.core.UnmanagedModelProjection) SimpleModelRuleDescriptor(org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor)

Aggregations

ModelPath (org.gradle.model.internal.core.ModelPath)1 UnmanagedModelProjection (org.gradle.model.internal.core.UnmanagedModelProjection)1 SimpleModelRuleDescriptor (org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor)1