Metacello - versionMap to versionMap dependencies

0 views
Skip to first unread message

Dale Henrichs

unread,
May 22, 2009, 8:06:17 PM5/22/09
to montice...@googlegroups.com
For the purposes of this discussion, I want to go back to Adrian's original example and take a different approach, by organizing things just a little differently.

Adrian had mentioned that B-library was used in multiple projects, so I'll assume that it is worth creating a versionMap for BRoot and that'll give us two versionMaps to reason with. We'll also ignore platform dependencies:

ARoot (in repository X)
- A-view
- A-model
- A-model-tests

BRoot (in repository Y)
- B-library
- B-library-tests

BRootVersionMap will be defined with the following methods two methods:

groups301
<groups: '3.0.1' attributes: #common>

^(MetacelloGroupsSpec for: self)
addGroup:
((MetacelloGroupSpec for: self)
groupName: 'Production'
description: 'production packages for the BRoot project';
addMembers: {'B-library'. };
yourself);
addGroup:
((MetacelloGroupSpec for: self)
groupName: 'Developer'
description: 'developer packages for the BRoot project';
addMembers: { 'Production'. 'B-library-tests'. };
yourself);
yourself

packages301
<packageVersions: '3.0.1' attributes: #common>

^(MetacelloPackagesSpec for: self)
addPackage: 'B-library' file: 'B-library-al.5';
addPackage: 'B-library-tests' file: 'B-library-tests-al.6';
addRepository: 'http://repsitoryY' type: 'http';
yourself

ARootVersionMap will be defined with these two methods:

groups100
<groups: '1.0.0' attributes: #common>

^(MetacelloGroupsSpec for: self)
addGroup:
((MetacelloGroupSpec for: self)
groupName: 'Production'
description: 'production packages for the ARoot project';
addMembers: { 'A-view'. 'A-model'. 'B-library'. };
yourself);
addGroup:
((MetacelloGroupSpec for: self)
groupName: 'Developer'
description: 'developer packages for the ARoot project';
addMembers: { 'Production'. 'A-model-tests'. 'B-library-tests'. };
yourself);
addGroup:
((MetacelloGroupSpec for: self)
groupName: 'B-library'
description: 'production packages from the BRoot project';
addMember:
(self versionMapSpecForBRoot: '3.0.1' loadList: { 'Production'. });
yourself);
addGroup:
((MetacelloGroupSpec for: self)
groupName: 'B-library-tests'
description: 'development packages from the BRoot project';
addMember:
(self versionMapSpecForBRoot: '3.0.1' loadList: { 'Developer'. });
yourself);
yourself

packages100
<packageVersions: '1.0.0' attributes: #common>

^(MetacelloPackagesSpec for: self)
addPackage: 'A-view' file: 'A-View-al.1';
addPackage:
((MetacelloPackageSpec for: self)
packageName: 'A-model';
file: 'A-Model-al.2';
before: { 'B-library'. };
yourself);
addPackage: 'A-view-tests' file: 'A-view-tests-al.3';
addPackage: 'A-model-tests' file: 'A-model-tests-al.4';
addRepository: 'http://repsitoryX' type: 'http';
yourself

versionMapSpecForBRoot: versionString loadList: loadList

^(MetacelloVersionMapSpec for: self)
versionMapClass: 'BRootVersionMap';
version: versionString;
loadList: loadList;
packagesSpec:
((MetacelloPackagesSpec new)
addFile: 'BRoot-VersionMap-al.11';
addRepository: 'http://repsitoryY';
yourself);
yourself

Note that 'B-library' and 'B-library-tests' have been removed from the #packages100 method but the #before dependency remains against 'B-library'. Instead of defining 'B-library' and 'B-library-tests' as packages, I've redefined them as groups.

The group is in turn defined with a versionMapSpec as a member, instead of a package/group name. Also note that the groups 'Production' and 'Developer' are used in the loadList in the respecitve versionMapSpecs. Earlier today I mentioned that I think that dependencies on other projects should be managed via groups and this illustrates the idea.

When the expression:

(ARootVersionMap version: '1.0.0') load: { 'A-model'. }

is executed, then the package A-model is loaded, then the 'Developer' group for BRootVersionMap is loaded ('A-model' is loaded #before 'B-library'). If BRootVersionMap isn't already loaded in the image, it will be loaded first.

When the expression:

(ARootVersionMap version: '1.0.0') load: { 'B-library'. }

it will be exactly equivalent to evaluating the following expression:

(BRootVersionMap version: '3.0.1') load: { 'Production'. }

none of the ARoot packages will be loaded - I suppose this should be classified as "Stupid Metacello Tricks".

Dale

Reply all
Reply to author
Forward
0 new messages