More bndlib fixes
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1433558 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
index efab9a3..391bf45 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
@@ -861,6 +861,8 @@
doSignature(in, member, access_flags);
else if ("ConstantValue".equals(attributeName))
doConstantValue(in);
+ else if ("AnnotationDefault".equals(attributeName))
+ doElementValue(in, member, RetentionPolicy.RUNTIME, cd!=null, access_flags);
else if ("Exceptions".equals(attributeName))
doExceptions(in, access_flags);
else {
diff --git a/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java b/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
index 08e5d02..57b6b37 100644
--- a/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
+++ b/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
@@ -179,6 +179,9 @@
*/
static final PutOptions DEFAULTOPTIONS = new PutOptions();
+ public static final int MAX_MAJOR = 999999999;
+
+
String shell;
String path;
String init;
@@ -195,7 +198,7 @@
protected File root;
Registry registry;
boolean canWrite = true;
- Pattern REPO_FILE = Pattern.compile("([-a-zA-z0-9_\\.]+)-([0-9\\.]+)\\.(jar|lib)");
+ Pattern REPO_FILE = Pattern.compile("([-a-zA-z0-9_\\.]+)-([0-9\\.]+|latest)\\.(jar|lib)");
Reporter reporter;
boolean dirty;
String name;
@@ -444,6 +447,7 @@
public SortedSet<Version> versions(String bsn) throws Exception {
init();
+ boolean haslatest = false;
File dir = new File(root, bsn);
if (dir.isDirectory()) {
String versions[] = dir.list();
@@ -453,10 +457,13 @@
if (m.matches()) {
String version = m.group(2);
if (version.equals("latest"))
- version = Integer.MAX_VALUE + "";
- list.add(new Version(version));
+ haslatest = true;
+ else
+ list.add(new Version(version));
}
}
+ if ( list.isEmpty() && haslatest)
+ list.add( new Version(MAX_MAJOR,0,0));
return new SortedList<Version>(list);
}
return SortedList.empty();
@@ -603,6 +610,12 @@
protected File getLocal(String bsn, Version version, Map<String,String> properties) {
File dir = new File(root, bsn);
+ if ( version.getMajor() == MAX_MAJOR && version.getMinor()== 0 && version.getMicro() == 0 && version.getQualifier() == null) {
+ File fjar = new File(dir, bsn + "-latest.jar");
+ if (fjar.isFile())
+ return fjar.getAbsoluteFile();
+ }
+
File fjar = new File(dir, bsn + "-" + version.getWithoutQualifier() + ".jar");
if (fjar.isFile())
return fjar.getAbsoluteFile();
diff --git a/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java b/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
index db81599..370d2d4 100644
--- a/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
+++ b/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
@@ -24,7 +24,7 @@
static int LINELENGTH = 60;
static Pattern ASSIGNMENT = Pattern.compile("(\\w[\\w\\d]*+)\\s*=\\s*([^\\s]+)\\s*");
Reporter reporter;
- Justif justif = new Justif(60);
+ Justif justif = new Justif(80,30,32,70);
CommandLineMessages msg;
public CommandLine(Reporter reporter) {
@@ -309,15 +309,19 @@
* Provide a help text.
*/
- public void help(Formatter f, @SuppressWarnings("unused") Object target, String cmd, Class< ? extends Options> specification) {
+ public void help(Formatter f, @SuppressWarnings("unused")
+ Object target, String cmd, Class< ? extends Options> specification) {
Description descr = specification.getAnnotation(Description.class);
Arguments patterns = specification.getAnnotation(Arguments.class);
Map<String,Method> options = getOptions(specification);
String description = descr == null ? "" : descr.value();
- f.format("NAME%n %s - %s%n%n", cmd, description);
- f.format("SYNOPSIS%n %s [options] ", cmd);
+ f.format("%nNAME%n %s \t0- \t1%s%n%n", cmd, description);
+ if (options.isEmpty())
+ f.format("SYNOPSIS%n %s ", cmd);
+ else
+ f.format("SYNOPSIS%n %s [options] ", cmd);
if (patterns == null)
f.format(" ...%n%n");
@@ -330,28 +334,30 @@
f.format("%s<%s>", del, pattern);
del = " ";
}
- f.format("%n%n");
+ f.format("%n");
}
- f.format("OPTIONS%n");
- for (Entry<String,Method> entry : options.entrySet()) {
- String optionName = entry.getKey();
- Method m = entry.getValue();
+ if (!options.isEmpty()) {
+ f.format("%nOPTIONS%n%n");
+ for (Entry<String,Method> entry : options.entrySet()) {
+ String optionName = entry.getKey();
+ Method m = entry.getValue();
- Config cfg = m.getAnnotation(Config.class);
- Description d = m.getAnnotation(Description.class);
- boolean required = isMandatory(m);
+ Config cfg = m.getAnnotation(Config.class);
+ Description d = m.getAnnotation(Description.class);
+ boolean required = isMandatory(m);
- String methodDescription = cfg != null ? cfg.description() : (d == null ? "" : d.value());
+ String methodDescription = cfg != null ? cfg.description() : (d == null ? "" : d.value());
- f.format(" %s -%s, --%s %s%s - %s%n", required ? " " : "[", //
- optionName.charAt(0), //
- optionName, //
- getTypeDescriptor(m.getGenericReturnType()), //
- required ? " " : "]",//
- methodDescription);
+ f.format(" %s -%s, --%s %s%s \t0- \t1%s%n", required ? " " : "[", //
+ optionName.charAt(0), //
+ optionName, //
+ getTypeDescriptor(m.getGenericReturnType()), //
+ required ? " " : "]",//
+ methodDescription);
+ }
+ f.format("%n");
}
- f.format("%n");
}
static Pattern LAST_PART = Pattern.compile(".*[\\$\\.]([^\\$\\.]+)");