pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Metacello should be able to force the loading of a baseline

Open Ducasse opened this issue 4 months ago • 3 comments

Metacello new	
	baseline: 'TheNoteTaker';	
	repository: 'github://pharo-contributions/the-note-taker/src';	
	load.

it fails because the baselineOfMicrodown as available in Pharo does not define the group editor

microdown: spec

	spec
		baseline: 'Microdown'
		with: [ spec
			repository: 'github://pillar-markup/Microdown:dev/src';
			loads: 'Editor'
			].

Ducasse avatar Oct 24 '25 10:10 Ducasse

I tried all kinds of combinations as bewlo

Metacello new	
	baseline: 'TheNoteTaker';	
	repository: 'github://hernanmd/the-note-taker/src';	
	 onUpgrade: [:ex :loaded :incoming |
  		  incoming baseName = 'Microdown'
      		ifTrue: [ ex useIncoming ]
      ];
	onConflict: [ :ex | ex useIncoming ];
	onUpgrade: [ :ex | ex useIncoming ];
	load.

But none of them is working.

Ducasse avatar Oct 25 '25 18:10 Ducasse

I was checking the cache

MetacelloProjectRegistry instance held by MetacelloProjectRegistration class. 

Surpringly Microdown baseline is not listed there and I do not get it because

BaselineOfIDE >> registerProject: projectName externalProject: externalProject baseline: baselineName otherBaselines: anArray
	| baselineClass className |

	className := ('BaselineOf', baselineName) asSymbol.
	baselineClass := self classNamed: className.
	baselineClass ifNil: [ ^ self ].

	self pharoPluginClass
		addProjectNamed: projectName
		commit: (self pharoPluginClass commitOfExternalProject: externalProject)
		baselines: { className }
		tags: #(#system).
	"Register baselines"
	({baselineName}, anArray) do: [ :each |
		Metacello new baseline: each; register ]


loadIceberg

	Metacello new
		baseline: 'Iceberg';
		repository: (self classNamed: #BaselineOfPharo) icebergRepository;
		onConflictUseLoaded;
		load.
	(self classNamed: #Iceberg) enableMetacelloIntegration: true.

	Smalltalk os environment at: #GITHUB_TOKEN ifPresent: [ :token |
		| credentials |
		credentials := (self classNamed: #IceTokenCredentials) new
			               username:
				               (Smalltalk os environment
					                at: #GITHUB_USER
					                ifAbsent: [ self error: 'Github token was found but not the github user associated to this token.' ]);
			               token: token;
			               host: 'github.com';
			               yourself.

		(self classNamed: #IceCredentialStore) current storeCredential: credentials forHostname: 'github.com'.
		'Using authentification for Github API' traceCr ].

	self registerPharo.
	self registerProject: 'Spec2' baseline: 'Spec2' otherBaselines: #('SpecCore').
	self registerProject: 'NewTools'.
	self registerProject: 'Roassal'.
	self registerProject: 'Microdown'.
	self registerProject: 'DocumentBrowser' baseline: 'NewToolsDocumentBrowser' otherBaselines: #().
	self registerIceberg

Ducasse avatar Oct 27 '25 12:10 Ducasse

Putting a break point in

registrationFor: aMetacelloProjectRegistration ifPresent: presentBlock ifAbsent: absentBlock
    | baseName |
    baseName := aMetacelloProjectRegistration baseName.
	baseName = 'Microdown' ifTrue: [ self halt ].
    aMetacelloProjectRegistration configurationProjectSpec
        ifNotNil: [ :spec | self configurationRegistry at: spec className ifPresent: [ :existing | ^ presentBlock value: existing ] ].
    aMetacelloProjectRegistration baselineProjectSpec
        ifNotNil: [ :spec | self baselineRegistry at: spec className ifPresent: [ :existing | ^ presentBlock value: existing ] ].
    self configurationRegistry
        at: 'ConfigurationOf' , baseName
        ifPresent: [ :existing | ^ presentBlock value: existing ].
    self baselineRegistry at: 'BaselineOf' , baseName ifPresent: [ :existing | ^ presentBlock value: existing ].
    ^ absentBlock value

seems too late.

Ducasse avatar Oct 27 '25 12:10 Ducasse