use of org.eclipse.tycho.artifacts.IllegalArtifactReferenceException in project tycho by eclipse.
the class P2DependencyResolver method doResolveDependencies.
private DependencyArtifacts doResolveDependencies(MavenSession session, MavenProject project, List<ReactorProject> reactorProjects, DependencyResolverConfiguration resolverConfiguration, TargetPlatform targetPlatform, P2Resolver resolver, TargetPlatformConfiguration configuration) {
Map<File, ReactorProject> projects = new HashMap<>();
resolver.setEnvironments(configuration.getEnvironments());
resolver.setAdditionalFilterProperties(configuration.getProfileProperties());
for (ReactorProject otherProject : reactorProjects) {
projects.put(otherProject.getBasedir(), otherProject);
}
if (resolverConfiguration != null) {
for (Dependency dependency : resolverConfiguration.getExtraRequirements()) {
try {
resolver.addDependency(dependency.getType(), dependency.getArtifactId(), dependency.getVersion());
} catch (IllegalArtifactReferenceException e) {
throw new BuildFailureException("Invalid extraRequirement " + dependency.getType() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion() + ": " + e.getMessage(), e);
}
}
}
// get reactor project with prepared optional dependencies // TODO use original IU and have the resolver create the modified IUs
ReactorProject optionalDependencyPreparedProject = getThisReactorProject(session, project, configuration);
if (!isAllowConflictingDependencies(project, configuration)) {
List<P2ResolutionResult> results = resolver.resolveDependencies(targetPlatform, optionalDependencyPreparedProject);
MultiEnvironmentDependencyArtifacts multiPlatform = new MultiEnvironmentDependencyArtifacts(DefaultReactorProject.adapt(project));
// FIXME this is just wrong
for (int i = 0; i < configuration.getEnvironments().size(); i++) {
TargetEnvironment environment = configuration.getEnvironments().get(i);
P2ResolutionResult result = results.get(i);
DefaultDependencyArtifacts platform = newDefaultTargetPlatform(DefaultReactorProject.adapt(project), projects, result);
multiPlatform.addPlatform(environment, platform);
}
return multiPlatform;
} else {
P2ResolutionResult result = resolver.collectProjectDependencies(targetPlatform, optionalDependencyPreparedProject);
return newDefaultTargetPlatform(DefaultReactorProject.adapt(project), projects, result);
}
}
use of org.eclipse.tycho.artifacts.IllegalArtifactReferenceException in project tycho by eclipse.
the class P2ResolverImpl method addDependency.
@Override
public void addDependency(String type, String id, String versionRange) throws IllegalArtifactReferenceException {
final VersionRange parsedVersionRange;
try {
parsedVersionRange = new VersionRange(versionRange);
} catch (IllegalArgumentException e) {
throw new IllegalArtifactReferenceException("The string \"" + versionRange + "\" is not a valid OSGi version range");
}
additionalRequirements.add(ArtifactTypeHelper.createRequirementFor(type, id, parsedVersionRange));
}
use of org.eclipse.tycho.artifacts.IllegalArtifactReferenceException in project tycho by eclipse.
the class ArtifactMatcher method resolveReference.
public static IInstallableUnit resolveReference(String type, String id, Version version, LinkedHashSet<IInstallableUnit> candidateUnits) throws IllegalArtifactReferenceException {
if (id == null) {
throw new IllegalArtifactReferenceException("ID is required");
}
VersionRange versionRange = getVersionRangeFromReference(version);
IQuery<IInstallableUnit> query = QueryUtil.createLatestQuery(ArtifactTypeHelper.createQueryFor(type, id, versionRange));
IQueryResult<IInstallableUnit> matchingIUs = query.perform(candidateUnits.iterator());
if (matchingIUs.isEmpty()) {
return null;
} else {
return matchingIUs.iterator().next();
}
}
Aggregations