Search in sources :

Example 1 with OsgiBundleProject

use of org.eclipse.tycho.core.osgitools.OsgiBundleProject in project tycho by eclipse.

the class TychoTest method testBundleExtraClasspath.

public void testBundleExtraClasspath() throws Exception {
    File basedir = getBasedir("projects/extraclasspath");
    File platformLocation = new File("src/test/resources/targetplatforms/basic");
    List<MavenProject> projects = getSortedProjects(basedir, platformLocation);
    assertEquals(3, projects.size());
    MavenProject b01 = projects.get(1);
    MavenProject b02 = projects.get(2);
    OsgiBundleProject projectType = (OsgiBundleProject) lookup(TychoProject.class, b02.getPackaging());
    List<ClasspathEntry> classpath = projectType.getClasspath(b02);
    assertEquals(5, classpath.size());
    // this bundle
    assertEquals(1, classpath.get(0).getLocations().size());
    assertEquals(canonicalFile("target/projects/extraclasspath/b02/target/classes"), classpath.get(0).getLocations().get(0).getCanonicalFile());
    // reference to external bundle entry not on classpath
    assertEquals(1, classpath.get(1).getLocations().size());
    assertEquals(canonicalFile("target/local-repo/.cache/tycho/org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar/launcher.properties"), classpath.get(1).getLocations().get(0).getCanonicalFile());
    // reference to reactor project entry
    assertEquals(1, classpath.get(2).getLocations().size());
    assertEquals(canonicalFile("target/projects/extraclasspath/b01/target/lib/nested.jar-classes"), classpath.get(2).getLocations().get(0).getCanonicalFile());
    // reference to external bundle
    assertEquals(1, classpath.get(3).getLocations().size());
    assertEquals(canonicalFile("src/test/resources/targetplatforms/basic/plugins/org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar"), classpath.get(3).getLocations().get(0).getCanonicalFile());
    // reference to project local folder
    assertEquals(1, classpath.get(4).getLocations().size());
    assertEquals(new File(basedir, "b02/classes").getCanonicalFile(), classpath.get(4).getLocations().get(0).getCanonicalFile());
}
Also used : MavenProject(org.apache.maven.project.MavenProject) TychoProject(org.eclipse.tycho.core.TychoProject) OsgiBundleProject(org.eclipse.tycho.core.osgitools.OsgiBundleProject) ClasspathEntry(org.eclipse.tycho.classpath.ClasspathEntry) File(java.io.File)

Example 2 with OsgiBundleProject

use of org.eclipse.tycho.core.osgitools.OsgiBundleProject in project tycho by eclipse.

the class TychoTest method testMissingClasspathEntries.

public void testMissingClasspathEntries() throws Exception {
    File basedir = getBasedir("projects/missingentry");
    File platformLocation = new File("src/test/resources/targetplatforms/missingentry");
    MavenProject project = getSortedProjects(basedir, platformLocation).get(0);
    OsgiBundleProject projectType = (OsgiBundleProject) lookup(TychoProject.class, project.getPackaging());
    List<ClasspathEntry> classpath = projectType.getClasspath(project);
    assertEquals(3, classpath.size());
    assertEquals(1, classpath.get(1).getLocations().size());
    assertEquals(canonicalFile("src/test/resources/targetplatforms/missingentry/plugins/dirbundle_0.0.1"), classpath.get(1).getLocations().get(0).getCanonicalFile());
    assertEquals(1, classpath.get(2).getLocations().size());
    assertEquals(canonicalFile("src/test/resources/targetplatforms/missingentry/plugins/jarbundle_0.0.1.jar"), classpath.get(2).getLocations().get(0).getCanonicalFile());
}
Also used : MavenProject(org.apache.maven.project.MavenProject) TychoProject(org.eclipse.tycho.core.TychoProject) OsgiBundleProject(org.eclipse.tycho.core.osgitools.OsgiBundleProject) ClasspathEntry(org.eclipse.tycho.classpath.ClasspathEntry) File(java.io.File)

Aggregations

File (java.io.File)2 MavenProject (org.apache.maven.project.MavenProject)2 ClasspathEntry (org.eclipse.tycho.classpath.ClasspathEntry)2 TychoProject (org.eclipse.tycho.core.TychoProject)2 OsgiBundleProject (org.eclipse.tycho.core.osgitools.OsgiBundleProject)2