Search in sources :

Example 1 with IRawArtifactFileProvider

use of org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider in project tycho by eclipse.

the class TargetPlatformFactoryImpl method createTargetPlatform.

/**
 * Computes the target platform from the given configuration and content.
 *
 * <p>
 * Used as entry point for tests, which can provide the execution environment configuration via
 * the more low-level type {@link ExecutionEnvironmentResolutionHandler}.
 * </p>
 *
 * @param tpConfiguration
 * @param eeResolutionHandler
 *            Representation of the target execution environment profile. In case of a custom EE
 *            profile, the handler also reads the full specification from the target platform.
 * @param reactorProjects
 *            may be <code>null</code>
 * @param pomDependencies
 *            may be <code>null</code>
 *
 * @see #createTargetPlatform(TargetPlatformConfigurationStub,
 *      ExecutionEnvironmentConfiguration, List, PomDependencyCollector)
 */
public P2TargetPlatform createTargetPlatform(TargetPlatformConfigurationStub tpConfiguration, ExecutionEnvironmentResolutionHandler eeResolutionHandler, List<ReactorProject> reactorProjects, PomDependencyCollector pomDependencies) {
    List<TargetDefinitionContent> targetFileContent = resolveTargetDefinitions(tpConfiguration, eeResolutionHandler.getResolutionHints());
    PomDependencyCollectorImpl pomDependenciesContent = (PomDependencyCollectorImpl) pomDependencies;
    // TODO 412416 remove when the RepositoryBlackboardKey registration is gone
    if (pomDependenciesContent == null)
        pomDependenciesContent = new PomDependencyCollectorImpl(mavenContext);
    // TODO 372780 get rid of this special handling of pomDependency artifacts: there should be one p2 artifact repo view on the target platform
    IRawArtifactFileProvider pomDependencyArtifactRepo = pomDependenciesContent.getArtifactRepoOfPublishedBundles();
    RepositoryBlackboardKey blackboardKey = RepositoryBlackboardKey.forResolutionContextArtifacts(pomDependenciesContent.getProjectLocation());
    ArtifactRepositoryBlackboard.putRepository(blackboardKey, new ProviderOnlyArtifactRepository(pomDependencyArtifactRepo, Activator.getProvisioningAgent(), blackboardKey.toURI()));
    logger.debug("Registered artifact repository " + blackboardKey);
    Set<MavenRepositoryLocation> completeRepositories = tpConfiguration.getP2Repositories();
    registerRepositoryIDs(completeRepositories);
    // collect & process metadata
    boolean includeLocalMavenRepo = shouldIncludeLocallyInstalledUnits(tpConfiguration);
    LinkedHashSet<IInstallableUnit> externalUIs = gatherExternalInstallableUnits(completeRepositories, targetFileContent, pomDependenciesContent, includeLocalMavenRepo);
    Map<IInstallableUnit, ReactorProjectIdentities> reactorProjectUIs = getPreliminaryReactorProjectUIs(reactorProjects);
    List<TargetPlatformFilter> iuFilters = tpConfiguration.getFilters();
    TargetPlatformFilterEvaluator filter = !iuFilters.isEmpty() ? new TargetPlatformFilterEvaluator(iuFilters, logger) : null;
    applyConfiguredFilter(filter, reactorProjectUIs.keySet());
    applyFilters(filter, externalUIs, reactorProjectUIs.keySet(), eeResolutionHandler.getResolutionHints());
    PreliminaryTargetPlatformImpl targetPlatform = new // 
    PreliminaryTargetPlatformImpl(// 
    reactorProjectUIs, // 
    externalUIs, // 
    pomDependenciesContent.getMavenInstallableUnits(), // 
    eeResolutionHandler.getResolutionHints(), // 
    filter, // 
    localMetadataRepository, createExternalArtifactProvider(completeRepositories, targetFileContent, pomDependencyArtifactRepo, // 
    tpConfiguration.getIncludePackedArtifacts()), // 
    localArtifactRepository, // 
    includeLocalMavenRepo, logger);
    eeResolutionHandler.readFullSpecification(targetPlatform.getInstallableUnits());
    return targetPlatform;
}
Also used : IRawArtifactFileProvider(org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) RepositoryBlackboardKey(org.eclipse.tycho.repository.registry.facade.RepositoryBlackboardKey) TargetPlatformFilterEvaluator(org.eclipse.tycho.p2.target.filters.TargetPlatformFilterEvaluator) MavenRepositoryLocation(org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation) ProviderOnlyArtifactRepository(org.eclipse.tycho.repository.p2base.artifact.repository.ProviderOnlyArtifactRepository) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter)

Example 2 with IRawArtifactFileProvider

use of org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider in project tycho by eclipse.

the class TargetPlatformFactoryImpl method createTargetPlatformWithUpdatedReactorUnits.

