use of aQute.bnd.build.Project in project bnd by bndtools.
the class WorkspaceRepositoryTest method reallyClean.
private static void reallyClean(Workspace ws) throws Exception {
String wsName = ws.getBase().getName();
for (Project project : ws.getAllProjects()) {
if (("p1".equals(project.getName()) && "ws-repo-test".equals(wsName)) || ("p2".equals(project.getName()) && "ws-repo-test".equals(wsName)) || ("p3".equals(project.getName()) && "ws-repo-test".equals(wsName))) {
File output = project.getSrcOutput().getAbsoluteFile();
if (output.isDirectory() && output.getParentFile() != null) {
IO.delete(output);
}
} else {
project.clean();
File target = project.getTargetDir();
if (target.isDirectory() && target.getParentFile() != null) {
IO.delete(target);
}
File output = project.getSrcOutput().getAbsoluteFile();
if (output.isDirectory() && output.getParentFile() != null) {
IO.delete(output);
}
}
}
IO.delete(ws.getFile("cnf/cache"));
}
use of aQute.bnd.build.Project in project bnd by bndtools.
the class LauncherTest method testMain.
/**
* Launches against main
*/
/*
* Launches against the agent& main
*/
public void testMain() throws Exception {
Project project = workspace.getProject("p1");
Run bndrun = new Run(workspace, project.getBase(), project.getFile("one.bndrun"));
bndrun.setProperty("-runpath", "biz.aQute.remote.launcher");
bndrun.setProperty("-runbundles", "bsn-1,bsn-2");
bndrun.setProperty("-runremote", "main;agent=1090");
final RemoteProjectLauncherPlugin pl = (RemoteProjectLauncherPlugin) bndrun.getProjectLauncher();
pl.prepare();
List<? extends RunSession> sessions = pl.getRunSessions();
assertEquals(1, sessions.size());
RunSessionImpl main = (RunSessionImpl) sessions.get(0);
CountDownLatch mainLatch = launch(main);
main.waitTillStarted(1000);
assertEquals(0, main.started.getCount());
Thread.sleep(500);
main.cancel();
mainLatch.await();
assertEquals(-3, main.getExitCode());
bndrun.close();
}
use of aQute.bnd.build.Project in project bndtools by bndtools.
the class AdjustClasspathsForNewProjectJob method runInWorkspace.
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) {
List<Project> projects;
SubMonitor progress;
try {
projects = new ArrayList<Project>(Central.getWorkspace().getAllProjects());
progress = SubMonitor.convert(monitor, projects.size());
} catch (Exception e) {
return Status.CANCEL_STATUS;
}
IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
while (!projects.isEmpty()) {
Project project = projects.remove(0);
IProject eclipseProject = WorkspaceUtils.findOpenProject(wsroot, project);
if (eclipseProject != null && !eclipseProject.equals(addedProject)) {
try {
project.propertiesChanged();
IJavaProject javaProject = JavaCore.create(eclipseProject);
if (javaProject != null) {
BndContainerInitializer.requestClasspathContainerUpdate(javaProject);
}
} catch (CoreException e) {
logger.logStatus(e.getStatus());
return Status.CANCEL_STATUS;
}
progress.worked(1);
}
if (progress.isCanceled())
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
use of aQute.bnd.build.Project in project bndtools by bndtools.
the class Central method refreshPlugins.
public static void refreshPlugins() throws Exception {
List<File> refreshedFiles = new ArrayList<File>();
List<Refreshable> rps = getWorkspace().getPlugins(Refreshable.class);
boolean changed = false;
boolean repoChanged = false;
for (Refreshable rp : rps) {
if (rp.refresh()) {
changed = true;
File root = rp.getRoot();
if (root != null)
refreshedFiles.add(root);
if (rp instanceof RepositoryPlugin) {
repoChanged = true;
}
}
}
if (changed) {
try {
for (File file : refreshedFiles) {
refreshFile(file);
}
for (Project p : Central.getWorkspace().getAllProjects()) {
p.setChanged();
for (ModelListener l : getInstance().listeners) l.modelChanged(p);
}
if (repoChanged) {
repositoriesViewRefresher.repositoriesRefreshed();
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
use of aQute.bnd.build.Project in project bndtools by bndtools.
the class BsnValidator method validate.
@Override
public IStatus validate(Builder builder) throws Exception {
Project project;
try {
project = Central.getProject(builder.getBase());
} catch (Exception e) {
project = null;
}
if (project == null) {
builder.error("Eclipse: Cannot find associated project for %s", builder);
return null;
}
String bsn = builder.getBsn();
if (bsn == null) {
loc(bsn, builder, builder.warning("Eclipse: Bundle Symbolic Name not valid, get null"));
return null;
}
if (!bsn.startsWith(project.getName())) {
loc(bsn, builder, builder.warning("Eclipse: The Bundle Symbolic Name must %s start with the project name %s, " + "which must be the project's directory %s name", bsn, project, project.getBase()));
return null;
}
File pf = builder.getPropertiesFile();
String rover = bsn.substring(project.getName().length());
if (rover.startsWith(".")) {
rover = rover.substring(1);
if (pf == null) {
loc(bsn, builder, builder.warning("Eclipse: The Bundle Symbolic %s starts with the project name %s " + "but then continues while it is not a sub-bundle", bsn, project));
return null;
}
String suffix = removeExtension(pf.getName());
if (!suffix.equals(rover)) {
loc(bsn, builder, builder.warning("Eclipse: The Bundle Symbolic %s starts with the project name %s but then does not end with the subbuilder name", bsn, project, pf.getName()));
}
return null;
}
if (rover.isEmpty()) {
if (pf != null) {
loc(bsn, builder, builder.warning("Eclipse: The Bundle Symbolic %s is a sub-bundle %s but uses the project name", bsn, pf.getName(), project));
}
return null;
}
loc(bsn, builder, builder.warning("Eclipse: The Bundle Symbolic %s starts with the project name %s " + "but then continues but lacks the separating '.'", bsn, project));
return null;
}
Aggregations