Search in sources :

Example 26 with ArtifactKey

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());
        }
    }
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) Element(de.pdark.decentxml.Element)

Example 27 with ArtifactKey

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;
}
Also used : DefaultDependencyArtifacts(org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) ReactorProject(org.eclipse.tycho.ReactorProject) DefaultReactorProject(org.eclipse.tycho.core.osgitools.DefaultReactorProject) P2ResolutionResult(org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey)

Example 28 with ArtifactKey

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"));
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) Test(org.junit.Test)

Example 29 with ArtifactKey

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"));
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) Test(org.junit.Test)

Example 30 with ArtifactKey

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"));
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) Test(org.junit.Test)

Aggregations

ArtifactKey (org.eclipse.tycho.ArtifactKey)41 File (java.io.File)19 DefaultArtifactKey (org.eclipse.tycho.DefaultArtifactKey)15 Test (org.junit.Test)14 ArtifactDescriptor (org.eclipse.tycho.ArtifactDescriptor)13 ReactorProject (org.eclipse.tycho.ReactorProject)8 DefaultArtifactDescriptor (org.eclipse.tycho.core.osgitools.DefaultArtifactDescriptor)6 DefaultDependencyArtifacts (org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts)6 DefaultReactorProject (org.eclipse.tycho.core.osgitools.DefaultReactorProject)5 LinkedHashMap (java.util.LinkedHashMap)3 MavenProject (org.apache.maven.project.MavenProject)3 BundleStartLevel (org.eclipse.sisu.equinox.launching.BundleStartLevel)3 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)3 FeatureRef (org.eclipse.tycho.model.FeatureRef)3 PluginRef (org.eclipse.tycho.model.PluginRef)3 Version (org.osgi.framework.Version)3 Element (de.pdark.decentxml.Element)2 Map (java.util.Map)2 Artifact (org.apache.maven.artifact.Artifact)2 Dependency (org.apache.maven.model.Dependency)2