ProjectBuilder.st
author Claus Gittinger <cg@exept.de>
Tue, 20 Oct 2009 22:36:54 +0200
changeset 2635 8b62bd023558
parent 2634 3f14301cec84
child 2644 428bb83dd360
permissions -rw-r--r--
namespace change
     1 "{ Package: 'stx:libtool2' }"
     2 
     3 "{ NameSpace: Tools }"
     4 
     5 Object subclass:#ProjectBuilder
     6 	instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory
     7 		myWorkingDirectory mySTXTopDirectory myTopDirectory'
     8 	classVariableNames:'PreviousBuildDirectory'
     9 	poolDictionaries:''
    10 	category:'System-Support-Projects'
    11 !
    12 
    13 
    14 !ProjectBuilder class methodsFor:'accessing'!
    15 
    16 previousBuildDirectory
    17     ^ PreviousBuildDirectory
    18 !
    19 
    20 previousBuildDirectory:something
    21     PreviousBuildDirectory := something.
    22 ! !
    23 
    24 !ProjectBuilder class methodsFor:'examples'!
    25 
    26 !
    27 
    28 methodsFor:'examples'
    29 ! !
    30 
    31 !ProjectBuilder methodsFor:'accessing'!
    32 
    33 ileBrowserClass openOnDirectory:builder packageBuildDirectory.
    34 !
    35 
    36 buildDirectory:something
    37     buildDirectory := something.
    38 !
    39 
    40 kageBuildDirectory.
    41 !
    42 
    43 he directoray, where the deployable binary is created (xxxSetup.exe)"
    44 
    45     ^ buildDirectory / (package asPackageId module) / (package asPackageId directory)
    46 !
    47 
    48 'building'
    49 ! !
    50 
    51 !ProjectBuilder methodsFor:'building'!
    52 
    53 "/ intermediate - this will move into a commonly used utility class
    54     "/ (where all the project code support will be collected).
    55 
    56     |module directory|
    57 
    58     projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
    59     projectDefinitionClass isNil ifTrue:[
    60         self error:('Missing ProjectDefinition class for "',package asString,'"')
    61     ].
    62 
    63     "/ ensure that everything is loaded...
    64     projectDefinitionClass loadAsAutoloaded:false.
    65     projectDefinitionClass loadExtensions.
    66     projectDefinitionClass loadAllClassesAsAutoloaded:false.
    67 
    68     module := package module.
    69     directory := package directory.
    70 
    71     buildDirectory isNil ifTrue:[
    72         buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
    73         buildDirectory isNil ifTrue:[
    74             buildDirectory := Filename tempDirectory construct:'stx_build'.
    75         ].
    76     ].
    77     buildDirectory := buildDirectory asFilename.
    78 
    79     "/ self validateBuildDirectoryIsPresent.
    80 
    81     PreviousBuildDirectory := buildDirectory.
    82 
    83     "/ UserPreferences current localBuild:true
    84     UserPreferences current localBuild ifFalse:[
    85         SourceCodeManager notNil ifTrue:[
    86             sourceCodeManager := SourceCodeManagerUtilities sourceCodeManagerFor:projectDefinitionClass.
    87         ]
    88     ].
    89     sourceCodeManager := nil.
    90 
    91     myTopDirectory := 
    92         Smalltalk packagePath 
    93             detect:[:aPath |
    94                 (aPath asFilename / 'stx' / 'include') exists
    95                 and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
    96             ifNone:nil.       
    97     myTopDirectory isNil ifTrue:[
    98         self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
    99     ].
   100     myTopDirectory := myTopDirectory asFilename.
   101     mySTXTopDirectory := myTopDirectory / 'stx'.
   102 
   103     self setupBuildDirectory.
   104     self activityNotification:'Generating stc directory...'.
   105     self copySTCDirectoryForBuild.
   106     self activityNotification:'Generating source files...'.
   107     self generateSourceFiles.
   108     self activityNotification:'Generating dlls for linkage...'.
   109     self copyDLLsForLinkage.
   110     self activityNotification:'Generating support files for linkage...'.
   111     self copySupportFilesForLinkage.
   112     self copyStartupFilesFromSmalltalk.
   113 
   114     self activityNotification:'Executing make...'.
   115     self makeWithOutputTo:stdOut errorTo:stdErr.
   116 !
   117 
   118 buildWithOutputTo:stdOut errorTo:stdErr
   119     "/ intermediate - this will move into a commonly used utility class
   120     "/ (where all the project code support will be collected).
   121 
   122     |module directory|
   123 
   124     projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
   125     projectDefinitionClass isNil ifTrue:[
   126         self error:('Missing ProjectDefinition class for "',package asString,'"')
   127     ].
   128 
   129     "/ ensure that everything is loaded...
   130     projectDefinitionClass loadAsAutoloaded:false.
   131     projectDefinitionClass loadExtensions.
   132     projectDefinitionClass loadAllClassesAsAutoloaded:false.
   133 
   134     module := package module.
   135     directory := package directory.
   136 
   137     buildDirectory isNil ifTrue:[
   138         buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
   139         buildDirectory isNil ifTrue:[
   140             buildDirectory := Filename tempDirectory construct:'stx_build'.
   141         ].
   142     ].
   143     buildDirectory := buildDirectory asFilename.
   144 
   145     "/ self validateBuildDirectoryIsPresent.
   146 
   147     PreviousBuildDirectory := buildDirectory.
   148 
   149     "/ UserPreferences current localBuild:true
   150     UserPreferences current localBuild ifFalse:[
   151         SourceCodeManager notNil ifTrue:[
   152             sourceCodeManager := SourceCodeManagerUtilities sourceCodeManagerFor:projectDefinitionClass.
   153         ]
   154     ].
   155     sourceCodeManager := nil.
   156 
   157     myTopDirectory := 
   158         Smalltalk packagePath 
   159             detect:[:aPath |
   160                 (aPath asFilename / 'stx' / 'include') exists
   161                 and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
   162             ifNone:nil.       
   163     myTopDirectory isNil ifTrue:[
   164         self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
   165     ].
   166     myTopDirectory := myTopDirectory asFilename.
   167     mySTXTopDirectory := myTopDirectory / 'stx'.
   168 
   169     self setupBuildDirectory.
   170     self activityNotification:'Generating stc directory...'.
   171     self copySTCDirectoryForBuild.
   172     self activityNotification:'Generating source files...'.
   173     self generateSourceFiles.
   174     self activityNotification:'Generating dlls for linkage...'.
   175     self copyDLLsForLinkage.
   176     self activityNotification:'Generating support files for linkage...'.
   177     self copySupportFilesForLinkage.
   178     self copyStartupFilesFromSmalltalk.
   179 
   180     self activityNotification:'Executing make...'.
   181     self makeWithOutputTo:stdOut errorTo:stdErr.
   182 !
   183 
   184 lRelativePath).    
   185         ]
   186     ].
   187 !
   188 
   189 !
   190 
   191 !
   192 
   193 !
   194 
   195 !
   196 
   197 !
   198 
   199 !
   200 
   201 !
   202 
   203 !
   204 
   205 !
   206 
   207 !
   208 
   209 !
   210 
   211 !
   212 
   213 ! !
   214 
   215 !ProjectBuilder class methodsFor:'documentation'!
   216 
   217 version_CVS
   218     ^ '$Header$'
   219 ! !