ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Scokart <gscok...@gmail.com>
Subject Re: svn commit: r789095 - in /ant/ivy/core/trunk: ./ doc/ivyfile/ src/java/org/apache/ivy/core/module/descriptor/ test/java/org/apache/ivy/core/resolve/ test/repositories/2/mod5.1/ test/repositories/2/mod5.2/
Date Mon, 06 Jul 2009 11:19:43 GMT
I preffer much more this example than the ones with colors.

I guess that this make sense only inside configuration expressions using
intersection.  Am I right?



Gilles Scokart


2009/7/1 Xavier Hanin <xavier.hanin@gmail.com>

> Here's a real world example:<conf name="win32" e:axis="platform" />
> <conf name="win64" e:axis="platform" />
> <conf name="linux32" e:axis="platform" />
> <conf name="linux64" e:axis="platform" />
>
> <conf name="debug" e:axis="debug" />
> <conf name="release" e:axis="debug" />
>
> It's nice to be able to refer to the platform configurations, especially if
> the configurations are defined in a separate file, or maybe even several
> ones, so you don't know in advance all the platform configurations.
>
> Does it make sense for you?
>
> Xavier
>
> On Mon, Jun 29, 2009 at 8:24 PM, Gilles Scokart <gscokart@gmail.com>
> wrote:
>
> > Do you have a concrete use case for this feature?  Based on the the
> > example,
> > I didn't catch it directly.  Maybe a real example combining 2 real axes
> > (other than 'color') would help.
> >
> >
> > Gilles Scokart
> >
> >
> > 2009/6/28 <xavier@apache.org>
> >
> > > Author: xavier
> > > Date: Sun Jun 28 13:02:10 2009
> > > New Revision: 789095
> > >
> > > URL: http://svn.apache.org/viewvc?rev=789095&view=rev
> > > Log:
> > > NEW: configuration groups (IVY-1097)
> > >
> > > Added:
> > >
> > >
> >
>  ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
> > >   (with props)
> > >    ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.dll   (with
> > > props)
> > >    ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.jar   (with
> > > props)
> > >    ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.so   (with
> > > props)
> > >    ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.5.xml   (with
> > props)
> > >    ant/ivy/core/trunk/test/repositories/2/mod5.2/ivy-3.1.xml   (with
> > props)
> > > Modified:
> > >    ant/ivy/core/trunk/CHANGES.txt
> > >    ant/ivy/core/trunk/doc/ivyfile/dependency.html
> > >
> > >
> >
>  ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
> > >
> > >
> >
>  ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
> > >
> > >
> >
>  ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
> > >
> > > Modified: ant/ivy/core/trunk/CHANGES.txt
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=789095&r1=789094&r2=789095&view=diff
> > >
> > >
> >
> ==============================================================================
> > > --- ant/ivy/core/trunk/CHANGES.txt (original)
> > > +++ ant/ivy/core/trunk/CHANGES.txt Sun Jun 28 13:02:10 2009
> > > @@ -90,6 +90,7 @@
> > >    trunk
> > >  =====================================
> > >  - NEW: configuration intersections (IVY-1093)
> > > +- NEW: configuration groups (IVY-1097)
> > >
> > >  - IMPROVEMENT: Added support for NTLM authentication (IVY-1094)
> (thanks
> > to
> > > Mathieu Anquetin)
> > >  - IMPROVEMENT: Standalone runner should accept all the same parameters
> > as
> > > ant tasks (IVY-1090)
> > >
> > > Modified: ant/ivy/core/trunk/doc/ivyfile/dependency.html
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/ivyfile/dependency.html?rev=789095&r1=789094&r2=789095&view=diff
> > >
> > >
> >
> ==============================================================================
> > > --- ant/ivy/core/trunk/doc/ivyfile/dependency.html (original)
> > > +++ ant/ivy/core/trunk/doc/ivyfile/dependency.html Sun Jun 28 13:02:10
> > 2009
> > > @@ -33,12 +33,14 @@
> > >  The revision can be given as a fixed one (1.5.2, for instance) or as a
> > > latest (or dynamic) one. Several possibilities for dynamic revisions
> are
> > > implemented in Ivy:
> > >  <ul>
> > >  <li>latest.integration</li> selects the latest revision of the
> > dependency
> > > module.
> > > -<li>latest.[any status]</li> selects the latest revision of the
> > dependency
> > > module with at least the specified status. <span class="since">since
> > > 1.4</span>
> > > +<li>latest.[any status] <span class="since">since 1.4</span></li>
> > selects
> > > the latest revision of the dependency module with at least the
> specified
> > > status.
> > > +
> > >  For instance latest.milestone will select the latest version being
> > either
> > > a milestone or a release, and latest.release will only selects the
> latest
> > > release. Note that in order to find the latest revision with the
> > appropriate
> > > status Ivy has to parse all the ivy files in your repository from the
> > last
> > > one until it finds such a revision. Hence don't be surprised if the
> > > resolution slow down.
> > >  See also [[settings/statuses]] to see how to configure module
> statuses.
> > >  <li>end the revision with a +</li> selects the latest sub-revision
of
> > the
> > > dependency module. For instance,
> > >  if the dependency module exists in revision 1.0.3, 1.0.7 and 1.1.2,
> > > "1.0.+" will select 1.0.7.
> > > -<li>version ranges</li> mathematical notation for ranges can be
used
> to
> > > match a range of version. <span class="since">since 1.4</span>
> > > +<li>version ranges <span class="since">since 1.4</span></li>
> > mathematical
> > > notation for ranges can be used to match a range of version.
> > > +
> > >  Examples:
> > >  [1.0,2.0] matches all versions greater or equal to 1.0 and lower or
> > equal
> > > to 2.0
> > >  [1.0,2.0[ matches all versions greater or equal to 1.0 and lower than
> > 2.0
> > > @@ -116,7 +118,30 @@
> > >
> > >  Moreover, the mapping '*->@' is handled as a specific case with
> > > configuration intersections: it maps also the intersections. So if one
> > > resolve conf A+B in a module which defines a dependency with mapping
> > *->@,
> > > the mapping *->@ is interpreted as A+B->A+B so the intersection of A
> and
> > B
> > > will be resolved in the dependency.
> > >
> > > -<span class="since">since 1.4</span> you can add simple conditions
in
> > the
> > > dependency mapping. This is done by adding a condition between '[' and
> > ']'.
> > > If the condition evaluates to <code>true</code>, the mapping is
> > performed.
> > > If the condition evaluates to <code>false</code>, the mapping will
be
> > > ignored. For instance, <code>test->[org=A]runtime,[org=B]default</code>
> > > means that the <code>test</code> configuration will be mapped to
the
> > > <code>runtime</code> conf for the dependencies of organisation
'A' and
> to
> > > the <code>default</code> conf for dependencies of organisation
'B'.
> > > +<span class="since">since 2.1</span> you can refer to a group
of
> > > configurations sharing the same value for an attribute as left side
> part
> > of
> > > the dependency mapping.
> > > +
> > > +The syntax is
> > > +<code>*[att=value]</code>
> > > +where <em>att</em> is the name of the attribute shared by the
> > > configurations of the group, and <em>value</em is the value for this
> > > attribute that configurations must have to be part of the group. This
> is
> > > especially useful with extra attributes.
> > > +
> > > +For instance, if you have:
> > > +<code>
> > > +<configurations>
> > > +       <conf name="red" e:axis="color" />
> > > +       <conf name="blue" e:axis="color" />
> > > +
> > > +       <conf name="windows" e:axis="platform" />
> > > +       <conf name="linux" e:axis="platform"/>
> > > +</configurations>
> > > +</code>
> > > +
> > > +Then you can do:
> > > +<code>
> > > +<dependency org="acme" name="foo" rev="2.0"
> > > conf="*[axis=platform]->default"/>
> > > +</code>
> > > +To map the windows and linux configurations (the one which have the
> > > attribute axis equal to platform) to the default configuration of foo.
> > > +
> > > +<span class="since">since 1.4</span> you can add simple conditions
in
> > the
> > > right side of the dependency mapping. This is done by adding a
> condition
> > > between '[' and ']'. If the condition evaluates to <code>true</code>,
> the
> > > mapping is performed. If the condition evaluates to <code>false</code>,
> > the
> > > mapping will be ignored. For instance,
> > > <code>test->[org=A]runtime,[org=B]default</code> means that
the
> > > <code>test</code> configuration will be mapped to the
> > <code>runtime</code>
> > > conf for the dependencies of organisation 'A' and to the
> > > <code>default</code> conf for dependencies of organisation 'B'.
> > >
> > >  <li>Specify a semi-column separated list of any of the previous
> > > specs.</li> In this case, it is the union of the mapping which is kept.
> > For
> > > instance, 'A -> B; * -> C' means that B conf is needed in A conf and
C
> > conf
> > > is need in all master conf... so both B & C dep conf are required in A
> > > master conf
> > >  </ul>
> > >
> > > Added:
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java?rev=789095&view=auto
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
> > > (added)
> > > +++
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
> > > Sun Jun 28 13:02:10 2009
> > > @@ -0,0 +1,72 @@
> > > +/*
> > > + *  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.
> > > + *
> > > + */
> > > +package org.apache.ivy.core.module.descriptor;
> > > +
> > > +import java.util.Iterator;
> > > +import java.util.Map;
> > > +
> > > +/**
> > > + * A configuration which is actually a group of several
> configurations.
> > > + */
> > > +public class ConfigurationGroup extends Configuration {
> > > +
> > > +    private final Map/*<String, Configuration>*/ members;
> > > +
> > > +    public ConfigurationGroup(String confName, Map /*<String,
> > > Configuration>*/ members) {
> > > +        super(confName);
> > > +        this.members = members;
> > > +    }
> > > +
> > > +    /**
> > > +     * Returns the list of configurations' names this object is a
> group
> > > of.
> > > +     * <p>
> > > +     * This list is built from the configuration name, if some of
> these
> > > configuration names have
> > > +     * actually not been recognized in the module, they will be
> > > <code>null</code> when accessed from
> > > +     * {@link #getIntersectedConfiguration(String)}.
> > > +     * </p>
> > > +     *
> > > +     * @return the list of configurations' names this object is an
> > > intersection of.
> > > +     */
> > > +    public String[] getMembersConfigurationNames() {
> > > +        return (String[]) members.keySet()
> > > +                    .toArray(new String[members.size()]);
> > > +    }
> > > +
> > > +    /**
> > > +     * Returns the {@link Configuration} object for the given conf
> name,
> > > or
> > > +     * <code>null</code> if the given conf name is not part of
this
> > group
> > > or if this conf
> > > +     * name isn't defined in the module in which this group has been
> > > built.
> > > +     *
> > > +     * @param confName
> > > +     *            the name of the configuration to return.
> > > +     * @return the member {@link Configuration} object for the given
> > conf
> > > name
> > > +     */
> > > +    public Configuration getMemberConfiguration(String confName) {
> > > +        return (Configuration) members.get(confName);
> > > +    }
> > > +
> > > +    public Visibility getVisibility() {
> > > +        for (Iterator it = members.values().iterator(); it.hasNext();)
> {
> > > +            Configuration c = (Configuration) it.next();
> > > +            if (c != null &&
> > Visibility.PRIVATE.equals(c.getVisibility()))
> > > {
> > > +                return Visibility.PRIVATE;
> > > +            }
> > > +        }
> > > +        return Visibility.PUBLIC;
> > > +    }
> > > +}
> > >
> > > Propchange:
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > >    svn:mime-type = text/plain
> > >
> > > Modified:
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java?rev=789095&r1=789094&r2=789095&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
> > > (original)
> > > +++
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
> > > Sun Jun 28 13:02:10 2009
> > > @@ -305,20 +305,37 @@
> > >                         }
> > >                     }
> > >                 }
> > > +                List confsList = (List)
> confs.get(moduleConfiguration);
> > > +                if (confsList != null) {
> > > +                    intersectedDepConfs.addAll(confsList);
> > > +                }
> > >                 if (intersectedDepConfs.isEmpty()) {
> > >                     List defConfs = (List) confs.get("*");
> > >                     if (defConfs != null) {
> > >                         for (Iterator it = defConfs.iterator();
> > > it.hasNext();) {
> > >                             String mappedConf = (String) it.next();
> > >                             if (mappedConf != null &&
> > > mappedConf.startsWith("@+")) {
> > > -                                return new String[]
> {moduleConfiguration
> > +
> > > mappedConf.substring(1)};
> > > +                                return new String[] {
> > > +                                        moduleConfiguration +
> > > mappedConf.substring(1)};
> > >                             } else if (mappedConf != null &&
> > > mappedConf.equals("@")) {
> > >                                 return new String[]
> > {moduleConfiguration};
> > >                             }
> > >                         }
> > >                     }
> > >                 }
> > > -                return (String[]) intersectedDepConfs.toArray(new
> > > String[intersectedDepConfs.size()]);
> > > +                return (String[]) intersectedDepConfs.toArray(
> > > +                            new String[intersectedDepConfs.size()]);
> > > +            } else if (c instanceof ConfigurationGroup) {
> > > +                ConfigurationGroup group = (ConfigurationGroup) c;
> > > +                Set /*<String>*/ groupDepConfs = new HashSet();
> > > +                String[] members =
> group.getMembersConfigurationNames();
> > > +                for (int i = 0; i < members.length; i++) {
> > > +                    Collection depConfs =
> > > +
> getDependencyConfigurationsIncludingExtending(
> > > +                             members[i], requestedConfiguration);
> > > +                    groupDepConfs.addAll(depConfs);
> > > +                }
> > > +                return (String[]) groupDepConfs.toArray(new
> > > String[groupDepConfs.size()]);
> > >             }
> > >         }
> > >
> > > @@ -532,6 +549,14 @@
> > >                     + "' to configuration '" + masterConf + "' of
> module
> > "
> > >                     + md.getModuleRevisionId() + " because this
> > > configuration doesn't exist!");
> > >             }
> > > +            if (config instanceof ConfigurationGroup) {
> > > +                ConfigurationGroup group = (ConfigurationGroup)
> config;
> > > +                String[] members =
> group.getMembersConfigurationNames();
> > > +                for (int i = 0; i < members.length; i++) {
> > > +                    addDependencyConfiguration(members[i], depConf);
> > > +                }
> > > +                return;
> > > +            }
> > >         }
> > >
> > >         List confsList = (List) confs.get(masterConf);
> > >
> > > Modified:
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java?rev=789095&r1=789094&r2=789095&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
> > > (original)
> > > +++
> > >
> >
> ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
> > > Sun Jun 28 13:02:10 2009
> > > @@ -23,7 +23,6 @@
> > >  import java.util.ArrayList;
> > >  import java.util.Arrays;
> > >  import java.util.Collection;
> > > -import java.util.Collections;
> > >  import java.util.Date;
> > >  import java.util.HashMap;
> > >  import java.util.Iterator;
> > > @@ -33,6 +32,8 @@
> > >  import java.util.Map;
> > >  import java.util.Set;
> > >  import java.util.Stack;
> > > +import java.util.regex.Matcher;
> > > +import java.util.regex.Pattern;
> > >
> > >  import org.apache.ivy.core.module.id.ArtifactId;
> > >  import org.apache.ivy.core.module.id.ModuleId;
> > > @@ -337,19 +338,27 @@
> > >      * @param artifact
> > >      */
> > >     public void addArtifact(String conf, Artifact artifact) {
> > > -        if (!configurations.containsKey(conf)) {
> > > +        Configuration c = getConfiguration(conf);
> > > +        if (c == null) {
> > >             throw new IllegalArgumentException("Cannot add artifact '"
> +
> > > artifact.getId().getArtifactId().getShortDescription()
> > >                     + "' to configuration '" + conf + "' of module " +
> > > revId
> > >                     + " because this configuration doesn't exist!");
> > >         }
> > > -
> > > -        Collection artifacts = (Collection) artifactsByConf.get(conf);
> > > -        if (artifacts == null) {
> > > -            artifacts = new ArrayList();
> > > -            artifactsByConf.put(conf, artifacts);
> > > +        if (c instanceof ConfigurationGroup) {
> > > +            ConfigurationGroup group = (ConfigurationGroup) c;
> > > +            String[] members = group.getMembersConfigurationNames();
> > > +            for (int i = 0; i < members.length; i++) {
> > > +                addArtifact(members[i], artifact);
> > > +            }
> > > +        } else {
> > > +            Collection artifacts = (Collection)
> > artifactsByConf.get(conf);
> > > +            if (artifacts == null) {
> > > +                artifacts = new ArrayList();
> > > +                artifactsByConf.put(conf, artifacts);
> > > +            }
> > > +            artifacts.add(artifact);
> > > +            this.artifacts.add(artifact);
> > >         }
> > > -        artifacts.add(artifact);
> > > -        this.artifacts.add(artifact);
> > >     }
> > >
> > >     public ModuleRevisionId getModuleRevisionId() {
> > > @@ -391,6 +400,23 @@
> > >     public Configuration getConfiguration(String confName) {
> > >         Configuration configuration = (Configuration)
> > > configurations.get(confName);
> > >         if (configuration == null && confName != null) {
> > > +            // let's first check if the configuration is a conf group
> > > +            Matcher m =
> > > Pattern.compile("\\*\\[([^=]+)\\=([^\\]]+)\\]").matcher(confName);
> > > +            if (m.matches()) {
> > > +                String attName = m.group(1);
> > > +                String attValue = m.group(2);
> > > +
> > > +                // this is a conf group, let's search for its members
> > > +                Map /*<String,Configuration>*/ members = new
> > > LinkedHashMap();
> > > +                for (Iterator it = configurations.values().iterator();
> > > it.hasNext();) {
> > > +                    Configuration conf = (Configuration) it.next();
> > > +                    if (attValue.equals(conf.getAttribute(attName))) {
> > > +                        members.put(conf.getName(), conf);
> > > +                    }
> > > +                }
> > > +                return new ConfigurationGroup(confName, members);
> > > +            }
> > > +
> > >             // let's see if a configuration intersection is requested
> > >             String[] confs = confName.split("\\+");
> > >             if (confs.length <= 1) {
> > > @@ -413,32 +439,51 @@
> > >     }
> > >
> > >     public Artifact[] getArtifacts(String conf) {
> > > +        Configuration c = getConfiguration(conf);
> > > +        if (c == null) {
> > > +            return new Artifact[0];
> > > +        }
> > >         Collection artifacts = (Collection) artifactsByConf.get(conf);
> > > -        if (artifacts == null) {
> > > -            Configuration c = getConfiguration(conf);
> > > -            if (c instanceof ConfigurationIntersection) {
> > > -                ConfigurationIntersection intersection =
> > > (ConfigurationIntersection) c;
> > > -                String[] intersected =
> > > intersection.getIntersectedConfigurationNames();
> > > -                Set/*<Artifact>*/ intersectedArtifacts = new
> > > LinkedHashSet();
> > > -                for (int j = 0; j < intersected.length; j++) {
> > > -                    Collection arts =
> > > getArtifactsIncludingExtending(intersected[j]);
> > > -                    if (intersectedArtifacts.isEmpty()) {
> > > -                        intersectedArtifacts.addAll(arts);
> > > -                    } else {
> > > -                        intersectedArtifacts.retainAll(arts);
> > > -                    }
> > > +        if (c instanceof ConfigurationIntersection) {
> > > +            ConfigurationIntersection intersection =
> > > (ConfigurationIntersection) c;
> > > +            String[] intersected =
> > > intersection.getIntersectedConfigurationNames();
> > > +            Set/*<Artifact>*/ intersectedArtifacts = new
> > LinkedHashSet();
> > > +            for (int j = 0; j < intersected.length; j++) {
> > > +                Collection arts =
> > > getArtifactsIncludingExtending(intersected[j]);
> > > +                if (intersectedArtifacts.isEmpty()) {
> > > +                    intersectedArtifacts.addAll(arts);
> > > +                } else {
> > > +                    intersectedArtifacts.retainAll(arts);
> > >                 }
> > > -                return (Artifact[]) intersectedArtifacts.toArray(new
> > > Artifact[intersectedArtifacts.size()]);
> > > -            } else {
> > > -                return new Artifact[0];
> > >             }
> > > +            if (artifacts != null) {
> > > +                intersectedArtifacts.addAll(artifacts);
> > > +            }
> > > +            return (Artifact[]) intersectedArtifacts.toArray(
> > > +                new Artifact[intersectedArtifacts.size()]);
> > > +        } else if (c instanceof ConfigurationGroup) {
> > > +            ConfigurationGroup group = (ConfigurationGroup) c;
> > > +            String[] members = group.getMembersConfigurationNames();
> > > +            Set/*<Artifact>*/ groupArtifacts = new LinkedHashSet();
> > > +            for (int i = 0; i < members.length; i++) {
> > > +
> > >  groupArtifacts.addAll(getArtifactsIncludingExtending(members[i]));
> > > +            }
> > > +            if (artifacts != null) {
> > > +                groupArtifacts.addAll(artifacts);
> > > +            }
> > > +            return (Artifact[]) groupArtifacts.toArray(new
> > > Artifact[groupArtifacts.size()]);
> > >         } else {
> > > -            return (Artifact[]) artifacts.toArray(new
> > > Artifact[artifacts.size()]);
> > > +            if (artifacts == null) {
> > > +                return new Artifact[0];
> > > +            } else {
> > > +                return (Artifact[]) artifacts.toArray(new
> > > Artifact[artifacts.size()]);
> > > +            }
> > >         }
> > >     }
> > >
> > >     private Collection/*<Artifact>*/
> > getArtifactsIncludingExtending(String
> > > conf) {
> > > -        Collection extendingConfs =
> > > Configuration.findConfigurationExtending(conf, getConfigurations());
> > > +        Collection extendingConfs =
> > > Configuration.findConfigurationExtending(
> > > +                                                            conf,
> > > getConfigurations());
> > >         Set/*<Artifact>*/ artifacts = new LinkedHashSet();
> > >         Collection arts = (Collection) artifactsByConf.get(conf);
> > >         if (arts != null) {
> > >
> > > Modified:
> > >
> ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=789095&r1=789094&r2=789095&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
> > > (original)
> > > +++
> > >
> ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
> > > Sun Jun 28 13:02:10 2009
> > > @@ -3747,6 +3747,31 @@
> > >         assertFalse(getArchiveFileInCache("org2", "mod2.8", "0.6",
> > > "art28-windows-debug", "jar", "jar").exists());
> > >     }
> > >
> > > +    public void testConfigurationGroups() throws Exception {
> > > +        // mod5.2;3.1 -> mod5.1;4.5 (*->@)
> > > +        // mod5.1;4.5 -> mod1.2;2.0 (B,*[axis=platform]->default)
> > > +        // mod5.1;4.5 -> mod2.2;0.9
> > (B,windows->myconf1;B,linux->myconf2)
> > > +        // mod5.1;4.5 -> mod2.1;0.5 (B,windows->A+B)
> > > +        // mod5.1;4.5 -> mod2.8;0.6
> > (windows,linux->@+thread+debug;A,B->*)
> > > +        ivy.resolve(new
> > > File("test/repositories/2/mod5.2/ivy-3.1.xml").toURL(),
> > > +            getResolveOptions(new String[] {"B+linux"}));
> > > +
> > > +        assertFalse(getArchiveFileInCache("org5", "mod5.1", "4.5",
> > > "art51A", "jar", "jar").exists());
> > > +        assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.5",
> > > "art51B", "jar", "jar").exists());
> > > +        assertFalse(getArchiveFileInCache("org5", "mod5.1", "4.5",
> > > "art51B", "dll", "dll").exists());
> > > +        assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.5",
> > > "art51B", "so", "so").exists());
> > > +        assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0",
> > > "mod1.2", "jar", "jar").exists());
> > > +        assertFalse(getArchiveFileInCache("org2", "mod2.2", "0.9",
> > > "art22-1", "jar", "jar").exists());
> > > +        assertTrue(getArchiveFileInCache("org2", "mod2.2", "0.9",
> > > "art22-2", "jar", "jar").exists());
> > > +        assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.5",
> > > "art21A", "jar", "jar").exists());
> > > +        assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.5",
> > > "art21B", "jar", "jar").exists());
> > > +        assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.5",
> > > "art21AB", "jar", "jar").exists());
> > > +        assertTrue(getArchiveFileInCache("org2", "mod2.8", "0.6",
> > > "art28-linux-debug-thread", "jar", "jar").exists());
> > > +        assertFalse(getArchiveFileInCache("org2", "mod2.8", "0.6",
> > > "art28-linux-debug", "jar", "jar").exists());
> > > +        assertFalse(getArchiveFileInCache("org2", "mod2.8", "0.6",
> > > "art28-windows-debug-thread", "jar", "jar").exists());
> > > +        assertFalse(getArchiveFileInCache("org2", "mod2.8", "0.6",
> > > "art28-windows-debug", "jar", "jar").exists());
> > > +    }
> > > +
> > >     public void testResolveFallbackConfiguration() throws Exception {
> > >         // mod10.2 depends on mod5.1 conf runtime(default)
> > >         ivy.resolve(new
> > > File("test/repositories/2/mod10.2/ivy-1.0.xml").toURL(),
> > >
> > > Added: ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.dll
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.dll?rev=789095&view=auto
> > >
> > >
> >
> ==============================================================================
> > > Binary file - no diff available.
> > >
> > > Propchange:
> ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.dll
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > >    svn:mime-type = application/octet-stream
> > >
> > > Added: ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.jar
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.jar?rev=789095&view=auto
> > >
> > >
> >
> ==============================================================================
> > > Binary file - no diff available.
> > >
> > > Propchange:
> ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.jar
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > >    svn:mime-type = application/octet-stream
> > >
> > > Added: ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.so
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/2/mod5.1/art51B-4.5.so?rev=789095&view=auto
> > >
> > >
> >
> ==============================================================================
> > > Binary file - no diff available.
> > >
> > > Propchange: ant/ivy/core/trunk/test/repositories/2/mod5.1/
> art51B-4.5.so
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > >    svn:mime-type = application/octet-stream
> > >
> > > Added: ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.5.xml
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.5.xml?rev=789095&view=auto
> > >
> > >
> >
> ==============================================================================
> > > --- ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.5.xml (added)
> > > +++ ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.5.xml Sun Jun
> 28
> > > 13:02:10 2009
> > > @@ -0,0 +1,45 @@
> > > +<!--
> > > +   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:e="http://ant.apache.org/ivy/extra">
> > > +       <info organisation="org5"
> > > +              module="mod5.1"
> > > +              revision="4.5"
> > > +              status="integration"
> > > +              publication="20090501110000"
> > > +       />
> > > +       <configurations>
> > > +               <conf name="A" />
> > > +               <conf name="B" />
> > > +
> > > +               <conf name="windows" e:axis="platform" />
> > > +               <conf name="linux" e:axis="platform"/>
> > > +       </configurations>
> > > +       <publications>
> > > +               <artifact name="art51A" type="jar"
> > > conf="A,*[axis=platform]"/>
> > > +               <artifact name="art51B" type="jar"
> > > conf="B,*[axis=platform]"/>
> > > +               <artifact name="art51B" type="dll" conf="B,windows"/>
> > > +               <artifact name="art51B" type="so" conf="B,linux"/>
> > > +       </publications>
> > > +       <dependencies>
> > > +               <dependency org="org1" name="mod1.2" rev="2.0"
> > > conf="B,*[axis=platform]->default"/>
> > > +               <dependency org="org2" name="mod2.2" rev="0.9"
> > > conf="B,windows->myconf1;B,linux->myconf2"/>
> > > +               <dependency org="org2" name="mod2.1" rev="0.5"
> > > conf="B,windows->A+B"/>
> > > +               <dependency org="org2" name="mod2.8" rev="0.6"
> > > conf="windows,linux->@+thread+debug;A,B->*"/>
> > > +       </dependencies>
> > > +</ivy-module>
> > >
> > > Propchange: ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.5.xml
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > >    svn:mime-type = text/plain
> > >
> > > Added: ant/ivy/core/trunk/test/repositories/2/mod5.2/ivy-3.1.xml
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/2/mod5.2/ivy-3.1.xml?rev=789095&view=auto
> > >
> > >
> >
> ==============================================================================
> > > --- ant/ivy/core/trunk/test/repositories/2/mod5.2/ivy-3.1.xml (added)
> > > +++ ant/ivy/core/trunk/test/repositories/2/mod5.2/ivy-3.1.xml Sun Jun
> 28
> > > 13:02:10 2009
> > > @@ -0,0 +1,37 @@
> > > +<!--
> > > +   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="org5"
> > > +              module="mod5.2"
> > > +              revision="3.1"
> > > +              status="integration"
> > > +              publication="20090601110000"
> > > +       />
> > > +       <configurations>
> > > +               <conf name="A"/>
> > > +               <conf name="B"/>
> > > +
> > > +               <conf name="windows"/>
> > > +               <conf name="linux"/>
> > > +       </configurations>
> > > +       <publications />
> > > +       <dependencies>
> > > +               <dependency name="mod5.1" rev="4.5" conf="*->@"/>
> > > +       </dependencies>
> > > +</ivy-module>
> > >
> > > Propchange: ant/ivy/core/trunk/test/repositories/2/mod5.2/ivy-3.1.xml
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > >    svn:mime-type = text/plain
> > >
> > >
> > >
> >
>
>
>
> --
> Xavier Hanin - 4SH France
> BordeauxJUG co leader - http://www.bordeauxjug.org/
> Blogger - http://xhab.blogspot.com/
> Apache Ivy Creator - http://ant.apache.org/ivy/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message