HI, all

    I used ivy for years and aways used the ivy configuration for some
common case like depend on two or more configurations of the dependency.

    In ivy, the configuration will be like this : 'runtime -> compile(*),
runtime(*)'. It says that the configuration 'runtime' of this project will
depends on the "compile" and 'runtime' configurations of the dependency.
And compile(*) is to say that if no compile configuration found in the
dependency, "*" will be used to avoid failure.

    In gradle, when I want to use similar format in configuration, the
gradle will reports error and don't support configuration like :
'compile(*)', 'compile, runtime'.

   Even for  '*',  standard ivy format for all configurations, the gradle
doesn'tsupport : gradle will not report error, but nothing of this
dependency will be effective.

   To confirm this case, I checked the source code of gradle. In
class DefaultIvyDependencyResolver, I found the reason:

     private ResolveOptions createResolveOptions(Configuration
configuration) {
        ResolveOptions resolveOptions = new ResolveOptions();
        resolveOptions.setDownload(false);
       * resolveOptions.setConfs(WrapUtil.toArray(configuration.getName()));
*
        return resolveOptions;
    }

       In this method, the configuration name will be directly passed to
ivy resolveOptions by a simply wrap from a String to a String[]. So when the
configuration is 'compile,runtime', I expect that the ivy will handle two
configurations like String[]{"compile", "runtime"} , but gradle will pass a
String["compile,runtime"] to ivy.

       This is not the way that Ivy works for the configuration of
denpendency. The support for complex ivy configuration is very powerful
and convenient. Now in gradle, I have to write two lines to set
one dependency with two configuration like this:

felixProvidedBundle group:'org.apache.felix',
name:'org.apache.felix.webconsole', version:'3.1.8', configuration:'master'
felixProvidedBundle group:'org.apache.felix',
name:'org.apache.felix.webconsole', version:'3.1.8',
configuration:'provided'

      And I have no way to support this format "compile(*)".

      Here is a real ivy dependencies setting for
'org.apache.felix.webconsole', we can see that the conf properties are aways
complex.

<dependencies>
<dependency org="javax.servlet" name="servlet-api" rev="2.4" force="true"
conf="provided->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="commons-fileupload" name="commons-fileupload" rev="1.1.1"
force="true" conf="optional->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="commons-io" name="commons-io" rev="1.4" force="true"
conf="optional->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="org.osgi" name="org.osgi.core" rev="4.1.0" force="true"
conf="provided->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="org.osgi" name="org.osgi.compendium" rev="4.1.0"
force="true" conf="provided->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="org.json" name="json" rev="20070829" force="true"
conf="optional->compile(*),master(*)"/>
<dependency org="org.apache.felix" name="org.apache.felix.scr" rev="1.6.0"
force="true" conf="provided->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="org.apache.felix" name="org.apache.felix.shell" rev="1.0.0"
force="true" conf="provided->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="org.apache.felix" name="org.apache.felix.framework"
rev="2.0.2" force="true"
conf="optional->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="org.apache.felix" name="org.apache.felix.utils" rev="1.0.0"
force="true" conf="optional->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="org.apache.felix" name="org.osgi.service.obr" rev="1.0.2"
force="true" conf="provided->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="org.apache.felix" name="org.apache.felix.bundlerepository"
rev="1.6.0" force="true"
conf="optional->compile(*),provided(*),runtime(*),master(*)"/>
<dependency org="junit" name="junit" rev="4.0" force="true"
conf="test->runtime(*),master(*)"/>
<dependency org="org.easymock" name="easymock" rev="2.4" force="true"
conf="test->runtime(*),master(*)"/>
<dependency org="org.mockito" name="mockito-all" rev="1.7" force="true"
conf="test->runtime(*),master(*)"/>
</dependencies>

      So, My suggestion is that we need to support it in gradle, since
gradle uses ivy as dependency manager and ivy supports this feature.


Sky Ao

Reply via email to