P2TargetPlatform createTargetPlatformWithUpdatedReactorUnits(PreliminaryTargetPlatformImpl preliminaryTP, Map<IInstallableUnit, ReactorProjectIdentities> reactorUnitsMap, List<IRawArtifactFileProvider> reactorArtifacts) {
    LinkedHashSet<IInstallableUnit> allUnits = preliminaryTP.getExternalUnits();
    // external units are already filtered, only reactor units need to be filtered again
    if (reactorUnitsMap != null) {
        Collection<IInstallableUnit> reactorUnits = new LinkedList<>(reactorUnitsMap.keySet());
        TargetPlatformFilterEvaluator configuredFilters = preliminaryTP.getFilter();
        if (configuredFilters != null) {
            configuredFilters.filterUnits(reactorUnits);
        }
        allUnits.addAll(reactorUnits);
    }
    IRawArtifactFileProvider jointArtifacts = createJointArtifactProvider(reactorArtifacts, preliminaryTP.getExternalArtifacts());
    return new FinalTargetPlatformImpl(allUnits, preliminaryTP.getEEResolutionHints(), jointArtifacts, localArtifactRepository, preliminaryTP.getOriginalMavenArtifactMap(), reactorUnitsMap);
}
Also used : IRawArtifactFileProvider(org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) TargetPlatformFilterEvaluator(org.eclipse.tycho.p2.target.filters.TargetPlatformFilterEvaluator) LinkedList(java.util.LinkedList)

Example 3 with IRawArtifactFileProvider

use of org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider in project tycho by eclipse.

the class ProviderOnlyArtifactRepositoryTest method createProviderOnlyArtifactRepositoryDelegatingTo.

private static ProviderOnlyArtifactRepository createProviderOnlyArtifactRepositoryDelegatingTo(URI... delegatedContent) throws Exception {
    IProvisioningAgent p2Agent = p2Context.getAgent();
    IRawArtifactFileProvider artifactProvider = new FileRepositoryArtifactProvider(asList(delegatedContent), ArtifactTransferPolicies.forRemoteArtifacts(), p2Agent);
    ProviderOnlyArtifactRepository result = new ProviderOnlyArtifactRepository(artifactProvider, p2Agent, URI.create("memory:test"));
    return result;
}
Also used : IProvisioningAgent(org.eclipse.equinox.p2.core.IProvisioningAgent) IRawArtifactFileProvider(org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider)

Example 4 with IRawArtifactFileProvider

use of org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider in project tycho by eclipse.

the class TargetPlatformFactoryImpl method createExternalArtifactProvider.

/**
 * Provider for all target platform artifacts from outside the reactor.
 */
private IRawArtifactFileProvider createExternalArtifactProvider(Set<MavenRepositoryLocation> completeRepositories, List<TargetDefinitionContent> targetDefinitionsContent, IRawArtifactFileProvider pomDependencyArtifactRepository, boolean includePackedArtifacts) {
    RepositoryArtifactProvider remoteArtifactProvider = createRemoteArtifactProvider(completeRepositories, targetDefinitionsContent);
    MirroringArtifactProvider remoteArtifactCache = MirroringArtifactProvider.createInstance(localArtifactRepository, remoteArtifactProvider, includePackedArtifacts, logger);
    IRawArtifactFileProvider jointArtifactsProvider = new CompositeArtifactProvider(pomDependencyArtifactRepository, remoteArtifactCache);
    return jointArtifactsProvider;
}
Also used : CompositeArtifactProvider(org.eclipse.tycho.repository.p2base.artifact.provider.CompositeArtifactProvider) IRawArtifactFileProvider(org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider) MirroringArtifactProvider(org.eclipse.tycho.repository.local.MirroringArtifactProvider) RepositoryArtifactProvider(org.eclipse.tycho.repository.p2base.artifact.repository.RepositoryArtifactProvider)

Aggregations

IRawArtifactFileProvider (org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider)4 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)2 TargetPlatformFilterEvaluator (org.eclipse.tycho.p2.target.filters.TargetPlatformFilterEvaluator)2 LinkedList (java.util.LinkedList)1 IProvisioningAgent (org.eclipse.equinox.p2.core.IProvisioningAgent)1 ReactorProjectIdentities (org.eclipse.tycho.ReactorProjectIdentities)1 TargetPlatformFilter (org.eclipse.tycho.artifacts.TargetPlatformFilter)1 MavenRepositoryLocation (org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation)1 MirroringArtifactProvider (org.eclipse.tycho.repository.local.MirroringArtifactProvider)1 CompositeArtifactProvider (org.eclipse.tycho.repository.p2base.artifact.provider.CompositeArtifactProvider)1 ProviderOnlyArtifactRepository (org.eclipse.tycho.repository.p2base.artifact.repository.ProviderOnlyArtifactRepository)1 RepositoryArtifactProvider (org.eclipse.tycho.repository.p2base.artifact.repository.RepositoryArtifactProvider)1 RepositoryBlackboardKey (org.eclipse.tycho.repository.registry.facade.RepositoryBlackboardKey)1