Latest bnd code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1355520 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/AnalyzerMessages.java b/bundleplugin/src/main/java/aQute/lib/osgi/AnalyzerMessages.java
index 3efea0a..a91a0f0 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/AnalyzerMessages.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/AnalyzerMessages.java
@@ -1,19 +1,3 @@
-/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package aQute.lib.osgi;
import aQute.libg.reporter.*;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java b/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
index f49d6e3..b31be5c 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
@@ -117,7 +117,6 @@
dot.setName(getBsn());
sign(dot);
- doDigests(dot);
doSaveManifest(dot);
doDiff(dot); // check if need to diff this bundle
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/CombinedResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/CombinedResource.java
index d76b695..3886c48 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/CombinedResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/CombinedResource.java
@@ -1,19 +1,3 @@
-/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package aQute.lib.osgi;
import java.io.*;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
index eefc1e2..47ba4ac 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
@@ -1,19 +1,3 @@
-/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package aQute.lib.osgi;
import java.io.*;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Domain.java b/bundleplugin/src/main/java/aQute/lib/osgi/Domain.java
index f520378..e705534 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Domain.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Domain.java
@@ -6,8 +6,8 @@
import java.util.jar.*;
import aQute.libg.header.*;
-import aQute.libg.reporter.*;
import aQute.libg.version.*;
+import aQute.service.reporter.*;
/**
* This class abstracts domains that have properties holding OSGi meta data. It
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java b/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java
index 76a4b0d..725b065 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java
@@ -11,7 +11,7 @@
import aQute.lib.base64.*;
import aQute.lib.io.*;
-import aQute.libg.reporter.*;
+import aQute.service.reporter.*;
public class Jar implements Closeable {
public enum Compression {
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java b/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
index 608e9a0..c6b5dd9 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
@@ -13,7 +13,7 @@
import aQute.lib.io.*;
import aQute.libg.generics.*;
import aQute.libg.header.*;
-import aQute.libg.reporter.*;
+import aQute.service.reporter.*;
public class Processor extends Domain implements Reporter, Registry, Constants, Closeable {
@@ -113,41 +113,64 @@
return p;
}
- public void warning(String string, Object... args) {
+ public SetLocation warning(String string, Object... args) {
Processor p = current();
String s = formatArrays(string, args);
if (!p.warnings.contains(s))
p.warnings.add(s);
p.signal();
+ return location(s);
}
- public void error(String string, Object... args) {
+ public SetLocation error(String string, Object... args) {
Processor p = current();
- if (p.isFailOk())
- p.warning(string, args);
- else {
- String s = formatArrays(string, args == null ? new Object[0] : args);
- if (!p.errors.contains(s))
- p.errors.add(s);
+ try {
+ if (p.isFailOk())
+ return p.warning(string, args);
+ else {
+ String s = formatArrays(string, args == null ? new Object[0] : args);
+ if (!p.errors.contains(s))
+ p.errors.add(s);
+ return location(s);
+ }
}
- p.signal();
+ finally {
+ p.signal();
+ }
}
- public void error(String string, Throwable t, Object... args) {
+ public void progress(float progress, String format, Object... args) {
+ format = String.format("[%2d] %s", (int)progress, format);
+ trace(format, args);
+ }
+
+ public void progress(String format, Object... args) {
+ progress(-1f, format, args);
+ }
+
+ public SetLocation exception(Throwable t, String format, Object... args) {
+ return error(format, t, args);
+ }
+
+ public SetLocation error(String string, Throwable t, Object... args) {
Processor p = current();
-
- if (p.isFailOk())
- p.warning(string + ": " + t, args);
- else {
- p.errors.add("Exception: " + t.getMessage());
- String s = formatArrays(string, args == null ? new Object[0] : args);
- if (!p.errors.contains(s))
- p.errors.add(s);
+ try {
+ if (p.exceptions)
+ t.printStackTrace();
+ if (p.isFailOk()) {
+ return p.warning(string + ": " + t, args);
+ }
+ else {
+ p.errors.add("Exception: " + t.getMessage());
+ String s = formatArrays(string, args == null ? new Object[0] : args);
+ if (!p.errors.contains(s))
+ p.errors.add(s);
+ return location(s);
+ }
}
- if (p.exceptions)
- t.printStackTrace();
-
- p.signal();
+ finally {
+ p.signal();
+ }
}
public void signal() {}
@@ -184,10 +207,6 @@
toBeClosed.remove(jar);
}
- public void progress(String s, Object... args) {
- trace(s, args);
- }
-
public boolean isPedantic() {
return current().pedantic;
}
@@ -1584,4 +1603,64 @@
return s + newExtension;
}
+
+ /**
+ * Create a location object and add it to the locations
+ *
+ * @param s
+ * @return
+ */
+ List<Location> locations = new ArrayList<Location>();
+
+ static class SetLocationImpl extends Location implements SetLocation {
+ public SetLocationImpl(String s) {
+ this.message = s;
+ }
+
+ public SetLocation file(String file) {
+ this.file = file;
+ return this;
+ }
+
+ public SetLocation header(String header) {
+ this.header = header;
+ return this;
+ }
+
+ public SetLocation context(String context) {
+ this.context = context;
+ return this;
+ }
+
+ public SetLocation method(String methodName) {
+ this.methodName = methodName;
+ return this;
+ }
+
+ public SetLocation line(int n) {
+ this.line = n;
+ return this;
+ }
+
+ public SetLocation reference(String reference) {
+ this.reference = reference;
+ return this;
+ }
+
+ }
+
+ private SetLocation location(String s) {
+ SetLocationImpl loc = new SetLocationImpl(s);
+ locations.add(loc);
+ return loc;
+ }
+
+ public Location getLocation(String msg) {
+ for (Location l : locations)
+ if ((l.message != null) && l.message.equals(msg))
+ return l;
+
+ return null;
+ }
+
}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java b/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java
index cb511e7..c146477 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java
@@ -9,7 +9,7 @@
import org.w3c.dom.*;
import org.xml.sax.*;
-import aQute.libg.reporter.*;
+import aQute.service.reporter.*;
/**
* Parse the Eclipse project information for the classpath. Unfortunately, it is