Monticello reverse project dependency

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Monticello reverse project dependency

Peter Uhnak
Hi,

I have the following situation:

I have ProjectMain, and ProjectPlugin, now normally the Plugin depends on Main, however I would like to load Plugin as part of Main.

The problem is that I can't specify to load Plugin after Main has been already fully loaded, if I do something like this

BaselineOfMain>>baseline: spec
<baseline>
spec
for: #common
do:
[ spec
baseline: 'Plugin'
with: [ spec
repository: '...';
loads: #('default' OR 'plugin') ].
spec
package: 'Main' with: [ spec requires: #(more stuff) ];
spec group: 'default' with: #('Main').
spec group: 'complete' with: #('default' 'Plugin') ]

The BaselineOfPlugin has two groups… "default", which loads also "Main", and "plugin", which doesn't.

Now the problem is that there is no guaranteed way that Plugin will load after Main (in fact the should happen). If I load the plugin's #default, then Metacello ends up in an endless loop for some reason, and if I load #plugin, then it will load it before the Main which will break it (because Plugin has dependencies on main).

So my question is:
is it possible to reverse it somehow?
Maybe add at the end `spec postLoadDoIt: #postLoadPlugins`, and then in that method manually load the plugins with Metacello/Gofer? Or is there a better way?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: Monticello reverse project dependency

wernerk
Hi Peter,
have you looked at metacellos #includes: method?
from https://code.google.com/archive/p/metacello/wikis/APIReference.wiki :
"When 'Example-AddOn' is loaded, load 'Example-UI'"
                 includes: #('Example-UI' );
werner

On 02/13/2016 11:26 PM, Peter Uhnák wrote:

> Hi,
>
> I have the following situation:
>
> I have ProjectMain, and ProjectPlugin, now normally the Plugin depends
> on Main, however I would like to load Plugin as part of Main.
>
> The problem is that I can't specify to load Plugin after Main has been
> already fully loaded, if I do something like this
>
> BaselineOfMain>>baseline: spec
> <baseline>
> spec
> for: #common
> do:
> [ spec
> baseline: 'Plugin'
> with: [ spec
> repository: '...';
> loads: #('default' OR 'plugin') ].
> spec
> package: 'Main' with: [ spec requires: #(more stuff) ];
> spec group: 'default' with: #('Main').
> specgroup: 'complete' with: #('default' 'Plugin') ]
>
> The BaselineOfPlugin has two groups… "default", which loads also "Main",
> and "plugin", which doesn't.
>
> Now the problem is that there is no guaranteed way that Plugin will load
> after Main (in fact the should happen). If I load the plugin's #default,
> then Metacello ends up in an endless loop for some reason, and if I load
> #plugin, then it will load it before the Main which will break it
> (because Plugin has dependencies on main).
>
> So my question is:
> is it possible to reverse it somehow?
> Maybe add at the end `specpostLoadDoIt: #postLoadPlugins`, and then in
> that method manually load the plugins with Metacello/Gofer? Or is there
> a better way?
>
> Thanks,
> Peter