Search in sources :

Example 1 with CommandBuilderWithArgList

use of com.thoughtworks.go.domain.builder.CommandBuilderWithArgList in project gocd by gocd.

the class ExecTaskBuilder method createBuilder.

@Override
public Builder createBuilder(BuilderFactory builderFactory, ExecTask task, Pipeline pipeline, UpstreamPipelineResolver pipelineResolver) {
    String workingDir = task.workingDirectory();
    String command = task.command();
    File newWorkingDir = workingDir == null ? pipeline.defaultWorkingFolder() : new File(applyBaseDirIfRelativeAndNormalize(pipeline.defaultWorkingFolder(), new File(workingDir)));
    Builder builder = builderFactory.builderFor(task.cancelTask(), pipeline, pipelineResolver);
    String description = task.describe();
    if (!task.getArgList().isEmpty()) {
        return new CommandBuilderWithArgList(command, task.getArgList().toStringArray(), newWorkingDir, task.getConditions(), builder, description);
    } else {
        return new CommandBuilder(command, task.getArgs(), newWorkingDir, task.getConditions(), builder, description);
    }
}
Also used : Builder(com.thoughtworks.go.domain.builder.Builder) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) CommandBuilderWithArgList(com.thoughtworks.go.domain.builder.CommandBuilderWithArgList) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File)

Aggregations

Builder (com.thoughtworks.go.domain.builder.Builder)1 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)1 CommandBuilderWithArgList (com.thoughtworks.go.domain.builder.CommandBuilderWithArgList)1 File (java.io.File)1