|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gradle.GradleLauncher
public class GradleLauncher
GradleLauncher
is the main entry point for embedding Gradle. You use this class to manage a Gradle build,
as follows:
StartParameter
instance and configure it with the desired properties. The properties
of StartParameter
generally correspond to the command-line options of Gradle. You can use createStartParameter(String[])
to create a StartParameter
from a set of command-line options.GradleLauncher
instance by calling newInstance(org.gradle.StartParameter)
, passing in the StartParameter
,
or an array of Strings that will be treated as command line arguments.GradleLauncher
.run()
to execute the build. This will return a BuildResult
. Note that if the build fails, the
resulting exception will be contained in the BuildResult
.BuildResult.rethrowFailure()
to rethrow any build
failure.
Constructor Summary | |
---|---|
GradleLauncher(org.gradle.api.internal.GradleInternal gradle,
org.gradle.initialization.InitScriptHandler initScriptHandler,
org.gradle.initialization.SettingsHandler settingsHandler,
org.gradle.initialization.IGradlePropertiesLoader gradlePropertiesLoader,
org.gradle.initialization.BuildLoader buildLoader,
org.gradle.configuration.BuildConfigurer buildConfigurer,
org.gradle.initialization.LoggingConfigurer loggingConfigurer,
org.gradle.listener.ListenerManager listenerManager)
Creates a new instance. |
Method Summary | |
---|---|
void |
addListener(java.lang.Object listener)
Adds a BuildListener to this build instance. |
void |
addStandardErrorListener(StandardOutputListener listener)
Adds a StandardOutputListener to this build instance. |
void |
addStandardOutputListener(StandardOutputListener listener)
Adds a StandardOutputListener to this build instance. |
static StartParameter |
createStartParameter(java.lang.String[] commandLineArgs)
Returns a StartParameter object out of command line syntax arguments. |
BuildResult |
getBuildAnalysis()
Evaluates the settings and all the projects. |
BuildResult |
getBuildAndRunAnalysis()
Evaluates the settings and all the projects. |
static void |
injectCustomFactory(GradleFactory gradleFactory)
|
static GradleLauncher |
newInstance(StartParameter startParameter)
Returns a GradleLauncher instance based on the passed start parameter. |
static GradleLauncher |
newInstance(java.lang.String[] commandLineArgs)
Returns a GradleLauncher instance based on the passed command line syntax arguments. |
BuildResult |
run()
Executes the build for this GradleLauncher instance and returns the result. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GradleLauncher(org.gradle.api.internal.GradleInternal gradle, org.gradle.initialization.InitScriptHandler initScriptHandler, org.gradle.initialization.SettingsHandler settingsHandler, org.gradle.initialization.IGradlePropertiesLoader gradlePropertiesLoader, org.gradle.initialization.BuildLoader buildLoader, org.gradle.configuration.BuildConfigurer buildConfigurer, org.gradle.initialization.LoggingConfigurer loggingConfigurer, org.gradle.listener.ListenerManager listenerManager)
newInstance(StartParameter)
or newInstance(String[])
instead. Note that this method is package-protected to discourage it's direct use.
Method Detail |
---|
public BuildResult run()
Executes the build for this GradleLauncher instance and returns the result. Note that when the build fails,
the exception is available using BuildResult.getFailure()
.
public BuildResult getBuildAnalysis()
Gradle.getRootProject()
object.
public BuildResult getBuildAndRunAnalysis()
Gradle.getRootProject()
object. Fills the execution plan without running
the build. The tasks to be executed tasks are available via Gradle.getTaskGraph()
.
public static GradleLauncher newInstance(StartParameter startParameter)
startParameter
- The start parameter object the GradleLauncher instance is initialized withpublic static GradleLauncher newInstance(java.lang.String[] commandLineArgs)
createStartParameter(String[])
in conjunction with newInstance(String[])
.
commandLineArgs
- A String array where each element denotes an entry of the Gradle command line syntaxpublic static StartParameter createStartParameter(java.lang.String[] commandLineArgs)
commandLineArgs
- A String array where each element denotes an entry of the Gradle command line syntaxpublic static void injectCustomFactory(GradleFactory gradleFactory)
public void addListener(java.lang.Object listener)
Adds a BuildListener
to this build instance. The listener is notified of events which occur during the
execution of the build.
listener
- The listener to add. Has no effect if the listener has already been added.public void addStandardOutputListener(StandardOutputListener listener)
Adds a StandardOutputListener
to this build instance. The listener is notified of any text written to
standard output by Gradle's logging system
listener
- The listener to add. Has no effect if the listener has already been added.public void addStandardErrorListener(StandardOutputListener listener)
Adds a StandardOutputListener
to this build instance. The listener is notified of any text written to
standard error by Gradle's logging system
listener
- The listener to add. Has no effect if the listener has already been added.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |