"
COPYRIGHT (c) 2006 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
"{ Package: 'stx:libbasic' }"
Object subclass:#ProjectDefinition
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'System-Support-Projects'
!
ProjectDefinition class instanceVariableNames:'overwrittenMethods'
"
No other class instance variables are inherited by this class.
"
!
!ProjectDefinition class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 2006 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
! !
!ProjectDefinition class methodsFor:'instance creation'!
newForPackage:packageID
^ self
newNamed:(self initialClassNameForDefinitionOf:packageID)
package:packageID.
"Created: / 11-08-2006 / 14:27:19 / cg"
!
newNamed:newName package:packageID
|newClass|
"/ for now, we are strict.
self assert:(self initialClassNameForDefinitionOf:packageID) = newName.
self assert:(self ~~ ProjectDefinition). "ProjectDefinition is abstract"
newClass := self
subclass:(newName asSymbol)
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:(self defaultCategory).
newClass package:packageID asSymbol.
^ newClass
"Created: / 09-08-2006 / 17:57:37 / fm"
"Modified: / 09-08-2006 / 19:27:53 / fm"
"Modified: / 17-08-2006 / 17:24:23 / cg"
! !
!ProjectDefinition class methodsFor:'accessing'!
defaultCategory
^'* Projects *'
"Created: / 11-08-2006 / 14:16:49 / cg"
!
initialClassNameForDefinitionOf:aPackageId
|s|
s := aPackageId asString copy replaceAny:':/' with:$_.
(s endsWith:$_) ifTrue:[
s := s copyWithoutLast:1
].
^ s
"
DapasXProject initialClassNameForDefinitionOf:'bosch:dapasx/interactiver_editor'
DapasXProject initialClassNameForDefinitionOf:'stx:libbasic'
DapasXProject initialClassNameForDefinitionOf:'stx:goodies/xml'
"
"Created: / 09-08-2006 / 17:44:47 / fm"
"Modified: / 11-08-2006 / 14:00:05 / cg"
!
libraryName
^ self package asPackageId libraryName
"
bosch_dapasx_datenbasis_Definition libraryName
stx_libbasic3 libraryName
"
"Modified: / 09-08-2006 / 18:20:29 / fm"
"Modified: / 18-08-2006 / 12:36:45 / cg"
!
libraryNameFor:aProjectID
^ aProjectID asPackageId libraryName
"
bosch_dapasx_datenbasis libraryName
stx_libbasic3 libraryNameFor:'stx:libbasic'
"
"Modified: / 09-08-2006 / 18:20:29 / fm"
"Modified: / 18-08-2006 / 12:37:02 / cg"
!
module
^ self moduleOfClass:self
"
bosch_dapasx_datenbasis_Definition module
DapasX_Datenbasis module
stx_libbasic3 module
"
"Created: / 08-08-2006 / 20:24:53 / fm"
"Modified: / 09-08-2006 / 16:16:37 / fm"
"Modified: / 17-08-2006 / 20:50:46 / cg"
!
moduleDirectory
^ (PackageId from:self package) directory
"
bosch_dapasx_datenbasis_Definition moduleDirectory
bosch_dapasx_parameter_system_Definition moduleDirectory
stx_libbasic3 moduleDirectory
"
"Created: / 08-08-2006 / 20:25:39 / fm"
"Modified: / 18-08-2006 / 12:18:33 / cg"
!
moduleDirectoryFor:aProjectID
^ (aProjectID subStrings:$:) last
"
bosch_dapasx_datenbasis_Definition moduleDirectory
bosch_dapasx_parameter_system_Definition moduleDirectory
"
"Created: / 08-08-2006 / 20:25:39 / fm"
"Modified: / 17-08-2006 / 14:13:41 / cg"
!
moduleFor:aProjectID
^ (aProjectID subStrings:$:) first
"
DapasXProject module
DapasX_Datenbasis module
"
"Created: / 09-08-2006 / 16:16:16 / fm"
"Modified: / 17-08-2006 / 14:13:46 / cg"
!
moduleOfClass:aClass
^ self moduleFor:aClass package
"
DapasXProject module
DapasX_Datenbasis module
"
"Created: / 09-08-2006 / 16:16:16 / fm"
"Modified: / 17-08-2006 / 14:13:51 / cg"
!
msdosPathToPackage:aPackageID
"Returns the path to the package defined by aPackageID relative to my path"
^ self msdosPathToTop , '\..\' , (self msdosTopRelativePathToPackage:aPackageID)
"
self msdosPathToPackage:'bosch:dapasx/kernel'
"
"Created: / 09-08-2006 / 16:35:22 / fm"
"Modified: / 17-08-2006 / 14:21:53 / cg"
!
msdosPathToPackage:toPackageID from:fromPackageID
"Returns the path to the package defined by aPackageID relative to my path"
^ (self msdosPathToTopFor:fromPackageID) , '\..\' , (self msdosTopRelativePathToPackage:toPackageID)
"
self msdosPathToPackage:'bosch:dapasx/kernel' from:'bosch:dapasx/application'
"
"Created: / 17-08-2006 / 14:26:39 / cg"
!
msdosPathToTop
"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"
^self msdosPathToTopFor: self package
"
bosch_dapasx_datenbasis_Definition msdosPathToTop
DapasX_Datenbasis pathToTop
"
"Created: / 09-08-2006 / 15:45:54 / fm"
"Modified: / 17-08-2006 / 14:25:28 / cg"
!
msdosPathToTopFor: aProjectID
"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"
^ (((1 to:(aProjectID asCollectionOfSubstringsSeparatedByAny:':/') size)
collect:[:n | '..\']) asStringWith:'') , 'stx'
"
self msdosPathToTopFor: #'bosch:dapasx/datenbasis'
"
"Created: / 09-08-2006 / 15:45:54 / fm"
"Modified: / 17-08-2006 / 14:25:18 / cg"
!
msdosTopRelativePathToPackage:aPackageID
"Returns the path to the package as specified by aPackageID relative to the top directory"
^ aPackageID asString copy replaceAny:':/' with:$\
"
self msdosTopRelativePathToPackage:'stx:goodies/xml'
self msdosTopRelativePathToPackage:'bosch:dapasx/kernel'
"
"Created: / 17-08-2006 / 14:20:44 / cg"
!
packageName
^self packageNameFor: self package
"
bosch_dapasx_hw_schnittstellen_Definition packageName
bosch_dapasx_datenbasis_Definition packageName
bosch_dapasx_parameter_system_Definition packageName
"
"Created: / 08-08-2006 / 20:24:53 / fm"
"Modified: / 09-08-2006 / 16:16:37 / fm"
!
packageNameFor: aProjectID
^((aProjectID asString copy replaceAny:'/' with:$:) subStrings: $:) last
"
bosch_dapasx_hw_schnittstellen packageName
bosch_dapasx_datenbasis packageName
bosch_dapasx_parameter_system packageName
"
"Created: / 08-08-2006 / 20:24:53 / fm"
"Modified: / 09-08-2006 / 16:16:37 / fm"
"Modified: / 11-08-2006 / 14:02:32 / cg"
!
parentProject
^(self parentProjectFor: self package)
"
bosch_dapasx_hw_schnittstellen_Definition parentProject
DapasX_Datenbasis parentProject
"
"Created: / 07-08-2006 / 20:18:27 / fm"
"Modified: / 08-08-2006 / 10:47:37 / fm"
!
parentProjectFor: aProjectID
^(aProjectID subStrings: $/) first
"
bosch_dapasx_hw_schnittstellen parentProject
"
"Created: / 07-08-2006 / 20:18:27 / fm"
"Modified: / 08-08-2006 / 10:47:37 / fm"
"Modified: / 23-08-2006 / 15:07:36 / cg"
!
requiredProjects
^self preRequisites, self subProjects
!
topRelativeMsdosPathToPackage:aPackageID
"Returns the path to the package as specified by aPackageID relative to the top directory"
^ aPackageID asString copy replaceAny:':/' with:$\
"
self topRelativePathToPackage:'stx:goodies/xml'
self topRelativePathToPackage:'bosch:dapasx/kernel'
"
"Created: / 17-08-2006 / 14:16:28 / cg"
!
unixPathToPackage:aPackageID
"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"
^ self unixPathToTop , '/../' , (self unixTopRelativePathToPackage:aPackageID)
"
bosch_dapasx_kernel unixPathToPackage:'bosch:dapasx/kernel'
"
"Created: / 09-08-2006 / 16:35:22 / fm"
"Modified: / 16-08-2006 / 18:55:41 / User"
"Modified: / 17-08-2006 / 14:20:28 / cg"
!
unixPathToTop
"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"
^ (((1 to:(self package asCollectionOfSubstringsSeparatedByAny:':/') size)
collect:[:n | '../']) asStringWith:'') , 'stx'
"
bosch_dapasx_kernel unixPathToTop
stx_goodies_xml unixPathToTop
"
"Created: / 09-08-2006 / 15:45:54 / fm"
"Modified: / 17-08-2006 / 14:17:59 / cg"
!
unixTopRelativePathToPackage:aPackageID
"Returns the path to the package as specified by aPackageID relative to the top directory"
^ aPackageID asString copy replaceAny:':/' with:$/
"
self unixTopRelativePathToPackage:'stx:goodies/xml'
self unixTopRelativePathToPackage:'bosch:dapasx/kernel'
"
"Created: / 17-08-2006 / 14:20:18 / cg"
! !
!ProjectDefinition class methodsFor:'defaults'!
applicationTypes
^ #( 'GUI-Application' 'NonGUI-Application' )
"Created: / 23-08-2006 / 14:27:05 / cg"
!
defaultDescription
^ 'description'
!
libraryTypes
^ #( 'Library' )
"Created: / 23-08-2006 / 14:27:16 / cg"
!
projectTypes
^ self libraryTypes , self applicationTypes
"Created: / 23-08-2006 / 14:27:32 / cg"
! !
!ProjectDefinition class methodsFor:'description'!
postLoadAction
"invoked after loading a project"
"/ intentionally left blank
"Created: / 08-08-2006 / 11:07:40 / fm"
"Modified: / 17-08-2006 / 19:59:17 / cg"
!
preRequisites
"list packages which are required as a prerequisite. This method is generated automatically,
by searching along the inheritance chain of all of my classes.
However, when generating automatically, packages are only added - never removed, unless listed
in excludedFromPreRequisites."
^ #()
"Modified: / 17-08-2006 / 19:54:21 / cg"
!
preUnloadAction
"invoked before unloading a project"
"/ intentionally left blank
"Created: / 08-08-2006 / 11:07:40 / fm"
"Modified: / 17-08-2006 / 19:59:26 / cg"
!
subProjects
"list packages which are known as subprojects. This method is generated automatically.
However, when generating automatically, packages are only added - never removed, unless listed
in excludedFromSubProjects."
^ #()
"Modified: / 17-08-2006 / 19:57:46 / cg"
! !
!ProjectDefinition class methodsFor:'description - classes'!
additionalClassNamesAndAttributes
^ #()
"Created: / 21-08-2006 / 19:53:04 / cg"
!
allClassNames
^ self classNamesForWhich:[:nm :attr | true ].
!
classNames
"a correponding method with real names is generated in my subclasses"
self halt.
^ #()
"Created: / 07-08-2006 / 19:02:57 / fm"
"Modified: / 07-08-2006 / 21:25:25 / fm"
"Modified: / 17-08-2006 / 20:47:20 / cg"
!
classNamesAndAttributes
"a correponding method with real names is generated in my subclasses"
^ #()
"Created: / 07-08-2006 / 19:02:57 / fm"
"Modified: / 07-08-2006 / 21:25:25 / fm"
"Modified: / 17-08-2006 / 20:47:20 / cg"
!
classNamesForWhich:aBlock
"a correponding method with real names is generated in my subclasses"
|coll|
coll := OrderedCollection new.
self classNamesAndAttributesDo:[:nm :attributes |
(aBlock value:nm value:attributes) ifTrue:[
coll add:nm.
].
].
^ coll
"Created: / 07-08-2006 / 19:02:57 / fm"
"Modified: / 07-08-2006 / 21:25:25 / fm"
"Modified: / 17-08-2006 / 20:47:20 / cg"
!
common_compiled_classNames
^ self classNamesForWhich:[:nm :attr | attr isEmptyOrNil].
"Modified: / 07-08-2006 / 21:25:25 / fm"
"Created: / 21-08-2006 / 18:47:12 / cg"
!
compiled_classNames
^ self classNamesForWhich:[:nm :attr | attr isEmptyOrNil or:[(attr includes:#autoload) not]].
"Created: / 07-08-2006 / 19:02:57 / fm"
"Modified: / 07-08-2006 / 21:25:25 / fm"
"Modified: / 21-08-2006 / 18:48:31 / cg"
!
compiled_classNamesForArchitecture:architectureID
^ self
classNamesForWhich:[:nm :attr |
(attr includes:#autoload) not
and:[(attr includes:architectureID)]
].
"Created: / 07-08-2006 / 19:02:57 / fm"
"Modified: / 07-08-2006 / 21:25:25 / fm"
"Modified: / 17-08-2006 / 20:47:20 / cg"
!
compiled_classNames_common
"class, only to be compiled under unix"
^ self
classNamesForWhich:[:nm :attr |
attr isEmptyOrNil
].
"Created: / 18-08-2006 / 13:37:51 / cg"
!
compiled_classNames_unix
"class, only to be compiled under unix"
^ self
classNamesForWhich:[:nm :attr |
attr includes:#unix
].
"Created: / 18-08-2006 / 13:37:51 / cg"
!
compiled_classNames_windows
"class, only to be compiled under windows"
^ self
classNamesForWhich:[:nm :attr |
attr includes:#win32
].
"Created: / 18-08-2006 / 13:37:56 / cg"
!
extensionMethodNames
"list class/selector pairs of extensions.
A correponding method with real names is generated in my subclasses"
^ #()
"Modified: / 17-08-2006 / 20:49:51 / cg"
! !
!ProjectDefinition class methodsFor:'description - compilation'!
additionalDefinitions_make_dot_proto
"allows for additional definitions/rules to be added to the make.proto file."
^ ''
"Created: / 22-08-2006 / 23:53:08 / cg"
!
additionalDefinitions_nt_dot_mak
"allows for additional definitions/rules to be added to the nt.mak file."
^ ''
"Created: / 22-08-2006 / 23:59:32 / cg"
!
additionalRules_make_dot_proto
"allows for additional rules to be added to the make.proto file."
^ ''
"Created: / 22-08-2006 / 23:59:16 / cg"
!
additionalRules_nt_dot_mak
"allows for additional rules to be added to the nt.mak file."
^ ''
"Created: / 22-08-2006 / 23:59:24 / cg"
!
additionalTargets_make_dot_proto
"allows for additional targets to be added to the make.proto file."
^ ''
"Created: / 22-08-2006 / 23:53:33 / cg"
!
additionalTargets_nt_dot_mak
"allows for additional targets to be added to the nt.mak file."
^ ''
"Created: / 23-08-2006 / 00:00:35 / cg"
!
stcOptimizationOptions
"see the stc reference / stc usage for options.
For now, the following variants are useful:
+optspace3 most compact code
- use for all gui, application code.
+optinline +inlineNew fastest code
- use only for computation-intensive classes"
^ '+optspace3'
"/ ^ '+optinline +inlineNew'
"Created: / 18-08-2006 / 12:50:27 / cg"
!
stcWarningOptions
"see the stc reference / stc usage for options.
For now, the following variants are useful:
-warn no warnings
-warnNonStandard no warnings about non-standard smalltalk features"
^ ''
"Created: / 18-08-2006 / 12:51:38 / cg"
! !
!ProjectDefinition class methodsFor:'description - project information'!
companyName
"Returns a company string which will appear in <lib>.rc.
Under win32, this is placed into the dlls file-info"
self module = 'stx' ifTrue:[
^ 'eXept Software AG'
].
^ 'My Company'
"Modified: / 18-08-2006 / 16:08:20 / cg"
!
description
"Returns a description string which will appear in nt.def / bc.def"
^ self name
"Created: / 08-08-2006 / 11:15:01 / fm"
"Modified: / 17-08-2006 / 20:53:34 / cg"
!
fileDescription
"Returns a description string which will appear in libName.rc"
^self productName,' ',self packageName
"Modified: / 17-08-2006 / 20:27:07 / cg"
!
fileMajorVersionNr
"Returns a versionNumber which will appear in libName.rc"
"must be manually maintained - bump, whenever incompatibilities
with the st/x runtime are introduced"
^ Smalltalk majorVersionNr printString
"Created: / 18-08-2006 / 12:03:32 / cg"
!
fileMinorVersionNr
"Returns a versionNumber which will appear in libName.rc"
"take the minor from the cvs-version"
^ Smalltalk minorVersionNr printString
"Created: / 18-08-2006 / 12:03:13 / cg"
"Modified: / 21-08-2006 / 19:30:02 / cg"
!
fileReleaseNr
"Returns a releaseNumber which will appear in libName.rc"
^ self cvsRevision last
"Created: / 18-08-2006 / 12:02:58 / cg"
"Modified: / 21-08-2006 / 19:30:12 / cg"
!
fileRevisionNr
"Returns a revisionNumber which will appear in libName.rc"
"take the revision from the cvs-version"
^ self cvsRevision first
"Created: / 18-08-2006 / 12:02:39 / cg"
"Modified: / 21-08-2006 / 19:30:10 / cg"
!
fileVersion
"Returns a fileVersion string which will appear in libName.rc"
"<major>.<minor>.<rev>.<rel> (such as '1.2.17.1') "
^ self fileMajorVersionNr
, '.'
, self fileMinorVersionNr
, '.'
, self fileRevisionNr
, '.'
, self fileReleaseNr
"
self fileVersion
"
"Modified: / 18-08-2006 / 12:06:21 / cg"
!
fileVersionCommaSeparated
"Returns a fileVersion string which will appear in libName.rc"
"<major>,<minor>,0,0 (such as '2,17,0,0') "
^ self fileMajorVersionNr
, ','
, self fileMinorVersionNr
, ','
, self fileRevisionNr
, ','
, self fileReleaseNr
"Created: / 17-08-2006 / 20:16:17 / cg"
"Modified: / 18-08-2006 / 13:19:08 / cg"
!
internalName
"Returns a name string which will appear in libName.rc"
^self packageName
"Modified: / 17-08-2006 / 20:27:37 / cg"
!
legalCopyright
"Returns a copyright string which will appear in <lib>.rc.
Under win32, this is placed into the dlls file-info"
self module = 'stx' ifTrue:[
"hardwired-in"
^ 'Copyright Claus Gittinger 1988-%1\nCopyright eXept Software AG 1998-%1'
bindWith:(Date today year printString)
].
^ 'My CopyRight or CopyLeft'
"Modified: / 23-08-2006 / 00:06:09 / cg"
!
majorVersionNr
"Returns a versionNumber which will appear in libName.rc"
"<major>.<minor>.<revision>.<release> (such as '5.3.2.1')
the default here takes smalltalks version number.
But thats probably not good for an end-user-app."
^ Smalltalk majorVersionNr
"Created: / 17-08-2006 / 20:20:18 / cg"
!
minorVersionNr
"Returns a versionNumber which will appear in libName.rc"
"<major>.<minor>.<revision>.<release> (such as '5.3.2.1')
the default here takes smalltalks version number.
But thats probably not good for an end-user-app."
^ Smalltalk minorVersionNr
"Created: / 17-08-2006 / 20:20:32 / cg"
!
productDate
"Returns a product-date string which will appear in libName.rc"
"take the current date - by default"
^ Timestamp now printStringRFC1123Format
"Created: / 17-08-2006 / 20:17:28 / cg"
!
productName
"Returns a product name which will appear in <lib>.rc.
Under win32, this is placed into the dlls file-info"
self module = 'stx' ifTrue:[
^ 'Smalltalk/X'
].
^ 'My Product'
"Modified: / 18-08-2006 / 16:08:26 / cg"
!
productVersion
"Returns a product version which will appear in libName.rc"
"<major>.<minor>.<revision>.<release> (such as '5.3.2.1')"
^ self majorVersionNr printString
, '.'
, self minorVersionNr printString
, '.'
, self revisionNr printString
, '.'
, self releaseNr printString
"
self productVersion
"
"Modified: / 18-08-2006 / 12:07:02 / cg"
!
productVersionCommaSeparated
"Returns a product version which will appear in libName.rc"
"<major>.<minor>.<revision>.<release> (such as '0,1,1,1') "
^ self majorVersionNr printString
, ','
, self minorVersionNr printString
, ','
, self revisionNr printString
, ','
, self releaseNr printString
"Created: / 17-08-2006 / 20:13:32 / cg"
!
releaseNr
"Returns a releaseNr which will appear in libName.rc"
"<major>.<minor>.<revision>.<release> (such as '5.3.2.1')
the default here takes smalltalks version number.
But thats probably not good for an end-user-app."
^ Smalltalk releaseNr
"Created: / 17-08-2006 / 20:20:51 / cg"
!
revisionNr
"Returns a revisionNr which will appear in libName.rc"
"<major>.<minor>.<revision>.<release> (such as '5.3.2.1')
the default here takes smalltalks version number.
But thats probably not good for an end-user-app."
^ Smalltalk revisionNr
"Created: / 17-08-2006 / 20:20:40 / cg"
!
versionNumber
"Returns a version string which will appear in nt.def "
^''
"Created: / 08-08-2006 / 11:35:52 / fm"
"Modified: / 17-08-2006 / 19:46:29 / cg"
! !
!ProjectDefinition class methodsFor:'file generation'!
fileNamesToGenerate
self subclassResponsibility
!
forEachFileNameAndGeneratedContentsDo:aTwoArgBlock
|pairs|
pairs := OrderedCollection new.
self forEachFileNameAndGeneratorMethodDo:[:fileName :generator |
|file|
file := self perform:generator.
pairs add:(Array with:fileName with:file)
].
pairs pairsDo:aTwoArgBlock
"Created: / 16-08-2006 / 18:37:52 / User"
!
forEachFileNameAndGeneratorMethodDo:aTwoArgBlock
|fileNamesAndSelectors|
fileNamesAndSelectors := self fileNamesToGenerate asOrderedCollection.
fileNamesAndSelectors
add:(Array
with:self packageName , '.rc'
with:#'generate_packageName_dot_rc').
fileNamesAndSelectors pairsDo:aTwoArgBlock
!
generateFile:filename
filename = 'nt.mak' ifTrue:[
^ self generate_nt_dot_mak
].
filename = 'Make.spec' ifTrue:[
^ self generate_make_dot_spec
].
filename = 'Make.proto' ifTrue:[
^ self generate_make_dot_proto
].
filename = 'bc.def' ifTrue:[
^ self generate_bc_dot_def
].
filename = 'abbrev.stc' ifTrue:[
^ self generate_abbrev_dot_stc
].
self error:('File "%1" not appropriate (not generated) for this type of project.'
bindWith:filename)
"Modified: / 22-08-2006 / 18:39:10 / cg"
!
generate_abbrev_dot_stc
^ String
streamContents:[:s |
|addEntry|
addEntry :=
[:eachClassName |
|cls fn wasLoaded|
s nextPutAll:eachClassName.
s nextPutAll:' '.
cls := Smalltalk classNamed:eachClassName.
cls isNil ifTrue:[
s nextPutAll:(Smalltalk fileNameForClass:eachClassName).
s nextPutAll:' '; nextPutAll:'unknownPackage'; nextPutAll:' '.
s nextPutAll:' '; nextPutAll:'unknownCategory' storeString; nextPutAll:' '.
s nextPutAll:' '; nextPutAll:'0'.
] ifFalse:[
wasLoaded := cls isLoaded.
cls autoload.
fn := cls classFilename asFilename withoutSuffix baseName.
(fn includes:Character space) ifTrue:[
s nextPutAll:fn storeString.
] ifFalse:[
s nextPutAll:fn.
].
s nextPutAll:' '; nextPutAll:(cls package); nextPutAll:' '.
s nextPutAll: (cls category asString storeString).
s nextPutAll:' '; nextPutAll:(cls theMetaclass instVarNames size) printString.
wasLoaded ifFalse:[
cls unload
]
].
s cr.
].
self allClassNames do:addEntry.
self namesAndAttributesIn:(self additionalClassNamesAndAttributes) do: [:nm :attr |
(attr isEmptyOrNil or:[(attr includes:#autoload) not]) ifTrue:[
addEntry value:nm
].
].
]
"
DapasXProject generate_abbrev_dot_stc
DapasX_Datenbasis generate_abbrev_dot_stc
bosch_dapasx_interactiver_editor generate_abbrev_dot_stc
"
"Created: / 09-08-2006 / 11:24:39 / fm"
"Modified: / 22-08-2006 / 18:30:48 / cg"
!
generate_bc_dot_def
^self replaceMappings: self bc_dot_def_mappings
in: self bc_dot_def
"
DapasXProject generate_bc_dot_def
DapasX_Datenbasis generate_bc_dot_def
"
"Modified: / 09-08-2006 / 11:30:42 / fm"
!
generate_bmake_dot_mak
^self replaceMappings: self bmake_dot_mak_mappings
in: self bmake_dot_mak
"Created: / 17-08-2006 / 20:03:43 / cg"
!
generate_make_dot_proto
^self replaceMappings: self make_dot_proto_mappings
in: self make_dot_proto
"
DapasXProject generate_make_dot_proto
DapasX_Datenbasis generate_make_dot_proto
"
"Modified: / 09-08-2006 / 11:31:01 / fm"
!
generate_make_dot_spec
^self replaceMappings: self make_dot_spec_mappings
in: self make_dot_spec
"
DapasXProject generate_make_dot_spec
DapasX_Datenbasis generate_make_dot_spec
bosch_dapasx_kernel_Definition generate_make_dot_spec
"
"Modified: / 09-08-2006 / 11:31:09 / fm"
!
generate_modules_dot_stx
^self replaceMappings: self modules_dot_stx_mappings
in: self modules_dot_stx
"
bosch_dapasx_application generate_modules_dot_stx
"
"Modified: / 09-08-2006 / 11:31:09 / fm"
"Modified: / 11-08-2006 / 14:01:56 / cg"
!
generate_nt_dot_def
^self replaceMappings: self nt_dot_def_mappings
in: self nt_dot_def
"
DapasXProject generate_nt_dot_def
DapasX_Datenbasis generate_nt_dot_def
"
"Modified: / 09-08-2006 / 11:31:21 / fm"
!
generate_nt_dot_mak
^self replaceMappings: self nt_dot_mak_mappings
in: self nt_dot_mak
"
DapasXProject generate_nt_dot_mak
DapasX_Datenbasis generate_nt_dot_mak
"
"Modified: / 09-08-2006 / 11:46:14 / fm"
!
generate_packageName_dot_rc
^self replaceMappings: self packageName_dot_rc_mappings
in: self packageName_dot_rc
"
bosch_dapasx_datenbasis generate_packageName_dot_rc
bosch_dapasx_hw_schnittstellen generate_packageName_dot_rc
stx_libbasic3 generate_packageName_dot_rc
stx_libwidg3 generate_packageName_dot_rc
stx_libwidg3 productVersion
"
"Modified: / 09-08-2006 / 11:31:09 / fm"
"Modified: / 21-08-2006 / 19:33:21 / cg"
! !
!ProjectDefinition class methodsFor:'file templates'!
bmake_dot_mak
"the template code for the bmake.bat file"
^
'make.exe -N -f nt.mak %%1 %%2
'
"Created: / 17-08-2006 / 20:04:14 / cg"
"Modified: / 22-08-2006 / 23:32:24 / cg"
!
packageName_dot_rc
"the template code for the <libName>.rc file"
^
'//
// DO NOT EDIT
// automagically generated from the projectDefinition: ',self name,'.
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION %(FILE_VERSION_COMMASEPARATED)
PRODUCTVERSION %(PRODUCT_VERSION_COMMASEPARATED)
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
FILEFLAGS VS_FF_PRERELEASE | VS_FF_SPECIALBUILD
FILEOS VOS_NT_WINDOWS32
FILETYPE %(FILETYPE)
FILESUBTYPE VS_USER_DEFINED
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "%(COMPANY_NAME)\0"
VALUE "FileDescription", "%(FILE_DESCRIPTION)\0"
VALUE "FileVersion", "%(FILE_VERSION)\0"
VALUE "InternalName", "%(INTERNAL_NAME)\0"
%(LEGAL_COPYRIGHT_LINE)
VALUE "ProductName", "%(PRODUCT_NAME)\0"
VALUE "ProductVersion", "%(PRODUCT_VERSION)\0"
VALUE "ProductDate", "%(PRODUCT_DATE)\0"
END
END
BLOCK "VarFileInfo"
BEGIN // Language | Translation
VALUE "Translation", 0x409, 0x4E4 // U.S. English, Windows Multilingual
END
END
'
"
stx_libbasic3 packageName_dot_rc
stx_libbasic3 generate_packageName_dot_rc
"
"Created: / 08-08-2006 / 19:31:29 / fm"
"Modified: / 09-08-2006 / 15:10:57 / fm"
"Modified: / 23-08-2006 / 01:32:23 / cg"
! !
!ProjectDefinition class methodsFor:'loading'!
load
self loadExtensions.
self loadAllClasses.
"Created: / 17-08-2006 / 01:01:41 / cg"
!
loadAllClasses
|loadedClasses loadClass|
loadedClasses := OrderedCollection new.
loadClass := [:className |
|cls|
cls := Smalltalk at:className asSymbol.
(cls isNil or:[cls isLoaded not]) ifTrue:[
cls := Smalltalk
fileInClass:className
package:self package
initialize:false
lazy:false
silent:false.
cls notNil ifTrue:[
loadedClasses add:cls
].
].
].
self allClassNames do:loadClass.
OperatingSystem isUNIXlike ifTrue:[
self compiled_classNames_unix do:loadClass.
] ifFalse:[
OperatingSystem isMSWINDOWSlike ifTrue:[
self compiled_classNames_windows do:loadClass.
] ifFalse:[
self error:'unknown OS'
].
].
loadedClasses do:[:each |
(each theMetaclass implements:#initialize) ifTrue:[
each initialize
].
].
"Created: / 17-08-2006 / 01:01:14 / cg"
"Modified: / 18-08-2006 / 13:43:48 / cg"
!
loadExtensions
Smalltalk loadExtensionsForPackage:self package.
"Created: / 17-08-2006 / 00:21:39 / cg"
!
postAutoload
self extensionMethodNames notEmptyOrNil ifTrue:[
self loadExtensions
].
"Created: / 17-08-2006 / 00:21:29 / cg"
! !
!ProjectDefinition class methodsFor:'mappings'!
bc_dot_def_mappings
^ (Dictionary new)
at:#'DESCRIPTION'
put:[
|d|
d := self description.
(d isEmptyOrNil ifTrue:[ self defaultDescription ] ifFalse:[ d ]) storeString.
];
yourself
"Created: / 09-08-2006 / 11:17:59 / fm"
!
bmake_dot_mak_mappings
^ (Dictionary new)
yourself
"Created: / 17-08-2006 / 21:41:56 / cg"
!
make_dot_spec_mappings
^ Dictionary new
at: #'TAB' put: ( Character tab asString );
at: #'MODULE' put: ( self module );
at: #'MODULE_DIRECTORY' put: ( self moduleDirectory );
at: #'STCWARNINGOPTIONS' put: (self stcWarningOptions);
at: #'STCOPTIMIZATIONOPTIONS' put: (self stcOptimizationOptions);
yourself
"Created: / 18-08-2006 / 11:44:23 / cg"
"Modified: / 18-08-2006 / 12:53:09 / cg"
!
nt_dot_mak_mappings
|d|
d := Dictionary new.
d
at: #'TAB' put: ( Character tab asString );
at: #'TOP' put: ( self msdosPathToTop );
at: #'MODULE' put: ( self module );
at: #'MODULE_DIRECTORY' put: ( self moduleDirectory ).
^ d
"Created: / 18-08-2006 / 11:43:39 / cg"
!
packageName_dot_rc_mappings
|d s|
d := Dictionary new.
d
at: #'COMPANY_NAME' put: [self companyName];
at: #'FILE_DESCRIPTION' put: [self fileDescription];
at: #'FILE_VERSION' put: [self fileVersion];
at: #'INTERNAL_NAME' put: [self internalName].
s := self legalCopyright.
s notNil ifTrue:[
d
at: #'LEGAL_COPYRIGHT_LINE' put: ' VALUE "LegalCopyright", "',s,'\0"'
].
d
at: #'PRODUCT_NAME' put: [self productName];
at: #'PRODUCT_VERSION' put: [self productVersion];
at: #'PRODUCT_DATE' put: [self productDate];
at: #'FILETYPE' put: [ 'VFT_DLL' ];
at: #'FILE_VERSION_COMMASEPARATED' put: [self fileVersionCommaSeparated];
at: #'PRODUCT_VERSION_COMMASEPARATED' put: [self productVersionCommaSeparated];
yourself.
^ d
"Created: / 09-08-2006 / 11:21:21 / fm"
"Modified: / 23-08-2006 / 01:33:14 / cg"
!
replaceMappings: mappings in: fileTemplate
"Replaces the defined variable mappings found in a file template with the corresponding information"
^ fileTemplate bindWithArguments:mappings.
"
self replaceMappings: (self nt_dot_def_mappingsFor: self) in: self nt_dot_def
"
"Created: / 08-08-2006 / 11:44:27 / fm"
"Modified: / 08-08-2006 / 12:46:13 / fm"
! !
!ProjectDefinition class methodsFor:'private'!
classNamesAndAttributesDo: aBlock
self namesAndAttributesIn:(self classNamesAndAttributes) do: aBlock
"Modified: / 22-08-2006 / 18:20:21 / cg"
!
compile:someCode categorized:category
Class packageQuerySignal
answer:self package
do:[
self theMetaclass compilerClass
compile:someCode
forClass:self theMetaclass
inCategory:category
notifying:nil
install:true
skipIfSame:true
silent:true.
]
"Created: / 23-08-2006 / 14:36:53 / cg"
!
compileDescriptionMethods
Class packageQuerySignal
answer:self package
do:[
self
forEachMethodsCodeToCompileDo:[:code :category |
self compile:code categorized:category
].
self instAndClassMethodsDo:[:m | m package:self package].
].
"
DapasXProject compileDescriptionMethods
DapasX_Datenbasis compileDescriptionMethods
bosch_dapasx_interactiver_editor compileDescriptionMethods
stx_libbasic compileDescriptionMethods
"
"Created: / 09-08-2006 / 18:00:31 / fm"
"Modified: / 23-08-2006 / 14:38:03 / cg"
!
compiled_classes
^ self compiled_classNames collect:[:eachName| (Smalltalk at:eachName asSymbol)]
"Created: / 09-08-2006 / 16:28:15 / fm"
"Modified: / 09-08-2006 / 18:02:28 / fm"
!
compiled_classesDo:aBlock
self compiled_classes do:aBlock.
"Created: / 09-08-2006 / 16:28:15 / fm"
"Modified: / 09-08-2006 / 18:02:28 / fm"
!
compiled_classesForArchitecture:arch
^ (self compiled_classNamesForArchitecture:arch) collect:[:eachName| (Smalltalk at:eachName asSymbol)]
"Created: / 09-08-2006 / 16:28:15 / fm"
"Modified: / 09-08-2006 / 18:02:28 / fm"
!
compiled_classes_common
^ self compiled_classNames_common collect:[:eachName| (Smalltalk at:eachName asSymbol)]
"Created: / 09-08-2006 / 16:28:15 / fm"
"Modified: / 09-08-2006 / 18:02:28 / fm"
!
cvsRevision
|rev|
rev := self revision.
rev isNil ifTrue:[
"not yet pubplished"
^ #( '0' '1' )
].
^ rev asCollectionOfSubstringsSeparatedBy:$. .
"
self cvsRevision
stx_libbasic3 cvsRevision
"
"Created: / 17-08-2006 / 20:19:03 / cg"
!
inconsistency:message
Dialog warn:message
"
self searchForNeverCompiledSuperclasses
DapasX_Datenbasis searchForNeverCompiledSuperclasses
"
"Created: / 09-08-2006 / 16:32:31 / fm"
!
namesAndAttributesIn:aCollection do: aBlock
aCollection do:[:entry |
|className attributes|
entry isArray ifFalse:[
className := entry.
attributes := #().
] ifTrue:[
className := entry first.
attributes := entry copyFrom:2.
].
aBlock value: className value: attributes
].
"Created: / 22-08-2006 / 18:20:09 / cg"
!
searchForClasses
^ (self searchForClassesWithProject: self package)
asOrderedCollection sort:[:a :b | a name < b name]
"
self searchForClasses
"
"Modified: / 07-08-2006 / 21:56:25 / fm"
"Created: / 17-08-2006 / 21:18:30 / cg"
!
searchForClassesWithProject: aProjectID
^ Smalltalk allClasses
select:[:cls | (cls package == aProjectID) ].
"
self searchForClassesWithProject: #'bosch:dapasx'
self searchForClassesWithProject: #'bosch:dapasx/datenbasis'
self searchForClassesWithProject: #'bosch:dapasx/kernel'
"
"Created: / 07-08-2006 / 20:42:39 / fm"
"Modified: / 07-08-2006 / 21:56:25 / fm"
"Modified: / 16-08-2006 / 18:50:48 / User"
!
searchForExtensions
^ self searchForExtensionsWithProject:self package
"
self searchForExtensions
DapasXProject searchForExtensions
DapasX_Datenbasis searchForExtensions
"
"Modified: / 09-08-2006 / 13:01:26 / fm"
"Created: / 17-08-2006 / 21:17:46 / cg"
!
searchForExtensionsWithProject:aProjectID
"search for any class which has extensions from aProjectID.
Return the extension-methods"
|methods|
methods := IdentitySet new.
Smalltalk allClassesDo:[:eachClass |
|classPackage|
classPackage := eachClass package.
eachClass instAndClassMethodsDo:[:mthd |
mthd package ~= classPackage ifTrue:[
mthd package = aProjectID ifTrue:[
methods add:mthd
]
].
].
].
^ methods
"
self searchForExtensionsWithProject:#'bosch:dapasx'
self searchForExtensionsWithProject:#'cg:oyster'
"
"Created: / 17-08-2006 / 21:19:04 / cg"
!
searchForProjectsWhichProvideHeaderFiles
|myPackageID requiredPackages|
requiredPackages := Set new.
myPackageID := self package.
self compiled_classesDo:[:includedClass |
includedClass allSuperclassesDo:[:eachSuperClass |
((eachSuperClass package ~= myPackageID)
and:[ (self moduleOfClass: eachSuperClass) ~= 'stx' ])
ifTrue:[
eachSuperClass package == Project noProjectID ifFalse:[
requiredPackages add:(eachSuperClass package).
]
]
]
].
^ requiredPackages
"
self searchForProjectsWhichProvideHeaderFiles
DapasX_Datenbasis searchForProjectsWhichProvideHeaderFiles
"
"Created: / 09-08-2006 / 16:26:37 / fm"
!
searchForSiblingProjects
|myPackage myParentPackage|
myPackage := self package asPackageId.
myParentPackage := myPackage parentPackage.
myParentPackage isNil ifTrue:[^ #() ].
^ Smalltalk allProjectIDs
select:[:projectID |
|thisPackage|
thisPackage := projectID asPackageId.
(thisPackage parentPackage = myParentPackage)
and:[ thisPackage ~= myPackage ].
]
"
self searchForSiblingProjects
bosch_dapasx_Application searchForSiblingProjects
stx_goodies_refactoryBrowser_changes searchForSiblingProjects
"
"Modified: / 07-08-2006 / 21:56:25 / fm"
"Created: / 23-08-2006 / 15:06:12 / cg"
!
searchForSubProjects
|myPackage|
myPackage := self package.
^ Smalltalk allProjectIDs select:[:projectID |
(projectID asPackageId parentPackage) = myPackage].
"
self searchForSubProjects
bosch_dapasx_Application searchForSubProjects
stx_goodies_refactoryBrowser_changes searchForSubProjects
"
"Created: / 07-08-2006 / 20:42:39 / fm"
"Modified: / 07-08-2006 / 21:56:25 / fm"
"Modified: / 23-08-2006 / 15:11:50 / cg"
!
setupForType:typeOrNil
typeOrNil = 'GUIApplication' ifTrue:[
self compile:'isGUIApplication\ ^ true' withCRs
categorized:'description'.
^ self
].
typeOrNil = 'NonGUI-Application' ifTrue:[
self compile:'isGUIApplication\ ^ false' withCRs
categorized:'description'.
^ self
].
^ self.
"Created: / 23-08-2006 / 14:26:10 / cg"
! !
!ProjectDefinition class methodsFor:'queries'!
definitionClassForPackage: aPackageID
^ self definitionClassForPackage:aPackageID createIfAbsent:false
"Modified: / 17-08-2006 / 14:33:35 / cg"
!
definitionClassForPackage:aPackageID createIfAbsent:doCreateIfAbsent
^ self definitionClassForPackage:aPackageID createIfAbsent:doCreateIfAbsent projectType:nil
"Modified: / 23-08-2006 / 14:29:15 / cg"
!
definitionClassForPackage: aPackageID createIfAbsent: doCreateIfAbsent projectType:typeOrNil
|packageDefinitionClassName class|
packageDefinitionClassName := ProjectDefinition initialClassNameForDefinitionOf:aPackageID.
class := Smalltalk classNamed:packageDefinitionClassName.
class isNil ifTrue:[
doCreateIfAbsent ifTrue:[
class := self newForPackage:aPackageID.
"setup before prerequisites are defined"
class setupForType:typeOrNil.
class compileDescriptionMethods.
].
] ifFalse:[
typeOrNil notNil ifTrue:[
class setupForType:typeOrNil.
].
].
^ class
"Created: / 23-08-2006 / 14:29:21 / cg"
"Modified: / 23-08-2006 / 15:35:26 / cg"
!
definitionClassForPackage:newProjectID projectType:typeOrNil createIfAbsent:createIfAbsent
^ (self definitionClassForType:typeOrNil)
definitionClassForPackage:newProjectID
createIfAbsent:createIfAbsent
projectType:typeOrNil
"Created: / 23-08-2006 / 14:28:53 / cg"
!
definitionClassForType: type
(type = 'Application') ifTrue:[ ^ ApplicationDefinition ].
(type = 'GUI-Application') ifTrue:[ ^ ApplicationDefinition ].
(type = 'NonGUI-Application') ifTrue:[ ^ ApplicationDefinition ].
(type = 'Library') ifTrue:[ ^ LibraryDefinition ].
self error.
"Created: / 17-08-2006 / 14:46:28 / cg"
"Modified: / 23-08-2006 / 13:49:27 / cg"
!
hasAllClassesLoaded
|checkLoaded|
checkLoaded := [:nm |
|cls|
cls := Smalltalk classNamed:nm.
(cls isNil or:[cls isLoaded not]) ifTrue:[^ false ].
].
self allClassNames do:checkLoaded.
OperatingSystem isUNIXlike ifTrue:[
self compiled_classNames_unix do:checkLoaded.
] ifFalse:[
OperatingSystem isMSWINDOWSlike ifTrue:[
self compiled_classNames_windows do:checkLoaded.
] ifFalse:[
self error:'unknown OS'
].
].
^ true.
"Created: / 17-08-2006 / 00:50:01 / cg"
"Modified: / 18-08-2006 / 13:44:31 / cg"
!
hasAllExtensionsLoaded
self extensionMethodNames pairWiseDo:[:className :selector |
|cls|
cls := Smalltalk at:className asSymbol.
(cls isNil or:[cls isLoaded not]) ifTrue:[^ false ].
(cls compiledMethodAt:selector) isNil ifTrue:[^ false ].
].
^ true.
"Created: / 17-08-2006 / 00:50:01 / cg"
! !
!ProjectDefinition class methodsFor:'testing'!
isApplicationDefinition
"concrete i.e. not abstract"
^ false
"Created: / 23-08-2006 / 15:17:32 / cg"
!
isLibraryDefinition
"concrete i.e. not abstract"
^ false
"Created: / 23-08-2006 / 15:17:46 / cg"
!
isProjectDefinition
"concrete i.e. not abstract"
^ self ~~ ProjectDefinition
"Created: / 10-08-2006 / 16:24:02 / cg"
"Modified: / 23-08-2006 / 14:24:38 / cg"
! !
!ProjectDefinition class methodsFor:'update description'!
companyName_code
^ String streamContents:[:s |
s nextPutLine:'companyName'.
s nextPutLine:' "Return a companyname which will appear in <lib>.rc"'.
s cr; nextPutLine:' ^ ',self companyName storeString.
].
"
self companyName_code
stx_libbasic3 companyName_code
"
"Created: / 18-08-2006 / 16:20:42 / cg"
!
description_code
^ String streamContents:[:s |
s nextPutLine:'description'.
s nextPutLine:' "Return a description string which will appear in nt.def / bc.def"'.
s cr; nextPutLine:' ^ ',self description storeString.
].
"
self description_code
stx_libbasic3 description_code
"
"Created: / 17-08-2006 / 21:24:01 / cg"
"Modified: / 18-08-2006 / 16:16:24 / cg"
!
forEachMethodsCodeToCompileDo:aTwoArgBlock
(self implements:#description) ifFalse:[
aTwoArgBlock
value: self description_code
value: 'description - project information'.
].
(self implements:#productName) ifFalse:[
aTwoArgBlock
value: self productName_code
value: 'description - project information'.
].
(self implements:#companyName) ifFalse:[
aTwoArgBlock
value: self companyName_code
value: 'description - project information'.
].
(self implements:#legalCopyright) ifFalse:[
aTwoArgBlock
value: self legalCopyright_code
value: 'description - project information'.
].
"Created: / 18-08-2006 / 16:22:37 / cg"
!
legalCopyright_code
^ String streamContents:[:s |
s nextPutLine:'legalCopyright'.
s nextPutLine:' "Return copyright string which will appear in <lib>.rc"'.
s cr; nextPutLine:' ^ ',self legalCopyright storeString.
].
"
self legalCopyright_code
stx_libbasic3 legalCopyright_code
"
"Created: / 18-08-2006 / 16:21:01 / cg"
!
productName_code
^ String streamContents:[:s |
s nextPutLine:'productName'.
s nextPutLine:' "Return a product name which will appear in <lib>.rc"'.
s cr; nextPutLine:' ^ ',self productName storeString.
].
"
self productName_code
stx_libbasic3 productName_code
"
"Created: / 18-08-2006 / 16:14:19 / cg"
! !
!ProjectDefinition class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.34 2006-08-23 14:43:05 cg Exp $'
! !