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, true); mirrorApp.setSlicingOptions(createSlicingOptions(mirrorOptions)); 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); } catch (ProvisionException e) { throw new FacadeException( MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e); } } finally { agent.stop(); } }
public void mirrorReactor( RepositoryReferences sources, DestinationRepositoryDescriptor destination, Collection<?> seedUnits, BuildContext context, boolean includeAllDependencies, boolean includePacked) throws FacadeException { IProvisioningAgent agent = Activator.createProvisioningAgent(context.getTargetDirectory()); try { final MirrorApplication mirrorApp = createMirrorApplication(sources, destination, agent, includePacked); // mirror scope: seed units... mirrorApp.setSourceIUs(toInstallableUnitList(seedUnits)); // TODO the p2 mirror tool should support mirroring multiple environments at once for (TargetEnvironment environment : context.getEnvironments()) { SlicingOptions options = new SlicingOptions(); options.considerStrictDependencyOnly(!includeAllDependencies); Map<String, String> filter = options.getFilter(); addFilterForFeatureJARs(filter); filter.putAll(environment.toFilter()); mirrorApp.setSlicingOptions(options); try { LogListener logListener = new LogListener(mavenContext.getLogger()); mirrorApp.setLog(logListener); IStatus returnStatus = mirrorApp.run(null); checkStatus(returnStatus); logListener.showHelpForLoggedMessages(); } catch (ProvisionException e) { throw new FacadeException( MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e); } } } finally { agent.stop(); } }