use of org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription in project tycho by eclipse.
the class MirrorStandaloneTest method testIgnoreErrorShouldNotThrowException.
@Test
public void testIgnoreErrorShouldNotThrowException() throws FacadeException {
MirrorOptions mirrorOptions = new MirrorOptions();
mirrorOptions.setIgnoreErrors(true);
subject.mirrorStandalone(sourceRepos("invalid/wrong_checksum"), destinationRepo, Collections.singletonList(new IUDescription("jarsigning", "0.0.1.201109191414")), mirrorOptions, targetFolder);
}
use of org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription in project tycho by eclipse.
the class MirrorApplicationServiceImpl method mirrorStandalone.
@Override
public void mirrorStandalone(RepositoryReferences sources, DestinationRepositoryDescriptor destination, Collection<IUDescription> seedIUs, MirrorOptions mirrorOptions, BuildOutputDirectory tempDirectory) throws FacadeException {
IProvisioningAgent agent = Activator.createProvisioningAgent(tempDirectory);
try {
final MirrorApplication mirrorApp = createMirrorApplication(sources, destination, agent, mirrorOptions.isIncludePacked());
mirrorApp.setSlicingOptions(createSlicingOptions(mirrorOptions));
mirrorApp.setIgnoreErrors(mirrorOptions.isIgnoreErrors());
try {
// we want to see mirror progress as this is a possibly long-running operation
mirrorApp.setVerbose(true);
mirrorApp.setLog(new LogListener(mavenContext.getLogger()));
mirrorApp.setSourceIUs(querySourceIus(seedIUs, mirrorApp.getCompositeMetadataRepository(), sources));
IStatus returnStatus = mirrorApp.run(null);
checkStatus(returnStatus, mirrorOptions.isIgnoreErrors());
} catch (ProvisionException e) {
throw new FacadeException(MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e);
}
} finally {
agent.stop();
}
}
use of org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription in project tycho by eclipse.
the class MirrorApplicationServiceImpl method toInstallableUnitList.
private static List<IInstallableUnit> toInstallableUnitList(Collection<DependencySeed> seeds, IMetadataRepository sourceRepository, RepositoryReferences sourceRepositoryNames) throws FacadeException {
List<IInstallableUnit> result = new ArrayList<>(seeds.size());
for (DependencySeed seed : seeds) {
if (seed.getInstallableUnit() == null) {
// TODO 372780 drop this when getInstallableUnit can no longer be null
String unitId = seed.getId() + (ArtifactType.TYPE_ECLIPSE_FEATURE.equals(seed.getType()) ? ".feature.group" : "");
result.addAll(querySourceIus(Collections.singletonList(new IUDescription(unitId, null)), sourceRepository, sourceRepositoryNames));
} else {
result.add((IInstallableUnit) seed.getInstallableUnit());
}
}
if (result.isEmpty()) {
throw new IllegalArgumentException("List of seed units for repository aggregation must not be empty");
}
return result;
}
use of org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription in project tycho by eclipse.
the class MirrorApplicationServiceImpl method querySourceIus.
private static List<IInstallableUnit> querySourceIus(Collection<IUDescription> sourceIUs, IMetadataRepository repository, RepositoryReferences sources) throws FacadeException {
if (sourceIUs == null || sourceIUs.isEmpty()) {
return null;
}
List<IInstallableUnit> result = new ArrayList<>();
for (IUDescription iu : sourceIUs) {
IQuery<IInstallableUnit> iuQuery = createQuery(iu);
Iterator<IInstallableUnit> queryResult = repository.query(iuQuery, null).iterator();
if (!queryResult.hasNext()) {
throw new FacadeException("Could not find IU " + iu.toString() + " in any of the source repositories " + sources.getMetadataRepositories(), null);
}
while (queryResult.hasNext()) {
result.add(queryResult.next());
}
}
return result;
}
use of org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription in project tycho by eclipse.
the class MirrorStandaloneTest method testMirrorMatchExpression.
@Test
public void testMirrorMatchExpression() throws Exception {
subject.mirrorStandalone(e342PlusFragmentsRepo(), destinationRepo, Collections.singletonList(new IUDescription(null, null, "id == $0 && version == $1", new String[] { "org.eclipse.core.runtime", "3.4.0.v20080512" })), new MirrorOptions(), targetFolder);
assertEquals(1, getMirroredBundleFiles().length);
assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar").exists());
}
Aggregations