#REFACTORING by cg
class: ProjectDefinition
added:9 methods
comment/format in:7 methods
changed:
#info_dot_plist_contents
#packageName_dot_rc_mappings (send #applicationIconFileNameWindows instead of #applicationIconFileName)
--- a/ProjectDefinition.st Sun Oct 09 00:50:37 2016 +0200
+++ b/ProjectDefinition.st Sun Oct 09 11:21:34 2016 +0200
@@ -36,6 +36,14 @@
privateIn:ProjectDefinition
!
+Object subclass:#ApplicationDocumentTypeDescription
+ instanceVariableNames:'extension iconFileOSX mimeType typeName iconFileWindows
+ iconFileLinux roleOSX'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:ProjectDefinition
+!
+
!ProjectDefinition class methodsFor:'documentation'!
buildingMakefiles
@@ -1329,7 +1337,63 @@
!ProjectDefinition class methodsFor:'code generation'!
+applicationIconFileNameLinux_code
+ ^ String streamContents:[:s |
+ s nextPutLine:'applicationIconFileNameLinux'.
+ s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon).'
+ s nextputLine:' This is currently unused (will be for desktop definitions)"'.
+ s cr;
+ nextPutLine:' ^ nil';
+ nextPutLine:' " ^ self applicationName "'.
+ ].
+
+ "
+ self applicationIconFileNameLinux_code
+ stx_libbasic3 applicationIconFileNameLinux_code
+ "
+
+ "Created: / 18-08-2006 / 16:21:01 / cg"
+!
+
+applicationIconFileNameOSX_code
+ ^ String streamContents:[:s |
+ s nextPutLine:'applicationIconFileNameOSX'.
+ s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon).'
+ s nextputLine:' This is used to create the info.plist file"'.
+ s cr;
+ nextPutLine:' ^ nil';
+ nextPutLine:' " ^ self applicationName "'.
+ ].
+
+ "
+ self applicationIconFileNameOSX_code
+ stx_libbasic3 applicationIconFileNameOSX_code
+ "
+
+ "Created: / 18-08-2006 / 16:21:01 / cg"
+!
+
+applicationIconFileNameWindows_code
+ ^ String streamContents:[:s |
+ s nextPutLine:'applicationIconFileNameWindows'.
+ s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon).'
+ s nextputLine:' This will be included in the rc-resource file for Windowsdeployment"'.
+ s cr;
+ nextPutLine:' ^ nil';
+ nextPutLine:' " ^ self applicationName "'.
+ ].
+
+ "
+ self applicationIconFileNameWindows_code
+ stx_libbasic3 applicationIconFileNameWindows_code
+ "
+
+ "Created: / 18-08-2006 / 16:21:01 / cg"
+!
+
applicationIconFileName_code
+ "obsolete - replaced by three separate methods as-per-OS"
+
^ String streamContents:[:s |
s nextPutLine:'applicationIconFileName'.
s nextPutLine:' "Return the name (without suffix) of an icon-file (the app''s icon); will be included in the rc-resource file"'.
@@ -1478,6 +1542,8 @@
!
companyName_code
+ "generate code that answers the company name."
+
^ self companyName_codeFor:self companyName
"
@@ -1489,6 +1555,8 @@
!
companyName_codeFor:aString
+ "generate code that answers aString as the company name."
+
^ String streamContents:[:s |
s nextPutLine:'companyName'.
s nextPutAll: ' "'; nextPutAll: (self class superclass lookupMethodFor: #companyName) comment; nextPutLine:'"'.
@@ -1850,7 +1918,7 @@
].
"
- self productInstallDirBaseName_code
+ ApplicationDefinition productInstallDirBaseName_code
stx_libbasic3 productInstallDirBaseName_code
stx_clients_Clock_QlockTwoWatchApplication productInstallDirBaseName_code
"
@@ -1860,6 +1928,8 @@
!
productName_code
+ "generate code that answers the product name."
+
^ self productName_codeFor:(self productName)
"
@@ -1871,6 +1941,8 @@
!
productName_codeFor:aString
+ "generate code that answers aString as the product name."
+
^ String streamContents:[:s |
s nextPutLine:'productName'.
s nextPutAll: ' "'; nextPutAll: (self class superclass lookupMethodFor: #productName) comment; nextPutLine:'"'.
@@ -2752,12 +2824,47 @@
^ #()
!
+applicationDocumentTypeDescriptions
+ "Return the OSX document type descriptions.
+ For deployment, some systems can make use of additional information
+ on which documents are handled by the application.
+ This is used eg. for double-clicking on a document in OSX.
+ If the deployed app can/should handle this, redefine this
+ to return a collection of instances of me."
+
+
+ ^ nil
+!
+
applicationIconFileName
"Return the icon-filename for the application (nil if there is none)"
^ nil
!
+applicationIconFileNameLinux
+ "Return the icon-filename for the application (nil if there is none)"
+
+ ^ nil
+!
+
+applicationIconFileNameOSX
+ "Return the OSX icon-filename for the application (nil if there is none).
+ This must be the name of a .icns file, which contains the app-icon in
+ multiple resolutions."
+
+ ^ nil
+!
+
+applicationIconFileNameWindows
+ "Return the icon-filename for the application (nil if there is none).
+ This must be the name of a .ico file, which contains the app-icon in
+ single or multiple resolutions."
+
+ "/ for backward compatibility
+ ^ self applicationIconFileName
+!
+
companyName
"Returns a company string which will appear in <lib>.rc.
Under win32, this is placed into the dll's file-info.
@@ -3984,7 +4091,7 @@
s := String streamContents:[:stream|
|suff|
- s := self applicationIconFileName.
+ s := self applicationIconFileNameWindows.
s notNil ifTrue:[
s asFilename suffix isEmptyOrNil ifTrue:[
suff := '.ico'
@@ -4983,6 +5090,66 @@
"Modified: / 08-08-2006 / 15:46:05 / fm"
!
+info_dot_plist
+ "template for the info.plist file, which is included in an OS X deployment"
+
+ |plist|
+
+ (plist := self info_dot_plist_dictionary) isNil ifTrue:[^ nil].
+ ^ MacPlistXMLCoder encode:plist
+
+ "
+ exept_expecco_application info_dot_plist
+ "
+!
+
+info_dot_plist_dictionary
+ "template for the info.plist file, which is included in an OS X deployment"
+
+ |plist pkg icnFilename docTypeDescriptions|
+
+ plist := Dictionary new.
+ plist at:'CFBundleInfoDictionaryVersion' put:'6.0'.
+ pkg := self package copyReplaceAny:':/' with:$..
+ (pkg endsWith:'.application') ifTrue:[
+ pkg := pkg copyButLast:'.application' size.
+ ].
+ plist at:'CFBundleIdentifier' put:pkg.
+ plist at:'CFBundleShortVersionString' put:(self fileVersion asString).
+ plist at:'CFBundleVersion' put:(self fileVersion asString).
+ plist at:'LSMinimumSystemVersion' put:'10.6'.
+ "/ plist at:'CFBundleDevelopmentRegion' put:'English'.
+ "/ plist at:'CFBundleExecutable' put:(self executableName).
+
+ self isLibraryDefinition ifTrue:[
+ plist at:'CFBundleName' put:(self package copyReplaceAny:':/' with:$.).
+ ] ifFalse:[
+ plist at:'CFBundleName' put:(self applicationName).
+ plist at:'CFBundlePackageType' put:'APPL'.
+ ].
+ (icnFilename := self applicationIconFileNameOSX) notNil ifTrue:[
+ plist at:'CFBundleIconFile' put:icnFilename.
+ ].
+ (docTypeDescriptions := self applicationDocumentTypeDescriptions) notNil ifTrue:[
+ plist at:'CFBundleDocumentTypes' put:
+ (docTypeDescriptions collect:[:each |
+ |d|
+ d := Dictionary new.
+ d at:'CFBundleTypeExtensions' put:{ each extension }.
+ d at:'CFBundleTypeIconFile' put:{ each iconFileOSX }.
+ d at:'CFBundleTypeMimeTypes' put:{ each mimeType }.
+ d at:'CFBundleTypeName' put:(each documentTypeName).
+ d at:'CFBundleTypeRole' put:'Editor'.
+ d
+ ]).
+ ].
+ ^ plist
+
+ "
+ exept_expecco_application info_dot_plist
+ "
+!
+
lccmake_dot_mak
"the template code for the lccmake.bat file"
@@ -8093,6 +8260,98 @@
"Created: / 18-08-2011 / 14:18:37 / cg"
! !
+!ProjectDefinition::ApplicationDocumentTypeDescription class methodsFor:'documentation'!
+
+documentation
+"
+ for deployment, some systems can make use of additional information
+ on which documents are handled by the application.
+ This is used eg. for double-clicking on a document in OSX.
+ If the deployed app can/should handle this, redefine the
+ applicatinDocumentTypeDescriptions / applicatinDocumentTypeDescriptionsOSX
+ methods in the projectDefinition to return a collection of instances of me.
+
+ [author:]
+ cg
+
+ For example:
+ mimeType: 'application/x-expecco-testsuite
+ extension: 'ets'
+ typeName: 'expecco test suite'
+ iconFileWindows: 'expeccoSuite.ico'
+ iconFileOSX: 'expeccoSuite.icns'
+ roleOSX: 'Editor'
+"
+! !
+
+!ProjectDefinition::ApplicationDocumentTypeDescription methodsFor:'accessing'!
+
+extension
+ "the extension of the document"
+
+ ^ extension
+!
+
+extension:aString
+ "the extension of the document"
+
+ extension := aString.
+!
+
+iconFileLinux
+ ^ iconFileLinux
+!
+
+iconFileLinux:aString
+ iconFileLinux := aString.
+!
+
+iconFileOSX
+ ^ iconFileOSX
+!
+
+iconFileOSX:aString
+ iconFileOSX := aString.
+!
+
+iconFileWindows
+ ^ iconFileWindows
+!
+
+iconFileWindows:aString
+ iconFileWindows := aString.
+!
+
+mimeType
+ ^ mimeType
+!
+
+mimeType:aString
+ mimeType := aString.
+!
+
+roleOSX
+ ^ roleOSX
+!
+
+roleOSX:aString
+ roleOSX := aString.
+!
+
+typeName
+ "something like 'foo Document';
+ eg. 'expecco test suite', 'expecco log file', etc."
+
+ ^ typeName
+!
+
+typeName:something
+ "something like 'foo Document';
+ eg. 'expecco test suite', 'expecco log file', etc."
+
+ typeName := something.
+! !
+
!ProjectDefinition class methodsFor:'documentation'!
version