Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tycho-4.0.x] Only warn if a referenced repository can not be loaded #3510

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,13 @@ private LinkedHashSet<IInstallableUnit> gatherExternalInstallableUnits(
Set<URI> loaded = new HashSet<>();
for (MavenRepositoryLocation location : completeRepositories) {
artifactRepositories.add(location.getURL());
loadMetadataRepository(location, metadataRepositories, loaded, artifactRepositories, includeReferences);
try {
loadMetadataRepository(location, metadataRepositories, loaded, artifactRepositories, includeReferences);
} catch (ProvisionException e) {
String idMessage = location.getId() == null ? "" : " with ID '" + location.getId() + "'";
throw new RuntimeException(
"Failed to load p2 repository" + idMessage + " from location " + location.getURL(), e);
}
}
if (includeLocalMavenRepo) {
metadataRepositories.add(localMetadataRepository);
Expand All @@ -429,30 +435,29 @@ private LinkedHashSet<IInstallableUnit> gatherExternalInstallableUnits(

private void loadMetadataRepository(MavenRepositoryLocation location,
List<IMetadataRepository> metadataRepositories, Set<URI> loaded, Set<URI> artifactRepositories,
boolean includeReferences) {
boolean includeReferences) throws ProvisionException {
if (loaded.add(location.getURL().normalize())) {
try {
IMetadataRepository repository = remoteMetadataRepositoryManager.loadRepository(location.getURL(),
monitor);
metadataRepositories.add(repository);
if (includeReferences) {
for (IRepositoryReference reference : repository.getReferences()) {
if ((reference.getOptions() | IRepository.ENABLED) != 0) {
if (reference.getType() == IRepository.TYPE_METADATA) {
IMetadataRepository repository = remoteMetadataRepositoryManager.loadRepository(location.getURL(), monitor);
metadataRepositories.add(repository);
if (includeReferences) {
for (IRepositoryReference reference : repository.getReferences()) {
if ((reference.getOptions() | IRepository.ENABLED) != 0) {
if (reference.getType() == IRepository.TYPE_METADATA) {
try {
loadMetadataRepository(
new MavenRepositoryLocation(reference.getNickname(), reference.getLocation()),
metadataRepositories, loaded, artifactRepositories, includeReferences);
} else if (reference.getType() == IRepository.TYPE_ARTIFACT) {
artifactRepositories.add(reference.getLocation());
} catch (ProvisionException e) {
logger.warn("Loading referenced repository failed: " + e.getMessage(),
logger.isDebugEnabled() ? e : null);
}
} else if (reference.getType() == IRepository.TYPE_ARTIFACT) {
artifactRepositories.add(reference.getLocation());
}
}
}
} catch (ProvisionException e) {
String idMessage = location.getId() == null ? "" : " with ID '" + location.getId() + "'";
throw new RuntimeException(
"Failed to load p2 repository" + idMessage + " from location " + location.getURL(), e);
}

}
}

Expand Down