本文整理汇总了Java中org.gradle.api.internal.tasks.TaskExecutionContext类的典型用法代码示例。如果您正苦于以下问题:Java TaskExecutionContext类的具体用法?Java TaskExecutionContext怎么用?Java TaskExecutionContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TaskExecutionContext类属于org.gradle.api.internal.tasks包,在下文中一共展示了TaskExecutionContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
listener.beforeActions(task);
if (!task.getTaskActions().isEmpty()) {
outputsGenerationListener.beforeTaskOutputsGenerated();
}
state.setExecuting(true);
try {
GradleException failure = executeActions(task, state, context);
if (failure != null) {
state.setOutcome(failure);
} else {
state.setOutcome(
state.getDidWork() ? TaskExecutionOutcome.EXECUTED : TaskExecutionOutcome.UP_TO_DATE
);
}
} finally {
state.setExecuting(false);
listener.afterActions(task);
}
}
示例2: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
boolean skip;
try {
skip = !task.getOnlyIf().isSatisfiedBy(task);
} catch (Throwable t) {
state.setOutcome(new GradleException(String.format("Could not evaluate onlyIf predicate for %s.", task), t));
return;
}
if (skip) {
LOGGER.info("Skipping {} as task onlyIf is false.", task);
state.setOutcome(TaskExecutionOutcome.SKIPPED);
return;
}
executer.execute(task, state, context);
}
示例3: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
List<String> messages = new ArrayList<String>();
for (TaskValidator validator : task.getValidators()) {
validator.validate(task, messages);
}
if (!messages.isEmpty()) {
List<InvalidUserDataException> causes = new ArrayList<InvalidUserDataException>();
messages = messages.subList(0, Math.min(5, messages.size()));
for (String message : messages) {
causes.add(new InvalidUserDataException(message));
}
String errorMessage;
if (messages.size() == 1) {
errorMessage = String.format("A problem was found with the configuration of %s.", task);
} else {
errorMessage = String.format("Some problems were found with the configuration of %s.", task);
}
state.setOutcome(new TaskValidationException(errorMessage, causes));
return;
}
executer.execute(task, state, context);
}
示例4: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
boolean skip;
try {
skip = !task.getOnlyIf().isSatisfiedBy(task);
} catch (Throwable t) {
state.executed(new GradleException(String.format("Could not evaluate onlyIf predicate for %s.", task), t));
return;
}
if (skip) {
LOGGER.info("Skipping {} as task onlyIf is false.", task);
state.skipped("SKIPPED");
return;
}
executer.execute(task, state, context);
}
示例5: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
List<String> messages = new ArrayList<String>();
for (TaskValidator validator : task.getValidators()) {
validator.validate(task, messages);
}
if (!messages.isEmpty()) {
List<InvalidUserDataException> causes = new ArrayList<InvalidUserDataException>();
messages = messages.subList(0, Math.min(5, messages.size()));
for (String message : messages) {
causes.add(new InvalidUserDataException(message));
}
String errorMessage;
if (messages.size() == 1) {
errorMessage = String.format("A problem was found with the configuration of %s.", task);
} else {
errorMessage = String.format("Some problems were found with the configuration of %s.", task);
}
state.executed(new TaskValidationException(errorMessage, causes));
return;
}
executer.execute(task, state, context);
}
示例6: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
if (task.getActions().isEmpty()) {
LOGGER.info("Skipping {} as it has no actions.", task);
boolean upToDate = true;
for (Task dependency : task.getTaskDependencies().getDependencies(task)) {
if (!dependency.getState().getSkipped()) {
upToDate = false;
break;
}
}
if (upToDate) {
state.upToDate();
}
return;
}
executer.execute(task, state, context);
}
示例7: executeAction
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
private void executeAction(TaskInternal task, ContextAwareTaskAction action, TaskExecutionContext context) {
action.contextualise(context);
try {
action.execute(task);
} finally {
action.contextualise(null);
}
}
示例8: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
@Override
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
BuildCacheKey beforeExecution = context.getTaskArtifactState().calculateCacheKey();
delegate.execute(task, state, context);
if (beforeExecution != null) {
BuildCacheKey afterExecution = repository.getStateFor(task).calculateCacheKey();
if (afterExecution == null || !beforeExecution.getHashCode().equals(afterExecution.getHashCode())) {
throw new TaskExecutionException(task, new GradleException("The inputs for the task changed during the execution! Check if you have a `doFirst` changing the inputs."));
}
}
}
示例9: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
@Override
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
try {
delegate.execute(task, state, context);
} catch (RuntimeException e) {
state.setOutcome(e);
}
}
示例10: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
LOGGER.debug("Determining if {} is up-to-date", task);
Timer clock = Timers.startTimer();
TaskArtifactState taskArtifactState = context.getTaskArtifactState();
try {
List<String> messages = LOGGER.isInfoEnabled() ? new ArrayList<String>() : null;
if (taskArtifactState.isUpToDate(messages)) {
LOGGER.info("Skipping {} as it is up-to-date (took {}).", task, clock.getElapsed());
state.setOutcome(TaskExecutionOutcome.UP_TO_DATE);
return;
}
logOutOfDateMessages(messages, task, clock.getElapsed());
task.getOutputs().setHistory(taskArtifactState.getExecutionHistory());
taskArtifactState.beforeTask();
try {
executer.execute(task, state, context);
if (state.getFailure() == null) {
taskArtifactState.afterTask();
}
} finally {
task.getOutputs().setHistory(null);
}
} finally {
taskArtifactState.finished();
}
}
示例11: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
if (state.getExecuted()) {
return;
}
LOGGER.debug("Starting to execute {}", task);
try {
executer.execute(task, state, context);
} finally {
LOGGER.debug("Finished executing {}", task);
}
}
示例12: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
@Override
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
Timer clock = Timers.startTimer();
context.setTaskArtifactState(repository.getStateFor(task));
LOGGER.info("Putting task artifact state for {} into context took {}.", task, clock.getElapsed());
try {
executer.execute(task, state, context);
} finally {
context.setTaskArtifactState(null);
LOGGER.debug("Removed task artifact state for {} from context.");
}
}
示例13: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
if (task.getActions().isEmpty()) {
LOGGER.info("Skipping {} as it has no actions.", task);
boolean upToDate = true;
for (Task dependency : task.getTaskDependencies().getDependencies(task)) {
if (!dependency.getState().getSkipped()) {
upToDate = false;
break;
}
}
state.setOutcome(upToDate ? TaskExecutionOutcome.UP_TO_DATE : TaskExecutionOutcome.EXECUTED);
return;
}
executer.execute(task, state, context);
}
示例14: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
LOGGER.debug("Determining if {} is up-to-date", task);
Clock clock = new Clock();
TaskArtifactState taskArtifactState = repository.getStateFor(task);
try {
List<String> messages = new ArrayList<String>();
if (taskArtifactState.isUpToDate(messages)) {
LOGGER.info("Skipping {} as it is up-to-date (took {}).", task, clock.getTime());
state.upToDate();
return;
}
logOutOfDateMessages(messages, task, clock.getTime());
task.getOutputs().setHistory(taskArtifactState.getExecutionHistory());
context.setTaskArtifactState(taskArtifactState);
taskArtifactState.beforeTask();
try {
executer.execute(task, state, context);
if (state.getFailure() == null) {
taskArtifactState.afterTask();
}
} finally {
task.getOutputs().setHistory(null);
context.setTaskArtifactState(null);
}
} finally {
taskArtifactState.finished();
}
}
示例15: execute
import org.gradle.api.internal.tasks.TaskExecutionContext; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
if (state.getExecuted()) {
return;
}
LOGGER.debug("Starting to execute {}", task);
try {
executer.execute(task, state, context);
} finally {
state.executed();
LOGGER.debug("Finished executing {}", task);
}
}