public interface GradleExecuter
| Modifier and Type | Method and Description |
|---|---|
GradleExecuter |
afterExecute(java.util.function.Consumer<? super GradleExecuter> action)
Adds an action to be called immediately after execution.
|
GradleExecuter |
beforeExecute(java.util.function.Function<? super GradleExecuter,GradleExecuter> action)
Adds an action to be called immediately before execution, to allow extra configuration to be injected.
|
GradleDistribution |
getDistribution()
Return the Gradle distribution used by this executer.
|
TestFile |
getTestDirectory()
The directory that the executer will use for any test specific storage.
|
java.io.File |
getWorkingDirectory()
Returns the working directory of this executer.
|
GradleExecuter |
inDirectory(java.io.File directory)
Sets the working directory to use.
|
GradleExecuter |
requireGradleDistribution()
Requires that there is a real gradle distribution for the execution, which in-process execution does not.
|
GradleExecuter |
requireOwnGradleUserHomeDirectory()
Configures a unique gradle user home dir for the test.
|
ExecutionResult |
run()
Executes the requested build, asserting that the build succeeds.
|
ExecutionFailure |
runWithFailure()
Executes the requested build, asserting that the build fails.
|
GradleExecuter |
usingBuildScript(java.io.File buildScript)
Uses the given build script by adding
"--build-file" argument. |
GradleExecuter |
usingInitScript(java.io.File initScript)
Uses the given init script by adding
"--init-script" argument. |
GradleExecuter |
usingProjectDirectory(java.io.File projectDirectory)
Uses the given project directory by adding the
"--project-dir" argument. |
GradleExecuter |
usingSettingsFile(java.io.File settingsFile)
Uses the given settings file by adding
"--settings-file" argument. |
GradleExecuter |
withArgument(java.lang.String arg)
Adds an additional command-line argument to use when executing the build.
|
GradleExecuter |
withArguments(java.util.List<java.lang.String> args)
Sets the additional command-line arguments to use when executing the build.
|
GradleExecuter |
withArguments(java.lang.String... args)
Sets the additional command-line arguments to use when executing the build.
|
GradleExecuter |
withBuildCacheEnabled()
Activates the build cache.
|
GradleExecuter |
withConsole(ConsoleOutput consoleOutput)
Executes the build with
"--console=rich, auto, verbose" argument. |
GradleExecuter |
withDebuggerAttached()
Allows to trigger on breakpoints inside the Gradle build when the debugger is attached to the caller.
|
GradleExecuter |
withEnvironmentVars(java.util.Map<java.lang.String,?> environment)
Sets the environment variables to use when executing the build.
|
GradleExecuter |
withGradleUserHomeDirectory(java.io.File gradleUserHomeDirectory)
Sets the Gradle user home dir.
|
GradleExecuter |
withoutDeprecationChecks()
Disable deprecation warning checks.
|
GradleExecuter |
withPluginClasspath()
Activates the plugin classpath from the plugins under test.
|
GradleExecuter |
withStacktraceDisabled()
Executes the builds without adding the
"--stacktrace" argument. |
GradleExecuter |
withTasks(java.util.List<java.lang.String> tasks)
Sets the task names to execute.
|
GradleExecuter |
withTasks(java.lang.String... tasks)
Sets the task names to execute.
|
GradleExecuter |
withUserHomeDirectory(java.io.File userHomeDirectory)
Sets the user's home dir to use when running the build.
|
GradleDistribution getDistribution()
GradleDistribution instance used by this executer, never null.GradleExecuter inDirectory(java.io.File directory)
java.io.File getWorkingDirectory()
GradleExecuter withDebuggerAttached()
GradleExecuter instance that will attach the debugger, never null.GradleExecuter withTasks(java.lang.String... tasks)
GradleExecuter instance with the specified tasks to execute, never null.GradleExecuter withTasks(java.util.List<java.lang.String> tasks)
GradleExecuter withArguments(java.lang.String... args)
GradleExecuter withArguments(java.util.List<java.lang.String> args)
args - the new arguments to use, the old ones are discardedGradleExecuter instance with the new configuration.GradleExecuter withArgument(java.lang.String arg)
GradleExecuter withStacktraceDisabled()
"--stacktrace" argument.GradleExecuter withBuildCacheEnabled()
GradleExecuter withPluginClasspath()
GradleExecuter withUserHomeDirectory(java.io.File userHomeDirectory)
GradleExecuter withGradleUserHomeDirectory(java.io.File gradleUserHomeDirectory)
Note: does not affect the daemon base dir.
GradleExecuter withEnvironmentVars(java.util.Map<java.lang.String,?> environment)
GradleExecuter usingSettingsFile(java.io.File settingsFile)
"--settings-file" argument.GradleExecuter usingBuildScript(java.io.File buildScript)
"--build-file" argument.GradleExecuter usingInitScript(java.io.File initScript)
"--init-script" argument.GradleExecuter usingProjectDirectory(java.io.File projectDirectory)
"--project-dir" argument.TestFile getTestDirectory()
ExecutionResult run()
ExecutionFailure runWithFailure()
GradleExecuter beforeExecute(java.util.function.Function<? super GradleExecuter,GradleExecuter> action)
GradleExecuter afterExecute(java.util.function.Consumer<? super GradleExecuter> action)
GradleExecuter withConsole(ConsoleOutput consoleOutput)
"--console=rich, auto, verbose" argument.GradleExecuter requireOwnGradleUserHomeDirectory()
getTestDirectory() directory.
Note: does not affect the daemon base dir.
GradleExecuter withoutDeprecationChecks()
GradleExecuter with the new configuration.GradleExecuter requireGradleDistribution()
Note: try to avoid using this method. It has some major drawbacks when it comes to development: 1. It requires a Gradle distribution or installation, and this will need to be rebuilt after each change in order to use the test, and 2. it requires that the build run in a different JVM, which makes it very difficult to debug.