use of org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry in project tycho by eclipse.
the class P2ResolverTest method testReactorVsExternal.
@Test
public void testReactorVsExternal() throws Exception {
tpConfig.addP2Repository(resourceFile("reactor-vs-external/extrepo").toURI());
reactorProjects.add(createReactorProject(resourceFile("reactor-vs-external/bundle01"), TYPE_ECLIPSE_PLUGIN, "org.sonatype.tycho.p2.impl.resolver.test.bundle01"));
projectToResolve = createReactorProject(resourceFile("reactor-vs-external/feature01"), TYPE_ECLIPSE_FEATURE, "org.sonatype.tycho.p2.impl.resolver.test.feature01");
result = singleEnv(impl.resolveDependencies(getTargetPlatform(), projectToResolve));
assertEquals(2, result.getArtifacts().size());
assertEquals(0, result.getNonReactorUnits().size());
for (Entry entry : result.getArtifacts()) {
assertEquals("1.0.0.qualifier", entry.getVersion());
}
}
use of org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry in project tycho by eclipse.
the class P2ResolverTest method testProductMultienvP2Inf.
@Test
public void testProductMultienvP2Inf() throws Exception {
List<TargetEnvironment> environments = new ArrayList<>();
environments.add(new TargetEnvironment("linux", "gtk", "x86_64"));
environments.add(new TargetEnvironment("macosx", "cocoa", "x86_64"));
impl.setEnvironments(environments);
String artifactId = "product.multienv.p2-inf";
projectToResolve = createReactorProject(resourceFile("resolver/product.multienv.p2-inf"), TYPE_ECLIPSE_REPOSITORY, artifactId);
List<P2ResolutionResult> results = impl.resolveDependencies(getTargetPlatform(), projectToResolve);
assertEquals(2, results.size());
P2ResolutionResult linux = results.get(0);
List<Entry> linuxEntries = new ArrayList<>(linux.getArtifacts());
assertEquals(1, linuxEntries.size());
assertEquals(1, linuxEntries.get(0).getInstallableUnits().size());
assertEquals(0, linux.getNonReactorUnits().size());
P2ResolutionResult macosx = results.get(1);
List<Entry> macosxEntries = new ArrayList<>(macosx.getArtifacts());
assertEquals(1, macosxEntries.size());
assertEquals(2, macosxEntries.get(0).getInstallableUnits().size());
assertEquals(0, macosx.getNonReactorUnits().size());
}
use of org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry in project tycho by eclipse.
the class P2ResolverTest method testFeatureMultienvP2Inf.
@Test
public void testFeatureMultienvP2Inf() throws Exception {
List<TargetEnvironment> environments = new ArrayList<>();
environments.add(new TargetEnvironment("linux", "gtk", "x86_64"));
environments.add(new TargetEnvironment("macosx", "cocoa", "x86_64"));
impl.setEnvironments(environments);
String artifactId = "feature.multienv.p2-inf";
projectToResolve = createReactorProject(resourceFile("resolver/feature.multienv.p2-inf"), TYPE_ECLIPSE_FEATURE, artifactId);
List<P2ResolutionResult> results = impl.resolveDependencies(getTargetPlatform(), projectToResolve);
assertEquals(2, results.size());
P2ResolutionResult linux = results.get(0);
List<Entry> linuxEntries = new ArrayList<>(linux.getArtifacts());
assertEquals(1, linuxEntries.size());
assertEquals(1, linuxEntries.get(0).getInstallableUnits().size());
assertEquals(0, linux.getNonReactorUnits().size());
P2ResolutionResult macosx = results.get(1);
List<Entry> macosxEntries = new ArrayList<>(macosx.getArtifacts());
assertEquals(1, macosxEntries.size());
assertEquals(2, macosxEntries.get(0).getInstallableUnits().size());
assertEquals(0, macosx.getNonReactorUnits().size());
}
use of org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry in project tycho by eclipse.
the class P2ResolverTest method testSourceBundle.
@Test
public void testSourceBundle() throws Exception {
String featureId = "org.eclipse.tycho.p2.impl.resolver.test.feature01";
projectToResolve = createReactorProject(resourceFile("sourcebundles/feature01"), TYPE_ECLIPSE_FEATURE, featureId);
File bundle = resourceFile("sourcebundles/bundle01");
String bundleId = "org.eclipse.tycho.p2.impl.resolver.test.bundle01";
String bundleVersion = "1.0.0-SNAPSHOT";
reactorProjects.add(createReactorProject(bundle, TYPE_ECLIPSE_PLUGIN, bundleId));
ReactorProjectStub sb = new ReactorProjectStub(bundle, bundleId, bundleId, bundleVersion, TYPE_ECLIPSE_PLUGIN);
DependencyMetadata metadata = new SourcesBundleDependencyMetadataGenerator().generateMetadata(new ArtifactMock(sb, "source"), getEnvironments(), null);
sb.setDependencyMetadata(metadata);
reactorProjects.add(sb);
result = singleEnv(impl.resolveDependencies(getTargetPlatform(), projectToResolve));
assertEquals(3, result.getArtifacts().size());
List<P2ResolutionResult.Entry> entries = new ArrayList<>(result.getArtifacts());
Collections.sort(entries, new Comparator<Entry>() {
@Override
public int compare(Entry entry1, Entry entry2) {
return entry1.getId().compareTo(entry2.getId());
}
});
assertEquals("org.eclipse.tycho.p2.impl.resolver.test.bundle01", entries.get(0).getId());
assertEquals("org.eclipse.tycho.p2.impl.resolver.test.bundle01.source", entries.get(1).getId());
assertEquals("org.eclipse.tycho.p2.impl.resolver.test.feature01", entries.get(2).getId());
assertEquals(bundle, entries.get(0).getLocation());
assertEquals(bundle, entries.get(1).getLocation());
assertEquals("sources", entries.get(1).getClassifier());
}
use of org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry 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