You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by gs...@apache.org on 2007/08/06 14:57:53 UTC

svn commit: r563160 - in /incubator/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/core/resolve/ResolveEngine.java src/java/org/apache/ivy/core/resolve/ResolveOptions.java test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml

Author: gscokart
Date: Mon Aug  6 07:57:48 2007
New Revision: 563160

URL: http://svn.apache.org/viewvc?view=rev&rev=563160
Log:
support *(public) and *(private) in the configuration

Added:
    incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml   (with props)
Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java

Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?view=diff&rev=563160&r1=563159&r2=563160
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Mon Aug  6 07:57:48 2007
@@ -53,6 +53,9 @@
 =====================================
 - FIX: cachepath based on a resolve done in a previous build broken (IVY-583)
 
+- IMPROVEMENT: artifactproperty should not overwrite the existing properties (IVY-587)
+- IMPROVEMENT: Support *(private) and *(public) in the confs parameter of the resolve (IVY-588)
+
    2.0.0-alpha2-incubating
 =====================================
 - NEW: Add cleancache task (IVY-565)

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?view=diff&rev=563160&r1=563159&r2=563160
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Mon Aug  6 07:57:48 2007
@@ -142,14 +142,13 @@
             boolean changing) throws ParseException, IOException {
         DefaultModuleDescriptor md;
 
-        String[] confs = options.getConfs();
-        if (confs.length == 1 && confs[0].equals("*")) {
+        if (options.useSpecialConfs()) {
             // create new resolve options because this is a different resolve than the real resolve
             // (which will be a resolve of a newCallerInstance module)
             ResolvedModuleRevision rmr = findModule(mrid, new ResolveOptions(options));
             if (rmr == null) {
-                md = DefaultModuleDescriptor.newCallerInstance(mrid, confs, options.isTransitive(),
-                    changing);
+                md = DefaultModuleDescriptor.newCallerInstance(mrid, 
+                    options.getConfs(rmr.getDescriptor()), options.isTransitive(), changing);
                 return new ResolveReport(md, options.getResolveId()) {
                     public boolean hasError() {
                         return true;
@@ -160,13 +159,13 @@
                     }
                 };
             } else {
-                confs = rmr.getDescriptor().getConfigurationsNames();
+                String[] confs = options.getConfs(rmr.getDescriptor());
                 md = DefaultModuleDescriptor.newCallerInstance(ModuleRevisionId.newInstance(mrid,
                     rmr.getId().getRevision()), confs, options.isTransitive(), changing);
             }
         } else {
-            md = DefaultModuleDescriptor.newCallerInstance(mrid, confs, options.isTransitive(),
-                changing);
+            md = DefaultModuleDescriptor.newCallerInstance(mrid, options.getConfs()
+                , options.isTransitive(), changing);
         }
 
         return resolve(md, options);
@@ -213,10 +212,7 @@
                 IvyContext.getContext().setCache(cacheManager.getCache());
             }
 
-            String[] confs = options.getConfs();
-            if (confs.length == 1 && confs[0].equals("*")) {
-                confs = md.getConfigurationsNames();
-            }
+            String[] confs = options.getConfs(md);
             options.setConfs(confs);
 
             if (options.getResolveId() == null) {
@@ -415,10 +411,7 @@
             IvyContext.getContext().setCache(cacheManager.getCache());
         }
 
-        String[] confs = options.getConfs();
-        if (confs.length == 1 && confs[0].equals("*")) {
-            confs = md.getConfigurationsNames();
-        }
+        String[] confs = options.getConfs(md);
         options.setConfs(confs);
 
         Date reportDate = new Date();

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java?view=diff&rev=563160&r1=563159&r2=563160
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java Mon Aug  6 07:57:48 2007
@@ -22,6 +22,7 @@
 import org.apache.ivy.core.cache.CacheManager;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleId;
+import org.apache.ivy.util.ConfigurationUtils;
 import org.apache.ivy.util.filter.Filter;
 import org.apache.ivy.util.filter.FilterHelper;
 
@@ -137,10 +138,46 @@
         return this;
     }
 
