use of org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry in project tycho by eclipse.
the class P2ResolverTest method getClassifiedArtifact.
private static P2ResolutionResult.Entry getClassifiedArtifact(P2ResolutionResult resolutionResult, String classifier) {
Set<String> availableClassifiers = new HashSet<>();
P2ResolutionResult.Entry selectedEntry = null;
for (Entry entry : resolutionResult.getArtifacts()) {
availableClassifiers.add(entry.getClassifier());
if (eq(classifier, entry.getClassifier())) {
selectedEntry = entry;
}
}
assertThat(availableClassifiers, hasItem(classifier));
return selectedEntry;
}
use of org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry in project tycho by eclipse.
the class FeatureRootfileArtifactRepository method createRootfileOutputStream.
private OutputStream createRootfileOutputStream(IArtifactKey artifactKey) throws ProvisionException, IOException {
File outputFile = new File(this.outputDirectory, artifactKey.getId() + "-" + artifactKey.getVersion() + "-" + ROOTFILE_CLASSIFIER + "." + ROOTFILE_EXTENSION);
OutputStream target = null;
try {
SimpleArtifactDescriptor simpleArtifactDescriptor = (SimpleArtifactDescriptor) createArtifactDescriptor(artifactKey);
Collection<IPropertyAdvice> advices = publisherInfo.getAdvice(null, false, simpleArtifactDescriptor.getArtifactKey().getId(), simpleArtifactDescriptor.getArtifactKey().getVersion(), IPropertyAdvice.class);
boolean mavenPropAdviceExists = false;
for (IPropertyAdvice entry : advices) {
if (entry instanceof MavenPropertiesAdvice) {
mavenPropAdviceExists = true;
entry.getArtifactProperties(null, simpleArtifactDescriptor);
}
}
if (!mavenPropAdviceExists) {
throw new ProvisionException("MavenPropertiesAdvice does not exist for artifact: " + simpleArtifactDescriptor);
}
String mavenArtifactClassifier = getRootFileArtifactClassifier(simpleArtifactDescriptor.getArtifactKey().getId());
simpleArtifactDescriptor.setProperty(RepositoryLayoutHelper.PROP_CLASSIFIER, mavenArtifactClassifier);
simpleArtifactDescriptor.setProperty(RepositoryLayoutHelper.PROP_EXTENSION, ROOTFILE_EXTENSION);
target = new BufferedOutputStream(new FileOutputStream(outputFile));
this.publishedArtifacts.put(mavenArtifactClassifier, new P2Artifact(outputFile, Collections.<IInstallableUnit>emptySet(), simpleArtifactDescriptor));
descriptors.add(simpleArtifactDescriptor);
} catch (FileNotFoundException e) {
throw new ProvisionException(e.getMessage(), e);
}
return target;
}
use of org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry in project tycho by eclipse.
the class P2DependencyResolver method getThisReactorProject.
private ReactorProject getThisReactorProject(MavenSession session, MavenProject project, TargetPlatformConfiguration configuration) {
// 'this' project should obey optionalDependencies configuration
final List<TargetEnvironment> environments = configuration.getEnvironments();
final OptionalResolutionAction optionalAction = configuration.getDependencyResolverConfiguration().getOptionalResolutionAction();
Map<String, IDependencyMetadata> dependencyMetadata = getDependencyMetadata(session, project, environments, optionalAction);
final Set<Object> metadata = new LinkedHashSet<>();
final Set<Object> secondaryMetadata = new LinkedHashSet<>();
for (Map.Entry<String, IDependencyMetadata> entry : dependencyMetadata.entrySet()) {
metadata.addAll(entry.getValue().getMetadata(true));
secondaryMetadata.addAll(entry.getValue().getMetadata(false));
}
ReactorProject reactorProjet = new DefaultReactorProject(project) {
@Override
public Set<?> getDependencyMetadata(boolean primary) {
return primary ? metadata : secondaryMetadata;
}
};
return reactorProjet;
}
Aggregations