use of org.eclipse.equinox.p2.metadata.IArtifactKey in project tycho by eclipse.
the class CompositeArtifactProvider method getArtifactFromAnySource.
@Override
protected void getArtifactFromAnySource(IArtifactSink sink, List<IStatus> statusCollector, IProgressMonitor monitor) throws ArtifactSinkException {
IArtifactKey requestedKey = sink.getArtifactToBeWritten();
for (IRawArtifactFileProvider component : components) {
if (component.contains(requestedKey)) {
if (!sink.canBeginWrite()) {
return;
}
IStatus transferStatus = component.getArtifact(sink, monitor);
statusCollector.add(transferStatus);
if (!isFatal(transferStatus)) {
// read was successful -> done
return;
}
}
}
}
use of org.eclipse.equinox.p2.metadata.IArtifactKey in project tycho by eclipse.
the class VerifierServiceImpl method verifyAllArtifactContent.
private boolean verifyAllArtifactContent(IArtifactRepository repository, MavenLogger logger) {
boolean valid = true;
IQueryResult<IArtifactKey> allKeys = repository.query(new ExpressionMatchQuery<>(IArtifactKey.class, ExpressionUtil.TRUE_EXPRESSION), null);
for (Iterator<IArtifactKey> keyIt = allKeys.iterator(); keyIt.hasNext(); ) {
IArtifactKey key = keyIt.next();
IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(key);
for (IArtifactDescriptor descriptor : descriptors) {
valid &= verifyArtifactContent(repository, logger, descriptor);
}
}
return valid;
}
use of org.eclipse.equinox.p2.metadata.IArtifactKey in project tycho by eclipse.
the class ArtifactRepositoryTestUtils method packedDescriptorFor.
public static IArtifactDescriptor packedDescriptorFor(IArtifactKey key) {
ArtifactDescriptor result = new ArtifactDescriptor(key);
result.setProcessingSteps(new IProcessingStepDescriptor[] { new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) });
result.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED);
return result;
}
use of org.eclipse.equinox.p2.metadata.IArtifactKey in project tycho by eclipse.
the class AuthoredIUAction method perform.
@Override
@SuppressWarnings("deprecation")
public IStatus perform(IPublisherInfo info, IPublisherResult results, IProgressMonitor monitor) {
File iuFile = new File(iuProject, "p2iu.xml");
if (!iuFile.exists())
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not find the p2iu.xml file in folder " + iuProject);
try {
FileInputStream is = new FileInputStream(iuFile);
InstallableUnitDescription iuDescriptions = new MetadataIO().readOneIU(is);
tweakIU(iuDescriptions);
Set<IInstallableUnit> ius = toIUs(iuDescriptions);
results.addIUs(ius, IPublisherResult.ROOT);
IArtifactRepository repo = info.getArtifactRepository();
boolean artifactReferenced = false;
if (repo != null) {
for (IInstallableUnit iu : ius) {
Collection<IArtifactKey> associatedKeys = iu.getArtifacts();
for (IArtifactKey key : associatedKeys) {
ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, key, null);
processArtifactPropertiesAdvice(iu, ad, info);
ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP);
ad.setProperty(RepositoryLayoutHelper.PROP_EXTENSION, "zip");
repo.addDescriptor(ad);
artifactReferenced = true;
}
}
}
// and fails in many places. I tried to change the code where the failures were occurring but did not succeed.
if (!artifactReferenced && repo != null) {
IInstallableUnit iu = ((IInstallableUnit) ius.iterator().next());
ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, new ArtifactKey("binary", "generated_" + iu.getId(), iu.getVersion()), null);
processArtifactPropertiesAdvice(iu, ad, info);
ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP);
repo.addDescriptor(ad);
artifactReferenced = true;
}
return Status.OK_STATUS;
} catch (IOException e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error while reading " + iuFile, e);
}
}
use of org.eclipse.equinox.p2.metadata.IArtifactKey in project tycho by eclipse.
the class TargetPlatformBundlePublisherTest method artifactMD5Of.
private static String artifactMD5Of(IArtifactKey key, IRawArtifactProvider artifactProvider) throws Exception {
ProbeRawArtifactSink probeSink = ProbeRawArtifactSink.newRawArtifactSinkFor(new ArtifactDescriptor(key));
artifactProvider.getArtifact(probeSink, null);
return probeSink.md5AsHex();
}
Aggregations