You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Boris Brodski <br...@yahoo.com.INVALID> on 2014/07/15 11:18:13 UTC

Selecting optional dependencies of OSGi-bundles with Ivy (+150 bounty on StackOverflow)

Hello,


I posted a question about selecting optional dependencies of OSGI-bundle on Stackoverflow: 

ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow

  
          
ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
I use Ivy to resolve OSGi bundles, like org.eclipse.jdt: <dependencies> <dependency org="bundle" name="org.eclipse.jdt" rev="x.y.z"/>
</dependencies>   
View on stackoverflow.com Preview by Yahoo  
  

Even issuing a bounty of +150 didn't helped... No answers, no comments. (The bounty expired within 24 hours.)

I going to repost my question here hoping to get an answer and also hoping to give away +150 reputation on StackOverflow.



I use Ivy to resolve OSGi bundles, like org.eclipse.jdt:
<dependencies><dependencyorg="bundle"name="org.eclipse.jdt"rev="x.y.z"/></dependencies>
It works fine and gives me all mandatory dependencies.
My question is, how can I select some (not all) optional dependencies of transitive bundles?
I can:
	* Select optional dependencies of org.eclipse.jdt by activating use_xxx configuration
	* Select all optional dependencies using transitive-optional configuration
What I actually need is a possibility to globally activate a configuration use_yyy. Globally means (applying to all transitive dependencies):
	* If a module doesn't have this configuration, do nothing
	* If a module does have this configuration, activate it


Thank you very much for help!


Kind regards,
Boris Brodski

Re: Selecting optional dependencies of OSGi-bundles with Ivy (+150 bounty on StackOverflow)

Posted by Nicolas Lalevée <ni...@hibnet.org>.
Le 16 juil. 2014 à 09:21, Boris Brodski <br...@yahoo.com.INVALID> a écrit :

> Hello Nicolas,
> 
>>  But this "use_xyz" configuration will be the one of org.eclipse.jdt, not one of its dependency.
> 
> this is exactly, what I need. But unfortunately the "rev" attribute is mandatory:
> 
> <dependency org="bundle" name="org.eclipse.xtend.core" conf="default->default,use_org.eclipse.jdt.core"/>
> 
> 
> produces
> 
> [xml parsing: ... cvc-complex-type.4: Attribute 'rev' must appear on element 'dependency' ...]
> 
> 
> Do you have an Idea, how can I activate this configuration without specifying the version of the bundle explicitly?

Maybe you can use this trick: you can specify a range of versions, a range so wide that it will match anything existing; you can write rev="[0,)"

Nicolas

> 
> Thank you!
> 
> 
> Cheers,
> Boris
> 
> 
> 
> On Tuesday, July 15, 2014 6:25 PM, Nicolas Lalevée <ni...@hibnet.org> wrote:
> 
> 
> 
> 
> Le 15 juil. 2014 à 18:16, Boris Brodski <br...@yahoo.com.INVALID> a écrit :
> 
>> Hello Nicolas,
>> 
>> 
>> thank you for the quick reply. I use your suggestion already, but specifying the version is some kind nasty, especially if you have many such optional dependencies.
>> 
>> Is there really absolutely no possibility to just activate a configuration of a bundle, like
>> 
>> <dependency org="bundle" name="org.eclipse.jdt"> <!-- No version here -->
>>     <conf name="use_xyz"/>
>> </dependency>
>>   
>> This would be completely enough for me!
> 
> Yes you can, just like a normal ivy file:
> <dependency org="bundle" name="org.eclipse.jdt" conf="default->use_xyz" />
> 
> But this "use_xyz" configuration will be the one of org.eclipse.jdt, not one of its dependency.
> 
> 
> Nicolas
> 
>> 
>> 
>> Cheers,
>> Boris
>> 
>> 
>> On Tuesday, July 15, 2014 3:43 PM, Nicolas Lalevée <ni...@hibnet.org> wrote:
>> 
>> 
>> 
>> Hi,
>> 
>> Le 15 juil. 2014 à 11:18, Boris Brodski <br...@yahoo.com.INVALID> a écrit :
>> 
>>> Hello,
>>> 
>>> 
>>> I posted a question about selecting optional dependencies of OSGI-bundle on Stackoverflow: 
>>> 
>>> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
>>> 
>>>   
>>>           
>>> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
>>> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt: <dependencies> <dependency org="bundle" name="org.eclipse.jdt" rev="x.y.z"/>
>>> </dependencies>  
>>> View on stackoverflow.com Preview by Yahoo  
>>>   
>>> 
>>> Even issuing a bounty of +150 didn't helped... No answers, no comments. (The bounty expired within 24 hours.)
>>> 
>>> I going to repost my question here hoping to get an answer and also hoping to give away +150 reputation on StackOverflow.
>>> 
>>> 
>>> 
>>> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt:
>>> <dependencies><dependencyorg="bundle"name="org.eclipse.jdt"rev="x.y.z"/></dependencies>
>>> It works fine and gives me all mandatory dependencies.
>>> My question is, how can I select some (not all) optional dependencies of transitive bundles?
>>> I can:
>>>      * Select optional dependencies of org.eclipse.jdt by activating use_xxx configuration
>>>      * Select all optional dependencies using transitive-optional configuration
>>> What I actually need is a possibility to globally activate a configuration use_yyy. Globally means (applying to all transitive dependencies):
>>>      * If a module doesn't have this configuration, do nothing
>>>      * If a module does have this configuration, activate it
>> 
>> Only the first solution you suggest is possible.
>> 
>> But if in your use case you need an optional dependency to be fetched, then it is actually required for you. So in your ivy.xml, put an extra line about the dependency you require.
>> The non ideal point here is about choosing the right version of your dependency. With a pure OSGi resolver, you just declare a dependency on a bundle symbolic name, OSGi will figure out the version which can match while looking up the optional dependencies. Ivy cannot do that, there is no notion of optionality, either the configuration is in the dependency graph, either it's not. So you'll have to put a version to the extra dependency.
>> 
>> Nicolas
>> 
>> 
>>> 
>>> 
>>> Thank you very much for help!
>>> 
>>> 
>>> Kind regards,
>>> Boris Brodski


