ProjectBuilder.st
changeset 2635 8b62bd023558
parent 2634 3f14301cec84
child 2644 428bb83dd360
     1.1 --- a/ProjectBuilder.st	Tue Oct 20 21:51:54 2009 +0200
     1.2 +++ b/ProjectBuilder.st	Tue Oct 20 22:36:54 2009 +0200
     1.3 @@ -1,5 +1,7 @@
     1.4  "{ Package: 'stx:libtool2' }"
     1.5  
     1.6 +"{ NameSpace: Tools }"
     1.7 +
     1.8  Object subclass:#ProjectBuilder
     1.9  	instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory
    1.10  		myWorkingDirectory mySTXTopDirectory myTopDirectory'
    1.11 @@ -28,33 +30,89 @@
    1.12  
    1.13  !ProjectBuilder methodsFor:'accessing'!
    1.14  
    1.15 -x:clients/Demos/foxCalcApplication'.
    1.16 -    builder build.
    1.17 -
    1.18 -    UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
    1.19 +ileBrowserClass openOnDirectory:builder packageBuildDirectory.
    1.20  !
    1.21  
    1.22  buildDirectory:something
    1.23      buildDirectory := something.
    1.24  !
    1.25  
    1.26 -uilder build.
    1.27 -
    1.28 -    UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
    1.29 -!
    1.30 -
    1.31  kageBuildDirectory.
    1.32  !
    1.33  
    1.34 -packageBuildDirectory
    1.35 -    "the directoray, where the deployable binary is created (xxxSetup.exe)"
    1.36 +he directoray, where the deployable binary is created (xxxSetup.exe)"
    1.37  
    1.38      ^ buildDirectory / (package asPackageId module) / (package asPackageId directory)
    1.39 +!
    1.40 +
    1.41 +'building'
    1.42  ! !
    1.43  
    1.44  !ProjectBuilder methodsFor:'building'!
    1.45  
    1.46 -(package asPackageId module) / (package asPackageId directory)
    1.47 +"/ intermediate - this will move into a commonly used utility class
    1.48 +    "/ (where all the project code support will be collected).
    1.49 +
    1.50 +    |module directory|
    1.51 +
    1.52 +    projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
    1.53 +    projectDefinitionClass isNil ifTrue:[
    1.54 +        self error:('Missing ProjectDefinition class for "',package asString,'"')
    1.55 +    ].
    1.56 +
    1.57 +    "/ ensure that everything is loaded...
    1.58 +    projectDefinitionClass loadAsAutoloaded:false.
    1.59 +    projectDefinitionClass loadExtensions.
    1.60 +    projectDefinitionClass loadAllClassesAsAutoloaded:false.
    1.61 +
    1.62 +    module := package module.
    1.63 +    directory := package directory.
    1.64 +
    1.65 +    buildDirectory isNil ifTrue:[
    1.66 +        buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
    1.67 +        buildDirectory isNil ifTrue:[
    1.68 +            buildDirectory := Filename tempDirectory construct:'stx_build'.
    1.69 +        ].
    1.70 +    ].
    1.71 +    buildDirectory := buildDirectory asFilename.
    1.72 +
    1.73 +    "/ self validateBuildDirectoryIsPresent.
    1.74 +
    1.75 +    PreviousBuildDirectory := buildDirectory.
    1.76 +
    1.77 +    "/ UserPreferences current localBuild:true
    1.78 +    UserPreferences current localBuild ifFalse:[
    1.79 +        SourceCodeManager notNil ifTrue:[
    1.80 +            sourceCodeManager := SourceCodeManagerUtilities sourceCodeManagerFor:projectDefinitionClass.
    1.81 +        ]
    1.82 +    ].
    1.83 +    sourceCodeManager := nil.
    1.84 +
    1.85 +    myTopDirectory := 
    1.86 +        Smalltalk packagePath 
    1.87 +            detect:[:aPath |
    1.88 +                (aPath asFilename / 'stx' / 'include') exists
    1.89 +                and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
    1.90 +            ifNone:nil.       
    1.91 +    myTopDirectory isNil ifTrue:[
    1.92 +        self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
    1.93 +    ].
    1.94 +    myTopDirectory := myTopDirectory asFilename.
    1.95 +    mySTXTopDirectory := myTopDirectory / 'stx'.
    1.96 +
    1.97 +    self setupBuildDirectory.
    1.98 +    self activityNotification:'Generating stc directory...'.
    1.99 +    self copySTCDirectoryForBuild.
   1.100 +    self activityNotification:'Generating source files...'.
   1.101 +    self generateSourceFiles.
   1.102 +    self activityNotification:'Generating dlls for linkage...'.
   1.103 +    self copyDLLsForLinkage.
   1.104 +    self activityNotification:'Generating support files for linkage...'.
   1.105 +    self copySupportFilesForLinkage.
   1.106 +    self copyStartupFilesFromSmalltalk.
   1.107 +
   1.108 +    self activityNotification:'Executing make...'.
   1.109 +    self makeWithOutputTo:stdOut errorTo:stdErr.
   1.110  !
   1.111  
   1.112  buildWithOutputTo:stdOut errorTo:stdErr
   1.113 @@ -123,107 +181,35 @@
   1.114      self makeWithOutputTo:stdOut errorTo:stdErr.
   1.115  !
   1.116  
   1.117 -...'.
   1.118 -    self copySupportFilesForLinkage.
   1.119 -    self copyStartupFilesFromSmalltalk.
   1.120 -
   1.121 -    self activityNotification:'Executing make...'.
   1.122 -    self makeWithOutputTo:stdOut errorTo:stdErr.
   1.123 -!
   1.124 -
   1.125 -(packageTargetDir / dllRelativePath) directory recursiveMakeDirectory.
   1.126 -            (dllSourceDir / dllRelativePath) copyTo:(packageTargetDir / dllRelativePath).    
   1.127 +lRelativePath).    
   1.128          ]
   1.129      ].
   1.130  !
   1.131  
   1.132 -tory:relativepath
   1.133 -    "/ need rules in stx
   1.134 -    ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
   1.135 -        recursiveCopyTo:(buildDirectory construct:'stx').
   1.136  !
   1.137  
   1.138 -ification:'copying ',eachFile pathName,'...'.
   1.139 -                eachFile copyTo:(targetDir construct:eachFile baseName)
   1.140 -            ]
   1.141 -        ].
   1.142 -    ].
   1.143 -    self activityNotification:nil
   1.144  !
   1.145  
   1.146 -tory / module / directory / 'styles' ) exists ifTrue:[
   1.147 -        (myTopDirectory / module / directory / 'styles' )
   1.148 -            recursiveCopyTo:(buildDirectory / module / directory)
   1.149 -    ].
   1.150  !
   1.151  
   1.152 -me ]) ifTrue:[
   1.153 -            self activityNotification:'copying ',sourceFile pathName,'...'.
   1.154 -            sourceFile copyTo:targetFile
   1.155 -        ].
   1.156 -    ].
   1.157 -    self activityNotification:nil
   1.158  !
   1.159  
   1.160 -'host.rc' 'h_win32.rc'  
   1.161 -    ) do:[:fn |
   1.162 -        (myTopDirectory / 'stx' / 'projects/smalltalk' / fn)
   1.163 -            copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / fn)
   1.164 -    ]
   1.165  !
   1.166  
   1.167 -ry / 'stx' / dllRelativePath) directory recursiveMakeDirectory.
   1.168 -            (mySTXTopDirectory / dllRelativePath) copyTo:(buildDirectory / 'stx' / dllRelativePath).    
   1.169 -        ]
   1.170 -    ].
   1.171  !
   1.172  
   1.173 -ename / ((Smalltalk fileNameForClass:aClass),'.STH').
   1.174 -    (file exists not
   1.175 -    or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[
   1.176 -        file contents: newContents.
   1.177 -    ].
   1.178  !
   1.179  
   1.180 -self generateSourceFilesByCheckingOutUsing:sourceCodeManager
   1.181 -    ] ifFalse:[
   1.182 -        "/ local build
   1.183 -        "/ fileout the project
   1.184 -        self generateSourceFilesByFilingOut
   1.185 -    ]
   1.186  !
   1.187  
   1.188 -:nil
   1.189 -        outputTo:Transcript
   1.190 -        errorTo:Transcript
   1.191 -        inDirectory:(buildDirectory construct:module)
   1.192 -        onError:[:status| self error:'cvs update failed'].
   1.193 -self halt.
   1.194  !
   1.195  
   1.196 -or:cls in:packageTargetDir
   1.197 -            ].
   1.198 -        ].
   1.199 -        self copyResourcesForPackage:eachPackageToFileout.
   1.200 -    ].
   1.201 -
   1.202 -"/    stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic')
   1.203  !
   1.204  
   1.205 -nil
   1.206 -            outputTo:stdOut
   1.207 -            errorTo:stdErr
   1.208 -            inDirectory:(buildDirectory / module / directory)
   1.209 -            onError:[:status| self error:'make failed'].
   1.210 -    ]
   1.211  !
   1.212  
   1.213 -(buildDirectory / 'stx') exists ifFalse:[
   1.214 -        (buildDirectory / 'stx') makeDirectory.
   1.215 -    ].
   1.216 +!
   1.217  
   1.218 -    self copyDirectoryForBuild:'include'.
   1.219 -    self copyDirectoryForBuild:'rules'.
   1.220  ! !
   1.221  
   1.222  !ProjectBuilder class methodsFor:'documentation'!