use of aQute.bnd.build.Container in project bnd by bndtools.
the class ProjectTest method testRepoFilterBuildPath.
public void testRepoFilterBuildPath() throws Exception {
Workspace ws = getWorkspace(IO.getFile("testresources/ws"));
Project project = ws.getProject("repofilter");
assertNotNull(project);
project.setProperty("-buildpath", "p3; version='[1,2)'; repo=Relea*");
ArrayList<Container> buildpath = new ArrayList<Container>(project.getBuildpath());
assertEquals(1, buildpath.size());
// Without repos filter we would get lowest version, i.e. 1.0.0 from the
// repo named "Repo".
assertEquals("1.1.0", buildpath.get(0).getVersion());
}
use of aQute.bnd.build.Container in project bnd by bndtools.
the class ProjectTest method testWildcardBuildPath.
public void testWildcardBuildPath() throws Exception {
Workspace ws = getWorkspace(IO.getFile("testresources/ws"));
Project project = ws.getProject("repofilter");
assertNotNull(project);
project.setProperty("-buildpath", "lib*");
ArrayList<Container> buildpath = new ArrayList<Container>(project.getBuildpath());
for (int i = 1; i < buildpath.size(); i++) {
Container c = buildpath.get(i);
assertEquals(Container.TYPE.REPO, c.getType());
}
}
use of aQute.bnd.build.Container in project bnd by bndtools.
the class ProjectTest method testHashVersionWithAlgorithmNotFound.
public void testHashVersionWithAlgorithmNotFound() throws Exception {
Workspace ws = getWorkspace(IO.getFile("testresources/ws-versionhash"));
Project project = ws.getProject("p1");
assertNotNull(project);
project.setProperty("-buildpath", "tmp; version=hash; hash=SHA-1:7fe83bfd5999fa4ef9cec40282d5d67dd0ff3303bac6b8c7b0e8be80a821441c");
ArrayList<Container> buildpath = new ArrayList<Container>(project.getBuildpath());
assertEquals(0, buildpath.size());
}
use of aQute.bnd.build.Container in project bnd by bndtools.
the class bnd method _deliverables.
@Description("Show all deliverables from this workspace. with their current version and path.")
public void _deliverables(deliverableOptions options) throws Exception {
Project project = getProject(options.project());
if (project == null) {
messages.NoProject();
return;
}
Collection<Project> projects;
if (options.limit())
projects = Arrays.asList(project);
else
projects = project.getWorkspace().getAllProjects();
List<Container> containers = new ArrayList<Container>();
for (Project p : projects) {
containers.addAll(p.getDeliverables());
}
for (Container c : containers) {
Version v = new Version(c.getVersion());
err.printf("%-40s %8s %s\n", c.getBundleSymbolicName(), v.getWithoutQualifier(), c.getFile());
}
getInfo(project);
}
use of aQute.bnd.build.Container in project bnd by bndtools.
the class bnd method _find.
public void _find(FindOptions options) throws Exception {
List<File> files = new ArrayList<File>();
List<String> args = options._arguments();
if (args.size() == 0) {
Project p = getProject();
if (p == null) {
error("This is not a project directory and you have specified no jar files ...");
return;
}
File output = p.getOutput();
if (output.exists()) {
files.add(output);
}
for (Container c : p.getBuildpath()) {
files.add(c.getFile());
}
} else {
for (String f : args) {
File file = getFile(f);
files.add(file);
}
}
for (File f : files) {
logger.debug("find {}", f);
try (Jar jar = new Jar(f)) {
Manifest m = jar.getManifest();
if (m != null) {
Domain domain = Domain.domain(m);
if (options.exports() != null) {
Parameters ep = domain.getExportPackage();
for (Glob g : options.exports()) {
for (Entry<String, Attrs> exp : ep.entrySet()) {
if (g.matcher(exp.getKey()).matches()) {
String v = exp.getValue().get(VERSION_ATTRIBUTE);
if (v == null)
v = "0";
out.printf(">%s: %s-%s%n", f.getPath(), exp.getKey(), v);
}
}
}
}
if (options.imports() != null) {
Parameters ip = domain.getImportPackage();
for (Glob g : options.imports()) {
for (Entry<String, Attrs> imp : ip.entrySet()) {
if (g.matcher(imp.getKey()).matches()) {
String v = imp.getValue().get(VERSION_ATTRIBUTE);
if (v == null)
v = "0";
out.printf("<%s: %s-%s%n", f.getPath(), imp.getKey(), v);
}
}
}
}
}
}
}
}
Aggregations