int importCount = importedSources.length;
if (importCount > 0) {
ArrayList<ResolvableLibrary> importedLibraries = new ArrayList<ResolvableLibrary>();
boolean explicitlyImportsCore = false;
for (int i = 0; i < importCount; i++) {
Source importedSource = importedSources[i];
if (importedSource.equals(coreLibrarySource)) {
explicitlyImportsCore = true;
}
ResolvableLibrary importedLibrary = libraryMap.get(importedSource);
if (importedLibrary == null) {
importedLibrary = createLibraryOrNull(importedSource);
if (importedLibrary != null) {
computeLibraryDependencies(importedLibrary);
if (taskData != null) {
return;
}
}
}
if (importedLibrary != null) {
importedLibraries.add(importedLibrary);
dependencyGraph.addEdge(library, importedLibrary);
}
}
library.setExplicitlyImportsCore(explicitlyImportsCore);
if (!explicitlyImportsCore && !coreLibrarySource.equals(library.getLibrarySource())) {
ResolvableLibrary importedLibrary = libraryMap.get(coreLibrarySource);
if (importedLibrary == null) {
importedLibrary = createLibraryOrNull(coreLibrarySource);
if (importedLibrary != null) {
computeLibraryDependencies(importedLibrary);
if (taskData != null) {
return;
}
}
}
if (importedLibrary != null) {
importedLibraries.add(importedLibrary);
dependencyGraph.addEdge(library, importedLibrary);
}
}
library.setImportedLibraries(importedLibraries.toArray(new ResolvableLibrary[importedLibraries.size()]));
} else {
library.setExplicitlyImportsCore(false);
ResolvableLibrary importedLibrary = libraryMap.get(coreLibrarySource);
if (importedLibrary == null) {
importedLibrary = createLibraryOrNull(coreLibrarySource);
if (importedLibrary != null) {
computeLibraryDependencies(importedLibrary);
if (taskData != null) {
return;
}
}
}
if (importedLibrary != null) {
dependencyGraph.addEdge(library, importedLibrary);
library.setImportedLibraries(new ResolvableLibrary[] {importedLibrary});
}
}
int exportCount = exportedSources.length;
if (exportCount > 0) {
ArrayList<ResolvableLibrary> exportedLibraries = new ArrayList<ResolvableLibrary>(
exportCount);
for (int i = 0; i < exportCount; i++) {
Source exportedSource = exportedSources[i];
ResolvableLibrary exportedLibrary = libraryMap.get(exportedSource);
if (exportedLibrary == null) {
exportedLibrary = createLibraryOrNull(exportedSource);
if (exportedLibrary != null) {
computeLibraryDependencies(exportedLibrary);