use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class BuildWorkEnvironmentVariablesTest method getBuildWorkWithP4MaterialRevision.
private BuildWork getBuildWorkWithP4MaterialRevision(P4Material p4Material) {
pipelineConfig.setMaterialConfigs(new Materials(p4Material).convertToConfigs());
JobPlan plan = new DefaultJobPlan(new Resources(), new ArrayList<>(), new ArrayList<>(), -1, new JobIdentifier(PIPELINE_NAME, 1, "1", STAGE_NAME, "1", JOB_NAME, 123L), null, new EnvironmentVariables(), new EnvironmentVariables(), null);
MaterialRevisions materialRevisions = new MaterialRevisions(new MaterialRevision(p4Material, new Modification("user", "comment", "a@b.com", new Date(), "10")));
BuildCause buildCause = BuildCause.createWithModifications(materialRevisions, TRIGGERED_BY_USER);
List<Builder> builders = new ArrayList<>();
builders.add(new CommandBuilder("ant", "", dir, new RunIfConfigs(), new NullBuilder(), ""));
BuildAssignment assignment = BuildAssignment.create(plan, buildCause, builders, dir, environmentVariableContext, new ArtifactStores());
return new BuildWork(assignment, systemEnvironment.consoleLogCharset());
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class NantTaskBuilder method createBuilder.
@Override
public Builder createBuilder(BuilderFactory builderFactory, NantTask task, Pipeline pipeline, UpstreamPipelineResolver resolver) {
File taskWorkingDirectory = new File(FileUtil.join(pipeline.defaultWorkingFolder(), task.workingDirectory()));
String command = task.command();
String argument = task.arguments();
Builder cancelBuilder = builderFactory.builderFor(task.cancelTask(), pipeline, resolver);
return new CommandBuilder(command, argument, taskWorkingDirectory, task.getConditions(), cancelBuilder, task.describe(), "BUILD FAILED");
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class RakeTaskBuilder method createBuilder.
@Override
public Builder createBuilder(BuilderFactory builderFactory, RakeTask task, Pipeline pipeline, UpstreamPipelineResolver resolver) {
String newWorkingDir = FileUtil.join(pipeline.defaultWorkingFolder(), task.workingDirectory());
String argument = task.arguments();
Builder builder = builderFactory.builderFor(task.cancelTask(), pipeline, resolver);
return new CommandBuilder("rake", argument, new File(newWorkingDir), task.getConditions(), builder, task.describe());
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class AntTaskBuilderTest method shouldUseAbsoluteWorkingDirectoryWhenItIsSet.
@Test
public void shouldUseAbsoluteWorkingDirectoryWhenItIsSet() {
final File absoluteFile = new File("me/antdirectory").getAbsoluteFile();
antTask.setWorkingDirectory(absoluteFile.getPath());
CommandBuilder builder = (CommandBuilder) antTaskBuilder.createBuilder(builderFactory, antTask, pipeline, resolver);
assertThat(builder.getWorkingDir(), is(absoluteFile));
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class AntTaskBuilderTest method shouldPrependDefaultWorkingDirectoryIfRelativeAntHomeIsUsed.
@Test
public void shouldPrependDefaultWorkingDirectoryIfRelativeAntHomeIsUsed() {
antTask.setWorkingDirectory("lib");
File baseDir = new File(DEFAULT_WORKING_DIRECTORY);
CommandBuilder builder = (CommandBuilder) antTaskBuilder.createBuilder(builderFactory, antTask, pipeline, resolver);
assertThat(builder.getWorkingDir(), is(new File(baseDir, "lib")));
}
Aggregations