Search in sources :

Example 56 with Project

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

the class LauncherTest method testRemotePackager.

/**
	 * Test the packager for remote
	 * 
	 * @throws Exception
	 */
public static void testRemotePackager() throws Exception {
    Project project = getProject();
    project.clear();
    project.setProperty("-runpath", "biz.aQute.remote.launcher;version=latest");
    ProjectLauncher l = project.getProjectLauncher();
    l.setTrace(true);
    Jar executable = l.executable();
    assertTrue(project.check());
    assertNotNull(executable);
}
Also used : Project(aQute.bnd.build.Project) ProjectLauncher(aQute.bnd.build.ProjectLauncher) Jar(aQute.bnd.osgi.Jar)

Example 57 with Project

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

the class LauncherTest method testEnv.

/**
	 * Test env variables
	 * 
	 * @throws Exception
	 */
public static void testEnv() throws Exception {
    Project project = getProject();
    project.clear();
    project.setProperty("-runenv", "ANSWER=84");
    ProjectLauncher l = project.getProjectLauncher();
    l.setTrace(true);
    l.getRunProperties().put("test.cmd", "env");
    assertEquals(84, l.launch());
}
Also used : Project(aQute.bnd.build.Project) ProjectLauncher(aQute.bnd.build.ProjectLauncher)

Example 58 with Project

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

the class LocationTest method testBasic.

public void testBasic() throws Exception {
    Project project = ws.getProject("p1");
    assertNotNull(project);
    ProjectBuilder sub1 = project.getSubBuilder("sub1");
    assertNotNull(sub1);
    ProjectBuilder sub2 = project.getSubBuilder("sub2");
    assertNotNull(sub2);
    assertTrue(find(sub1, "sub1", "p1/sub1.bnd", 4));
    assertTrue(find(sub1, "bnd.bnd", "p1/bnd.bnd", 4));
    assertTrue(find(project, "bnd.bnd", "p1/bnd.bnd", 4));
    assertTrue(find(sub1, "i1", "p1/i1.bnd", 2));
    assertTrue(find(project, "i1", "p1/i1.bnd", 2));
    assertTrue(find(sub1, "i2", "p1/i2.bnd", 2));
    assertTrue(find(project, "i2", "p1/i2.bnd", 2));
    assertTrue(find(sub2, "sub2", "p1/sub2.bnd", 3));
    assertTrue(find(sub2, "bnd.bnd", "p1/bnd.bnd", 4));
    assertTrue(find(sub2, "workspace", "cnf/build.bnd", 6));
    assertTrue(find(project, "workspace", "cnf/build.bnd", 6));
    assertTrue(find(project.getWorkspace(), "workspace", "cnf/build.bnd", 6));
}
Also used : Project(aQute.bnd.build.Project) ProjectBuilder(aQute.bnd.build.ProjectBuilder)

Example 59 with Project

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

the class LauncherTest method testShaPackager.

/**
	 * Test the sha packager
	 * 
	 * @throws Exception
	 */
public static void testShaPackager() throws Exception {
    Project project = getProject();
    project.clear();
    project.setProperty("-package", "jpm");
    ProjectLauncher l = project.getProjectLauncher();
    l.setTrace(true);
    Jar executable = l.executable();
    assertNotNull(executable);
    Manifest m = executable.getManifest();
    m.write(System.out);
    System.out.flush();
    assertNotNull(m.getMainAttributes().getValue("JPM-Classpath"));
    assertNotNull(m.getMainAttributes().getValue("JPM-Runbundles"));
    Resource r = executable.getResource("launcher.properties");
    assertNotNull(r);
    Properties p = new Properties();
    try (InputStream in = r.openInputStream()) {
        p.load(in);
    }
    System.out.println(p);
    String s = p.getProperty("launch.bundles");
    assertTrue(s.contains("${JPMREPO}/"));
    assertEquals("false", p.getProperty("launch.embedded"));
}
Also used : Project(aQute.bnd.build.Project) InputStream(java.io.InputStream) Resource(aQute.bnd.osgi.Resource) ProjectLauncher(aQute.bnd.build.ProjectLauncher) Jar(aQute.bnd.osgi.Jar) Manifest(java.util.jar.Manifest) Properties(java.util.Properties)

Example 60 with Project

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

the class LauncherTest method testPackager.

/**
	 * Test the packager
	 * 
	 * @throws Exception
	 */
public static void testPackager() throws Exception {
    Project project = getProject();
    project.clear();
    project.setProperty("[debug]testprop", "debug");
    project.setProperty("[exec]testprop", "exec");
    project.setProperty("Header", "${testprop}");
    project.setProperty(Constants.PROFILE, "exec");
    ProjectLauncher l = project.getProjectLauncher();
    l.setTrace(true);
    Jar executable = l.executable();
    assertNotNull(executable);
    assertEquals("exec", project.getProperty("testprop"));
    assertEquals("exec", project.getProperty("Header"));
}
Also used : Project(aQute.bnd.build.Project) ProjectLauncher(aQute.bnd.build.ProjectLauncher) Jar(aQute.bnd.osgi.Jar)

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