Re: Selecting optional dependencies of OSGi-bundles with Ivy (+150 bounty on StackOverflow)

Posted by Boris Brodski <br...@yahoo.com.INVALID>.
Hello Nicolas,

> But this "use_xyz" configuration will be the one of org.eclipse.jdt, not one of its dependency.

this is exactly, what I need. But unfortunately the "rev" attribute is mandatory:

<dependency org="bundle" name="org.eclipse.xtend.core" conf="default->default,use_org.eclipse.jdt.core"/>


produces

[xml parsing: ... cvc-complex-type.4: Attribute 'rev' must appear on element 'dependency' ...]


Do you have an Idea, how can I activate this configuration without specifying the version of the bundle explicitly?

Thank you!


Cheers,
Boris



On Tuesday, July 15, 2014 6:25 PM, Nicolas Lalevée <ni...@hibnet.org> wrote:
 



Le 15 juil. 2014 à 18:16, Boris Brodski <br...@yahoo.com.INVALID> a écrit :

> Hello Nicolas,
> 
> 
> thank you for the quick reply. I use your suggestion already, but specifying the version is some kind nasty, especially if you have many such optional dependencies.
> 
> Is there really absolutely no possibility to just activate a configuration of a bundle, like
> 
> <dependency org="bundle" name="org.eclipse.jdt"> <!-- No version here -->
>    <conf name="use_xyz"/>
> </dependency>
>  
> This would be completely enough for me!

Yes you can, just like a normal ivy file:
<dependency org="bundle" name="org.eclipse.jdt" conf="default->use_xyz" />

But this "use_xyz" configuration will be the one of org.eclipse.jdt, not one of its dependency.


Nicolas

> 
> 
> Cheers,
> Boris
> 
> 
> On Tuesday, July 15, 2014 3:43 PM, Nicolas Lalevée <ni...@hibnet.org> wrote:
> 
> 
> 
> Hi,
> 
> Le 15 juil. 2014 à 11:18, Boris Brodski <br...@yahoo.com.INVALID> a écrit :
> 
>> Hello,
>> 
>> 
>> I posted a question about selecting optional dependencies of OSGI-bundle on Stackoverflow: 
>> 
>> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
>> 
>>  
>>          
>> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
>> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt: <dependencies> <dependency org="bundle" name="org.eclipse.jdt" rev="x.y.z"/>
>> </dependencies>  
>> View on stackoverflow.com Preview by Yahoo  
>>  
>> 
>> Even issuing a bounty of +150 didn't helped... No answers, no comments. (The bounty expired within 24 hours.)
>> 
>> I going to repost my question here hoping to get an answer and also hoping to give away +150 reputation on StackOverflow.
>> 
>> 
>> 
>> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt:
>> <dependencies><dependencyorg="bundle"name="org.eclipse.jdt"rev="x.y.z"/></dependencies>
>> It works fine and gives me all mandatory dependencies.
>> My question is, how can I select some (not all) optional dependencies of transitive bundles?
>> I can:
>>     * Select optional dependencies of org.eclipse.jdt by activating use_xxx configuration
>>     * Select all optional dependencies using transitive-optional configuration
>> What I actually need is a possibility to globally activate a configuration use_yyy. Globally means (applying to all transitive dependencies):
>>     * If a module doesn't have this configuration, do nothing
>>     * If a module does have this configuration, activate it
> 
> Only the first solution you suggest is possible.
> 
> But if in your use case you need an optional dependency to be fetched, then it is actually required for you. So in your ivy.xml, put an extra line about the dependency you require.
> The non ideal point here is about choosing the right version of your dependency. With a pure OSGi resolver, you just declare a dependency on a bundle symbolic name, OSGi will figure out the version which can match while looking up the optional dependencies. Ivy cannot do that, there is no notion of optionality, either the configuration is in the dependency graph, either it's not. So you'll have to put a version to the extra dependency.
> 
> Nicolas
> 
> 
>> 
>> 
>> Thank you very much for help!
>> 
>> 
>> Kind regards,
>> Boris Brodski

