Class EclipseApp
- java.lang.Object
-
- com.diffplug.gradle.eclipserunner.EclipseApp
-
- Direct Known Subclasses:
CategoryPublisher,EclipseApp.AntRunner,FeaturesAndBundlesPublisher,P2Model.DirectorApp,Repo2Runnable
public class EclipseApp extends Object
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`, callrunUsing(EclipseRunner)and pass anEclipseRunnerinstance. ```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, usecompleteState()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 overridingEclipseApp.AntRunner.runUsing(EclipseRunner), setting up any state that the application requires, and cleaning up the state after it has completed. SeeEclipseApp.AntRunnerfor an example.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEclipseApp.AntRunnerModels the `org.eclipse.ant.core.antRunner` application, including its `build.xml`.
-
Constructor Summary
Constructors Constructor Description EclipseApp(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArg(String key)`addArg("flag")` will add "-flag" to command line.voidaddArg(String key, String value)`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.StringcompleteState()Writes out the entire state of this argsbuilder to a string.voidconsolelog()Any 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.protected List<String>toArgList()Returns the args.StringtoString()
-
-
-
Constructor Detail
-
EclipseApp
public EclipseApp(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 Detail
-
runUsing
public void runUsing(EclipseRunner runner) throws Exception
Runs this app using the given runner.- Throws:
Exception
-
completeState
public String 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.
-
addArg
public void addArg(String key, String value)
`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
public void addArg(String key)
`addArg("flag")` will add "-flag" to command line.
-
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).
-
-