Skip to content

Commit

Permalink
Fix #665 Nested target fails if artifact is not already downloaded
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
  • Loading branch information
laeubi committed Feb 20, 2022
1 parent 057e3a3 commit abe9f2a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2020 SAP SE and others.
* Copyright (c) 2011, 2022 SAP SE and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand All @@ -14,6 +14,7 @@
* - [Bug 568729] Support new "Maven" Target location
* - [Bug 569060] All ids of target file must be different
* - [Bug 569481] Support for maven target location includeSource="true" attribute
* - [Issue #401] Support nested targets
*******************************************************************************/
package org.eclipse.tycho.p2.target;

Expand Down Expand Up @@ -133,6 +134,7 @@ TargetDefinitionContent resolveContentWithExceptions(TargetDefinition definition
Map<String, FileTargetDefinitionContent> fileRepositories = new LinkedHashMap<>();
Map<String, URITargetDefinitionContent> uriRepositories = new LinkedHashMap<>();
List<MavenTargetDefinitionContent> mavenLocations = new ArrayList<>();
List<TargetDefinitionContent> referencedTargetLocations = new ArrayList<>();
for (Location locationDefinition : definition.getLocations()) {
if (locationDefinition instanceof InstallableUnitLocation) {
InstallableUnitLocation installableUnitLocation = (InstallableUnitLocation) locationDefinition;
Expand Down Expand Up @@ -209,6 +211,7 @@ TargetDefinitionContent resolveContentWithExceptions(TargetDefinition definition
IQueryResult<IInstallableUnit> result = content.query(QueryUtil.ALL_UNITS,
new LoggingProgressMonitor(logger));
unitResultSet.addAll(result);
referencedTargetLocations.add(content);
} else {
logger.warn("Target location type '" + locationDefinition.getTypeDescription() + "' is not supported");
}
Expand Down Expand Up @@ -237,6 +240,11 @@ TargetDefinitionContent resolveContentWithExceptions(TargetDefinition definition
metadataRepositories.add(mavenContent.getMetadataRepository());
artifactRepositories.add(mavenContent.getArtifactRepository());
}
//preliminary step: add all referenced targets:
for (TargetDefinitionContent referenceContent : referencedTargetLocations) {
metadataRepositories.add(referenceContent.getMetadataRepository());
artifactRepositories.add(referenceContent.getArtifactRepository());
}
//now we can resolve the p2 sources
if (installableUnitResolver != null) {
//FIXME installableUnitResolver should provide Meta+Artifact repositories so we have a complete view on the target!
Expand Down

0 comments on commit abe9f2a

Please sign in to comment.