use of org.gradle.TaskExecutionRequest in project gradle by gradle.
the class DefaultTasksBuildExecutionAction method configure.
public void configure(BuildExecutionContext context) {
StartParameter startParameter = context.getGradle().getStartParameter();
for (TaskExecutionRequest request : startParameter.getTaskRequests()) {
if (!request.getArgs().isEmpty()) {
context.proceed();
return;
}
}
// Gather the default tasks from this first group project
ProjectInternal project = context.getGradle().getDefaultProject();
//so that we don't miss out default tasks
projectConfigurer.configure(project);
List<String> defaultTasks = project.getDefaultTasks();
if (defaultTasks.size() == 0) {
defaultTasks = Collections.singletonList(ProjectInternal.HELP_TASK);
LOGGER.info("No tasks specified. Using default task {}", GUtil.toString(defaultTasks));
} else {
LOGGER.info("No tasks specified. Using project default tasks {}", GUtil.toString(defaultTasks));
}
startParameter.setTaskNames(defaultTasks);
context.proceed();
}
use of org.gradle.TaskExecutionRequest in project gradle by gradle.
the class ProviderStartParameterConverter method unpack.
private List<TaskExecutionRequest> unpack(final List<InternalLaunchable> launchables, File projectDir) {
// Important that the launchables are unpacked on the client side, to avoid sending back any additional internal state that
// the launchable may hold onto. For example, GradleTask implementations hold onto every task for every project in the build
List<TaskExecutionRequest> requests = new ArrayList<TaskExecutionRequest>(launchables.size());
for (InternalLaunchable launchable : launchables) {
if (launchable instanceof TaskExecutionRequest) {
TaskExecutionRequest originalLaunchable = (TaskExecutionRequest) launchable;
TaskExecutionRequest launchableImpl = new DefaultTaskExecutionRequest(originalLaunchable.getArgs(), originalLaunchable.getProjectPath(), originalLaunchable.getRootDir());
requests.add(launchableImpl);
} else {
throw new InternalUnsupportedBuildArgumentException("Problem with provided launchable arguments: " + launchables + ". " + "\nOnly objects from this provider can be built.");
}
}
return requests;
}
use of org.gradle.TaskExecutionRequest in project gradle by gradle.
the class TaskNameResolvingBuildConfigurationAction method configure.
public void configure(BuildExecutionContext context) {
GradleInternal gradle = context.getGradle();
TaskGraphExecuter executer = gradle.getTaskGraph();
List<TaskExecutionRequest> taskParameters = gradle.getStartParameter().getTaskRequests();
for (TaskExecutionRequest taskParameter : taskParameters) {
List<TaskSelector.TaskSelection> taskSelections = commandLineTaskParser.parseTasks(taskParameter);
for (TaskSelector.TaskSelection taskSelection : taskSelections) {
LOGGER.info("Selected primary task '{}' from project {}", taskSelection.getTaskName(), taskSelection.getProjectPath());
executer.addTasks(taskSelection.getTasks());
}
}
context.proceed();
}
Aggregations