use of org.gradle.internal.time.Timer in project gradle by gradle.
the class BuildScriptProcessor method execute.
public void execute(ProjectInternal project) {
LOGGER.info("Evaluating {} using {}.", project, project.getBuildScriptSource().getDisplayName());
final Timer clock = Timers.startTimer();
try {
ScriptPlugin configurer = configurerFactory.create(project.getBuildScriptSource(), project.getBuildscript(), project.getClassLoaderScope(), project.getBaseClassLoaderScope(), true);
configurer.apply(project);
} finally {
LOGGER.debug("Timing: Running the build script took {}", clock.getElapsed());
}
}
use of org.gradle.internal.time.Timer in project gradle by gradle.
the class JarClasspathSnapshotMaker method storeJarSnapshots.
@Override
public void storeJarSnapshots(Iterable<File> classpath) {
//clients may or may not have already created jar classpath snapshot
maybeInitialize(classpath);
Timer clock = Timers.startTimer();
classpathSnapshotStore.put(jarClasspathSnapshot.getData());
LOG.info("Written jar classpath snapshot for incremental compilation in {}.", clock.getElapsed());
}
use of org.gradle.internal.time.Timer in project gradle by gradle.
the class ResolveTaskArtifactStateTaskExecuter method execute.
@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.");
}
}
use of org.gradle.internal.time.Timer in project gradle by gradle.
the class SkipCachedTaskExecuter method execute.
@Override
public void execute(final TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
final Timer clock = Timers.startTimer();
LOGGER.debug("Determining if {} is cached already", task);
final TaskOutputsInternal taskOutputs = task.getOutputs();
TaskOutputCachingBuildCacheKey cacheKey = context.getBuildCacheKey();
boolean taskOutputCachingEnabled = state.getTaskOutputCaching().isEnabled();
if (taskOutputCachingEnabled) {
if (cacheKey.isValid()) {
TaskArtifactState taskState = context.getTaskArtifactState();
if (taskState.isAllowedToUseCachedResults()) {
boolean found = buildCache.load(cacheKey, new BuildCacheEntryReader() {
@Override
public void readFrom(final InputStream input) {
taskOutputsGenerationListener.beforeTaskOutputsGenerated();
packer.unpack(taskOutputs, input, taskOutputOriginFactory.createReader(task));
LOGGER.info("Unpacked output for {} from cache (took {}).", task, clock.getElapsed());
}
});
if (found) {
state.setOutcome(TaskExecutionOutcome.FROM_CACHE);
return;
}
} else {
LOGGER.info("Not loading {} from cache because pulling from cache is disabled for this task", task);
}
} else {
LOGGER.info("Not caching {} because no valid cache key was generated", task);
}
}
delegate.execute(task, state, context);
if (taskOutputCachingEnabled) {
if (cacheKey.isValid()) {
if (state.getFailure() == null) {
buildCache.store(cacheKey, new BuildCacheEntryWriter() {
@Override
public void writeTo(OutputStream output) {
LOGGER.info("Packing {}", task.getPath());
packer.pack(taskOutputs, output, taskOutputOriginFactory.createWriter(task, clock.getElapsedMillis()));
}
});
} else {
LOGGER.debug("Not pushing result from {} to cache because the task failed", task);
}
} else {
LOGGER.info("Not pushing results from {} to cache because no valid cache key was generated", task);
}
}
}
use of org.gradle.internal.time.Timer in project gradle by gradle.
the class SkipUpToDateTaskExecuter method execute.
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();
}
}
Aggregations