From the Gradle's code I found that there are methods : TemporaryFileProvider and TestNameTestDirectoryProvider for creating temporary file and folder but they are not part of the public API.
org.gradle.api.internal.file.TemporaryFileProvider
org.gradle.test.fixtures.file.TestNameTestDirectoryProvider
If there any methods from the public Gradle's API that gives the user ability to create temporary files and folders and if not what are the best ways to do it?
PS. I use org.junit.rules.TemporaryFolder
for JUnit tests and Java's File.createTempFile
Task implementations can use task.getTemporaryDir().createNewFile()
. What to use in JUnit tests isn't Gradle's business, but org.junit.rules.TemporaryFolder
would be my default choice.