use of org.gradle.integtests.fixtures.executer.ExecutionFailure in project gradle by gradle.
the class BuildScriptClasspathIntegrationTest method buildSrcProjectCanReferToSourceOutsideBuildSrcDir.
@Test
public void buildSrcProjectCanReferToSourceOutsideBuildSrcDir() {
testFile("gradle/src/BuildClass.java").writelns("public class BuildClass { }");
testFile("buildSrc/build.gradle").writelns("apply plugin: 'java'", "sourceSets.main.java.srcDirs = ['../gradle/src']");
testFile("build.gradle").writelns("task test { doLast { new BuildClass() } }");
inTestDirectory().withTasks("test").run();
testFile("gradle/src/BuildClass.java").writelns("public class BuildClass { public BuildClass(String value) { throw new RuntimeException(\"broken\"); } }");
ExecutionFailure failure = inTestDirectory().withTasks("test").runWithFailure();
failure.assertHasCause("broken");
}
use of org.gradle.integtests.fixtures.executer.ExecutionFailure in project gradle by gradle.
the class ProjectLoadingIntegrationTest method buildFailsWhenMultipleProjectsMeetDefaultProjectCriteria.
@Test
public void buildFailsWhenMultipleProjectsMeetDefaultProjectCriteria() {
testFile("settings.gradle").writelns("include 'child'", "project(':child').projectDir = rootProject.projectDir");
testFile("build.gradle").write("// empty");
ExecutionFailure result = inTestDirectory().withTasks("test").runWithFailure();
result.assertThatDescription(startsWith("Multiple projects in this build have project directory"));
result = usingProjectDir(getTestDirectory()).withTasks("test").runWithFailure();
result.assertThatDescription(startsWith("Multiple projects in this build have project directory"));
result = usingBuildFile(testFile("build.gradle")).withTasks("test").runWithFailure();
result.assertThatDescription(startsWith("Multiple projects in this build have build file"));
}
use of org.gradle.integtests.fixtures.executer.ExecutionFailure in project gradle by gradle.
the class ProjectLoadingIntegrationTest method buildFailsWhenSpecifiedSettingsFileDoesNotContainMatchingProject.
@Test
public void buildFailsWhenSpecifiedSettingsFileDoesNotContainMatchingProject() {
TestFile settingsFile = testFile("settings.gradle");
settingsFile.write("// empty");
TestFile projectDir = testFile("project dir");
TestFile buildFile = projectDir.file("build.gradle").createFile();
ExecutionFailure result = usingProjectDir(projectDir).usingSettingsFile(settingsFile).runWithFailure();
result.assertHasDescription(String.format("No projects in this build have project directory '%s'.", projectDir));
result = usingBuildFile(buildFile).usingSettingsFile(settingsFile).runWithFailure();
result.assertHasDescription(String.format("No projects in this build have build file '%s'.", buildFile));
}
use of org.gradle.integtests.fixtures.executer.ExecutionFailure in project gradle by gradle.
the class ProjectLoadingIntegrationTest method buildFailsWhenSpecifiedProjectDirectoryIsNotADirectory.
@Test
public void buildFailsWhenSpecifiedProjectDirectoryIsNotADirectory() {
TestFile file = testFile("unknown");
ExecutionFailure result = usingProjectDir(file).runWithFailure();
result.assertHasDescription("The specified project directory '" + file + "' does not exist.");
file.createFile();
result = usingProjectDir(file).runWithFailure();
result.assertHasDescription("The specified project directory '" + file + "' is not a directory.");
}
use of org.gradle.integtests.fixtures.executer.ExecutionFailure in project gradle by gradle.
the class ProjectLoadingIntegrationTest method buildFailsWhenSpecifiedBuildFileIsNotAFile.
@Test
public void buildFailsWhenSpecifiedBuildFileIsNotAFile() {
TestFile file = testFile("unknown");
ExecutionFailure result = usingBuildFile(file).runWithFailure();
result.assertHasDescription("The specified build file '" + file + "' does not exist.");
file.createDir();
result = usingBuildFile(file).runWithFailure();
result.assertHasDescription("The specified build file '" + file + "' is not a file.");
}
Aggregations