use of org.eclipse.tycho.p2.target.P2TargetPlatform in project tycho by eclipse.
the class ReactorRepositoryManagerTest method testTargetPlatformComputationInIntegration.
@Test
public void testTargetPlatformComputationInIntegration() throws Exception {
subject = getService(ReactorRepositoryManagerFacade.class);
ReactorProject currentProject = new ReactorProjectStub("reactor-artifact");
TargetPlatformConfigurationStub tpConfig = new TargetPlatformConfigurationStub();
tpConfig.addP2Repository(new MavenRepositoryLocation(null, ResourceUtil.resourceFile("repositories/launchers").toURI()));
subject.computePreliminaryTargetPlatform(currentProject, tpConfig, new ExecutionEnvironmentConfigurationStub("JavaSE-1.7"), null, null);
ReactorProjectIdentities upstreamProject = new ReactorProjectIdentitiesStub(ResourceUtil.resourceFile("projectresult"));
subject.computeFinalTargetPlatform(currentProject, Arrays.asList(upstreamProject));
P2TargetPlatform finalTP = (P2TargetPlatform) currentProject.getContextValue("org.eclipse.tycho.core.TychoConstants/targetPlatform");
Collection<IInstallableUnit> units = finalTP.getInstallableUnits();
// units from the p2 repository
assertThat(units, hasItem(unitWithId("org.eclipse.equinox.launcher")));
// units from the upstream project
assertThat(units, hasItem(unitWithId("bundle")));
assertThat(units, hasItem(unitWithId("bundle.source")));
// TODO get artifact
}
use of org.eclipse.tycho.p2.target.P2TargetPlatform in project tycho by eclipse.
the class PublishProductToolTest method initPublisher.
private PublishProductTool initPublisher(IInstallableUnit... tpUnits) {
LinkedHashSet<IInstallableUnit> contextUnits = new LinkedHashSet<>();
contextUnits.addAll(Arrays.asList(tpUnits));
P2TargetPlatform targetPlatform = new FinalTargetPlatformImpl(contextUnits, null, null, null, null, null);
PublisherActionRunner publisherRunner = new PublisherActionRunner(targetPlatform.getInstallableUnitsAsMetadataRepository(), ENVIRONMENTS, logVerifier.getLogger());
return new PublishProductToolImpl(publisherRunner, outputRepository, targetPlatform, QUALIFIER, interpolatorMock, logVerifier.getLogger());
}
use of org.eclipse.tycho.p2.target.P2TargetPlatform in project tycho by eclipse.
the class PublisherServiceFactoryImpl method createProductPublisher.
@Override
public PublishProductTool createProductPublisher(ReactorProject project, List<TargetEnvironment> environments, String buildQualifier, Interpolator interpolator) {
P2TargetPlatform targetPlatform = (P2TargetPlatform) reactorRepoManager.getFinalTargetPlatform(project);
PublisherActionRunner publisherRunner = getPublisherRunnerForProject(targetPlatform, environments);
PublishingRepository publishingRepository = reactorRepoManager.getPublishingRepository(project.getIdentities());
return new PublishProductToolImpl(publisherRunner, publishingRepository, targetPlatform, buildQualifier, interpolator, mavenContext.getLogger());
}
use of org.eclipse.tycho.p2.target.P2TargetPlatform in project tycho by eclipse.
the class PublisherServiceFactoryImpl method createPublisher.
@Override
public PublisherService createPublisher(ReactorProject project, List<TargetEnvironment> environments) {
P2TargetPlatform targetPlatform = (P2TargetPlatform) reactorRepoManager.getFinalTargetPlatform(project);
PublisherActionRunner publisherRunner = getPublisherRunnerForProject(targetPlatform, environments);
PublishingRepository publishingRepository = reactorRepoManager.getPublishingRepository(project.getIdentities());
return new PublisherServiceImpl(publisherRunner, project.getBuildQualifier(), publishingRepository);
}
use of org.eclipse.tycho.p2.target.P2TargetPlatform 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;
}
Aggregations