use of aQute.bnd.version.Version in project bndtools by bndtools.
the class RunBlacklistPart method createRequirement.
private static Requirement createRequirement(Object elem) {
String bsn = null;
Version version = null;
if (elem instanceof RepositoryBundle) {
bsn = ((RepositoryBundle) elem).getBsn();
} else if (elem instanceof RepositoryBundleVersion) {
RepositoryBundleVersion rbv = (RepositoryBundleVersion) elem;
bsn = rbv.getBsn();
version = rbv.getVersion();
} else if (elem instanceof ProjectBundle) {
bsn = ((ProjectBundle) elem).getBsn();
}
if (bsn != null) {
Filter filter = new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, bsn);
if (version != null) {
filter = new AndFilter().addChild(filter).addChild(new SimpleFilter("version", Operator.GreaterThanOrEqual, version.toString()));
}
Requirement req = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement();
return req;
}
return null;
}
use of aQute.bnd.version.Version in project bnd by bndtools.
the class MavenRepository method find.
File[] find(String groupId, String artifactId, VersionRange range) {
String path = groupId.replace(".", "/");
File vsdir = Processor.getFile(root, path);
if (!vsdir.isDirectory())
return null;
vsdir = Processor.getFile(vsdir, artifactId);
List<File> result = new ArrayList<File>();
if (vsdir.isDirectory()) {
String[] versions = vsdir.list();
for (String v : versions) {
String vv = Analyzer.cleanupVersion(v);
if (Verifier.isVersion(vv)) {
Version vvv = new Version(vv);
if (range.includes(vvv)) {
File file = Processor.getFile(vsdir, v + "/" + artifactId + "-" + v + ".jar");
if (file.isFile())
result.add(file);
else
reporter.warning("Expected maven entry was not a valid file %s ", file);
}
} else {
reporter.warning("Expected a version directory in maven: dir=%s raw-version=%s cleaned-up-version=%s", vsdir, vv, v);
}
}
} else
return null;
return result.toArray(new File[0]);
}
use of aQute.bnd.version.Version in project bnd by bndtools.
the class JustAnotherPackageManager method update.
public void update(UpdateMemo memo) throws Exception {
ArtifactData target = put(memo.best.urls.iterator().next());
memo.current.version = new Version(memo.best.version);
target.sync();
memo.current.sha = target.sha;
// memo.current.dependencies = target.dependencies;
// memo.current.dependencies.add((new File(repoDir,
// Hex.toHexString(target.sha))).getCanonicalPath());
// memo.current.runbundles = target.runbundles;
// memo.current.description = target.description;
memo.current.time = target.time;
if (memo.current instanceof ServiceData) {
Service service = getService((ServiceData) memo.current);
service.remove();
createService((ServiceData) memo.current, true);
IO.delete(new File(IO.getFile(serviceDir, memo.current.name), "data"));
storeData(new File(IO.getFile(serviceDir, memo.current.name), "data"), memo.current);
} else {
platform.deleteCommand(memo.current);
createCommand(memo.current, false);
IO.delete(IO.getFile(commandDir, memo.current.name));
storeData(IO.getFile(commandDir, memo.current.name), memo.current);
}
}
use of aQute.bnd.version.Version in project bnd by bndtools.
the class OBRTest method testVersions.
public static void testVersions() throws Exception {
SortedSet<Version> result = obr.versions("name.njbartlett.osgi.emf.minimal");
assertEquals(2, result.size());
assertEquals(new Version("2.6.1.v20100914-1218"), result.first());
assertEquals(new Version("2.7.0.201104130744"), result.last());
}
use of aQute.bnd.version.Version in project bnd by bndtools.
the class TestCompressedObrRepo method testVersions.
public static void testVersions() throws Exception {
SortedSet<Version> result = obr.versions("name.njbartlett.osgi.emf.minimal");
assertEquals(2, result.size());
assertEquals(new Version("2.6.1.v20100914-1218"), result.first());
assertEquals(new Version("2.7.0.201104130744"), result.last());
}
Aggregations