Ivy
  1. Ivy
  2. IVY-215

add sort of 'fallback'-mapping to the defaultconfmapping attribute

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.4-RC1
    • Component/s: Core
    • Labels:
      None

      Description

      Allow specifying something like:
      compile->compile;[all-other-configs]->default
      where [all-other-configs] mean all configurations not mapped by the other mappings in the defaultconfmapping.

      [all-other-configs] could be specified by special characters like '%' or '+' or ...

      For more information, see http://www.jayasoft.org/node/589 point 3.

      regards,
      Maarten

        Activity

        Maarten Coene created issue -
        Hide
        Maarten Coene added a comment -

        Here is a patch.
        Is it really that simple, or am I missing something?

        Index: C:/projects/ivy/ivy/src/java/fr/jayasoft/ivy/DefaultDependencyDescriptor.java
        ===================================================================
        — C:/projects/ivy/ivy/src/java/fr/jayasoft/ivy/DefaultDependencyDescriptor.java (revision 304)
        +++ C:/projects/ivy/ivy/src/java/fr/jayasoft/ivy/DefaultDependencyDescriptor.java (working copy)
        @@ -173,6 +173,10 @@

        public String[] getDependencyConfigurations(String moduleConfiguration, String requestedConfiguration) {
        List confs = (List)_confs.get(moduleConfiguration);
        + if (confs == null)

        { + // there is no mapping defined for this configuration, add the 'other' mappings. + confs = (List)_confs.get("%"); + }

        List defConfs = (List)_confs.get("*");
        Collection ret = new LinkedHashSet();
        if (confs != null) {

        Here is a junit test for ResolveTest:

        public void testResolveOtherConfiguration() throws Exception {
        ResolveReport report = _ivy.resolve(ResolveTest.class.getResource("ivy-other.xml"), null, new String[]

        {"test"}

        , _cache, null, true);

        XmlModuleDescriptorWriter.write(report.getModuleDescriptor(), new File("output.xml"));

        assertNotNull(report);
        assertFalse(report.hasError());

        assertEquals("Number of artifacts not correct", 1, report.getConfigurationReport("test").getArtifactsNumber());
        }

        Here is the file: ivy-other.xml

        <ivy-module version="1.0">
        <info organisation="test"
        module="IVY-other"
        status="integration"
        publication="20050202110000"
        />
        <configurations defaultconfmapping="compile->A;%->B">
        <conf name="compile"/>
        <conf name="runtime" extends="compile"/>
        <conf name="test" extends="runtime"/>
        </configurations>
        <dependencies>
        <dependency org="org5" name="mod5.1" rev="4.2" force="true" conf="test" transitive="false" />
        </dependencies>
        </ivy-module>

        Show
        Maarten Coene added a comment - Here is a patch. Is it really that simple, or am I missing something? Index: C:/projects/ivy/ivy/src/java/fr/jayasoft/ivy/DefaultDependencyDescriptor.java =================================================================== — C:/projects/ivy/ivy/src/java/fr/jayasoft/ivy/DefaultDependencyDescriptor.java (revision 304) +++ C:/projects/ivy/ivy/src/java/fr/jayasoft/ivy/DefaultDependencyDescriptor.java (working copy) @@ -173,6 +173,10 @@ public String[] getDependencyConfigurations(String moduleConfiguration, String requestedConfiguration) { List confs = (List)_confs.get(moduleConfiguration); + if (confs == null) { + // there is no mapping defined for this configuration, add the 'other' mappings. + confs = (List)_confs.get("%"); + } List defConfs = (List)_confs.get("*"); Collection ret = new LinkedHashSet(); if (confs != null) { Here is a junit test for ResolveTest: public void testResolveOtherConfiguration() throws Exception { ResolveReport report = _ivy.resolve(ResolveTest.class.getResource("ivy-other.xml"), null, new String[] {"test"} , _cache, null, true); XmlModuleDescriptorWriter.write(report.getModuleDescriptor(), new File("output.xml")); assertNotNull(report); assertFalse(report.hasError()); assertEquals("Number of artifacts not correct", 1, report.getConfigurationReport("test").getArtifactsNumber()); } Here is the file: ivy-other.xml <ivy-module version="1.0"> <info organisation="test" module="IVY-other" status="integration" publication="20050202110000" /> <configurations defaultconfmapping="compile->A;%->B"> <conf name="compile"/> <conf name="runtime" extends="compile"/> <conf name="test" extends="runtime"/> </configurations> <dependencies> <dependency org="org5" name="mod5.1" rev="4.2" force="true" conf="test" transitive="false" /> </dependencies> </ivy-module>
        Hide
        Xavier Hanin added a comment -

        I've integrated your patch, it seems to work well. Thanks for your contribution.

        Show
        Xavier Hanin added a comment - I've integrated your patch, it seems to work well. Thanks for your contribution.
        Hide
        Maarten Coene added a comment -
        Show
        Maarten Coene added a comment - Documentation updated: http://www.jayasoft.org/ivy/doc/ivyfile/dependency
        Jeff Turner made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Xavier Hanin
            Reporter:
            Maarten Coene
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Due:
              Created:
              Updated:
              Resolved:

              Development