use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method noDeprecationWarningAppearsWhenEnclosingBuildUsesAnotherBuildFile.
@Test
public void noDeprecationWarningAppearsWhenEnclosingBuildUsesAnotherBuildFile() {
testFile("settings.gradle").write("include 'another'");
TestFile renamedBuildGradle = getTestDirectory().file("renamed_build.gradle").createFile();
usingBuildFile(renamedBuildGradle).inDirectory(getTestDirectory()).withTasks("help").run();
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method canDetermineRootProjectAndDefaultProjectBasedOnCurrentDirectory.
@Test
public void canDetermineRootProjectAndDefaultProjectBasedOnCurrentDirectory() {
File rootDir = getTestDirectory();
File childDir = new File(rootDir, "child");
testFile("settings.gradle").write("include('child')");
testFile("build.gradle").write("task('do-stuff')");
testFile("child/build.gradle").write("task('do-stuff')");
inDirectory(rootDir).withTasks("do-stuff").run().assertTasksExecuted(":do-stuff", ":child:do-stuff");
inDirectory(rootDir).withTasks(":do-stuff").run().assertTasksExecuted(":do-stuff");
inDirectory(childDir).withTasks("do-stuff").run().assertTasksExecuted(":child:do-stuff");
inDirectory(childDir).withTasks(":do-stuff").run().assertTasksExecuted(":do-stuff");
}
use of org.gradle.test.fixtures.file.TestFile 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());
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class TestResources method maybeCopy.
/**
* Copies the given resource to the test directory.
*/
public void maybeCopy(String resource) {
TestFile dir = resources.findResource(resource);
if (dir != null) {
logger.debug("Copying test resource '{}' from {} to test directory.", resource, dir);
dir.copyTo(getDir());
} else {
logger.debug("Test resource '{}' not found, skipping.", resource);
}
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class AbstractGradleExecuter method isSettingsFileAvailable.
private boolean isSettingsFileAvailable() {
boolean settingsFoundAboveInTestDir = false;
TestFile dir = new TestFile(getWorkingDir());
while (dir != null && getTestDirectoryProvider().getTestDirectory().isSelfOrDescendent(dir)) {
if (dir.file("settings.gradle").isFile()) {
settingsFoundAboveInTestDir = true;
break;
}
dir = dir.getParentFile();
}
return settingsFoundAboveInTestDir;
}
Aggregations