当前位置: 首页>>代码示例>>Java>>正文


Java TaskExecutionContext类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:ExecuteActionsTaskExecuter.java

示例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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:SkipOnlyIfTaskExecuter.java

示例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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:ValidatingTaskExecuter.java

示例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);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:SkipOnlyIfTaskExecuter.java

示例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);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:23,代码来源:ValidatingTaskExecuter.java

示例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);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:SkipTaskWithNoActionsExecuter.java

示例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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:ExecuteActionsTaskExecuter.java

示例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."));
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:VerifyNoInputChangesTaskExecuter.java

示例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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:CatchExceptionTaskExecuter.java

示例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();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:29,代码来源:SkipUpToDateTaskExecuter.java

示例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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:ExecuteAtMostOnceTaskExecuter.java

示例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.");
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:ResolveTaskArtifactStateTaskExecuter.java

示例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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:SkipTaskWithNoActionsExecuter.java

示例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();
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:31,代码来源:SkipUpToDateTaskExecuter.java

示例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);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:13,代码来源:ExecuteAtMostOnceTaskExecuter.java


注:本文中的org.gradle.api.internal.tasks.TaskExecutionContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。