use of com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo in project gocd by gocd.
the class PluggableTaskPluginInfoBuilder method pluginInfoFor.
public PluggableTaskPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) {
final TaskPreference[] tp = { null };
extension.doOnTask(descriptor.id(), new Action<Task>() {
@Override
public void execute(Task task, GoPluginDescriptor pluginDescriptor) {
tp[0] = new TaskPreference(task);
}
});
TaskConfig config = tp[0].getConfig();
TaskView view = tp[0].getView();
if (config == null) {
throw new RuntimeException(format("Plugin[%s] returned null task configuration", descriptor.id()));
}
if (view == null) {
throw new RuntimeException(format("Plugin[%s] returned null task view", descriptor.id()));
}
String displayName = view.displayValue();
PluggableInstanceSettings taskSettings = new PluggableInstanceSettings(configurations(config), new PluginView(view.template()));
return new PluggableTaskPluginInfo(descriptor, displayName, taskSettings);
}
Aggregations