Author: hibou
Date: Sun Jan  5 10:37:46 2014
New Revision: 1555476

URL: http://svn.apache.org/r1555476
Log:
fix computation of the extension of unpacked artifacts

Added:
    ant/ivy/core/trunk/test/repositories/1/packaging/module7/
    ant/ivy/core/trunk/test/repositories/1/packaging/module7/ivys/
    ant/ivy/core/trunk/test/repositories/1/packaging/module7/ivys/ivy-1.0.xml   
(with props)
    ant/ivy/core/trunk/test/repositories/1/packaging/module7/jars/
    
ant/ivy/core/trunk/test/repositories/1/packaging/module7/jars/module7-1.0.jar.pack.gz
   (with props)
    ant/ivy/core/trunk/test/repositories/1/packaging/module8/
    ant/ivy/core/trunk/test/repositories/1/packaging/module8/ivys/
    ant/ivy/core/trunk/test/repositories/1/packaging/module8/ivys/ivy-1.0.xml   
(with props)
Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/Pack200Packing.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/ZipPacking.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/Pack200Packing.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/Pack200Packing.java?rev=1555476&r1=1555475&r2=1555476&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/Pack200Packing.java 
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/Pack200Packing.java 
Sun Jan  5 10:37:46 2014
@@ -39,10 +39,15 @@ public class Pack200Packing extends Stre
     @Override
     public String getUnpackedExtension(String ext) {
         if (ext.endsWith("pack.gz")) {
-            return ext.substring(0, ext.length() - 7);
-        }
-        if (ext.endsWith("pack")) {
-            return ext.substring(0, ext.length() - 4);
+            ext = ext.substring(0, ext.length() - 7);
+            if (ext.endsWith(".")) {
+                ext = ext.substring(0, ext.length() - 1);
+            }
+        } else if (ext.endsWith("pack")) {
+            ext = ext.substring(0, ext.length() - 4);
+            if (ext.endsWith(".")) {
+                ext = ext.substring(0, ext.length() - 1);
+            }
         }
         return ext;
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/ZipPacking.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/ZipPacking.java?rev=1555476&r1=1555475&r2=1555476&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/ZipPacking.java 
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/pack/ZipPacking.java Sun 
Jan  5 10:37:46 2014
@@ -39,7 +39,10 @@ public class ZipPacking extends ArchiveP
     @Override
     public String getUnpackedExtension(String ext) {
         if (ext.endsWith("zip") || ext.endsWith("jar") || ext.endsWith("war")) 
{
-            return ext.substring(0, ext.length() - 3);
+            ext = ext.substring(0, ext.length() - 3);
+            if (ext.endsWith(".")) {
+                ext = ext.substring(0, ext.length() - 1);
+            }
         }
         return ext;
     }

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java?rev=1555476&r1=1555475&r2=1555476&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java 
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java Sun 
Jan  5 10:37:46 2014
@@ -287,6 +287,25 @@ public class IvyCachePathTest extends Te
         assertEquals(unpacked, new File(p.list()[0]));
     }
 
+    public void testPackedOSGi() throws Exception {
+        project.setProperty("ivy.dep.file",
+            "test/repositories/1/packaging/module8/ivys/ivy-1.0.xml");
+        path.setPathid("testOSGi");
+        path.setOsgi(true);
+        path.execute();
+        Object ref = project.getReference("testOSGi");
+        assertNotNull(ref);
+        assertTrue(ref instanceof Path);
+        Path p = (Path) ref;
+        assertEquals(4, p.size());
+        File cacheDir = path.getSettings().getDefaultRepositoryCacheBasedir();
+        File unpacked = new File(cacheDir, 
"packaging/module7/jar_unpackeds/module7-1.0");
+        assertEquals(new File(unpacked, "lib/ant-antlr.jar"), new 
File(p.list()[0]));
+        assertEquals(new File(unpacked, "lib/ant-apache-bcel.jar"), new 
File(p.list()[1]));
+        assertEquals(new File(unpacked, "lib/ant-apache-bsf.jar"), new 
File(p.list()[2]));
+        assertEquals(new File(unpacked, "lib/ant-apache-log4j.jar"), new 
File(p.list()[3]));
+    }
+
     private File getArchiveFileInCache(String organisation, String module, 
String revision,
             String artifact, String type, String ext) {
         return TestHelper.getArchiveFileInCache(path.getIvyInstance(), 
organisation, module,

Added: ant/ivy/core/trunk/test/repositories/1/packaging/module7/ivys/ivy-1.0.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/packaging/module7/ivys/ivy-1.0.xml?rev=1555476&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/packaging/module7/ivys/ivy-1.0.xml 
(added)
+++ ant/ivy/core/trunk/test/repositories/1/packaging/module7/ivys/ivy-1.0.xml 
Sun Jan  5 10:37:46 2014
@@ -0,0 +1,27 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you 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.    
+-->
+<ivy-module version="1.0">
+    <info organisation="packaging" module="module7" revision="1.0" />
+    <configurations>
+        <conf name="default" />
+    </configurations>
+    <publications>
+        <artifact name="module7" type="jar" ext="jar.pack.gz" 
packaging="jar,pack200" />
+    </publications>
+</ivy-module>

Propchange: 
ant/ivy/core/trunk/test/repositories/1/packaging/module7/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ant/ivy/core/trunk/test/repositories/1/packaging/module7/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: 
ant/ivy/core/trunk/test/repositories/1/packaging/module7/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
ant/ivy/core/trunk/test/repositories/1/packaging/module7/jars/module7-1.0.jar.pack.gz
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/packaging/module7/jars/module7-1.0.jar.pack.gz?rev=1555476&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
ant/ivy/core/trunk/test/repositories/1/packaging/module7/jars/module7-1.0.jar.pack.gz
------------------------------------------------------------------------------
    svn:mime-type = application/x-gzip

Added: ant/ivy/core/trunk/test/repositories/1/packaging/module8/ivys/ivy-1.0.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/packaging/module8/ivys/ivy-1.0.xml?rev=1555476&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/packaging/module8/ivys/ivy-1.0.xml 
(added)
+++ ant/ivy/core/trunk/test/repositories/1/packaging/module8/ivys/ivy-1.0.xml 
Sun Jan  5 10:37:46 2014
@@ -0,0 +1,27 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you 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.    
+-->
+<ivy-module version="1.0">
+    <info organisation="packaging" module="module8" revision="1.0" />
+    <configurations>
+        <conf name="default" />
+    </configurations>
+    <dependencies>
+        <dependency org="packaging" name="module7" rev="1.0" />
+       </dependencies>
+</ivy-module>

Propchange: 
ant/ivy/core/trunk/test/repositories/1/packaging/module8/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ant/ivy/core/trunk/test/repositories/1/packaging/module8/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: 
ant/ivy/core/trunk/test/repositories/1/packaging/module8/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to