use of org.gradle.api.internal.file.temp.DefaultTemporaryFileProvider in project gradle by gradle.
the class ProjectBuilderImpl method prepareProjectDir.
public File prepareProjectDir(@Nullable final File projectDir) {
if (projectDir != null) {
return FileUtils.canonicalize(projectDir);
}
TemporaryFileProvider temporaryFileProvider = new DefaultTemporaryFileProvider(new Factory<File>() {
@Override
public File create() {
String rootTmpDir = SystemProperties.getInstance().getWorkerTmpDir();
if (rootTmpDir == null) {
@SuppressWarnings("deprecation") String javaIoTmpDir = SystemProperties.getInstance().getJavaIoTmpDir();
rootTmpDir = javaIoTmpDir;
}
return FileUtils.canonicalize(new File(rootTmpDir));
}
});
File tempDirectory = temporaryFileProvider.createTemporaryDirectory("gradle", "projectDir");
// TODO deleteOnExit won't clean up non-empty directories (and it leaks memory for long-running processes).
tempDirectory.deleteOnExit();
return tempDirectory;
}
Aggregations