ProjectDefinition.st
changeset 9559 06e8b0498471
parent 9555 5b5d49d5f09d
child 9569 b0bf179c9bf5
equal deleted inserted replaced
9558:510ca1ebce30 9559:06e8b0498471
    11 "
    11 "
    12 
    12 
    13 "{ Package: 'stx:libbasic3' }"
    13 "{ Package: 'stx:libbasic3' }"
    14 
    14 
    15 Object subclass:#BuildDefinition
    15 Object subclass:#BuildDefinition
    16 	instanceVariableNames:''
    16         instanceVariableNames:''
    17 	classVariableNames:''
    17         classVariableNames:''
    18 	poolDictionaries:''
    18         poolDictionaries:''
    19 	category:'System-Support-Projects'
    19         category:'System-Support-Projects'
    20 !
    20 !
    21 
    21 
    22 !BuildDefinition class methodsFor:'documentation'!
    22 !BuildDefinition class methodsFor:'documentation'!
    23 
    23 
    24 copyright
    24 copyright
    33  other person.  No title to or ownership of the software is
    33  other person.  No title to or ownership of the software is
    34  hereby transferred.
    34  hereby transferred.
    35 "
    35 "
    36 ! !
    36 ! !
    37 
    37 
       
    38 !BuildDefinition class methodsFor:'instance creation'!
       
    39 
       
    40 newForPackage:packageID
       
    41     ^ self 
       
    42         newNamed:(self initialClassNameForDefinitionOf:packageID) 
       
    43         package:packageID.
       
    44 
       
    45     "Created: / 11-08-2006 / 14:27:19 / cg"
       
    46 !
       
    47 
       
    48 newNamed:newName package:packageID
       
    49     |newClass|
       
    50 
       
    51     "/ for now, we are strict.
       
    52     self assert:(self initialClassNameForDefinitionOf:packageID) = newName.
       
    53     self assert:(self ~~ BuildDefinition).  "BuildDefinition is abstract"
       
    54 
       
    55     newClass := self
       
    56                     subclass:(newName asSymbol)
       
    57                     instanceVariableNames:''
       
    58                     classVariableNames:''
       
    59                     poolDictionaries:''
       
    60                     category:(self defaultCategory).
       
    61 
       
    62     newClass package:packageID asSymbol.
       
    63     ^ newClass
       
    64 
       
    65     "Created: / 09-08-2006 / 17:57:37 / fm"
       
    66     "Modified: / 09-08-2006 / 19:27:53 / fm"
       
    67     "Modified: / 17-08-2006 / 14:35:02 / cg"
       
    68 ! !
       
    69 
    38 !BuildDefinition class methodsFor:'accessing'!
    70 !BuildDefinition class methodsFor:'accessing'!
    39 
    71 
    40 defaultCategory
    72 defaultCategory
    41     ^'* Projects *'
    73     ^'* Projects *'
    42 
    74 
    61     "Created: / 09-08-2006 / 17:44:47 / fm"
    93     "Created: / 09-08-2006 / 17:44:47 / fm"
    62     "Modified: / 11-08-2006 / 14:00:05 / cg"
    94     "Modified: / 11-08-2006 / 14:00:05 / cg"
    63 !
    95 !
    64 
    96 
    65 libraryName
    97 libraryName
    66        ^ self libraryNameFor: self package
    98     ^ self libraryNameFor:self package
    67 
    99 
    68 "
   100     "
    69    bosch_dapasx_datenbasis_Definition libraryName   
   101        bosch_dapasx_datenbasis_Definition libraryName
    70 "
   102     "
    71 
   103 
    72     "Modified: / 09-08-2006 / 18:20:29 / fm"
   104     "Modified: / 09-08-2006 / 18:20:29 / fm"
    73 !
   105     "Modified: / 17-08-2006 / 14:13:14 / cg"
    74 
   106 !
    75 libraryNameFor: aProjectID
   107 
    76        ^ aProjectID asString copy replaceAny:':/' with:$_
   108 libraryNameFor:aProjectID 
    77 
   109     ^ aProjectID asString copy replaceAny:':/' with:$_
    78 "
   110 
    79    bosch_dapasx_datenbasis libraryName   
   111     "
    80 "
   112        bosch_dapasx_datenbasis libraryName
       
   113     "
    81 
   114 
    82     "Modified: / 09-08-2006 / 18:20:29 / fm"
   115     "Modified: / 09-08-2006 / 18:20:29 / fm"
    83     "Modified: / 11-08-2006 / 14:02:06 / cg"
   116     "Modified: / 17-08-2006 / 14:13:21 / cg"
    84 !
   117 !
    85 
   118 
    86 module
   119 module
    87 
   120     ^ self moduleOfClass:self
    88 ^self moduleOfClass: self
   121 
    89 
   122     "
    90 "
   123        bosch_dapasx_datenbasis_Definition module
    91    bosch_dapasx_datenbasis_Definition module
   124        DapasX_Datenbasis module
    92    DapasX_Datenbasis module
   125     "
    93 "
       
    94 
   126 
    95     "Created: / 08-08-2006 / 20:24:53 / fm"
   127     "Created: / 08-08-2006 / 20:24:53 / fm"
    96     "Modified: / 09-08-2006 / 16:16:37 / fm"
   128     "Modified: / 09-08-2006 / 16:16:37 / fm"
       
   129     "Modified: / 17-08-2006 / 14:13:28 / cg"
    97 !
   130 !
    98 
   131 
    99 moduleDirectory
   132 moduleDirectory
   100 
   133     ^ self moduleDirectoryFor:self package
   101 ^self moduleDirectoryFor: self package 
   134 
   102 
   135     "
   103 "
   136         bosch_dapasx_datenbasis_Definition moduleDirectory
   104     bosch_dapasx_datenbasis_Definition moduleDirectory    
   137         bosch_dapasx_parameter_system_Definition moduleDirectory
   105     bosch_dapasx_parameter_system_Definition moduleDirectory
   138     "
   106 "
       
   107 
   139 
   108     "Created: / 08-08-2006 / 20:25:39 / fm"
   140     "Created: / 08-08-2006 / 20:25:39 / fm"
   109 !
   141     "Modified: / 17-08-2006 / 14:13:36 / cg"
   110 
   142 !
   111 moduleDirectoryFor: aProjectID
   143 
   112 
   144 moduleDirectoryFor:aProjectID 
   113 ^(aProjectID subStrings: $:) last
   145     ^ (aProjectID subStrings:$:) last
   114 
   146 
   115 "
   147     "
   116     bosch_dapasx_datenbasis_Definition moduleDirectory    
   148         bosch_dapasx_datenbasis_Definition moduleDirectory
   117     bosch_dapasx_parameter_system_Definition moduleDirectory
   149         bosch_dapasx_parameter_system_Definition moduleDirectory
   118 "
   150     "
   119 
   151 
   120     "Created: / 08-08-2006 / 20:25:39 / fm"
   152     "Created: / 08-08-2006 / 20:25:39 / fm"
   121 !
   153     "Modified: / 17-08-2006 / 14:13:41 / cg"
   122 
   154 !
   123 moduleFor: aProjectID
   155 
   124 
   156 moduleFor:aProjectID 
   125 ^(aProjectID subStrings: $:) first
   157     ^ (aProjectID subStrings:$:) first
   126 
   158 
   127 "
   159     "
   128    DapasXProject module
   160        DapasXProject module
   129    DapasX_Datenbasis module
   161        DapasX_Datenbasis module
   130 "
   162     "
   131 
   163 
   132     "Created: / 09-08-2006 / 16:16:16 / fm"
   164     "Created: / 09-08-2006 / 16:16:16 / fm"
   133 !
   165     "Modified: / 17-08-2006 / 14:13:46 / cg"
   134 
   166 !
   135 moduleOfClass: aClass
   167 
   136 
   168 moduleOfClass:aClass 
   137 ^self moduleFor: aClass package 
   169     ^ self moduleFor:aClass package
   138 
   170 
   139 "
   171     "
   140    DapasXProject module
   172        DapasXProject module
   141    DapasX_Datenbasis module
   173        DapasX_Datenbasis module
   142 "
   174     "
   143 
   175 
   144     "Created: / 09-08-2006 / 16:16:16 / fm"
   176     "Created: / 09-08-2006 / 16:16:16 / fm"
   145 !
   177     "Modified: / 17-08-2006 / 14:13:51 / cg"
   146 
   178 !
   147 msdosPathToPackage:aPackageID
   179 
   148 "Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"
   180 msdosPathToPackage:aPackageID 
   149 
   181     "Returns the path to the package defined by aPackageID relative to my path"
   150         ^ self msdosPathToTop , '\..\' , (aPackageID asString copy replaceAny:':/' with:$\)
   182     
   151 
   183     ^ self msdosPathToTop , '\..\' , (self msdosTopRelativePathToPackage:aPackageID)
   152 "
   184 
   153   self msdosPathToPackage:'bosch:dapasx/kernel'
   185     "
   154 "
   186      self msdosPathToPackage:'bosch:dapasx/kernel'
       
   187     "
   155 
   188 
   156     "Created: / 09-08-2006 / 16:35:22 / fm"
   189     "Created: / 09-08-2006 / 16:35:22 / fm"
   157     "Modified: / 16-08-2006 / 18:39:37 / User"
   190     "Modified: / 17-08-2006 / 14:21:53 / cg"
   158 !
   191 !
   159 
   192 
   160 msdosPathToProjectFor: aProjectID
   193 msdosPathToPackage:toPackageID from:fromPackageID
   161 
   194     "Returns the path to the package defined by aPackageID relative to my path"
   162        ^ aProjectID asString copy replaceAny:':/' with:$\
   195     
   163 
   196     ^ (self msdosPathToTopFor:fromPackageID) , '\..\' , (self msdosTopRelativePathToPackage:toPackageID)
   164 "
   197 
   165    self msdosPathToProjectFor: #'bosch:dapasx/datenbasis'   
   198     "
   166 "
   199      self msdosPathToPackage:'bosch:dapasx/kernel' from:'bosch:dapasx/application'
   167 
   200     "
   168     "Modified: / 09-08-2006 / 18:20:29 / fm"
   201 
       
   202     "Created: / 17-08-2006 / 14:26:39 / cg"
   169 !
   203 !
   170 
   204 
   171 msdosPathToTop
   205 msdosPathToTop
   172 "Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"
   206     "Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"
   173 
   207 
   174 
   208     ^self msdosPathToTopFor: self package 
   175        ^self msdosPathToTopFor: self package 
   209 
   176 
   210     "
   177 "
   211      bosch_dapasx_datenbasis_Definition msdosPathToTop    
   178    bosch_dapasx_datenbasis_Definition msdosPathToTop    
   212      DapasX_Datenbasis pathToTop  
   179    DapasX_Datenbasis pathToTop  
   213     "
   180 "
       
   181 
   214 
   182     "Created: / 09-08-2006 / 15:45:54 / fm"
   215     "Created: / 09-08-2006 / 15:45:54 / fm"
       
   216     "Modified: / 17-08-2006 / 14:25:28 / cg"
   183 !
   217 !
   184 
   218 
   185 msdosPathToTopFor: aProjectID
   219 msdosPathToTopFor: aProjectID
   186 "Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"
   220     "Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"
   187 
   221 
   188 
   222     ^ (((1 to:(aProjectID asCollectionOfSubstringsSeparatedByAny:':/') size)
   189        ^ (((1 to:(aProjectID asCollectionOfSubstringsSeparatedByAny:':/') size)
       
   190             collect:[:n | '..\']) asStringWith:'') , 'stx'    
   223             collect:[:n | '..\']) asStringWith:'') , 'stx'    
   191 
   224 
   192 "
   225     "
   193    self msdosPathToTopFor: #'bosch:dapasx/datenbasis'   
   226      self msdosPathToTopFor: #'bosch:dapasx/datenbasis'   
   194 
   227     "
   195 "
       
   196 
   228 
   197     "Created: / 09-08-2006 / 15:45:54 / fm"
   229     "Created: / 09-08-2006 / 15:45:54 / fm"
       
   230     "Modified: / 17-08-2006 / 14:25:18 / cg"
       
   231 !
       
   232 
       
   233 msdosTopRelativePathToPackage:aPackageID 
       
   234     "Returns the path to the package as specified by aPackageID relative to the top directory"
       
   235     
       
   236     ^ aPackageID asString copy replaceAny:':/' with:$\
       
   237 
       
   238     "
       
   239      self msdosTopRelativePathToPackage:'stx:goodies/xml'
       
   240      self msdosTopRelativePathToPackage:'bosch:dapasx/kernel'
       
   241     "
       
   242 
       
   243     "Created: / 17-08-2006 / 14:20:44 / cg"
   198 !
   244 !
   199 
   245 
   200 packageName
   246 packageName
   201 
   247 
   202 ^self packageNameFor: self package
   248 ^self packageNameFor: self package
   257 requiredProjects
   303 requiredProjects
   258 
   304 
   259 ^self preRequisites, self subProjects
   305 ^self preRequisites, self subProjects
   260 !
   306 !
   261 
   307 
       
   308 topRelativeMsdosPathToPackage:aPackageID 
       
   309     "Returns the path to the package as specified by aPackageID relative to the top directory"
       
   310     
       
   311     ^ aPackageID asString copy replaceAny:':/' with:$\
       
   312 
       
   313     "
       
   314      self topRelativePathToPackage:'stx:goodies/xml'
       
   315      self topRelativePathToPackage:'bosch:dapasx/kernel'
       
   316     "
       
   317 
       
   318     "Created: / 17-08-2006 / 14:16:28 / cg"
       
   319 !
       
   320 
   262 unixPathToPackage:aPackageID
   321 unixPathToPackage:aPackageID
   263 "Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"
   322     "Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"
   264 
   323 
   265         ^ self unixPathToTop , '/../' , (aPackageID asString copy replaceAll:$: with:$/)
   324     ^ self unixPathToTop , '/../' , (self unixTopRelativePathToPackage:aPackageID)
   266 
   325 
   267 "
   326     "
   268    DapasX_Datenbasis pathToPackage:'bosch:dapasx/kernel'
   327      bosch_dapasx_kernel unixPathToPackage:'bosch:dapasx/kernel'
   269 "
   328     "
   270 
   329 
   271     "Created: / 09-08-2006 / 16:35:22 / fm"
   330     "Created: / 09-08-2006 / 16:35:22 / fm"
   272     "Modified: / 16-08-2006 / 18:55:41 / User"
   331     "Modified: / 16-08-2006 / 18:55:41 / User"
   273 !
   332     "Modified: / 17-08-2006 / 14:20:28 / cg"
   274 
       
   275 unixPathToProjectFor: aProjectID
       
   276 
       
   277        ^ aProjectID asString copy replaceAny:':/' with:$/
       
   278 
       
   279 "
       
   280    self unixPathToProjectFor: #'bosch:dapasx/datenbasis'   
       
   281 "
       
   282 
       
   283     "Modified: / 09-08-2006 / 18:20:29 / fm"
       
   284 !
   333 !
   285 
   334 
   286 unixPathToTop
   335 unixPathToTop
   287 "Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"
   336     "Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"
   288 
   337 
   289 
   338     ^ (((1 to:(self package asCollectionOfSubstringsSeparatedByAny:':/') size)
   290        ^ (((1 to:(self package asCollectionOfSubstringsSeparatedByAny:':/') size)
   339         collect:[:n | '../']) asStringWith:'') , 'stx'    
   291             collect:[:n | '../']) asStringWith:'') , 'stx'    
   340 
   292 
   341     "
   293 "
   342      bosch_dapasx_kernel unixPathToTop        
   294    DapasXProject pathToTop    
   343      stx_goodies_xml unixPathToTop  
   295    DapasX_Datenbasis pathToTop  
   344     "
   296 "
       
   297 
   345 
   298     "Created: / 09-08-2006 / 15:45:54 / fm"
   346     "Created: / 09-08-2006 / 15:45:54 / fm"
       
   347     "Modified: / 17-08-2006 / 14:17:59 / cg"
       
   348 !
       
   349 
       
   350 unixTopRelativePathToPackage:aPackageID 
       
   351     "Returns the path to the package as specified by aPackageID relative to the top directory"
       
   352     
       
   353     ^ aPackageID asString copy replaceAny:':/' with:$/
       
   354 
       
   355     "
       
   356      self unixTopRelativePathToPackage:'stx:goodies/xml'
       
   357      self unixTopRelativePathToPackage:'bosch:dapasx/kernel'
       
   358     "
       
   359 
       
   360     "Created: / 17-08-2006 / 14:20:18 / cg"
   299 ! !
   361 ! !
   300 
   362 
   301 !BuildDefinition class methodsFor:'defaults'!
   363 !BuildDefinition class methodsFor:'defaults'!
   302 
   364 
   303 defaultDescription
   365 defaultDescription
   791 ! !
   853 ! !
   792 
   854 
   793 !BuildDefinition class methodsFor:'queries'!
   855 !BuildDefinition class methodsFor:'queries'!
   794 
   856 
   795 definitionClassForPackage: aPackageID
   857 definitionClassForPackage: aPackageID
   796     |packageDefinitionClassName|
   858     ^ self definitionClassForPackage:aPackageID createIfAbsent:false
       
   859 
       
   860     "Modified: / 17-08-2006 / 14:33:35 / cg"
       
   861 !
       
   862 
       
   863 definitionClassForPackage: aPackageID createIfAbsent: doCreateIfAbsent
       
   864     |packageDefinitionClassName class|
   797 
   865 
   798     packageDefinitionClassName := ProjectDefinition initialClassNameForDefinitionOf:aPackageID.
   866     packageDefinitionClassName := ProjectDefinition initialClassNameForDefinitionOf:aPackageID.
   799     ^ Smalltalk at:packageDefinitionClassName asSymbol.
   867     class := Smalltalk classNamed:packageDefinitionClassName.
   800 
   868     class isNil ifTrue:[
   801     "Created: / 17-08-2006 / 09:53:09 / cg"
   869         doCreateIfAbsent ifTrue:[
       
   870             ^ self newForPackage:aPackageID    
       
   871         ].
       
   872     ].
       
   873     ^ class
       
   874 
       
   875     "Created: / 17-08-2006 / 14:33:02 / cg"
       
   876 !
       
   877 
       
   878 definitionClassForPackage:newProjectID type:type createIfAbsent:createIfAbsent
       
   879     ^ (self definitionClassForType:type)
       
   880         definitionClassForPackage:newProjectID createIfAbsent:createIfAbsent
       
   881 
       
   882     "Created: / 17-08-2006 / 14:48:01 / cg"
       
   883 !
       
   884 
       
   885 definitionClassForType: type
       
   886     (type = 'Application') ifTrue:[ ^ ApplicationDefinition ].
       
   887     (type = 'Library') ifTrue:[ ^ ProjectDefinition ].
       
   888     self error.
       
   889 
       
   890     "Created: / 17-08-2006 / 14:46:28 / cg"
   802 !
   891 !
   803 
   892 
   804 hasAllClassesLoaded
   893 hasAllClassesLoaded
   805     self allClassNames do:[:nm |
   894     self allClassNames do:[:nm |
   806         |cls|
   895         |cls|
   828 ! !
   917 ! !
   829 
   918 
   830 !BuildDefinition class methodsFor:'testing'!
   919 !BuildDefinition class methodsFor:'testing'!
   831 
   920 
   832 isProjectDefinition
   921 isProjectDefinition
   833     ^ self ~~ ProjectDefinition
   922     ^ self ~~ BuildDefinition
   834 
   923 
   835     "Created: / 10-08-2006 / 16:24:02 / cg"
   924     "Created: / 10-08-2006 / 16:24:02 / cg"
       
   925     "Modified: / 17-08-2006 / 14:12:04 / cg"
   836 ! !
   926 ! !
   837 
   927 
   838 !BuildDefinition class methodsFor:'update description'!
   928 !BuildDefinition class methodsFor:'update description'!
   839 
   929 
   840 compileDescriptionMethods
   930 compileDescriptionMethods
   980 ! !
  1070 ! !
   981 
  1071 
   982 !BuildDefinition class methodsFor:'documentation'!
  1072 !BuildDefinition class methodsFor:'documentation'!
   983 
  1073 
   984 version
  1074 version
   985     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.10 2006-08-17 07:55:05 cg Exp $'
  1075     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.11 2006-08-17 14:11:34 cg Exp $'
   986 ! !
  1076 ! !