use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class TaskPathResolver method resolvePath.
/**
* @param path the task path, e.g. 'someTask', 'sT', ':sT', ':foo:bar:sT'
* @param startFrom the starting project the task should be found recursively
* @return resolved task path
*/
public ResolvedTaskPath resolvePath(String path, ProjectInternal startFrom) {
ProjectInternal project;
// eg. 'someTask' or 'sT'
String taskName;
// eg. '', ':' or ':foo:bar'
String prefix;
if (path.contains(Project.PATH_SEPARATOR)) {
int idx = path.lastIndexOf(Project.PATH_SEPARATOR);
taskName = path.substring(idx + 1);
prefix = path.substring(0, idx + 1);
String projectPath = Project.PATH_SEPARATOR.equals(prefix) ? prefix : path.substring(0, idx);
project = projectFinder.findProject(projectPath, startFrom);
} else {
project = startFrom;
taskName = path;
prefix = "";
}
return new ResolvedTaskPath(prefix, taskName, project);
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class InstantiatingBuildLoader method createProjects.
private void createProjects(GradleInternal gradle, DefaultProjectDescriptor rootProjectDescriptor) {
ClassLoaderScope baseProjectClassLoaderScope = gradle.baseProjectClassLoaderScope();
ClassLoaderScope rootProjectClassLoaderScope = baseProjectClassLoaderScope.createChild("root-project[" + gradle.getIdentityPath() + "]");
ProjectState projectState = gradle.getOwner().getProjects().getProject(rootProjectDescriptor.path());
projectState.createMutableModel(rootProjectClassLoaderScope, baseProjectClassLoaderScope);
ProjectInternal rootProject = projectState.getMutableModel();
gradle.setRootProject(rootProject);
createChildProjectsRecursively(gradle.getOwner(), rootProjectDescriptor, rootProjectClassLoaderScope, baseProjectClassLoaderScope);
}
use of org.gradle.api.internal.project.ProjectInternal in project wildfly-swarm by wildfly-swarm.
the class GradleArtifactResolvingHelper method doResolve.
private Collection<ResolvedArtifact> doResolve(final Collection<ArtifactSpec> deps, boolean transitive) {
final Configuration config = this.project.getConfigurations().detachedConfiguration().setTransitive(transitive);
final DependencySet dependencySet = config.getDependencies();
deps.forEach(spec -> {
if (projects.containsKey(spec.groupId() + ":" + spec.artifactId() + ":" + spec.version())) {
dependencySet.add(new DefaultProjectDependency((ProjectInternal) projects.get(spec.groupId() + ":" + spec.artifactId() + ":" + spec.version()), new DefaultProjectAccessListener(), false));
} else {
final DefaultExternalModuleDependency d = new DefaultExternalModuleDependency(spec.groupId(), spec.artifactId(), spec.version());
final DefaultDependencyArtifact da = new DefaultDependencyArtifact(spec.artifactId(), spec.type(), spec.type(), spec.classifier(), null);
d.addArtifact(da);
dependencySet.add(d);
}
});
if (transitive) {
return config.getResolvedConfiguration().getResolvedArtifacts();
}
return config.getResolvedConfiguration().getFirstLevelModuleDependencies().stream().map(dep -> dep.getModuleArtifacts()).flatMap(artifacts -> artifacts.stream()).collect(Collectors.toList());
}
Aggregations