Search in sources :

Example 1 with Workspace

use of aQute.bnd.build.Workspace in project intellij-plugins by JetBrains.

the class ReimportProjectsAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    Workspace workspace = BndProjectImporter.getWorkspace(e.getProject());
    boolean available = workspace != null && !getProjectDirs(e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)).isEmpty();
    e.getPresentation().setEnabledAndVisible(available);
}
Also used : Workspace(aQute.bnd.build.Workspace)

Example 2 with Workspace

use of aQute.bnd.build.Workspace in project intellij-plugins by JetBrains.

the class BndProjectImporter method doReimportProjects.

private static void doReimportProjects(com.intellij.openapi.project.Project project, Collection<String> projectDirs, ProgressIndicator indicator) {
    Workspace workspace = getWorkspace(project);
    assert workspace != null : project;
    Collection<Project> projects;
    try {
        refreshRepositories(workspace, indicator);
        projects = ContainerUtil.newArrayListWithCapacity(projectDirs.size());
        for (String dir : projectDirs) {
            if (indicator != null)
                indicator.checkCanceled();
            Project p = workspace.getProject(PathUtil.getFileName(dir));
            if (p != null) {
                p.clear();
                p.forceRefresh();
                projects.add(p);
            }
        }
    } catch (Exception e) {
        LOG.error("ws=" + workspace.getBase() + " pr=" + projectDirs, e);
        return;
    }
    Runnable task = () -> new BndProjectImporter(project, workspace, projects).resolve(true);
    if (!isUnitTestMode()) {
        ApplicationManager.getApplication().invokeLater(task, project.getDisposed());
    } else {
        task.run();
    }
}
Also used : Project(aQute.bnd.build.Project) IOException(java.io.IOException) Workspace(aQute.bnd.build.Workspace)

Example 3 with Workspace

use of aQute.bnd.build.Workspace in project intellij-plugins by JetBrains.

the class BndProjectImporter method doReimportWorkspace.

private static void doReimportWorkspace(com.intellij.openapi.project.Project project, ProgressIndicator indicator) {
    Workspace workspace = getWorkspace(project);
    assert workspace != null : project;
    Collection<Project> projects;
    try {
        workspace.clear();
        workspace.forceRefresh();
        refreshRepositories(workspace, indicator);
        projects = getWorkspaceProjects(workspace);
        for (Project p : projects) {
            if (indicator != null)
                indicator.checkCanceled();
            p.clear();
            p.forceRefresh();
        }
    } catch (Exception e) {
        LOG.error("ws=" + workspace.getBase(), e);
        return;
    }
    Runnable task = () -> {
        BndProjectImporter importer = new BndProjectImporter(project, workspace, projects);
        importer.setupProject();
        importer.resolve(true);
    };
    if (!isUnitTestMode()) {
        ApplicationManager.getApplication().invokeLater(task, project.getDisposed());
    } else {
        task.run();
    }
}
Also used : Project(aQute.bnd.build.Project) IOException(java.io.IOException) Workspace(aQute.bnd.build.Workspace)

Example 4 with Workspace

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

the class WorkspaceTest method testJavacDefaults.

public void testJavacDefaults() throws Exception {
    String version = System.getProperty("java.specification.version", "1.8");
    try (Workspace w = new Workspace(tmp)) {
        assertEquals(version, w.getProperty("javac.source"));
        assertEquals(version, w.getProperty("javac.target"));
    }
}
Also used : Workspace(aQute.bnd.build.Workspace)

Example 5 with Workspace

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

the class WorkspaceTest method testDriver.

public void testDriver() throws Exception {
    try (Workspace w = new Workspace(tmp)) {
        assertEquals("unset", w.getDriver());
        assertEquals("unset", w.getReplacer().process("${driver}"));
        assertEquals("unset", w.getReplacer().process("${driver;unset}"));
        assertEquals("", w.getReplacer().process("${driver;set}"));
        Workspace.setDriver("test");
        assertEquals("test", w.getDriver());
        assertEquals("test", w.getReplacer().process("${driver}"));
        assertEquals("test", w.getReplacer().process("${driver;test}"));
        assertEquals("", w.getReplacer().process("${driver;nottest}"));
        w.setProperty("-bnd-driver", "test2");
        assertEquals("test2", w.getDriver());
        assertEquals("test2", w.getReplacer().process("${driver}"));
        assertEquals("test2", w.getReplacer().process("${driver;test2}"));
        assertEquals("", w.getReplacer().process("${driver;nottest}"));
    }
}
Also used : Workspace(aQute.bnd.build.Workspace)

Aggregations

Workspace (aQute.bnd.build.Workspace)171 Project (aQute.bnd.build.Project)71 File (java.io.File)66 Processor (aQute.bnd.osgi.Processor)27 HashMap (java.util.HashMap)22 IOException (java.io.IOException)20 ArrayList (java.util.ArrayList)19 Container (aQute.bnd.build.Container)17 RepositoryPlugin (aQute.bnd.service.RepositoryPlugin)13 Version (aQute.bnd.version.Version)13 Run (aQute.bnd.build.Run)11 IProject (org.eclipse.core.resources.IProject)11 CoreException (org.eclipse.core.runtime.CoreException)10 IResource (org.eclipse.core.resources.IResource)8 BndEditModel (aQute.bnd.build.model.BndEditModel)7 Description (aQute.lib.getopt.Description)7 Bndrun (biz.aQute.resolve.Bndrun)7 Attrs (aQute.bnd.header.Attrs)5 HttpClient (aQute.bnd.http.HttpClient)5 Jar (aQute.bnd.osgi.Jar)5