use of org.eclipse.n4js.workspace.N4JSProjectConfig in project n4js by eclipse.
the class SemanticDependencySupplier method computePackageName2ProjectIdMap.
/**
* Computes a map from package names to project ids. The context of the given project is taken into account, i.e. in
* case there exist multiple projects in the workspace with the same package name, the id of that project is mapped
* that would bind to the given project as a dependency.
*/
public Map<String, String> computePackageName2ProjectIdMap(N4JSWorkspaceConfig workspace, ProjectDescription projectDescription, Path relatedRootLocation, Iterable<String> packageNames) {
Path projectLocation = projectDescription.getLocation().toPath();
NodeModulesFolder nodeModulesFolder = nodeModulesDiscoveryHelper.getNodeModulesFolder(projectLocation);
Map<String, String> packageName2projectIds = new HashMap<>();
for (String packageName : packageNames) {
Set<N4JSProjectConfig> candidates = workspace.findProjectsByPackageName(packageName);
String qualifiedName = getQualifiedName(relatedRootLocation, projectLocation, candidates, nodeModulesFolder, packageName);
qualifiedName = qualifiedName == null ? packageName : qualifiedName;
packageName2projectIds.put(packageName, qualifiedName);
}
return packageName2projectIds;
}
use of org.eclipse.n4js.workspace.N4JSProjectConfig in project n4js by eclipse.
the class N4JSConfigSnapshotFactory method createProjectConfigSnapshot.
@Override
public N4JSProjectConfigSnapshot createProjectConfigSnapshot(XIProjectConfig projectConfig) {
N4JSProjectConfig projectConfigCasted = (N4JSProjectConfig) projectConfig;
List<String> semanticDependencies = Lists.transform(projectConfigCasted.getSemanticDependencies(), ProjectDependency::getPackageName);
return new N4JSProjectConfigSnapshot(projectConfigCasted.getProjectDescription(), projectConfig.getPath(), projectConfig.indexOnly(), projectConfig.isGeneratorEnabled(), semanticDependencies, Iterables.transform(projectConfig.getSourceFolders(), this::createSourceFolderSnapshot), projectConfigCasted.getPackageNameForProjectIdMap());
}
Aggregations