use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method settingsFileGetsIgnoredWhenUsingSettingsOnlyDirectoryAsProjectDirectory.
@Test
public void settingsFileGetsIgnoredWhenUsingSettingsOnlyDirectoryAsProjectDirectory() {
TestFile settingsDir = testFile("gradle");
TestFile settingsFile = settingsDir.file("settings.gradle");
settingsFile.writelns("rootProject.projectDir = new File(settingsDir, '../root')");
getTestDirectory().createDir("root").file("build.gradle").writelns("task thing");
inTestDirectory().withArguments("-p", settingsDir.getAbsolutePath()).withTasks("thing").runWithFailure().assertHasDescription("Task 'thing' not found in root project 'gradle'.");
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method usesRootProjectAsDefaultProjectWhenInSettingsDir.
@Test
public void usesRootProjectAsDefaultProjectWhenInSettingsDir() {
TestFile settingsDir = testFile("gradle");
TestFile settingsFile = settingsDir.file("settings.gradle");
settingsFile.writelns("rootProject.projectDir = new File(settingsDir, '../root')", "include 'sub'", "project(':sub').projectDir = new File(settingsDir, '../root/sub')");
getTestDirectory().createDir("root").file("build.gradle").writelns("allprojects { task thing }");
inDirectory(settingsDir).withTasks("thing").run().assertTasksExecuted(":thing", ":sub:thing");
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method multiProjectBuildCanHaveAllProjectsAsChildrenOfSettingsDir.
@Test
public void multiProjectBuildCanHaveAllProjectsAsChildrenOfSettingsDir() {
TestFile settingsFile = testFile("settings.gradle");
settingsFile.writelns("rootProject.projectDir = new File(settingsDir, 'root')", "include 'sub'", "project(':sub').projectDir = new File(settingsDir, 'root/sub')");
getTestDirectory().createDir("root").file("build.gradle").writelns("allprojects { task thing }");
inTestDirectory().withTasks(":thing").run().assertTasksExecuted(":thing");
inTestDirectory().withTasks(":sub:thing").run().assertTasksExecuted(":sub:thing");
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method cannotUseDirectoryAsBuildFile.
@Test
public void cannotUseDirectoryAsBuildFile() {
TestFile settingsDir = testFile("gradle").createDir();
inTestDirectory().withArguments("-b", settingsDir.getAbsolutePath()).withTasks("thing").runWithFailure().assertHasDescription(String.format("Build file '%s' is not a file.", settingsDir.getAbsolutePath()));
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class WebProjectIntegrationTest method createsAWar.
@Test
public void createsAWar() {
testFile("settings.gradle").writelns("rootProject.name = 'test'");
TestFile buildFile = testFile("build.gradle");
buildFile.writelns("apply plugin: 'war'");
testFile("src/main/webapp/index.jsp").write("<p>hi</p>");
usingBuildFile(buildFile).withTasks("assemble").run();
testFile("build/libs/test.war").assertIsFile();
}
Aggregations