Skip to content

Instantly share code, notes, and snippets.

@kelemen
Last active December 20, 2015 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelemen/6111321 to your computer and use it in GitHub Desktop.
Save kelemen/6111321 to your computer and use it in GitHub Desktop.
// Assuming there is a "ConsumerActionExecutor actionExecutor(ActionExecutorContext context)" in ProjectConnection.
final class ActionExecutorContext {
// Properties, like JavaHome, JvmArguments, Std[Err/Out/In] redirection
// I recommend this class to be immutable (created by a Builder).
}
interface ConsumerActionExecutor {
// After this method returns the actionListener will no longer be notified
// and the action has been executed.
<T> void execute(CancellationToken cancelToken, ConsumerAction<T> action, ConsumerActionListener<T> actionListener) throws IOException;
}
interface ConsumerActionListener<T> {
void progressChanged(ProgressEvent event);
void modelLoaded(T model);
}
interface ConsumerAction<T> {
void doAction(CancellationToken cancelToken, GradleAccessor accessor, ActionResultProvider<T> resultProvider);
}
interface ActionResultProvider<T> {
void sendModel(T model);
void setProgress(ProgressEvent event);
}
interface GradleAccessor {
// Only for project independent models
<T> T getModel(Class<T> modelClass);
// ProjectTree should contain only things available from
// evaluation of "settings.gradle". As a minimum, the fully qualified
// project name (i.e., "path") and the project folder.
ProjectTree getProjectTree();
// Returns the fully qualified name of the project defined for
// the associated ProjectConnection.
String getMainProjectPath();
// Evaluates a project specified by its fully qualified name
void evaluateProject(String path);
// Returns the fully qualified name of the evaluated projects.
List<EvaluatedProject> getEvaluatedProjects();
}
interface EvaluatedProject {
// Returns the fully qualified name of this project.
String getPath();
File getProjectDir();
<T> T getModel(Class<T> modelClass);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment