use of org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor 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.DestinationRepositoryDescriptor in project tycho by eclipse.
the class MirrorApplicationServiceImpl method createMirrorApplication.
private static MirrorApplication createMirrorApplication(RepositoryReferences sources, DestinationRepositoryDescriptor destination, IProvisioningAgent agent, boolean includePacked) {
final MirrorApplication mirrorApp = new MirrorApplication(agent, includePacked);
List<RepositoryDescriptor> sourceDescriptors = createSourceDescriptors(sources);
for (RepositoryDescriptor sourceDescriptor : sourceDescriptors) {
mirrorApp.addSource(sourceDescriptor);
}
mirrorApp.addDestination(createDestinationDescriptor(destination));
return mirrorApp;
}
use of org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor in project tycho by eclipse.
the class MirrorApplicationServiceImpl method createDestinationDescriptor.
private static RepositoryDescriptor createDestinationDescriptor(DestinationRepositoryDescriptor destination) {
final RepositoryDescriptor destinationDescriptor = new RepositoryDescriptor();
destinationDescriptor.setLocation(destination.getLocation().toURI());
destinationDescriptor.setAppend(destination.isAppend());
destinationDescriptor.setName(destination.getName());
destinationDescriptor.setCompressed(destination.isCompress());
if (destination.isMetaDataOnly()) {
// only mirror metadata
destinationDescriptor.setKind(RepositoryDescriptor.KIND_METADATA);
} else {
// metadata and artifacts is the default
}
return destinationDescriptor;
}
use of org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor in project tycho by eclipse.
the class MirrorApplicationServiceImpl method recreateArtifactRepository.
private void recreateArtifactRepository(DestinationRepositoryDescriptor destination) throws FacadeException {
// create the missing md5 checksums
if (destination.isMetaDataOnly()) {
return;
}
RepositoryDescriptor descriptor = new RepositoryDescriptor();
descriptor.setAppend(true);
descriptor.setFormat(null);
// $NON-NLS-1$
descriptor.setKind("artifact");
descriptor.setLocation(destination.getLocation().toURI());
RecreateRepositoryApplication application = new RecreateRepositoryApplication();
application.setArtifactRepository(descriptor);
try {
application.run(new NullProgressMonitor());
} catch (ProvisionException e) {
throw new FacadeException("Recreate artifact repository failed", e);
}
}
use of org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor in project tycho by eclipse.
the class MirrorApplicationServiceImpl method xzCompress.
private void xzCompress(DestinationRepositoryDescriptor destination) throws FacadeException {
if (!destination.isXZCompress()) {
return;
}
try {
XZCompressor xzCompressor = new XZCompressor();
xzCompressor.setPreserveOriginalFile(destination.shouldKeepNonXzIndexFiles());
xzCompressor.setRepoFolder(destination.getLocation().getAbsolutePath());
xzCompressor.compressRepo();
} catch (IOException e) {
throw new FacadeException("XZ compression failed", e);
}
}
Aggregations