Search in sources :

Example 31 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class TargetPlatformTest method testResolveFixedVersion.

@Test
public void testResolveFixedVersion() throws Exception {
    ArtifactKey key = subject.resolveArtifact("eclipse-plugin", "some.bundle", "1.1.0.v2013");
    assertThat(key.getType(), is(ArtifactType.TYPE_ECLIPSE_PLUGIN));
    assertThat(key.getId(), is("some.bundle"));
    assertThat(key.getVersion(), is("1.1.0.v2013"));
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) Test(org.junit.Test)

Example 32 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class TargetPlatformTest method testResolveIU.

@Test
public void testResolveIU() throws Exception {
    candidateIUs = createSet(createBundleIU("unit", "2.0.0"), createProductIU("unit", "1.99.0"));
    subject = createTP();
    ArtifactKey key = subject.resolveArtifact("p2-installable-unit", "unit", ANY_VERSION);
    assertThat(key.getType(), is(ArtifactType.TYPE_INSTALLABLE_UNIT));
    assertThat(key.getId(), is("unit"));
    assertThat(key.getVersion(), is("2.0.0"));
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) Test(org.junit.Test)

Example 33 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class DefaultDependencyArtifactsTest method testEqualArtifacts.

@Test
public void testEqualArtifacts() {
    DefaultDependencyArtifacts tp = new DefaultDependencyArtifacts();
    ArtifactKey key = new DefaultArtifactKey("type", "id", "version");
    File location = new File("location");
    tp.addArtifactFile(key, location, asSet("a"));
    tp.addArtifactFile(key, location, asSet("a"));
    Assert.assertEquals(1, tp.getArtifacts().size());
}
Also used : DefaultDependencyArtifacts(org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) File(java.io.File) Test(org.junit.Test)

Example 34 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class OsgiBundleProject method addExtraClasspathEntries.

private void addExtraClasspathEntries(List<ClasspathEntry> classpath, ReactorProject project, DependencyArtifacts artifacts) {
    EclipsePluginProject pdeProject = getEclipsePluginProject(project);
    Collection<BuildOutputJar> outputJars = pdeProject.getOutputJarMap().values();
    for (BuildOutputJar buildOutputJar : outputJars) {
        List<String> entries = buildOutputJar.getExtraClasspathEntries();
        for (String entry : entries) {
            Pattern platformURL = Pattern.compile("platform:/(plugin|fragment)/([^/]*)/*(.*)");
            Matcher m = platformURL.matcher(entry.trim());
            String bundleId = null;
            String path = null;
            if (m.matches()) {
                bundleId = m.group(2).trim();
                path = m.group(3).trim();
                if (path != null && path.length() <= 0) {
                    path = null;
                }
                ArtifactDescriptor matchingBundle = artifacts.getArtifact(ArtifactType.TYPE_ECLIPSE_PLUGIN, bundleId, null);
                if (matchingBundle != null) {
                    List<File> locations;
                    if (matchingBundle.getMavenProject() != null) {
                        locations = getOtherProjectClasspath(matchingBundle, matchingBundle.getMavenProject(), path);
                    } else if (path != null) {
                        locations = getBundleEntry(matchingBundle, path);
                    } else {
                        locations = getBundleClasspath(matchingBundle);
                    }
                    classpath.add(new DefaultClasspathEntry(matchingBundle.getMavenProject(), matchingBundle.getKey(), locations, null));
                } else {
                    getLogger().warn("Missing extra classpath entry " + entry.trim());
                }
            } else {
                entry = entry.trim();
                File file = new File(project.getBasedir(), entry).getAbsoluteFile();
                if (file.exists()) {
                    List<File> locations = Collections.singletonList(file);
                    ArtifactKey projectKey = getArtifactKey(project);
                    classpath.add(new DefaultClasspathEntry(project, projectKey, locations, null));
                } else {
                    getLogger().warn("Missing extra classpath entry " + entry);
                }
            }
        }
    }
}
Also used : EclipsePluginProject(org.eclipse.tycho.core.osgitools.project.EclipsePluginProject) Pattern(java.util.regex.Pattern) ArtifactKey(org.eclipse.tycho.ArtifactKey) BuildOutputJar(org.eclipse.tycho.core.osgitools.project.BuildOutputJar) Matcher(java.util.regex.Matcher) ArtifactDescriptor(org.eclipse.tycho.ArtifactDescriptor) File(java.io.File)

Example 35 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class OsgiBundleProject method setupProject.

@Override
public void setupProject(MavenSession session, MavenProject project) {
    ArtifactKey key = readArtifactKey(project.getBasedir());
    project.setContextValue(CTX_ARTIFACT_KEY, key);
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey)

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