Search in sources :

Example 1 with SourcepathEntry

use of org.eclipse.tycho.classpath.SourcepathEntry in project tycho by eclipse.

the class OsgiCompilerTest method test_embeddedNonClasspath.

public void test_embeddedNonClasspath() throws Exception {
    File basedir = getBasedir("projects/embedednonclasspath");
    List<MavenProject> projects = getSortedProjects(basedir, null);
    MavenProject project = projects.get(0);
    getMojo(projects, project).execute();
    assertTrue(new File(project.getBasedir(), "target/classes/src/Src.class").canRead());
    assertTrue(new File(project.getBasedir(), "target/library.jar-classes/src2/Src2.class").canRead());
    List<SourcepathEntry> sourcepath = getMojo(projects, project).getSourcepath();
    assertEquals(2, sourcepath.size());
}
Also used : SourcepathEntry(org.eclipse.tycho.classpath.SourcepathEntry) MavenProject(org.apache.maven.project.MavenProject) File(java.io.File)

Example 2 with SourcepathEntry

use of org.eclipse.tycho.classpath.SourcepathEntry in project tycho by eclipse.

the class AbstractOsgiCompilerMojo method getSourcepath.

@Override
public List<SourcepathEntry> getSourcepath() throws MojoExecutionException {
    ArrayList<SourcepathEntry> entries = new ArrayList<>();
    for (BuildOutputJar jar : getEclipsePluginProject().getOutputJars()) {
        final File outputDirectory = jar.getOutputDirectory();
        for (final File sourcesRoot : jar.getSourceFolders()) {
            SourcepathEntry entry = new SourcepathEntry() {

                @Override
                public File getSourcesRoot() {
                    return sourcesRoot;
                }

                @Override
                public File getOutputDirectory() {
                    return outputDirectory;
                }

                @Override
                public List<String> getIncludes() {
                    return null;
                }

                @Override
                public List<String> getExcludes() {
                    return null;
                }
            };
            entries.add(entry);
        }
    }
    return entries;
}
Also used : SourcepathEntry(org.eclipse.tycho.classpath.SourcepathEntry) BuildOutputJar(org.eclipse.tycho.core.osgitools.project.BuildOutputJar) ArrayList(java.util.ArrayList) File(java.io.File)

Example 3 with SourcepathEntry

use of org.eclipse.tycho.classpath.SourcepathEntry in project tycho by eclipse.

the class OsgiCompilerTest method test_multipleOutputJars_getSourcepath.

public void test_multipleOutputJars_getSourcepath() throws Exception {
    File basedir = getBasedir("projects/multijar");
    List<MavenProject> projects = getSortedProjects(basedir, null);
    MavenProject project = projects.get(0);
    List<SourcepathEntry> sourcepath = getMojo(projects, project).getSourcepath();
    assertEquals(2, sourcepath.size());
    assertSameFile(new File(project.getBasedir(), "target/classes"), sourcepath.get(0).getOutputDirectory());
    assertSameFile(new File(project.getBasedir(), "src"), sourcepath.get(0).getSourcesRoot());
    assertSameFile(new File(project.getBasedir(), "target/library.jar-classes"), sourcepath.get(1).getOutputDirectory());
    assertSameFile(new File(project.getBasedir(), "src2"), sourcepath.get(1).getSourcesRoot());
}
Also used : SourcepathEntry(org.eclipse.tycho.classpath.SourcepathEntry) MavenProject(org.apache.maven.project.MavenProject) File(java.io.File)

Example 4 with SourcepathEntry

use of org.eclipse.tycho.classpath.SourcepathEntry in project tycho by eclipse.

the class OsgiCompilerTest method test_multipleOutputJars.

public void test_multipleOutputJars() throws Exception {
    File basedir = getBasedir("projects/multijar");
    List<MavenProject> projects = getSortedProjects(basedir, null);
    MavenProject project = projects.get(0);
    getMojo(projects, project).execute();
    assertTrue(new File(project.getBasedir(), "target/classes/src/Src.class").canRead());
    assertTrue(new File(project.getBasedir(), "target/library.jar-classes/src2/Src2.class").canRead());
    List<SourcepathEntry> sourcepath = getMojo(projects, project).getSourcepath();
    assertEquals(2, sourcepath.size());
}
Also used : SourcepathEntry(org.eclipse.tycho.classpath.SourcepathEntry) MavenProject(org.apache.maven.project.MavenProject) File(java.io.File)

Aggregations

File (java.io.File)4 SourcepathEntry (org.eclipse.tycho.classpath.SourcepathEntry)4 MavenProject (org.apache.maven.project.MavenProject)3 ArrayList (java.util.ArrayList)1 BuildOutputJar (org.eclipse.tycho.core.osgitools.project.BuildOutputJar)1