use of org.jetbrains.jps.model.library.JpsTypedLibrary in project intellij-community by JetBrains.
the class DependencyResolvingBuilder method getRepositoryLibraries.
@NotNull
private static Collection<JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>>> getRepositoryLibraries(ModuleChunk chunk) {
final Collection<JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>>> result = new SmartHashSet<>();
for (JpsModule module : chunk.getModules()) {
for (JpsDependencyElement dep : module.getDependenciesList().getDependencies()) {
if (dep instanceof JpsLibraryDependency) {
final JpsLibrary _lib = ((JpsLibraryDependency) dep).getLibrary();
final JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>> lib = _lib != null ? _lib.asTyped(JpsMavenRepositoryLibraryType.INSTANCE) : null;
if (lib != null) {
result.add(lib);
}
}
}
}
return result;
}
use of org.jetbrains.jps.model.library.JpsTypedLibrary in project intellij-community by JetBrains.
the class DependencyResolvingBuilder method checkDependencies.
private static void checkDependencies(CompileContext context, ModuleChunk chunk) throws Exception {
final Collection<JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>>> libs = getRepositoryLibraries(chunk);
if (!libs.isEmpty()) {
final ArtifactRepositoryManager repoManager = getRepositoryManager(context);
for (JpsTypedLibrary<JpsSimpleElement<RepositoryLibraryDescriptor>> lib : libs) {
final RepositoryLibraryDescriptor descriptor = lib.getProperties().getData();
final ResourceGuard guard = ResourceGuard.get(context, descriptor);
if (guard.requestProcessing(context.getCancelStatus())) {
try {
final Collection<File> required = lib.getFiles(JpsOrderRootType.COMPILED);
for (Iterator<File> it = required.iterator(); it.hasNext(); ) {
if (it.next().exists()) {
// leaving only non-existing stuff requiring synchronization
it.remove();
}
}
if (!required.isEmpty()) {
final Collection<File> resolved = repoManager.resolveDependency(descriptor.getGroupId(), descriptor.getArtifactId(), descriptor.getVersion());
if (!resolved.isEmpty()) {
syncPaths(required, resolved);
} else {
LOG.info("No artifacts were resolved for repository dependency " + descriptor.getMavenId());
}
}
} finally {
guard.finish();
}
}
}
}
}
Aggregations