use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.
the class IUXmlTransformer method replaceZerosInRequirements.
public void replaceZerosInRequirements(IU iu, TargetPlatform targetPlatform) throws MojoFailureException {
List<Element> requirements = iu.getRequiredCapabilites();
if (requirements == null)
return;
for (Element req : requirements) {
String range = req.getAttributeValue(IU.RANGE);
if ("0.0.0".equals(range) && IU.P2_IU_NAMESPACE.equals(req.getAttributeValue(IU.NAMESPACE))) {
ArtifactKey artifact = resolveRequirementReference(targetPlatform, req.getAttributeValue(IU.NAME), range, req.toString());
req.setAttribute(IU.RANGE, artifact.getVersion());
}
}
}
use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.
the class P2DependencyResolver method newDefaultTargetPlatform.
protected DefaultDependencyArtifacts newDefaultTargetPlatform(ReactorProject project, Map<File, ReactorProject> projects, P2ResolutionResult result) {
DefaultDependencyArtifacts platform = new DefaultDependencyArtifacts(project);
platform.addNonReactorUnits(result.getNonReactorUnits());
for (P2ResolutionResult.Entry entry : result.getArtifacts()) {
ArtifactKey key = new DefaultArtifactKey(entry.getType(), entry.getId(), entry.getVersion());
ReactorProject otherProject = projects.get(entry.getLocation());
if (otherProject != null) {
platform.addReactorArtifact(key, otherProject, entry.getClassifier(), entry.getInstallableUnits());
} else {
platform.addArtifactFile(key, entry.getLocation(), entry.getInstallableUnits());
}
}
return platform;
}
use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.
the class TargetPlatformTest method testResolveFeature.
@Test
public void testResolveFeature() throws Exception {
candidateIUs = createSet(createBundleIU("unit", "2.0.0"), createBundleIU("unit.feature.group", "2.0.0"), createFeatureIU("unit", "1.2.0"));
subject = createTP();
ArtifactKey key = subject.resolveArtifact("eclipse-feature", "unit", ANY_VERSION);
assertThat(key.getType(), is(ArtifactType.TYPE_ECLIPSE_FEATURE));
// id is feature id
assertThat(key.getId(), is("unit"));
assertThat(key.getVersion(), is("1.2.0"));
}
use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.
the class TargetPlatformTest method testResolveLatestVersionThroughOmittedVersion.
@Test
public void testResolveLatestVersionThroughOmittedVersion() throws Exception {
// e.g. when version attribute is omitted
ArtifactKey key = subject.resolveArtifact("eclipse-plugin", "some.bundle", null);
assertThat(key.getVersion(), is("1.2.0"));
}
use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.
the class TargetPlatformTest method testResolveBundleChecksType.
@Test
public void testResolveBundleChecksType() throws Exception {
candidateIUs = createSet(createBundleIU("unit", "1.0.0"), createProductIU("unit", "1.99.0"));
subject = createTP();
ArtifactKey key = subject.resolveArtifact("eclipse-plugin", "unit", ANY_VERSION);
assertThat(key.getType(), is(ArtifactType.TYPE_ECLIPSE_PLUGIN));
assertThat(key.getId(), is("unit"));
assertThat(key.getVersion(), is("1.0.0"));
}
Aggregations