Search in sources :

Example 6 with NantTask

use of com.thoughtworks.go.config.NantTask in project gocd by gocd.

the class NantTaskBuilderTest method shouldDealWithSpacesInNantPath.

@Test
void shouldDealWithSpacesInNantPath() {
    NantTask nantTask = new NantTask();
    nantTask.setNantPath("lib/nant 1.0");
    nantTask.setBuildFile("ccnet default.build");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver);
    assertThat(new File(builder.getCommand())).isEqualTo(new File("lib/nant 1.0/nant"));
    assertThat(builder.getArgs()).isEqualTo("-buildfile:\"ccnet default.build\"");
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 7 with NantTask

use of com.thoughtworks.go.config.NantTask in project gocd by gocd.

the class NantTaskRepresenter method fromJSON.

public static NantTask fromJSON(JsonReader jsonReader) {
    NantTask nantTask = new NantTask();
    if (jsonReader == null) {
        return nantTask;
    }
    BaseTaskRepresenter.fromJSON(jsonReader, nantTask);
    jsonReader.readStringIfPresent("working_directory", nantTask::setWorkingDirectory);
    jsonReader.readStringIfPresent("build_file", nantTask::setBuildFile);
    jsonReader.readStringIfPresent("target", nantTask::setTarget);
    jsonReader.readStringIfPresent("nant_path", nantTask::setNantPath);
    return nantTask;
}
Also used : NantTask(com.thoughtworks.go.config.NantTask)

Example 8 with NantTask

use of com.thoughtworks.go.config.NantTask in project gocd by gocd.

the class NantTaskRepresenter method fromJSON.

public static NantTask fromJSON(JsonReader jsonReader) {
    NantTask nantTask = new NantTask();
    if (jsonReader == null) {
        return nantTask;
    }
    BaseTaskRepresenter.fromJSON(jsonReader, nantTask);
    jsonReader.readStringIfPresent("working_directory", nantTask::setWorkingDirectory);
    jsonReader.readStringIfPresent("build_file", nantTask::setBuildFile);
    jsonReader.readStringIfPresent("target", nantTask::setTarget);
    jsonReader.readStringIfPresent("nant_path", nantTask::setNantPath);
    return nantTask;
}
Also used : NantTask(com.thoughtworks.go.config.NantTask)

Example 9 with NantTask

use of com.thoughtworks.go.config.NantTask in project gocd by gocd.

the class PipelineBean method getTasks.

public Tasks getTasks() {
    Tasks tasks = new Tasks();
    if ("ant".equals(builder)) {
        AntTask antTask = new AntTask();
        antTask.setTarget(this.target);
        antTask.setBuildFile(defaultString(StringUtils.isBlank(this.buildfile) ? "build.xml" : this.buildfile));
        tasks.add(antTask);
    } else if ("nant".equals(builder)) {
        NantTask nantTask = new NantTask();
        nantTask.setTarget(this.target);
        nantTask.setBuildFile(defaultString(StringUtils.isBlank(this.buildfile) ? "default.build" : this.buildfile));
        tasks.add(nantTask);
    } else if ("rake".equals(builder)) {
        RakeTask rakeTask = new RakeTask();
        rakeTask.setTarget(this.target);
        rakeTask.setBuildFile(StringUtils.isBlank(this.buildfile) ? null : this.buildfile);
        tasks.add(rakeTask);
    } else if ("exec".equals(builder)) {
        String trimmedCommand = StringUtils.defaultString(this.command).trim();
        String trimmedArguments = StringUtils.defaultString(this.arguments).trim();
        ExecTask execTask = new ExecTask(trimmedCommand, trimmedArguments, (String) null);
        tasks.add(execTask);
    }
    return tasks;
}
Also used : Tasks(com.thoughtworks.go.config.Tasks) RakeTask(com.thoughtworks.go.config.RakeTask) ExecTask(com.thoughtworks.go.config.ExecTask) AntTask(com.thoughtworks.go.config.AntTask) NantTask(com.thoughtworks.go.config.NantTask) StringUtils.defaultString(org.apache.commons.lang.StringUtils.defaultString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 10 with NantTask

use of com.thoughtworks.go.config.NantTask in project gocd by gocd.

the class NantTaskBuilderTest method shouldSetTargetWhenTargetIsSpecified.

@Test
void shouldSetTargetWhenTargetIsSpecified() {
    NantTask nantTask = new NantTask();
    nantTask.setTarget("unit-test");
    CommandBuilder commandBuilder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver);
    assertThat(commandBuilder.getArgs()).isEqualTo("unit-test");
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) Test(org.junit.jupiter.api.Test)

Aggregations

NantTask (com.thoughtworks.go.config.NantTask)13 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)9 Test (org.junit.jupiter.api.Test)9 File (java.io.File)7 DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)2 AntTask (com.thoughtworks.go.config.AntTask)1 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 ExecTask (com.thoughtworks.go.config.ExecTask)1 RakeTask (com.thoughtworks.go.config.RakeTask)1 Tasks (com.thoughtworks.go.config.Tasks)1 StringUtils.defaultString (org.apache.commons.lang.StringUtils.defaultString)1 EnabledOnOs (org.junit.jupiter.api.condition.EnabledOnOs)1