use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class DefaultTaskSelector method getSelection.
private TaskSelection getSelection(String path, ProjectInternal project) {
ResolvedTaskPath taskPath = taskPathResolver.resolvePath(path, project);
ProjectInternal targetProject = taskPath.getProject();
if (taskPath.isQualified()) {
configurer.configure(targetProject);
} else {
configurer.configureHierarchy(targetProject);
}
TaskSelectionResult tasks = taskNameResolver.selectWithName(taskPath.getTaskName(), taskPath.getProject(), !taskPath.isQualified());
if (tasks != null) {
// An exact match
return new TaskSelection(taskPath.getProject().getPath(), path, tasks);
}
Map<String, TaskSelectionResult> tasksByName = taskNameResolver.selectAll(taskPath.getProject(), !taskPath.isQualified());
NameMatcher matcher = new NameMatcher();
String actualName = matcher.find(taskPath.getTaskName(), tasksByName.keySet());
if (actualName != null) {
return new TaskSelection(taskPath.getProject().getPath(), taskPath.getPrefix() + actualName, tasksByName.get(actualName));
}
throw new TaskSelectionException(matcher.formatErrorMessage("task", taskPath.getProject()));
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class DefaultTasksBuildExecutionAction method configure.
@Override
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 = new ArrayList<>();
for (BuiltInCommand command : builtInCommands) {
defaultTasks.addAll(command.asDefaultTask());
}
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.api.internal.project.ProjectInternal in project gradle by gradle.
the class DefaultConfiguration method markReferencedProjectConfigurationsObserved.
private void markReferencedProjectConfigurationsObserved(InternalState requestedState, ResolverResults results) {
ProjectInternal consumingProject = domainObjectContext.getProject();
ProjectState consumingProjectState = consumingProject == null ? null : consumingProject.getOwner();
for (ResolvedProjectConfiguration projectResult : results.getResolvedLocalComponents().getResolvedProjectConfigurations()) {
ProjectState targetProjectState = projectStateRegistry.stateFor(projectResult.getId());
dependencyObservedBroadcast.dependencyObserved(consumingProjectState, targetProjectState, requestedState, projectResult);
}
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class BuildLogger method projectsLoaded.
@Override
public void projectsLoaded(Gradle gradle) {
if (logger.isInfoEnabled()) {
ProjectInternal projectInternal = (ProjectInternal) gradle.getRootProject();
logger.info("Projects loaded. Root project using {}.", projectInternal.getBuildScriptSource().getDisplayName());
logger.info("Included projects: {}", projectInternal.getAllprojects());
}
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class DefaultTransformerInvocationFactory method createInvocation.
@Override
public CacheableInvocation<ImmutableList<File>> createInvocation(Transformer transformer, File inputArtifact, ArtifactTransformDependencies dependencies, TransformationSubject subject, InputFingerprinter inputFingerprinter) {
ProjectInternal producerProject = determineProducerProject(subject);
TransformationWorkspaceServices workspaceServices = determineWorkspaceServices(producerProject);
UnitOfWork execution;
if (producerProject == null) {
execution = new ImmutableTransformerExecution(transformer, inputArtifact, dependencies, buildOperationExecutor, fileCollectionFactory, inputFingerprinter, fileSystemAccess, workspaceServices);
} else {
execution = new MutableTransformerExecution(transformer, inputArtifact, dependencies, buildOperationExecutor, fileCollectionFactory, inputFingerprinter, workspaceServices);
}
return executionEngine.createRequest(execution).withIdentityCache(workspaceServices.getIdentityCache()).getOrDeferExecution(new DeferredExecutionHandler<TransformationResult, CacheableInvocation<ImmutableList<File>>>() {
@Override
public CacheableInvocation<ImmutableList<File>> processCachedOutput(Try<TransformationResult> cachedOutput) {
return CacheableInvocation.cached(mapResult(cachedOutput));
}
@Override
public CacheableInvocation<ImmutableList<File>> processDeferredOutput(Supplier<Try<TransformationResult>> deferredExecution) {
return CacheableInvocation.nonCached(() -> fireTransformListeners(transformer, subject, () -> mapResult(deferredExecution.get())));
}
@Nonnull
private Try<ImmutableList<File>> mapResult(Try<TransformationResult> cachedOutput) {
return cachedOutput.map(result -> result.resolveOutputsForInputArtifact(inputArtifact)).mapFailure(failure -> new TransformException(String.format("Execution failed for %s.", execution.getDisplayName()), failure));
}
});
}
Aggregations