Issue #259: fix `ProjectDefinition >> classesForPlatform` and use it `#testSuite` jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 12 Jun 2019 15:02:01 +0100
branchjv
changeset 24334 e82c3f5bc1f1
parent 24093 0f94f6c8c9d4
child 24904 0545a657e7a4
Issue #259: fix `ProjectDefinition >> classesForPlatform` and use it `#testSuite` THis allows packages to specify testcases valid for some platform only. This is normally not needed but sometimes the testcase uses a class that is platform specific and this will cause package validation error upon commit.
ProjectDefinition.st
--- a/ProjectDefinition.st	Tue Apr 09 11:34:04 2019 +0200
+++ b/ProjectDefinition.st	Wed Jun 12 15:02:01 2019 +0100
@@ -1208,7 +1208,7 @@
     |suite classes|
 
     suite := TestSuite named:self package.
-    classes := self classes
+    classes := self classesForPlatform
                 select:[:each |
                     [
                     each isLoaded ifFalse:[each autoload].
@@ -1234,6 +1234,7 @@
     "Created: / 01-04-2011 / 15:20:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 03-06-2011 / 17:07:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 08-08-2011 / 14:59:45 / cg"
+    "Modified: / 12-06-2019 / 14:49:00 / jv"
 ! !
 
 !ProjectDefinition class methodsFor:'class initialization'!
@@ -7782,6 +7783,36 @@
     "
 !
 
+classNamesForPlatform
+    "answer an array containing all the class names of the project's classes"
+
+    ^ self classNamesForPlatform: OperatingSystem platformName.
+
+
+    "
+     stx_libbasic classNamesForPlatform
+     stx_libview_tests classNamesForPlatform
+     stx_libhtml classNamesForPlatform
+    "
+
+    "Created: / 12-06-2019 / 14:52:01 / jv"
+!
+
+classNamesForPlatform: platformName
+    "answer an array containing all the class names of the project's classes"
+
+
+    ^ self classNamesForWhich:[:nm :attr | attr isEmptyOrNil or:[ (attr includes: platformName) or:[ (attr includes: #autoload) ]]]
+
+    "
+     stx_libbasic classNamesForPlatform
+     stx_libview_tests classNamesForPlatform
+     stx_libhtml classNamesForPlatform
+    "
+
+    "Created: / 12-06-2019 / 14:56:28 / jv"
+!
+
 classNamesForWhich:aBlock
     "a correponding method with real names is generated in my subclasses"
 
@@ -7825,8 +7856,11 @@
 
     "
      stx_libbasic classesForPlatform
+     stx_libview_tests classesForPlatform
      stx_libbasic classes
     "
+
+    "Modified (comment): / 12-06-2019 / 14:52:30 / jv"
 !
 
 compiled_classNames