I think that this would be a good idea ... as soon as we have a concrete need I think we should add it ... it won't require a change in the api...
Dale
What about a package that is only known to work from Pharo 1.1 onwards
and not in Pharo 1.0.
Or in Squeak trunk and Squeak 3.8 but not in Squeak 3.7.
We already have a notation for #requires: but used for package
dependencies.
Here we cross the border to non-packaged base systems, how can we
define a specific version/build nr/image
version as prerequisites?
I think what you describe is related to embedded configurations in configuration.
ConfigurationOfMoose 4.0 depends on ConfigurationOfMondrian 2.0 for example
Then ConfigurationOfMoose 4.1 will depend on ConfigurationOfMondrian 2.4 ....
The same thing with ConfigurationOfPharo should work, right? The strange thing perhaps is that you have to explicitly declare Pharo as a dependency of your project, but it should not be a problem.
--
Simon
I think it's a slightly different question, because the core isn't managed by Metacello.
I think a simple example would be to look at how Utilitilies class>>authorInitials has migrated to Author>>fullName. This is a simple problem with a number of possible solutions, one of which would be to load a different package (you really are running on a different "platform").
So the question is can you distinguish Pharo 1.0 from Pharo 1.1 and the answer is yes. For GemStone I've found that I've needed to distinguish between versions 2.x, 2.3.x, 2.4.x and 3.x.
There is a platform class for each of the three platforms: MetacelloSqueakPlatform, MetacelloPharoPlatform, and MetacelloGemStonePlatform. MetacelloPlatform class>>current arranges to point to an instance of the appropriate platform class. The message #defaultPlatformAttributes is sent to that instance.
Right now on Pharo, the method is implemented to return:
#(#squeakCommon #pharo )
On GemStone, the method is implemented as:
| stoneVersionAtts |
(stoneVersionAtts := self stoneVersionAttributes) ifNil: [^ #( #gemstone )].
^ stoneVersionAtts
and #stoneVersionAttrivutes is implemented as:
stoneVersionAttribute isSymbol ifTrue: [ stoneVersionAttribute := nil ].
stoneVersionAttribute ifNil: [ | gsVersion |
stoneVersionAttribute := ((gsVersion := System stoneVersionAt: 'gsVersion') beginsWith: '2.')
ifTrue: [
(gsVersion beginsWith: '2.3')
ifTrue: [ #( #gemstone #'gs2.x' #'gs2.3.x' ) ]
ifFalse: [
(gsVersion beginsWith: '2.4')
ifTrue: [ #( #gemstone #'gs2.x' #'gs2.4.x' ) ]
ifFalse: [ #( #gemstone #'gs2.x' ) ]]]
ifFalse: [#( #gemstone #'gs3.x' )]].
^ stoneVersionAttribute
stoneVersionAttribute is an IV, so the calculation only needs to be done once.
A similare method could be written for Pharo (and Squeak) to allow differentiation across platform versions.
The platform version attributes can be used in a for:do:, just like #squeak, #pharo, etc.
If finer-grained versions are needed it still is possible for a particular project to add it's an attribute in the ConfigurationOf (see ConfigurationOfGemTools>>project and the logic for creating the #'pharo1.0Beta' attribute).
If this doesn't cover the playing field, then we can discuss additional alternatives.
Dale
On Apr 21, 12:25 pm, Dale Henrichs <dale.henri...@gemstone.com> wrote:I think I've encountered a requirement, but from the user end:
> I'm waiting for the time when we have a clear requirement, before inserting this into Metacello itself. Individual Configurations can be written with methods that adjust for version ...
Metacello Configurations definitely simplify dependency management.
When it works, it's awesome! Where I am hitting the wall is managing
compatibility with different flavors of Squeak. Let me recount my
latest experience...
> I want to install ExternalWebBrowser.
> Oh good, there is a ConfigurationOf... in the SqS MetacelloRepository
> Let me make sure it works and then I'll add it to my ImageSetup script
> Results
> Pharo 1.1 trunk update 11364: ExternalWebBrowserMacOS class>>isApplescriptAvailable references SMSqueakMap, which was removed from Pharo. Ugh, okay, I'll manually install Applescript via Gofer and Monticello, then restart
> Pharo 1.0: same problem
> Squeak 4.1 trunk update 10145: MetacelloMCProjectSpec's instance variable 'className' is nil; when asSymbol is called on it, DNU asSymbol
> Squeak 4.1 official release: same problem
So my question is - what platform does this config target? It failed
for all the current Squeak and Pharo images!
As a user, I would like to either:
* have a specific place (depending on my platform) to find the correct
config
* or, even easier (and I suspect much less duplication, since many
configs may work with multiple platforms), a way to mark
ConfigurationsOf as working with particular platforms. Then, you
could at least issue a warning, like SqMap, that 'the Config was not
approved for this platform, do you want to continue.' If this info
was built into the Metacello model, one might even be able to query
the MetacelloRepository for configs approved for the current platform.
The way it is now, I think I spent more time above than manually
resolving the dependencies.
This may be totally out of nowhere, but could for:do: take a block?
In other words, instead of being restricted to for: #squeak do:, one
could say:
for: [ spec squeak version: '4.0' to: '4.1' ] do: [...]
Another thought is allow a simple regex - maybe use 'x' as 'anything
for this part of the version'