use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class P2RepositoryTest method testSimple.
public void testSimple() throws Exception {
try (P2Repository p2r = new P2Repository()) {
Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
w.setBase(tmp);
p2r.setRegistry(w);
Map<String, String> config = new HashMap<>();
config.put("url", "https://dl.bintray.com/bndtools/bndtools/latest/");
config.put("name", "test");
p2r.setProperties(config);
List<String> list = p2r.list(null);
assertNotNull(list);
assertTrue(list.size() > 1);
}
}
use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class bnd method _release.
/**
* Release the project
*
* @throws Exception
*/
@Description("Release this project")
public void _release(releaseOptions options) throws Exception {
Set<Project> projects = new LinkedHashSet<Project>();
Workspace ws = Workspace.findWorkspace(getBase());
if (ws == null) {
error("Workspace option was specified but cannot find a workspace from %s", getBase());
return;
}
if (options.workspace()) {
projects.addAll(ws.getAllProjects());
}
Project project = getProject(options.project());
if (project != null) {
projects.add(project);
}
if (projects.isEmpty()) {
error("Cannot find any projects");
return;
}
String repo = options.repo();
if (repo != null) {
RepositoryPlugin repository = ws.getRepository(repo);
if (repository == null) {
error("No such release repo %s%nFound:%n%s", repository, Strings.join("\n", ws.getRepositories()));
}
}
for (Project p : projects) {
if (repo != null) {
p.setProperty(Constants.RELEASEREPO, repo);
}
p.release(options.test());
}
getInfo(project);
}
use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class bnd method _plugins.
/**
* Show the loaded workspace plugins
*
* @throws Exception
*/
public void _plugins(projectOptions opts) throws Exception {
Workspace ws = getWorkspace(opts.project());
if (ws == null) {
error("Can't find a workspace");
return;
}
int n = 0;
for (Object o : ws.getPlugins()) {
String s = o.toString();
if (s.trim().length() == 0)
s = o.getClass().getName();
out.printf("%03d %s%n", n++, s);
}
}
use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class bnd method __par.
/**
* Lets see if we can build in parallel
*
* @throws Exception
*/
public void __par(final ParallelBuildOptions options) throws Exception {
ExecutorService pool = Executors.newCachedThreadPool();
final AtomicBoolean quit = new AtomicBoolean();
try {
final Project p = getProject(options.project());
final Workspace workspace = p == null || options.full() ? Workspace.getWorkspace(getBase()) : p.getWorkspace();
if (!workspace.exists()) {
error("cannot find workspace");
return;
}
final Collection<Project> targets = p == null ? workspace.getAllProjects() : p.getDependson();
final Forker<Project> forker = new Forker<Project>(pool);
for (final Project dep : targets) {
forker.doWhen(dep.getDependson(), dep, new Runnable() {
public void run() {
if (!quit.get()) {
try {
dep.compile(false);
if (!quit.get())
dep.build();
if (!dep.isOk())
quit.set(true);
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
}
System.err.flush();
forker.start(20000);
for (Project dep : targets) {
getInfo(dep, dep + ": ");
}
if (p != null && p.isOk() && !options.full()) {
p.compile(options.test());
p.build();
if (options.test() && p.isOk())
p.test();
getInfo(p);
}
workspace.close();
} finally {
pool.shutdownNow();
}
}
use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class bnd method _bootstrap.
public void _bootstrap(BootstrapOptions options) throws Exception {
Workspace ws = getWorkspace(getBase());
File buildDir = ws.getBuildDir();
File bndFile = IO.getFile(buildDir, "bnd.bnd");
if (!bndFile.isFile()) {
error("No bnd.bnd file found in cnf directory %s", bndFile);
return;
}
Run run = new Run(ws, buildDir, bndFile);
run.runLocal();
getInfo(run);
}
Aggregations