Class EclipseApp
java.lang.Object
com.diffplug.gradle.eclipserunner.EclipseApp
- Direct Known Subclasses:
CategoryPublisher,EclipseApp.AntRunner,FeaturesAndBundlesPublisher,P2Model.DirectorApp,Repo2Runnable
Models an eclipse utility application and all of
its input state.
Specifically targets utilities which are
only available as eclipse applications, such as
`org.eclipse.ant.core.antRunner` or
`org.eclipse.equinox.p2.director`.
To run an `EclipseApp`, call
runUsing(EclipseRunner)
and pass an EclipseRunner instance.
```java
EclipseApp p2director = new EclipseApp("org.eclipse.equinox.p2.director");
p2director.addArg("repository", "https://somerepo");
p2director.addArg("destination", "file://somefile");
p2director.addArg("installIU", "org.eclipse.jdt");
p2director.addArg("installIU", "org.eclipse.text");
p2director.runUsing(new NativeRunner(eclipseLauncherExe));
```
will turn into
```
eclipsec.exe -application org.eclipse.equinox.p2.director
-repository https://somerepo
-destination file://somefile
-installIU org.eclipse.jdt,org.eclipse.text
```
## Staleness
Many of these applications are deterministic - if you
pass them the same inputs, they generate the same outputs.
To build fast staleness checking, use completeState()
to get a String which contains the full state of the
application.
## State besides arguments
Sometimes, running an eclipse utility application includes state
besides its console arguments, such as the input `build.xml` for
`org.eclipse.ant.core.antRunner`.
Ideally, this state should be included within the `EclipseApp` instance.
This can be accomplished by overriding EclipseApp.AntRunner.runUsing(EclipseRunner),
setting up any state that the application requires, and cleaning up the state
after it has completed.
See EclipseApp.AntRunner for an example.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classModels the `org.eclipse.ant.core.antRunner` application, including its `build.xml`. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEclipseApp(String application) Creates an EclipseApp which will call the given application, such as `org.eclipse.ant.core.antRunner` or `org.eclipse.equinox.p2.director` -
Method Summary
Modifier and TypeMethodDescriptionvoid`addArg("flag")` will add "-flag" to command line.void`addArg("flag", "value")` will add `-flag value` to command line.voidclean()Any cached data used by the OSGi framework and eclipse runtime will be wiped clean.Writes out the entire state of this argsbuilder to a string.voidAny log output is also sent to Java's System.out (typically back to the command shell if any).voidrunUsing(EclipseRunner runner) Runs this app using the given runner.Returns the args.toString()
-
Field Details
-
args
-
-
Constructor Details
-
EclipseApp
Creates an EclipseApp which will call the given application, such as `org.eclipse.ant.core.antRunner` or `org.eclipse.equinox.p2.director`
-
-
Method Details
-
runUsing
Runs this app using the given runner.- Throws:
Exception
-
completeState
Writes out the entire state of this argsbuilder to a string. This can be used to determine if the arguments have changed at all, to aid in staleness checking. If you extend EclipseArgsBuilder and add any kinds of new state (e.g. EclipseAntArgsBuilder), then you *must* override this method and embed all internal state within it. -
toString
-
addArg
`addArg("flag", "value")` will add `-flag value` to command line. ```java addArg("flag", "A") addArg("flag", "B") ``` will add `-flag A,B` to the command line. -
addArg
`addArg("flag")` will add "-flag" to command line. -
toArgList
Returns the args. -
clean
public void clean()Any cached data used by the OSGi framework and eclipse runtime will be wiped clean. This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches. -
consolelog
public void consolelog()Any log output is also sent to Java's System.out (typically back to the command shell if any).
-