Search in sources :

Example 1 with ExecutionResult

use of org.gradle.integtests.fixtures.executer.ExecutionResult in project gradle by gradle.

the class MSBuildExecutor method succeeds.

public List<ExecutionResult> succeeds(MSBuildAction action) {
    withArgument(toTargetArgument(action));
    ExecOutput result = findMSBuild().execute(args, buildEnvironment(workingDir));
    System.out.println(result.getOut());
    String output = trimLines(result.getOut());
    String error = trimLines(result.getError());
    List<ExecutionResult> results = new ArrayList<ExecutionResult>();
    int first = output.indexOf(SEPARATOR);
    if (first < 0) {
        return Collections.emptyList();
    }
    output = output.substring(first + SEPARATOR.length());
    while (output.length() > 0) {
        int next = output.indexOf(SEPARATOR);
        if (next < 0) {
            results.add(OutputScrapingExecutionResult.from(output, error));
            output = "";
        } else {
            results.add(OutputScrapingExecutionResult.from(output.substring(0, next), error));
            output = output.substring(next + SEPARATOR.length());
        }
        error = "";
    }
    return results;
}
Also used : ExecOutput(org.gradle.test.fixtures.file.ExecOutput) ArrayList(java.util.ArrayList) ExecutionResult(org.gradle.integtests.fixtures.executer.ExecutionResult) OutputScrapingExecutionResult(org.gradle.integtests.fixtures.executer.OutputScrapingExecutionResult)

Example 2 with ExecutionResult

use of org.gradle.integtests.fixtures.executer.ExecutionResult in project gradle by gradle.

the class ProjectLoadingIntegrationTest method deprecationWarningAppearsWhenNestedBuildHasNoSettingsFile.

@Test
public void deprecationWarningAppearsWhenNestedBuildHasNoSettingsFile() {
    testFile("settings.gradle").write("include 'another'");
    TestFile subDirectory = getTestDirectory().file("sub");
    TestFile subBuildFile = subDirectory.file("sub.gradle").write("");
    subDirectory.file("build.gradle").write("");
    ExecutionResult result = inDirectory(subDirectory).withTasks("help").expectDeprecationWarning().run();
    result.assertOutputContains("Support for nested build without a settings file was deprecated and will be removed in Gradle 5.0. You should create a empty settings file in " + subDirectory.getAbsolutePath());
    result = usingBuildFile(subBuildFile).inDirectory(subDirectory).withTasks("help").expectDeprecationWarning().run();
    result.assertOutputContains("Support for nested build without a settings file was deprecated and will be removed in Gradle 5.0. You should create a empty settings file in " + subDirectory.getAbsolutePath());
    result = usingProjectDir(subDirectory).withTasks("help").expectDeprecationWarning().run();
    result.assertOutputContains("Support for nested build without a settings file was deprecated and will be removed in Gradle 5.0. You should create a empty settings file in " + subDirectory.getAbsolutePath());
}
Also used : TestFile(org.gradle.test.fixtures.file.TestFile) ExecutionResult(org.gradle.integtests.fixtures.executer.ExecutionResult) Test(org.junit.Test) AbstractIntegrationTest(org.gradle.integtests.fixtures.AbstractIntegrationTest)

Aggregations

ExecutionResult (org.gradle.integtests.fixtures.executer.ExecutionResult)2 ArrayList (java.util.ArrayList)1 AbstractIntegrationTest (org.gradle.integtests.fixtures.AbstractIntegrationTest)1 OutputScrapingExecutionResult (org.gradle.integtests.fixtures.executer.OutputScrapingExecutionResult)1 ExecOutput (org.gradle.test.fixtures.file.ExecOutput)1 TestFile (org.gradle.test.fixtures.file.TestFile)1 Test (org.junit.Test)1