Re: Selecting optional dependencies of OSGi-bundles with Ivy (+150 bounty on StackOverflow)

Posted by Nicolas Lalevée <ni...@hibnet.org>.
Le 15 juil. 2014 à 18:16, Boris Brodski <br...@yahoo.com.INVALID> a écrit :

> Hello Nicolas,
> 
> 
> thank you for the quick reply. I use your suggestion already, but specifying the version is some kind nasty, especially if you have many such optional dependencies.
> 
> Is there really absolutely no possibility to just activate a configuration of a bundle, like
> 
> <dependency org="bundle" name="org.eclipse.jdt"> <!-- No version here -->
>    <conf name="use_xyz"/>
> </dependency>
>  
> This would be completely enough for me!

Yes you can, just like a normal ivy file:
<dependency org="bundle" name="org.eclipse.jdt" conf="default->use_xyz" />

But this "use_xyz" configuration will be the one of org.eclipse.jdt, not one of its dependency.

Nicolas

> 
> 
> Cheers,
> Boris
> 
> 
> On Tuesday, July 15, 2014 3:43 PM, Nicolas Lalevée <ni...@hibnet.org> wrote:
> 
> 
> 
> Hi,
> 
> Le 15 juil. 2014 à 11:18, Boris Brodski <br...@yahoo.com.INVALID> a écrit :
> 
>> Hello,
>> 
>> 
>> I posted a question about selecting optional dependencies of OSGI-bundle on Stackoverflow: 
>> 
>> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
>> 
>>   
>>           
>> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
>> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt: <dependencies> <dependency org="bundle" name="org.eclipse.jdt" rev="x.y.z"/>
>> </dependencies>  
>> View on stackoverflow.com Preview by Yahoo  
>>   
>> 
>> Even issuing a bounty of +150 didn't helped... No answers, no comments. (The bounty expired within 24 hours.)
>> 
>> I going to repost my question here hoping to get an answer and also hoping to give away +150 reputation on StackOverflow.
>> 
>> 
>> 
>> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt:
>> <dependencies><dependencyorg="bundle"name="org.eclipse.jdt"rev="x.y.z"/></dependencies>
>> It works fine and gives me all mandatory dependencies.
>> My question is, how can I select some (not all) optional dependencies of transitive bundles?
>> I can:
>>     * Select optional dependencies of org.eclipse.jdt by activating use_xxx configuration
>>     * Select all optional dependencies using transitive-optional configuration
>> What I actually need is a possibility to globally activate a configuration use_yyy. Globally means (applying to all transitive dependencies):
>>     * If a module doesn't have this configuration, do nothing
>>     * If a module does have this configuration, activate it
> 
> Only the first solution you suggest is possible.
> 
> But if in your use case you need an optional dependency to be fetched, then it is actually required for you. So in your ivy.xml, put an extra line about the dependency you require.
> The non ideal point here is about choosing the right version of your dependency. With a pure OSGi resolver, you just declare a dependency on a bundle symbolic name, OSGi will figure out the version which can match while looking up the optional dependencies. Ivy cannot do that, there is no notion of optionality, either the configuration is in the dependency graph, either it's not. So you'll have to put a version to the extra dependency.
> 
> Nicolas
> 
> 
>> 
>> 
>> Thank you very much for help!
>> 
>> 
>> Kind regards,
>> Boris Brodski


Re: Selecting optional dependencies of OSGi-bundles with Ivy (+150 bounty on StackOverflow)

Posted by Boris Brodski <br...@yahoo.com.INVALID>.
Hello Nicolas,


thank you for the quick reply. I use your suggestion already, but specifying the version is some kind nasty, especially if you have many such optional dependencies.

Is there really absolutely no possibility to just activate a configuration of a bundle, like

