mirror of https://github.com/apache/ant-ivy
fix computation of the extension of unpacked artifacts
git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/trunk@1555476 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a63411d616
commit
5d5f09ea37
|
|
@ -39,10 +39,15 @@ public class Pack200Packing extends StreamPacking {
|
|||
@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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,10 @@ public class ZipPacking extends ArchivePacking {
|
|||
@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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,6 +287,25 @@ public class IvyCachePathTest extends TestCase {
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Binary file not shown.
|
|
@ -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>
|
||||
Loading…
Reference in New Issue