felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r1433558 - in /felix/trunk/bundleplugin/src/main/java/aQute: bnd/osgi/Clazz.java lib/deployer/FileRepo.java lib/getopt/CommandLine.java
Date Tue, 15 Jan 2013 18:08:21 GMT
Author: mcculls
Date: Tue Jan 15 18:08:21 2013
New Revision: 1433558

URL: http://svn.apache.org/viewvc?rev=1433558&view=rev
Log:
More bndlib fixes

Modified:
    felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
    felix/trunk/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
    felix/trunk/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java?rev=1433558&r1=1433557&r2=1433558&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java Tue Jan 15 18:08:21 2013
@@ -861,6 +861,8 @@ public class Clazz {
 			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 {

Modified: felix/trunk/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java?rev=1433558&r1=1433557&r2=1433558&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java Tue Jan 15 18:08:21
2013
@@ -179,6 +179,9 @@ public class FileRepo implements Plugin,
 	 */
 	static final PutOptions		DEFAULTOPTIONS		= new PutOptions();
 
+	public static final int	MAX_MAJOR	= 999999999;
+
+	
 	String						shell;
 	String						path;
 	String						init;
@@ -195,7 +198,7 @@ public class FileRepo implements Plugin,
 	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 class FileRepo implements Plugin,
 
 	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 @@ public class FileRepo implements Plugin,
 				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 @@ public class FileRepo implements Plugin,
 	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();

Modified: felix/trunk/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java?rev=1433558&r1=1433557&r2=1433558&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java Tue Jan 15 18:08:21
2013
@@ -24,7 +24,7 @@ public class CommandLine {
 	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 @@ public class CommandLine {
 	 * 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 @@ public class CommandLine {
 					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(".*[\\$\\.]([^\\$\\.]+)");



Mime
View raw message