buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ittay Dror <>
Subject Re: namespaces: sub namespace and parent namespaces
Date Thu, 07 Aug 2008 10:38:04 GMT

Ittay Dror wrote:
> Ittay Dror wrote:
>> Ittay Dror wrote:
>>> Hi,
>>> I'm trying to work with a sub namespace in a parent namespace:
>>> artifact_ns(:java) do |ns|
>>>    ns.ns :commons, :pool => 'commons-pool:commons-pool:jar:1.0.1'
> so after more print debugs, it looks like the method ns receives an 
> empty 'uses' array. if i add a dummy value then the 'uses' array has 
> the value and a hash. maybe it's a ruby bug (i'm using the stable 
> snapshot to workaround segmentation faults), i'll check.
ok, this has been driving me nuts. the issue was that using 
'artifact_ns.ns(:commons)' in the project definition doesn't use the 
parent hierarchy chain to find if such a namespace already exists in the 
parent, but instead only consults the registry, which has none, so one 
is created with no 'uses'

so i tried 'artifact_ns.fetch(:commons).pool'. now the problem is that 
the 'artifacts' method receives an ArtifactRequirement as one of the 
items in the specs, so I had to add a 'when' for that.

>>> end
>>> ....
>>> # the reason i'm setting parent explicitely, is because i have 
>>> projects of different kinds, each with different set of artifacts 
>>> and i want the names to be kept simple
>>> define 'someproj' do
>>>   artifact_ns.parent = artifact_ns(:java)
>>>   compile.with :commons_pool
>>> end
>> I'm trying this instead:
>>  compile.with artifact_ns.ns(:commons).pool
>> But artifact_ns(:commons).pool returns nil. this seems because the 
>> registry of the sub namespace is empty. i don't know why, and can't 
>> follow the code.
>> Thank you for your help,
>> Ittay
>>> this doesn't work. trying to analyze 'fetch', i see that the code 
>>> for manipulating "sub names" is done in ArtifactNamespace#get. If it 
>>> can't find the artifact locally (as in the case above) it delegates 
>>> the call to the registry ('unless artifact'). But the class Registry 
>>> doesn't have the mechanism for handling subnames, so this fails.
>>> Ittay

Ittay Dror <>

View raw message