Search in sources :

Example 1 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 2 with NantTask

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

the class NantTaskBuilderTest method shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnLinux.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnLinux() {
    NantTask nantTask = new NantTask();
    nantTask.setNantPath("/usr/bin");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver);
    assertThat(new File(builder.getCommand())).isEqualTo(new File("/usr/bin/nant"));
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 3 with NantTask

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

the class NantTaskBuilderTest method nantTaskShouldNormalizeWorkingDirectory.

@Test
@DisabledOnOs(OS.WINDOWS)
void nantTaskShouldNormalizeWorkingDirectory() {
    NantTask nantTask = new NantTask();
    nantTask.setWorkingDirectory("folder1\\folder2");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, ExecTaskBuilderTest.pipelineStub("label", "/var/cruise-agent/pipelines/cruise"), resolver);
    assertThat(builder.getWorkingDir()).isEqualTo(new File("/var/cruise-agent/pipelines/cruise/folder1/folder2"));
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 4 with NantTask

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

the class NantTaskBuilderTest method nantTaskShouldNormalizeBuildFile.

@Test
void nantTaskShouldNormalizeBuildFile() {
    NantTask task = new NantTask();
    task.setBuildFile("pavan\\build.xml");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, task, pipeline, resolver);
    assertThat(builder.getArgs()).isEqualTo("-buildfile:\"pavan/build.xml\"");
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) Test(org.junit.jupiter.api.Test)

Example 5 with NantTask

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

the class NantTaskBuilderTest method shouldUseDefaultWorkingDirectoryByDefault.

@Test
void shouldUseDefaultWorkingDirectoryByDefault() {
    NantTask nantTask = new NantTask();
    CommandBuilder commandBuilder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, ExecTaskBuilderTest.pipelineStub("label", "/cruise"), resolver);
    assertThat(commandBuilder.getWorkingDir()).isEqualTo(new File("/cruise"));
}
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)

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