Search in sources :

Example 46 with Workspace

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

the class ProjectTest method testNoCanonicalName.

/**
	 * Test linked canonical name
	 */
public void testNoCanonicalName() throws Exception {
    Workspace ws = getWorkspace("testresources/ws");
    Project project = ws.getProject("p6");
    project.clean();
    // Now we build it.
    File[] files = project.build();
    assertTrue(project.check());
    assertNotNull(files);
    assertEquals(1, files.length);
    assertEquals("p6.jar", files[0].getName());
    File f = new File(project.getTarget(), "p6.jar");
    assertTrue(f.isFile());
    assertFalse(IO.isSymbolicLink(f));
}
Also used : Project(aQute.bnd.build.Project) File(java.io.File) Workspace(aQute.bnd.build.Workspace)

Example 47 with Workspace

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

the class EclipsePlugin method created.

@Override
public void created(Project p) throws IOException {
    Workspace workspace = p.getWorkspace();
    copy("project", ".project", p);
    copy("classpath", ".classpath", p);
}
Also used : Workspace(aQute.bnd.build.Workspace)

Example 48 with Workspace

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

the class MavenPlugin method created.

@Override
public void created(Project p) throws IOException {
    Workspace workspace = p.getWorkspace();
    copy("pom.xml", "pom.xml", p);
    File root = workspace.getFile("pom.xml");
    doRoot(p, root);
    String rootPom = IO.collect(root);
    if (!rootPom.contains(getTag(p))) {
        rootPom = rootPom.replaceAll("<!-- DO NOT EDIT MANAGED BY BND MAVEN LIFECYCLE PLUGIN -->\n", "$0\n\t\t" + getTag(p) + "\n");
        IO.store(rootPom, root);
    }
}
Also used : File(java.io.File) Workspace(aQute.bnd.build.Workspace)

Example 49 with Workspace

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

the class Plugin method init.

/**
	 * This is called when all initialization is done for the plugins, now we
	 * can obtain a list of appropriate repos.
	 */
public void init() {
    if (init)
        return;
    init = true;
    try {
        //
        // Get the list if repos registered, repos that we can handle
        //
        List<InfoRepository> irs = new ArrayList<InfoRepository>();
        for (InfoRepository ir : registry.getPlugins(InfoRepository.class)) {
            irs.add(ir);
        }
        this.wrapper = new InfoRepositoryWrapper(dir, irs);
        if (config.reindex())
            this.wrapper.clear();
        if (config.augments() != null) {
            Workspace workspace = registry.getPlugin(Workspace.class);
            try (Processor p = new Processor(workspace)) {
                if (!config.augments().equals("WORKSPACE")) {
                    File f = IO.getFile(workspace.getBuildDir(), config.augments());
                    if (!f.isFile()) {
                        if (reporter != null)
                            reporter.error("No augment file found at %s", f.getAbsolutePath());
                        return;
                    }
                    //
                    // We read this in a processor that extends the
                    // workspace so
                    // we
                    // can use workspace properties
                    //
                    p.setProperties(f);
                    this.wrapper.clear(f.lastModified());
                }
                //
                // And then add it to the indexer to use.
                //
                this.wrapper.addAugment(p.getFlattenedProperties());
                this.wrapper.clear(workspace.getPropertiesFile().lastModified());
            }
        }
    } catch (Exception e) {
        throw Exceptions.duck(e);
    }
}
Also used : Processor(aQute.bnd.osgi.Processor) ArrayList(java.util.ArrayList) InfoRepository(aQute.bnd.service.repository.InfoRepository) File(java.io.File) Workspace(aQute.bnd.build.Workspace)

Example 50 with Workspace

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

the class ResolveTest method assertInclude.

/*
	 * Create a BndrunResolveContext with a skip of 'workspace' in the
	 * workspace, and then use different files that get -resolve.effective from
	 * the include file or the bndrun file.
	 */
private void assertInclude(String file, String value) throws Exception {
    LogService log = Mockito.mock(LogService.class);
    File f = IO.getFile("testdata/resolve/includebndrun/" + file);
    File wsf = IO.getFile("testdata/ws");
    Workspace ws = Workspace.getWorkspace(wsf);
    ws.setProperty("-resolve.effective", "active;skip:='workspace'");
    Run run = Run.createRun(ws, f);
    BndrunResolveContext context = new BndrunResolveContext(run, run, ws, log);
    context.init();
    Map<String, Set<String>> effectiveSet = context.getEffectiveSet();
    assertNotNull(effectiveSet.get("active"));
    assertTrue(effectiveSet.get("active").contains(value));
}
Also used : Set(java.util.Set) Run(aQute.bnd.build.Run) File(java.io.File) LogService(org.osgi.service.log.LogService) Workspace(aQute.bnd.build.Workspace)

Aggregations

Workspace (aQute.bnd.build.Workspace)164 Project (aQute.bnd.build.Project)69 File (java.io.File)62 Processor (aQute.bnd.osgi.Processor)26 IOException (java.io.IOException)20 HashMap (java.util.HashMap)20 Container (aQute.bnd.build.Container)15 ArrayList (java.util.ArrayList)15 Version (aQute.bnd.version.Version)13 RepositoryPlugin (aQute.bnd.service.RepositoryPlugin)12 IProject (org.eclipse.core.resources.IProject)10 Run (aQute.bnd.build.Run)9 CoreException (org.eclipse.core.runtime.CoreException)9 Description (aQute.lib.getopt.Description)7 Collection (java.util.Collection)6 BndEditModel (aQute.bnd.build.model.BndEditModel)5 Jar (aQute.bnd.osgi.Jar)5 HttpTestServer (aQute.http.testservers.HttpTestServer)5 BuildException (org.apache.tools.ant.BuildException)5 IResource (org.eclipse.core.resources.IResource)5