GemTalk / Rowan

a new project/package manager for Smalltalk that supports FileTree and Tonel repositories, and is independent of Monticello and Metacello
MIT License
14 stars 7 forks source link

(V3) incorrect handling of duplicate methods in different packages of the same project #940

Open dalehenrich opened 1 day ago

dalehenrich commented 1 day ago

As of RowanClientServices:cfe8285a6 and GemStone 3.7.2, there are duplicate methods in two packages Rowan-Services-Tests and Rowan-Services-TestsV2 ... These two packages can be loaded together and Rowan silently loads "both packages" even though only one of the methods wins ... fortunately an audit of RowanClientServices produces the following audit errors:

==============Auditing  project RowanClientServices
==============Auditing  package Rowan-Services-Tests
---------------RowanServicesTest>>Mismatched method category (expected: 'support' actual: #'*rowan-services-testsv2'): RowanServicesTest>>createServicesTestPackage
---------------RowanServicesTest>>Compiled method is not identical to loaded method: RowanServicesTest>>createServicesTestPackage
---------------RowanServicesTest>>Mismatched method category (expected: 'accessing' actual: #'*rowan-services-testsv2'): RowanServicesTest>>servicesTestComponentName
---------------RowanServicesTest>>Compiled method is not identical to loaded method: RowanServicesTest>>servicesTestComponentName
---------------RowanServicesTest>>Mismatched method category (expected: 'support' actual: #'*rowan-services-testsv2'): RowanServicesTest>>loadServicesTestProject
---------------RowanServicesTest>>Compiled method is not identical to loaded method: RowanServicesTest>>loadServicesTestProject
---------------RowanServicesTest>>Mismatched method category (expected: 'support' actual: #'*rowan-services-testsv2'): RowanServicesTest>>createProjectDefinitionNamed:
---------------RowanServicesTest>>Compiled method is not identical to loaded method: RowanServicesTest>>createProjectDefinitionNamed:
---------------RowanServicesTest>>Mismatched method category (expected: 'support' actual: #'*rowan-services-testsv2'): RowanServicesTest>>createNonDiskTestProjectNamed:packageName:
---------------RowanServicesTest>>Compiled method is not identical to loaded method: RowanServicesTest>>createNonDiskTestProjectNamed:packageName:
---------------RowanServicesTest>>Mismatched method category (expected: 'support' actual: #'*rowan-services-testsv2'): RowanServicesTest>>loadRowanSample1
---------------RowanServicesTest>>Compiled method is not identical to loaded method: RowanServicesTest>>loadRowanSample1

We should be able to recognize that there are duplicate methods in different packages in the same project during the load and throw an error.

dalehenrich commented 1 day ago

The following expression run against RowanClientServices:cfe8285a6 extent0.rowan3.dbf will reproduce the audit errors ... note that the conditional attribute testsV2 is what brings in the package with duplicate methods:

run
    | rowanProject loadSpecs projectsHome projectNames |
    projectsHome := '/bosch1/users/dhenrich/_stones/37x/k_37x_externals_st'.
 rowanProject := Rowan projectNamed: 'Rowan'.
    loadSpecs := rowanProject loadedLoadSpecifications.
    {
        'Announcements' .
        'FileSystemGs' .
        'RemoteServiceReplication' .
        'RowanClientServices' .
    }
        do: [:projectName |
            "pick up the extra rowan3 projects"
            (Rowan projectNamed: projectName ifAbsent: [])
                ifNotNil: [:project |
                    | loadSpec |
                    loadSpec :=  project loadSpecification.
                    loadSpecs addLoadSpec: loadSpec ] ].
    loadSpecs do: [:loadSpec |
        | relRoot projectAlias |
        projectAlias := loadSpec projectName = 'RowanClientServices'
            ifTrue: [ 
                (System gemVersionAt: 'gsVersion') asRwGemStoneVersionNumber >= ('3.7.2' asRwGemStoneVersionNumber)
                    ifTrue: [ 
                        "RowanClientServices is the only project that needs a projectAlias"
                        'RowanClientServicesV3']
                    ifFalse: [ loadSpec projectAlias ] ]
            ifFalse: [ loadSpec projectAlias ].
        relRoot := loadSpec relativeRepositoryRoot.
        relRoot isEmpty
            ifTrue: [ 
                loadSpec 
                    projectsHome: projectsHome;
                    gitUrl: 'file:', ((projectsHome, '/', projectAlias) asFileReference pathString);
                    yourself  ]
            ifFalse: [
                        "embedded Rowan project" 
                        loadSpec
                            gitUrl: 'file:', (((projectsHome, '/', projectAlias) asFileReference / relRoot) pathString);
                            projectsHome: projectsHome;
                            yourself ].
        loadSpec addCustomConditionalAttributes: #('tests' 'testsV2') ].
    projectNames := loadSpecs load projectNames asArray sort. 
    GsFile gciLogServer: 'Rowan projects attached and reloaded: '.
    projectNames do: [:each |
    GsFile gciLogServer: '  ', each ]

%

run
Rowan projectTools audit auditAll. 
%