Test for different methods in `ProjectDefinition >> #postLoadJavaHook`
authorJan Vrany <jan.vrany@labware.com>
Mon, 29 Nov 2021 16:36:55 +0000
changeset 4010 19843598d34b
parent 4009 944431c70558
child 4011 1e5cf64a3779
Test for different methods in `ProjectDefinition >> #postLoadJavaHook` This commit just changes the clumsy test for compiled class libraries to use multiple different methods. `#classNamesAndAttributes` may be missing in (pure) Pharo `PackageManifests`. `#mandatoryPreRequisites` may be missing in some old project definitions created before (single) `#preRequisites` have been split to `#mandatoryPreRequisites` and `#requiredPreRequisites`. Sigh.
extensions.st
--- a/extensions.st	Tue Nov 02 16:09:46 2021 +0000
+++ b/extensions.st	Mon Nov 29 16:36:55 2021 +0000
@@ -1693,7 +1693,16 @@
     "/ Do nothing if package is binary-compiled.
     "/ The byteCode isNil test is a clumsy way to check whether the
     "/ package has been binary-compiled or not.
-    (self class methodDictionary at:#classNamesAndAttributes) byteCode isNil ifTrue:[ ^ self ].
+    "/ 
+    "/ We have to try few methods because some may not be available
+    "/ and some were renamed over time (but old project definitions
+    "/ are still lurking around!!). Sigh.
+    #(#mandatoryPreRequisites preRequisites classNamesAndAttributes) do: [:sel |
+        | mthd |
+
+        mthd := self class methodDictionary at: sel ifAbsent: [ nil ].
+        (mthd notNil and:[mthd byteCode isNil]) ifTrue: [ ^ self ].
+    ].
 
     "/ Do nothing if package has no Java code...
     self javaBundle isNil ifTrue:[ ^ self ].
@@ -1710,6 +1719,7 @@
     ].
 
     "Created: / 15-06-2015 / 11:31:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-12-2021 / 12:01:36 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
 !Semaphore methodsFor:'waiting'!