seandenigris / Baby-Phexample

MIT License
0 stars 0 forks source link

Project Dependencies: Use #stable versions in Basline and numbered versions in Config #1

Open seandenigris opened 8 years ago

seandenigris commented 8 years ago

There was a pattern in pre-BaselineOf Metacello where one would define dependencies loosely in the #baselineXyz:, and then pin them to a specific version in the #versionAbc:.

For example:

ConfigurationOfBabyPhexample>>#baseline100: spec
        ...
        project: 'BabyMock' with: [
                spec
                        className: #ConfigurationOfBabyMock;
                        versionString: #'stable';
                        repository: 'http://smalltalkhub.com/mc/zeroflag/BabyMock/main/' ]
        ...

and then:

ConfigurationOfBabyPhexample>>#version10: spec
        ...
        spec
                project: 'BabyMock' with: '1.2'
        ...

How does one handle this sort of thing with #baseline:import:?

This is what I came up with…

In the BaselineOf:

BaselineOfBabyPhexample>>#baseline:
    …
    project: 'BabyMock' with: [
        spec ... versionString: #'stable' … ];

And then in the ConfigurationOf:
```smalltalk
ConfigurationOfBabyPhexample>>#version10: spec
        ...
        baseline: 'BabyPhexample'
                with: [
                      spec
                        repository:

'github://seandenigris/Baby-Phexample:INSERT-SHA-HERE/repository' ].
                spec
                        project: 'BabyMock' with: '1.2'
        ...

But I got this error from the last line: MessageNotUnderstood: receiver of "fetchUsing:" is nil. Then I changed the last line to:

    spec
        project: 'BabyMock' with: [ 
            spec
                className: #'ConfigurationOfBabyMock';
                versionString: '1.2' ]

And there was no error, but ConfigurationOfBabyPhexample project stableVersion record loadDirective. reports that the #stable version of BabyMock (1.3) will be loaded loaded instead of the version 1.2 that I specified in my configuration.

seandenigris commented 8 years ago

As a workaround, I guess when I want to release I could:

  1. Commit a baseline with specific versions of dependencies
  2. Reference the commit from the Config
  3. Change the baseline back to depending on #stable or #development or whatever

A bit tedious but replicates the previous behavior…

dalehenrich commented 8 years ago

@seandenigris ... first off you've got an error in your BabyPhexample baseline, you are using a symbol not a string ... I know that Pharo treats strings and symbols exactly the same, but it's a bad habit to get into --- using Strings and Symbols interchangeably ...

dalehenrich commented 8 years ago

Secondly, the fact the BabyMock 1.3 is being loaded implies that Metacello thinks that BabyMock 1.3 is already loaded ... I'd need to see a transcript log to be sure ... Are you doing loads using Metacello new or are you using the "should be obsolete" method of sending #load to a configuration? If you are using the latter, then depending upon the BabyMock configuration and dependencies, Metacello could just be guessing wrong ... if you use the former, Metacllo does't guess about which version of a project is loaded as the versions are recorded ...