+    /**
+     * Indicates if the configurations use a special configuration 
+     * * , *(private) or *(public).
+     * When special configurations are used, to must have the module
+     * descriptor in order to get the list of configurations.
+     * @see #getConfs()
+     * @see #getConfs(ModuleDescriptor)
+     */
+    public boolean useSpecialConfs() {
+        for (int i = 0; confs != null && i < confs.length; i++) {
+            if (confs[0].startsWith("*")) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @pre can only be called if useSpecialConfs()==false.  When it is true, 
+     * you have to provide a module desciptor so that configurations can be resolved.
+     * @see #getConfs(ModuleDescriptor)
+     */
     public String[] getConfs() {
+        if (useSpecialConfs()) {
+            throw new AssertionError("ResolveOptions.getConfs() " 
+                + "can not be used for options used special confs.");
+        }
         return confs;
     }
 
+    /** 
+     * Get the aksed confs.  Special confs (like *) use the moduleDescriptor to find the values * 
+     * @param md Used to get the exact values for special confs. 
+     * */
+    public String[] getConfs(ModuleDescriptor md) {
+        //TODO add isInline, in that case, replace * by *(public).
+        return ConfigurationUtils.replaceWildcards(confs, md);
+    }
+
+    
     public ResolveOptions setConfs(String[] confs) {
         this.confs = confs;
         return this;
@@ -227,6 +264,7 @@
         return this;
     }
 
+
     public static String getDefaultResolveId(ModuleDescriptor md) {
         ModuleId module = md.getModuleRevisionId().getModuleId();
         return getDefaultResolveId(module);
@@ -235,4 +273,5 @@
     public static String getDefaultResolveId(ModuleId moduleId) {
         return moduleId.getOrganisation() + "-" + moduleId.getName();
     }
+
 }

Added: incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml?view=auto&rev=563160
==============================================================================
--- incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml (added)
+++ incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml Mon Aug  6 07:57:48 2007
@@ -0,0 +1,36 @@
+<!--
+   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="org2"
+	       module="mod2.2"
+	       revision="0.8"
+	       status="integration"
+	       publication="20041101110000"
+	/>
+	<configurations>
+		<conf name="myconf1" description="desc 1" visibility="public"/>
+		<conf name="myconf2" description="desc 2" visibility="private"/>
+	</configurations>
+	<dependencies>
+		<dependency org="org1" name="mod1.3" rev="3.0">
+			<artifact name="mod1.3-A" type="jar"/>
+			<artifact name="mod1.3-B" type="jar" conf="myconf1"/>
+		</dependency>
+	</dependencies>
+</ivy-module>

Propchange: incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



RE: svn commit: r563160 - in /incubator/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/core/resolve/ResolveEngine.java src/java/org/apache/ivy/core/resolve/ResolveOptions.java test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml

Posted by Gilles Scokart <gs...@gmail.com>.
Oups, I missed the jira reference from my comment.  I will se if I can fix
that.

Gilles

> -----Original Message-----
> From: gscokart@apache.org [mailto:gscokart@apache.org]
> Sent: lundi 6 août 2007 16:58
> To: ivy-commits@incubator.apache.org
> Subject: svn commit: r563160 - in /incubator/ivy/core/trunk: CHANGES.txt
> src/java/org/apache/ivy/core/resolve/ResolveEngine.java
> src/java/org/apache/ivy/core/resolve/ResolveOptions.java
> test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml
> 
> Author: gscokart
> Date: Mon Aug  6 07:57:48 2007
> New Revision: 563160
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=563160
> Log:
> support *(public) and *(private) in the configuration
> 
> Added:
>     incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-
> 0.8.xml   (with props)
> Modified:
>     incubator/ivy/core/trunk/CHANGES.txt
> 
> incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngin
> e.java
> 
> incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptio
> ns.java
> 
> Modified: incubator/ivy/core/trunk/CHANGES.txt
> URL:
> http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?view=dif
> f&rev=563160&r1=563159&r2=563160
> ==========================================================================
> ====
> --- incubator/ivy/core/trunk/CHANGES.txt (original)
> +++ incubator/ivy/core/trunk/CHANGES.txt Mon Aug  6 07:57:48 2007
> @@ -53,6 +53,9 @@
>  =====================================
>  - FIX: cachepath based on a resolve done in a previous build broken (IVY-
> 583)
> 
> +- IMPROVEMENT: artifactproperty should not overwrite the existing
> properties (IVY-587)
> +- IMPROVEMENT: Support *(private) and *(public) in the confs parameter of
> the resolve (IVY-588)
> +
>     2.0.0-alpha2-incubating
>  =====================================
>  - NEW: Add cleancache task (IVY-565)
> 
> Modified:
> incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngin
> e.java
> URL:
> http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/
> ivy/core/resolve/ResolveEngine.java?view=diff&rev=563160&r1=563159&r2=5631
> 60
> ==========================================================================
> ====
> ---
> incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngin
> e.java (original)
> +++
> incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngin
> e.java Mon Aug  6 07:57:48 2007
> @@ -142,14 +142,13 @@
>              boolean changing) throws ParseException, IOException {
>          DefaultModuleDescriptor md;
> 
> -        String[] confs = options.getConfs();
> -        if (confs.length == 1 && confs[0].equals("*")) {
> +        if (options.useSpecialConfs()) {
>              // create new resolve options because this is a different
> resolve than the real resolve
>              // (which will be a resolve of a newCallerInstance module)
>              ResolvedModuleRevision rmr = findModule(mrid, new
> ResolveOptions(options));
>              if (rmr == null) {
> -                md = DefaultModuleDescriptor.newCallerInstance(mrid,
> confs, options.isTransitive(),
> -                    changing);
> +                md = DefaultModuleDescriptor.newCallerInstance(mrid,
> +                    options.getConfs(rmr.getDescriptor()),
> options.isTransitive(), changing);
>                  return new ResolveReport(md, options.getResolveId()) {
>                      public boolean hasError() {
>                          return true;
> @@ -160,13 +159,13 @@
>                      }
>                  };
>              } else {
> -                confs = rmr.getDescriptor().getConfigurationsNames();
> +                String[] confs = options.getConfs(rmr.getDescriptor());
>                  md =
> DefaultModuleDescriptor.newCallerInstance(ModuleRevisionId.newInstance(mri
> d,
>                      rmr.getId().getRevision()), confs,
> options.isTransitive(), changing);
>              }
>          } else {
> -            md = DefaultModuleDescriptor.newCallerInstance(mrid, confs,
> options.isTransitive(),
> -                changing);
> +            md = DefaultModuleDescriptor.newCallerInstance(mrid,
> options.getConfs()
> +                , options.isTransitive(), changing);
>          }
> 
>          return resolve(md, options);
> @@ -213,10 +212,7 @@
> 
> IvyContext.getContext().setCache(cacheManager.getCache());
>              }
> 
> -            String[] confs = options.getConfs();
> -            if (confs.length == 1 && confs[0].equals("*")) {
> -                confs = md.getConfigurationsNames();
> -            }
> +            String[] confs = options.getConfs(md);
>              options.setConfs(confs);
> 
>              if (options.getResolveId() == null) {
> @@ -415,10 +411,7 @@
>              IvyContext.getContext().setCache(cacheManager.getCache());
>          }
> 
> -        String[] confs = options.getConfs();
> -        if (confs.length == 1 && confs[0].equals("*")) {
> -            confs = md.getConfigurationsNames();
> -        }
> +        String[] confs = options.getConfs(md);
>          options.setConfs(confs);
> 
>          Date reportDate = new Date();
> 
> Modified:
> incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptio
> ns.java
> URL:
> http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/
> ivy/core/resolve/ResolveOptions.java?view=diff&rev=563160&r1=563159&r2=563
> 160
> ==========================================================================
> ====
> ---
> incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptio
> ns.java (original)
> +++
> incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptio
> ns.java Mon Aug  6 07:57:48 2007
> @@ -22,6 +22,7 @@
>  import org.apache.ivy.core.cache.CacheManager;
>  import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
>  import org.apache.ivy.core.module.id.ModuleId;
> +import org.apache.ivy.util.ConfigurationUtils;
>  import org.apache.ivy.util.filter.Filter;
>  import org.apache.ivy.util.filter.FilterHelper;
> 
> @@ -137,10 +138,46 @@
>          return this;
>      }
> 
> +    /**
> +     * Indicates if the configurations use a special configuration
> +     * * , *(private) or *(public).
> +     * When special configurations are used, to must have the module
> +     * descriptor in order to get the list of configurations.
> +     * @see #getConfs()
> +     * @see #getConfs(ModuleDescriptor)
> +     */
> +    public boolean useSpecialConfs() {
> +        for (int i = 0; confs != null && i < confs.length; i++) {
> +            if (confs[0].startsWith("*")) {
> +                return true;
> +            }
> +        }
> +        return false;
> +    }
> +
> +    /**
> +     * @pre can only be called if useSpecialConfs()==false.  When it is
> true,
> +     * you have to provide a module desciptor so that configurations can
> be resolved.
> +     * @see #getConfs(ModuleDescriptor)
> +     */
>      public String[] getConfs() {
> +        if (useSpecialConfs()) {
> +            throw new AssertionError("ResolveOptions.getConfs() "
> +                + "can not be used for options used special confs.");
> +        }
>          return confs;
>      }
> 
> +    /**
> +     * Get the aksed confs.  Special confs (like *) use the
> moduleDescriptor to find the values *
> +     * @param md Used to get the exact values for special confs.
> +     * */
> +    public String[] getConfs(ModuleDescriptor md) {
> +        //TODO add isInline, in that case, replace * by *(public).
> +        return ConfigurationUtils.replaceWildcards(confs, md);
> +    }
> +
> +
>      public ResolveOptions setConfs(String[] confs) {
>          this.confs = confs;
>          return this;
> @@ -227,6 +264,7 @@
>          return this;
>      }
> 
> +
>      public static String getDefaultResolveId(ModuleDescriptor md) {
>          ModuleId module = md.getModuleRevisionId().getModuleId();
>          return getDefaultResolveId(module);
> @@ -235,4 +273,5 @@
>      public static String getDefaultResolveId(ModuleId moduleId) {
>          return moduleId.getOrganisation() + "-" + moduleId.getName();
>      }
> +
>  }
> 
> Added: incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-
> 0.8.xml
> URL:
> http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/1/
> org2/mod2.2/ivys/ivy-0.8.xml?view=auto&rev=563160
> ==========================================================================
> ====
> --- incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-
> 0.8.xml (added)
> +++ incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-
> 0.8.xml Mon Aug  6 07:57:48 2007
> @@ -0,0 +1,36 @@
> +<!--
> +   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="org2"
> +	       module="mod2.2"
> +	       revision="0.8"
> +	       status="integration"
> +	       publication="20041101110000"
> +	/>
> +	<configurations>
> +		<conf name="myconf1" description="desc 1"
> visibility="public"/>
> +		<conf name="myconf2" description="desc 2"
> visibility="private"/>
> +	</configurations>
> +	<dependencies>
> +		<dependency org="org1" name="mod1.3" rev="3.0">
> +			<artifact name="mod1.3-A" type="jar"/>
> +			<artifact name="mod1.3-B" type="jar"
conf="myconf1"/>
> +		</dependency>
> +	</dependencies>
> +</ivy-module>
> 
> Propchange:
> incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml
> --------------------------------------------------------------------------
> ----
>     svn:eol-style = native
> 
> Propchange:
> incubator/ivy/core/trunk/test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml
> --------------------------------------------------------------------------
> ----
>     svn:keywords = "Author Date Id Revision"