use of org.eclipse.equinox.p2.publisher.PublisherInfo in project tycho by eclipse.
the class SiteDependenciesAction method perform.
@Override
public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) {
try {
// don't need transport to read local site.xml
Transport transport = null;
updateSite = UpdateSite.load(location.toURI(), transport, monitor);
} catch (ProvisionException e) {
return new Status(IStatus.ERROR, Activator.ID, "Error generating site xml action.", e);
}
return super.perform(publisherInfo, results, monitor);
}
use of org.eclipse.equinox.p2.publisher.PublisherInfo in project tycho by eclipse.
the class AbstractMetadataGenerator method publish.
private DependencyMetadata publish(PublisherInfo publisherInfo, List<IPublisherAction> actions) {
PublisherResult result = new PublisherResult();
Publisher publisher = new Publisher(publisherInfo, result);
IStatus status = publisher.publish(actions.toArray(new IPublisherAction[actions.size()]), monitor);
if (!status.isOK()) {
throw new RuntimeException(StatusTool.collectProblems(status), status.getException());
}
DependencyMetadata metadata = new DependencyMetadata();
metadata.setMetadata(true, result.getIUs(null, PublisherResult.ROOT));
metadata.setMetadata(false, result.getIUs(null, PublisherResult.NON_ROOT));
IArtifactRepository artifactRepository = publisherInfo.getArtifactRepository();
if (artifactRepository instanceof TransientArtifactRepository) {
metadata.setArtifacts(((TransientArtifactRepository) artifactRepository).getArtifactDescriptors());
}
return metadata;
}
use of org.eclipse.equinox.p2.publisher.PublisherInfo in project tycho by eclipse.
the class SourcesBundleDependencyMetadataGenerator method getPublisherActions.
@Override
protected List<IPublisherAction> getPublisherActions(IArtifactFacade artifact, List<TargetEnvironment> environments, OptionalResolutionAction optionalAction) {
ArrayList<IPublisherAction> actions = new ArrayList<>();
String id = artifact.getArtifactId();
String version = toCanonicalVersion(artifact.getVersion());
try {
// generated source bundle is not available at this point in filesystem yet, need to create
// in-memory BundleDescription instead
Dictionary<String, String> manifest = new Hashtable<>();
manifest.put("Manifest-Version", "1.0");
manifest.put("Bundle-ManifestVersion", "2");
String sourceBundleSymbolicName = id + ".source";
manifest.put("Bundle-SymbolicName", sourceBundleSymbolicName);
manifest.put("Bundle-Version", version);
manifest.put("Eclipse-SourceBundle", id + ";version=" + version + ";roots:=\".\"");
StateObjectFactory factory = StateObjectFactory.defaultFactory;
BundleDescription bundleDescription = factory.createBundleDescription(factory.createState(false), manifest, artifact.getLocation().getAbsolutePath(), createId(sourceBundleSymbolicName, version));
bundleDescription.setUserObject(manifest);
actions.add(new BundlesAction(new BundleDescription[] { bundleDescription }) {
@Override
protected void createAdviceFileAdvice(BundleDescription bundleDescription, IPublisherInfo publisherInfo) {
// 367255 p2.inf is not applicable to sources bundles
}
});
} catch (BundleException e) {
throw new RuntimeException(e);
}
return actions;
}
use of org.eclipse.equinox.p2.publisher.PublisherInfo in project tycho by eclipse.
the class CustomEEResolutionHintsTest method testConsistencyWithJREAction.
@Test
public void testConsistencyWithJREAction() throws Exception {
JREAction jreAction = new JREAction(resourceFile("profiles/TestMe-1.8.profile"));
PublisherResult results = new PublisherResult();
jreAction.perform(new PublisherInfo(), results, null);
Set<IInstallableUnit> publishedUnits = results.query(QueryUtil.ALL_UNITS, null).toUnmodifiableSet();
subject = new CustomEEResolutionHints("TestMe-1.8");
for (IInstallableUnit unit : publishedUnits) {
if (subject.isEESpecificationUnit(unit)) {
// success: we find the unit create by the JREAction
return;
}
}
fail("'a.jre' unit for profile 'TestMe-1.8' not found in" + publishedUnits);
}
use of org.eclipse.equinox.p2.publisher.PublisherInfo in project tycho by eclipse.
the class AbstractDependenciesAction method perform.
@Override
public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) {
InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
iud.setId(getId());
iud.setVersion(getVersion());
Set<IProvidedCapability> provided = new LinkedHashSet<>();
addProvidedCapabilities(provided);
provided.add(MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, iud.getId(), iud.getVersion()));
iud.addProvidedCapabilities(provided);
iud.addRequirements(getRequiredCapabilities());
addProperties(iud);
addPublisherAdvice(publisherInfo);
processCapabilityAdvice(iud, publisherInfo);
processInstallableUnitPropertiesAdvice(iud, publisherInfo);
IInstallableUnit iu = MetadataFactory.createInstallableUnit(iud);
results.addIU(iu, PublisherResult.ROOT);
InstallableUnitDescription[] others = processAdditionalInstallableUnitsAdvice(iu, publisherInfo);
if (others != null) {
for (InstallableUnitDescription other : others) {
// using PublisherResult.NON_ROOT results in these IUs appear after the primary
// see org.eclipse.equinox.p2.publisher.PublisherResult.getIUs(String, String)
// see org.eclipse.tycho.p2.metadata.IReactorArtifactFacade.getDependencyMetadata()
results.addIU(MetadataFactory.createInstallableUnit(other), PublisherResult.NON_ROOT);
}
}
return Status.OK_STATUS;
}
Aggregations