Search in sources :

Example 96 with Project

use of aQute.bnd.build.Project in project bnd by bndtools.

the class LauncherTest method testSpaces.

/**
	 * Try launching a workspace with spaces
	 */
public static void testSpaces() throws Exception {
    File f = new File("t m p");
    try {
        File cnf = new File(f, "cnf");
        File demo = new File(f, "demo");
        IO.copy(IO.getFile("../cnf"), IO.getFile(f, "cnf"));
        IO.copy(IO.getFile("../demo"), IO.getFile(f, "demo"));
        IO.copy(IO.getFile("../biz.aQute.launcher"), IO.getFile(f, "biz.aQute.launcher"));
        IO.copy(IO.getFile("../biz.aQute.junit"), IO.getFile(f, "biz.aQute.junit"));
        Workspace ws = Workspace.getWorkspace(f);
        Project p = ws.getProject("demo");
        p.setTrace(true);
        p.build();
        try {
            ProjectLauncher l = p.getProjectLauncher();
            l.setTrace(true);
            l.getRunProperties().put("test.cmd", "exit");
            assertEquals(42, l.launch());
        } finally {
            p.close();
            ws.close();
        }
    } finally {
        IO.delete(f);
    }
}
Also used : Project(aQute.bnd.build.Project) ProjectLauncher(aQute.bnd.build.ProjectLauncher) File(java.io.File) Workspace(aQute.bnd.build.Workspace)

Example 97 with Project

use of aQute.bnd.build.Project in project bnd by bndtools.

the class LauncherTest method testTimeout.

public static void testTimeout() throws Exception {
    Project project = getProject();
    project.clear();
    ProjectLauncher l = project.getProjectLauncher();
    l.setTimeout(100, TimeUnit.MILLISECONDS);
    l.setTrace(false);
    l.getRunProperties().put("test.cmd", "timeout");
    assertEquals(ProjectLauncher.TIMEDOUT, l.launch());
}
Also used : Project(aQute.bnd.build.Project) ProjectLauncher(aQute.bnd.build.ProjectLauncher)

Example 98 with Project

use of aQute.bnd.build.Project in project bnd by bndtools.

the class LauncherTest method assertExitCode.

private static void assertExitCode(String cmd, int rv) throws Exception {
    Project project = getProject();
    project.clear();
    ProjectLauncher l = project.getProjectLauncher();
    l.setTimeout(15000, TimeUnit.MILLISECONDS);
    l.setTrace(true);
    l.getRunProperties().put("test.cmd", cmd);
    assertEquals(rv, l.launch());
}
Also used : Project(aQute.bnd.build.Project) ProjectLauncher(aQute.bnd.build.ProjectLauncher)

Example 99 with Project

use of aQute.bnd.build.Project in project bnd by bndtools.

the class LocationTest method testMerged.

public void testMerged() throws Exception {
    Project project = ws.getProject("locationtest");
    FileLine fl = project.getHeader("-merged", "BAZ");
    assertNotNull(fl);
    assertEquals(project.getPropertiesFile().getAbsolutePath(), fl.file.getAbsolutePath());
    assertEquals(18, fl.line);
    assertEquals(167, fl.start);
    assertEquals(170, fl.end);
}
Also used : Project(aQute.bnd.build.Project) FileLine(aQute.bnd.osgi.Processor.FileLine)

Example 100 with Project

use of aQute.bnd.build.Project in project bnd by bndtools.

the class LocationTest method testProjectHeaderClauses.

public void testProjectHeaderClauses() throws Exception {
    Project project = ws.getProject("locationtest");
    assertNotNull(project);
    FileLine fl = project.getHeader("-inprojectsep", "BAZ");
    assertNotNull(fl);
    assertEquals(project.getPropertiesFile().getAbsolutePath(), fl.file.getAbsolutePath());
    assertEquals(10, fl.line);
    assertEquals(104, fl.start);
    assertEquals(107, fl.end);
    fl = project.getHeader("-inproject", "BAZ");
    assertNotNull(fl);
    assertEquals(project.getPropertiesFile().getAbsolutePath(), fl.file.getAbsolutePath());
    assertEquals(3, fl.line);
    assertEquals(23, fl.start);
    assertEquals(26, fl.end);
}
Also used : Project(aQute.bnd.build.Project) FileLine(aQute.bnd.osgi.Processor.FileLine)

Aggregations

Project (aQute.bnd.build.Project)140 Workspace (aQute.bnd.build.Workspace)70 File (java.io.File)45 ArrayList (java.util.ArrayList)22 IProject (org.eclipse.core.resources.IProject)21 Container (aQute.bnd.build.Container)19 IOException (java.io.IOException)17 ProjectLauncher (aQute.bnd.build.ProjectLauncher)15 Version (aQute.bnd.version.Version)12 Description (aQute.lib.getopt.Description)12 Jar (aQute.bnd.osgi.Jar)11 Builder (aQute.bnd.osgi.Builder)10 RepositoryPlugin (aQute.bnd.service.RepositoryPlugin)10 IJavaProject (org.eclipse.jdt.core.IJavaProject)9 Run (aQute.bnd.build.Run)8 BuildException (org.apache.tools.ant.BuildException)8 CoreException (org.eclipse.core.runtime.CoreException)8 IFile (org.eclipse.core.resources.IFile)7 ProjectBuilder (aQute.bnd.build.ProjectBuilder)6 ProjectTester (aQute.bnd.build.ProjectTester)5