You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by hi...@apache.org on 2011/09/25 13:46:37 UTC
svn commit: r1175395 - in /incubator/easyant/core/trunk: ./
repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/
src/main/java/org/apache/easyant/core/
src/main/java/org/apache/easyant/core/ivy/repository/
src/main/java/org/apache/easyant/core...
Author: hibou
Date: Sun Sep 25 13:46:37 2011
New Revision: 1175395
URL: http://svn.apache.org/viewvc?rev=1175395&view=rev
Log:
IP cleanup: remove the Easyant JarResolver and use the one from Ivy trunk
Added:
incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/
incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.ivy (with props)
incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.jar (with props)
Removed:
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ivy/repository/
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ivy/resolvers/
Modified:
incubator/easyant/core/trunk/module.ivy
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java
incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/core/default-easyant-ivysettings.xml
incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java
Modified: incubator/easyant/core/trunk/module.ivy
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/module.ivy?rev=1175395&r1=1175394&r2=1175395&view=diff
==============================================================================
--- incubator/easyant/core/trunk/module.ivy (original)
+++ incubator/easyant/core/trunk/module.ivy Sun Sep 25 13:46:37 2011
@@ -31,7 +31,7 @@
<dependency org="org.apache.ant" name="ant-testutil" rev="1.8.2" conf="test->default" transitive="false" />
<dependency org="org.apache.ant" name="ant" rev="1.8.2" conf="default->default"/>
- <dependency org="org.apache.ivy" name="ivy" rev="2.3.0-r1033912-patched" conf="default->core"/>
+ <dependency org="org.apache.ivy" name="ivy" rev="2.3.0-r1165119" conf="default->core"/>
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b2" conf="default->default"/>
<dependency org="commons-cli" name="commons-cli" rev="1.2" conf="default->default"/>
<!-- ivy uses a different namespace to reference ant -->
Added: incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.ivy
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.ivy?rev=1175395&view=auto
==============================================================================
--- incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.ivy (added)
+++ incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.ivy Sun Sep 25 13:46:37 2011
@@ -0,0 +1,62 @@
+<!--
+ 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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+ <info organisation="org.apache.ivy" module="ivy" revision="2.3.0-r1165119" status="milestone" publication="20110925153700">
+ <description homepage="http://ant.apache.org/ivy/">
+ Apache Ivy is a tool for managing (recording, tracking, resolving and reporting) project dependencies.
+ </description>
+ </info>
+ <configurations>
+ <conf name="core" description="only ivy jar, without any dependencies"/>
+ <conf name="httpclient" extends="core" description="core + optional httpclient for better http handling"/>
+ <conf name="oro" extends="core" description="to use optional glob matcher"/>
+ <conf name="vfs" extends="core" description="core + optional VirtualFileSystem(VFS) support"/>
+ <conf name="sftp" extends="core" description="core + optional SFTP support"/>
+ <conf name="standalone" extends="core" description="to launch in standalone mode (from command line)"/>
+ <conf name="ant" extends="core" description="core + ant jar provided as a dependency"/>
+ <conf name="default" extends="core" description="full ivy with all dependencies"/>
+ <conf name="test" description="dependencies used for junit testing ivy" visibility="private"/>
+ <conf name="source" description="ivy sources"/>
+ </configurations>
+ <publications>
+ <artifact name="ivy" type="jar" conf="core"/>
+ </publications>
+ <dependencies>
+ <dependency org="ant" name="ant" rev="1.6.2" conf="default,ant->default"/>
+ <dependency org="ant" name="ant-nodeps" rev="1.6.2" conf="default"/>
+ <dependency org="ant" name="ant-trax" rev="1.6.2" conf="default"/>
+ <dependency org="commons-httpclient" name="commons-httpclient" rev="3.0" conf="default,httpclient->runtime,master"/>
+ <dependency org="oro" name="oro" rev="2.0.8" conf="default,oro->default"/>
+ <dependency org="commons-vfs" name="commons-vfs" rev="1.0" conf="default,vfs->default"/>
+ <dependency org="com.jcraft" name="jsch" rev="0.1.31" conf="default,sftp->default"/>
+
+ <!-- Test dependencies -->
+ <dependency org="junit" name="junit" rev="3.8.2" conf="test->default"/>
+ <dependency org="commons-lang" name="commons-lang" rev="2.5" revConstraint="[1.0,3.0[" conf="test->default"/>
+ <dependency org="org.apache.ant" name="ant-testutil" rev="1.7.0" conf="test->default" transitive="false"/>
+ <dependency org="ant" name="ant-launcher" rev="1.6.2" conf="test->default" transitive="false"/>
+
+ <!-- This dependency is necessary for having validation in junit tests when running with JDK1.4 -->
+ <dependency org="xerces" name="xercesImpl" rev="2.6.2" conf="test->default"/>
+ <dependency org="xerces" name="xmlParserAPIs" rev="2.6.2" conf="test->default"/>
+
+ <!-- Global exclude for junit -->
+ <exclude org="junit" module="junit" conf="core,default,httpclient,oro,vfs,sftp,standalone,ant"/>
+ </dependencies>
+</ivy-module>
Propchange: incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.ivy
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.ivy
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.ivy
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.jar
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.jar?rev=1175395&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/easyant/core/trunk/repository/third-party-lib/org.apache.ivy/ivy/2.3.0-r1165119/ivy.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java?rev=1175395&r1=1175394&r2=1175395&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java Sun Sep 25 13:46:37 2011
@@ -21,7 +21,12 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
+import java.lang.reflect.Method;
+import java.net.JarURLConnection;
import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Properties;
@@ -113,10 +118,7 @@ public class EasyAntEngine {
"/org/apache/easyant/core/extra-easyant-ivysettings.xml")
.toExternalForm());
- project.setNewProperty(EasyAntMagicNames.EASYANT_CORE_REPO_URL, this
- .getClass().getResource(
- "/org/apache/easyant/core/repository/modules")
- .toExternalForm());
+ project.setNewProperty(EasyAntMagicNames.EASYANT_CORE_JAR_URL, guessEasyantCoreJarUrl().toExternalForm());
if (this.getClass().getResource(
"/org/apache/easyant/repository/extra-modules") != null) {
project.setNewProperty(EasyAntMagicNames.EASYANT_EXTRA_REPO_URL,
@@ -166,6 +168,41 @@ public class EasyAntEngine {
return ivyAntSettings.getConfiguredIvyInstance(easyantIvyConfigure);
}
+ private static Method getLocalURL;
+
+ public static URL guessEasyantCoreJarUrl() {
+ URL url = EasyAntEngine.class.getResource("/");
+ try {
+ if ("jar".equals(url.getProtocol())) {
+ return getJarUrl(url);
+ } else if ("bundleresource".equals(url.getProtocol())) {
+ URLConnection conn = url.openConnection();
+ try {
+ if (getLocalURL == null
+ && "org.eclipse.osgi.framework.internal.core.BundleURLConnection".equals(conn.getClass()
+ .getName())) {
+ EasyAntEngine.getLocalURL = conn.getClass().getMethod("getLocalURL", null);
+ getLocalURL.setAccessible(true);
+ }
+ if (getLocalURL != null && conn != null) {
+ URL localJarUrl = (URL) getLocalURL.invoke(conn, null);
+ return getJarUrl(localJarUrl);
+ }
+ } catch (Throwable throwable) {
+ throw new IOException("Cannot get jar url from Equinox OSGi bundle", throwable);
+ }
+ }
+ } catch (IOException ioe) {
+ throw new RuntimeException("Easyant jar cannot be guessed", ioe);
+ }
+ return url;
+ }
+
+ private static URL getJarUrl(URL url) throws IOException {
+ JarURLConnection conn = (JarURLConnection) url.openConnection();
+ return conn.getJarFileURL();
+ }
+
/**
* Get user easyant-ivysettings file
*
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java?rev=1175395&r1=1175394&r2=1175395&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMagicNames.java Sun Sep 25 13:46:37 2011
@@ -116,10 +116,10 @@ public interface EasyAntMagicNames {
public static final String PROJECT_DEFAULT_IVYSETTINGS = "project.default.ivysettings.url";
/**
- * Name of the property containing the easyant core repository Value:
+ * Name of the property containing the url of the easyant core jar:
* {@value}
*/
- public static final String EASYANT_CORE_REPO_URL = "easyant.core.repo.url";
+ public static final String EASYANT_CORE_JAR_URL = "easyant.core.jar.url";
/**
* Name of the property containing the easyant extra repository Value:
Modified: incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/core/default-easyant-ivysettings.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/core/default-easyant-ivysettings.xml?rev=1175395&r1=1175394&r2=1175395&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/core/default-easyant-ivysettings.xml (original)
+++ incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/core/default-easyant-ivysettings.xml Sun Sep 25 13:46:37 2011
@@ -17,11 +17,10 @@
<ivysettings>
<settings defaultResolver="easyant-default-chain"/>
<caches defaultCacheDir="${user.home}/.easyant/easyant-cache" useOrigin="true" />
- <typedef name="jar" classname="org.apache.easyant.core.ivy.resolvers.JarResolver"/>
<resolvers>
- <jar name="easyant-core-modules">
- <ivy pattern="${easyant.core.repo.url}/[organisation]/[module]/[revision]/[module].ivy"/>
- <artifact pattern="${easyant.core.repo.url}/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
+ <jar name="easyant-core-modules" url="${easyant.core.jar.url}">
+ <ivy pattern="org/apache/easyant/core/repository/modules/[organisation]/[module]/[revision]/[module].ivy"/>
+ <artifact pattern="org/apache/easyant/core/repository/modules/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
</jar>
<filesystem name="easyant-shared-modules">
<ivy pattern="${user.home}/.easyant/repository/easyant-shared-modules/[organisation]/[module]/[revision]/[module].ivy"/>
Modified: incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java?rev=1175395&r1=1175394&r2=1175395&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java (original)
+++ incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java Sun Sep 25 13:46:37 2011
@@ -27,6 +27,7 @@ import java.util.Set;
import junit.framework.Assert;
+import org.apache.easyant.core.EasyAntEngine;
import org.apache.easyant.core.EasyAntMagicNames;
import org.apache.easyant.core.descriptor.PropertyDescriptor;
import org.apache.easyant.core.report.EasyAntReport;
@@ -50,10 +51,7 @@ public class PluginServiceTest {
// configure the ivyinstance
Ivy ivy = IvyContext.pushNewContext().getIvy();
ivy.setVariable(
- EasyAntMagicNames.EASYANT_CORE_REPO_URL,
- PluginServiceTest.class.getResource(
- "/org/apache/easyant/core/repository/modules")
- .toExternalForm());
+ EasyAntMagicNames.EASYANT_CORE_JAR_URL, EasyAntEngine.guessEasyantCoreJarUrl().toExternalForm());
ivy.configure(PluginServiceTest.class
.getResource("/org/apache/easyant/core/default-easyant-ivysettings.xml"));
pluginService = new DefaultPluginServiceImpl(ivy);