You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2012/08/21 16:19:23 UTC
svn commit: r1375562 - in /ant/ivy/core/trunk/src/java/org/apache/ivy/osgi:
core/BundleInfo.java core/BundleInfoAdapter.java p2/P2MetadataParser.java
Author: hibou
Date: Tue Aug 21 14:19:22 2012
New Revision: 1375562
URL: http://svn.apache.org/viewvc?rev=1375562&view=rev
Log:
Add support for bundle with inner classpath
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java?rev=1375562&r1=1375561&r2=1375562&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java Tue Aug 21 14:19:22 2012
@@ -74,6 +74,8 @@ public class BundleInfo {
private URI sourceURI;
+ private boolean hasInnerClasspath;
+
public BundleInfo(String name, Version version) {
this.symbolicName = name;
this.version = version;
@@ -225,6 +227,14 @@ public class BundleInfo {
return versionTarget;
}
+ public void setHasInnerClasspath(boolean hasInnerClasspath) {
+ this.hasInnerClasspath = hasInnerClasspath;
+ }
+
+ public boolean hasInnerClasspath() {
+ return hasInnerClasspath;
+ }
+
public int hashCode() {
final int prime = 31;
int result = 1;
@@ -312,6 +322,9 @@ public class BundleInfo {
} else if (!sourceURI.equals(other.sourceURI)) {
return false;
}
+ if (hasInnerClasspath != other.hasInnerClasspath) {
+ return false;
+ }
return true;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java?rev=1375562&r1=1375561&r2=1375562&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java Tue Aug 21 14:19:22 2012
@@ -23,9 +23,11 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.ivy.Ivy;
@@ -111,14 +113,16 @@ public class BundleInfoAdapter {
requirementAsDependency(md, bundle, exportedPkgNames);
+ String compression = bundle.hasInnerClasspath() ? "zip" : null;
URI uri = bundle.getUri();
if (uri != null) {
- DefaultArtifact artifact = buildArtifact(mrid, baseUri, uri, "jar");
+ DefaultArtifact artifact = buildArtifact(mrid, baseUri, uri, "jar", compression);
md.addArtifact(CONF_NAME_DEFAULT, artifact);
}
URI sourceURI = bundle.getSourceURI();
if (sourceURI != null) {
- DefaultArtifact artifact = buildArtifact(mrid, baseUri, sourceURI, "source");
+ DefaultArtifact artifact = buildArtifact(mrid, baseUri, sourceURI, "source",
+ compression);
md.addArtifact(CONF_NAME_DEFAULT, artifact);
}
@@ -151,7 +155,7 @@ public class BundleInfoAdapter {
return md;
}
- public static DefaultArtifact buildArtifact(ModuleRevisionId mrid, URI baseUri, URI uri, String type) {
+ public static DefaultArtifact buildArtifact(ModuleRevisionId mrid, URI baseUri, URI uri, String type, String compression) {
DefaultArtifact artifact;
if ("ivy".equals(uri.getScheme())) {
artifact = decodeIvyURI(uri);
@@ -159,9 +163,13 @@ public class BundleInfoAdapter {
if (!uri.isAbsolute()) {
uri = baseUri.resolve(uri);
}
+ Map extraAtt = new HashMap();
+ if (compression != null) {
+ extraAtt.put("compression", compression);
+ }
try {
artifact = new DefaultArtifact(mrid, null, mrid.getName(), type, "jar", new URL(
- uri.toString()), null);
+ uri.toString()), extraAtt);
} catch (MalformedURLException e) {
throw new RuntimeException("Unable to make the uri into the url", e);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java?rev=1375562&r1=1375561&r2=1375562&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java Tue Aug 21 14:19:22 2012
@@ -295,6 +295,9 @@ public class P2MetadataParser implements
// });
addChild(new TouchpointDataHandler(), new ChildElementHandler() {
public void childHanlded(DelegetingHandler child) throws SAXParseException {
+ if (((TouchpointDataHandler) child).zipped) {
+ bundleInfo.setHasInnerClasspath(true);
+ }
if (!bundleInfo.isSource()) {
// we only care about parsing the manifest if it is a source
return;
@@ -685,11 +688,14 @@ public class P2MetadataParser implements
String manifest;
+ boolean zipped;
+
public TouchpointDataHandler() {
super(TOUCHPOINTDATA);
addChild(new InstructionsHandler(), new ChildElementHandler() {
public void childHanlded(DelegetingHandler child) {
manifest = ((InstructionsHandler) child).manifest;
+ zipped = ((InstructionsHandler) child).zipped;
}
});
}
@@ -708,12 +714,18 @@ public class P2MetadataParser implements
String manifest;
+ boolean zipped;
+
public InstructionsHandler() {
super(INSTRUCTIONS);
addChild(new InstructionHandler(), new ChildElementHandler() {
public void childHanlded(DelegetingHandler child) {
- if (((InstructionHandler) child).key.equals("manifest")) {
+ String key = ((InstructionHandler) child).key;
+ if ("manifest".equals(key)) {
manifest = ((InstructionHandler) child).getBufferedChars();
+ } else if ("zipped".equals(key)) {
+ zipped = Boolean.valueOf(
+ ((InstructionHandler) child).getBufferedChars().trim()).booleanValue();
}
}
});