<dependency org="bundle" name="org.eclipse.jdt"> <!-- No version here -->
   <conf name="use_xyz"/>
</dependency>
 
This would be completely enough for me!


Cheers,
Boris


On Tuesday, July 15, 2014 3:43 PM, Nicolas Lalevée <ni...@hibnet.org> wrote:
 


Hi,

Le 15 juil. 2014 à 11:18, Boris Brodski <br...@yahoo.com.INVALID> a écrit :

> Hello,
> 
> 
> I posted a question about selecting optional dependencies of OSGI-bundle on Stackoverflow: 
> 
> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
> 
>  
>          
> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt: <dependencies> <dependency org="bundle" name="org.eclipse.jdt" rev="x.y.z"/>
> </dependencies>  
> View on stackoverflow.com Preview by Yahoo  
>  
> 
> Even issuing a bounty of +150 didn't helped... No answers, no comments. (The bounty expired within 24 hours.)
> 
> I going to repost my question here hoping to get an answer and also hoping to give away +150 reputation on StackOverflow.
> 
> 
> 
> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt:
> <dependencies><dependencyorg="bundle"name="org.eclipse.jdt"rev="x.y.z"/></dependencies>
> It works fine and gives me all mandatory dependencies.
> My question is, how can I select some (not all) optional dependencies of transitive bundles?
> I can:
>     * Select optional dependencies of org.eclipse.jdt by activating use_xxx configuration
>     * Select all optional dependencies using transitive-optional configuration
> What I actually need is a possibility to globally activate a configuration use_yyy. Globally means (applying to all transitive dependencies):
>     * If a module doesn't have this configuration, do nothing
>     * If a module does have this configuration, activate it

Only the first solution you suggest is possible.

But if in your use case you need an optional dependency to be fetched, then it is actually required for you. So in your ivy.xml, put an extra line about the dependency you require.
The non ideal point here is about choosing the right version of your dependency. With a pure OSGi resolver, you just declare a dependency on a bundle symbolic name, OSGi will figure out the version which can match while looking up the optional dependencies. Ivy cannot do that, there is no notion of optionality, either the configuration is in the dependency graph, either it's not. So you'll have to put a version to the extra dependency.

Nicolas


> 
> 
> Thank you very much for help!
> 
> 
> Kind regards,
> Boris Brodski

Re: Selecting optional dependencies of OSGi-bundles with Ivy (+150 bounty on StackOverflow)

Posted by Nicolas Lalevée <ni...@hibnet.org>.
Hi,

Le 15 juil. 2014 à 11:18, Boris Brodski <br...@yahoo.com.INVALID> a écrit :

> Hello,
> 
> 
> I posted a question about selecting optional dependencies of OSGI-bundle on Stackoverflow: 
> 
> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
> 
>   
>           
> ant - Selecting optional dependencies of OSGi-bundles with Ivy - Stack Overflow
> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt: <dependencies> <dependency org="bundle" name="org.eclipse.jdt" rev="x.y.z"/>
> </dependencies>   
> View on stackoverflow.com Preview by Yahoo  
>   
> 
> Even issuing a bounty of +150 didn't helped... No answers, no comments. (The bounty expired within 24 hours.)
> 
> I going to repost my question here hoping to get an answer and also hoping to give away +150 reputation on StackOverflow.
> 
> 
> 
> I use Ivy to resolve OSGi bundles, like org.eclipse.jdt:
> <dependencies><dependencyorg="bundle"name="org.eclipse.jdt"rev="x.y.z"/></dependencies>
> It works fine and gives me all mandatory dependencies.
> My question is, how can I select some (not all) optional dependencies of transitive bundles?
> I can:
> 	* Select optional dependencies of org.eclipse.jdt by activating use_xxx configuration
> 	* Select all optional dependencies using transitive-optional configuration
> What I actually need is a possibility to globally activate a configuration use_yyy. Globally means (applying to all transitive dependencies):
> 	* If a module doesn't have this configuration, do nothing
> 	* If a module does have this configuration, activate it

Only the first solution you suggest is possible.

But if in your use case you need an optional dependency to be fetched, then it is actually required for you. So in your ivy.xml, put an extra line about the dependency you require.
The non ideal point here is about choosing the right version of your dependency. With a pure OSGi resolver, you just declare a dependency on a bundle symbolic name, OSGi will figure out the version which can match while looking up the optional dependencies. Ivy cannot do that, there is no notion of optionality, either the configuration is in the dependency graph, either it's not. So you'll have to put a version to the extra dependency.

Nicolas

> 
> 
> Thank you very much for help!
> 
> 
> Kind regards,
> Boris Brodski