ProjectBuilder.st
changeset 2873 bacaa7ec62b1
parent 2868 8a4d46fd157c
child 2895 2b939399b83b
equal deleted inserted replaced
2872:78e56e7f9638 2873:bacaa7ec62b1
    68     builder build.
    68     builder build.
    69 
    69 
    70     UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
    70     UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
    71 ! !
    71 ! !
    72 
    72 
       
    73 !ProjectBuilder class methodsFor:'queries'!
       
    74 
       
    75 defaultUsedCompiler
       
    76     |compiler|
       
    77 
       
    78     (compiler := UserPreferences current usedCompilerForBuild) notNil ifTrue:[
       
    79         ^ compiler
       
    80     ].
       
    81 
       
    82     OperatingSystem isMSWINDOWSlike ifTrue:[
       
    83         ^ 'bcc'
       
    84     ].
       
    85     ^ 'gcc'
       
    86 
       
    87     "Created: / 21-01-2012 / 14:06:51 / cg"
       
    88 !
       
    89 
       
    90 listOfPossibleCompilers
       
    91     OperatingSystem isMSWINDOWSlike ifTrue:[
       
    92         ^ #('bcc' 'vc' 'lcc' 'gcc' )
       
    93     ].
       
    94     ^ #('gcc')
       
    95 
       
    96     "Created: / 21-01-2012 / 14:04:15 / cg"
       
    97 ! !
       
    98 
    73 !ProjectBuilder methodsFor:'accessing'!
    99 !ProjectBuilder methodsFor:'accessing'!
    74 
   100 
    75 buildDirectory
   101 buildDirectory
    76     ^ buildDirectory
   102     ^ buildDirectory
    77 !
   103 !
   100 
   126 
   101 suffixForHeaderFiles
   127 suffixForHeaderFiles
   102     ^ OperatingSystem isUNIXlike ifTrue:['.H'] ifFalse:['.STH']
   128     ^ OperatingSystem isUNIXlike ifTrue:['.H'] ifFalse:['.STH']
   103 !
   129 !
   104 
   130 
   105 usedCompiler:something
   131 usedCompilerForBuild:something
   106     usedCompiler := something.
   132     usedCompiler := something.
       
   133 
       
   134     "Created: / 22-01-2012 / 10:50:48 / cg"
   107 ! !
   135 ! !
   108 
   136 
   109 !ProjectBuilder methodsFor:'building'!
   137 !ProjectBuilder methodsFor:'building'!
   110 
   138 
   111 build
   139 build
   135                             makeOutput nextPut:char.
   163                             makeOutput nextPut:char.
   136                             makeOutput emphasis:nil.
   164                             makeOutput emphasis:nil.
   137                         ]
   165                         ]
   138                     ];
   166                     ];
   139                     nextPutAllBlock:[:string |
   167                     nextPutAllBlock:[:string |
   140                         lock critical:[          (string includesString:'das Ziel' )ifTrue:[self halt].
   168                         lock critical:[          
       
   169                             "/ (string includesString:'das Ziel' )ifTrue:[self halt].
   141                             makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
   170                             makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
   142                             makeOutput nextPutAll:string.
   171                             makeOutput nextPutAll:string.
   143                             makeOutput emphasis:nil.
   172                             makeOutput emphasis:nil.
   144                         ]
   173                         ]
   145                     ].
   174                     ].
   148                         lock critical:[
   177                         lock critical:[
   149                             makeOutput nextPut:char.
   178                             makeOutput nextPut:char.
   150                         ]
   179                         ]
   151                     ];
   180                     ];
   152                     nextPutAllBlock:[:string |
   181                     nextPutAllBlock:[:string |
   153                         lock critical:[         (string includesString:'das Ziel' )ifTrue:[self halt].
   182                         lock critical:[         
       
   183                             "/ (string includesString:'das Ziel' )ifTrue:[self halt].
   154                             makeOutput nextPutAll:string.
   184                             makeOutput nextPutAll:string.
   155                         ]
   185                         ]
   156                     ].
   186                     ].
   157 
   187 
   158     self buildWithOutputTo:stdOut errorTo:stdErr.
   188     self buildWithOutputTo:stdOut errorTo:stdErr.
       
   189 
       
   190     "Modified: / 21-01-2012 / 13:49:13 / cg"
   159 !
   191 !
   160 
   192 
   161 buildWithOutputTo:stdOut errorTo:stdErr
   193 buildWithOutputTo:stdOut errorTo:stdErr
   162     "/ intermediate - this will move into a commonly used utility class
   194     "/ intermediate - this will move into a commonly used utility class
   163     "/ (where all the project code support will be collected).
   195     "/ (where all the project code support will be collected).
   378     OperatingSystem isMSWINDOWSlike ifTrue:[
   410     OperatingSystem isMSWINDOWSlike ifTrue:[
   379         files := #( 
   411         files := #( 
   380                     'support/win32/borland/cs3245.dll' 
   412                     'support/win32/borland/cs3245.dll' 
   381                     'support/win32/X11.dll'
   413                     'support/win32/X11.dll'
   382                     'support/win32/Xext.dll'
   414                     'support/win32/Xext.dll'
   383                     'librun/librun.dll'
   415                     'librun/objbc/librun.dll'
   384                     'libbc/librun.lib'
   416                     'libbc/librun.lib'
   385                     'libbc/cs32i.lib'
   417                     'libbc/cs32i.lib'
   386                     'librun/genDate.exe'
   418                     'librun/genDate.exe'
   387                     'librun/main.c'
   419                     'librun/main.c'
   388                     'projects/smalltalk/stx_16x16.ico'
   420                     'projects/smalltalk/stx_16x16.ico'
   418             ]
   450             ]
   419         ] ifFalse:[
   451         ] ifFalse:[
   420             self error:'Missing file: ',dllRelativePath printString mayProceed:true.
   452             self error:'Missing file: ',dllRelativePath printString mayProceed:true.
   421         ].
   453         ].
   422     ].
   454     ].
       
   455 
       
   456     "Modified: / 21-01-2012 / 13:40:56 / cg"
   423 !
   457 !
   424 
   458 
   425 createHeaderFileFor:aClass in:packageTargetDir
   459 createHeaderFileFor:aClass in:packageTargetDir
   426     |instVarList classInstVarList classVarList bindings superclassFilename
   460     |instVarList classInstVarList classVarList bindings superclassFilename
   427      template file newContents oldContents|
   461      template file newContents oldContents|
   635 
   669 
   636     module := package module.
   670     module := package module.
   637     directory := package directory.
   671     directory := package directory.
   638 
   672 
   639     makeCommand := ParserFlags makeCommand.
   673     makeCommand := ParserFlags makeCommand.
   640     usedCompiler = 'vc' ifTrue:[ makeCommand := 'vcmake'. compilerFlag := '-DUSEVC' ].
   674     usedCompiler = 'vc' ifTrue:[ 
   641     usedCompiler = 'lcc' ifTrue:[ makeCommand := 'lcmake'. compilerFlag := '-DUSELCC' ].
   675         makeCommand := 'vcmake'. "/ compilerFlag := '-DUSEVC' 
   642     usedCompiler = 'gcc' ifTrue:[ makeCommand := 'make'. ].
   676     ] ifFalse:[
       
   677         usedCompiler = 'lcc' ifTrue:[ 
       
   678             makeCommand := 'lcmake'. "/ compilerFlag := '-DUSELCC' 
       
   679         ] ifFalse:[
       
   680             usedCompiler = 'gcc' ifTrue:[ 
       
   681                 makeCommand := 'make'. 
       
   682             ] ifFalse:[
       
   683                 usedCompiler = 'bcc' ifTrue:[ 
       
   684                     makeCommand := 'bmake'.
       
   685                 ] ifFalse:[
       
   686                     self error.
       
   687                 ]
       
   688             ]
       
   689         ]
       
   690     ].
       
   691 
   643     "/ makeCommand := makeCommand, ' TOP=', mySTXTopDirectory pathName.
   692     "/ makeCommand := makeCommand, ' TOP=', mySTXTopDirectory pathName.
   644 
   693 
   645     OperatingSystem isUNIXlike ifTrue:[
   694     OperatingSystem isUNIXlike ifTrue:[
   646         OperatingSystem
   695         OperatingSystem
   647             executeCommand:('sh %1/rules/stmkmf' bindWith:mySTXTopDirectory pathName)
   696             executeCommand:('sh %1/rules/stmkmf' bindWith:mySTXTopDirectory pathName)
   678                 inDirectory:(buildDirectory / module / directory)
   727                 inDirectory:(buildDirectory / module / directory)
   679                 onError:[:status| self error:'make failed'].
   728                 onError:[:status| self error:'make failed'].
   680         ]
   729         ]
   681     ]
   730     ]
   682 
   731 
   683     "Modified: / 15-08-2011 / 14:49:21 / cg"
   732     "Modified: / 21-01-2012 / 13:52:56 / cg"
   684 !
   733 !
   685 
   734 
   686 recursiveCopyDirectoryForBuild:subdir
   735 recursiveCopyDirectoryForBuild:subdir
   687     |targetDir|
   736     |targetDir|
   688 
   737