home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # Copyright (c) 1993-1997 by Cayenne Software, Inc.
- #
- # This software is furnished under a license and may be used only in
- # accordance with the terms of such license and with the inclusion of
- # the above copyright notice. This software or any other copies thereof
- # may not be provided or otherwise made available to any other person.
- # No title to and ownership of the software is hereby transferred.
- #
- # The information in this software is subject to change without notice
- # and should not be construed as a commitment by Cayenne Software, Inc.
- #
- #---------------------------------------------------------------------------
- #
- # File: @(#)pbconfig.tcl /main/titanic/5
- # Author: discovery
- # Description: Configure PB Environment, i.e.:
- # - in ObjectDesign: import system 'PBBuiltins' with PB builtins
- # - in Implementation: install Cayenne class library
- #
- #---------------------------------------------------------------------------
- # SccsId = @(#)pbconfig.tcl /main/titanic/5 30 Sep 1997 Copyright 1997 Cayenne Software Inc.
-
-
- source [m4_path_name tcl cginit.tcl]
-
- require caynutil.tcl
-
- global thisModulesName
- set thisModulesName "powerbuilder"
-
- #
- # Return base directory to install stuff
- #
- proc moduleBaseDir {name} {
- set modHdlr [ModuleHandler new]
- if {$modHdlr == ""} {
- return ""
- }
- $modHdlr setCurrentContext
- set spec [$modHdlr getModuleSpec $name]
- if {$spec != ""} {
- return [$spec path]
- }
- return ""
- }
-
- proc m4copydir {dir} {
- set save_dir [pwd]
- global thisModulesName
- set subdir [location [moduleBaseDir $thisModulesName] $dir]
-
- if [catch {cd $subdir} msg] {
- puts "Error: $subdir not found"
- return
- }
-
- set files [glob -nocomplain classlib.pbl *.sru]
-
- set cc [ClientContext::global]
- set dest [location [[$cc currentPhase] path] src]
- if {! [file exist $dest]} {
- mkdir -path [list $dest]
- }
- set pblFile [path_name concat $dest classlib pbl]
- if [file exist $pblFile] {
- puts "Overwriting library '$pblFile' ..."
- }
- foreach file $files {
- puts "Copying $file to $dest ..."
- BasicFS::copyFile $file [location $dest $file]
- }
- cd $save_dir
- }
-
- proc importBuiltins {dir} {
- set cc [ClientContext::global]
- set phaseV [$cc currentPhase]
- foreach sys {PBBuiltins} {
- puts ""
- set sysV [$phaseV findSystemVersion $sys "system"]
- if {![$sysV isNil]} {
- puts "System '$sys' already exists: not configuring it again."
- continue
- }
- global thisModulesName
- set srcDir [location [moduleBaseDir $thisModulesName] $dir]
- set file [path_name concat $srcDir $sys tcl]
- if {! [file exist $file]} {
- puts "'Configure PB Environment' failed:\
- file '$file' not found."
- } else {
- puts "Importing system '$sys' ... (this action will take some time)"
- source $file
- puts ""
- }
- }
- }
-
- proc makeCfgSystems {} {
- set cc [ClientContext::global]
- set configV [$cc currentConfig]
- set phaseV [$cc currentPhase]
- foreach sys {PBBuiltins} {
- puts ""
- set sysV [$phaseV findSystemVersion $sys "system"]
- if {[$sysV isNil]} {
- puts "Creating System '$sys'."
- set sysV [$phaseV createSystemVersion $sys "cl" "system" $configV]
- $sysV freeze "Configure PowerBuilder"
- } elseif {[$sysV status] == "working"} {
- $sysV freeze "Configure PowerBuilder"
- }
- }
- }
-
-
- puts "Configure PowerBuilder Environment"
- puts "==================================\n"
- puts ""
-
- set cc [ClientContext::global]
- set phaseType [[[$cc currentPhase] phase] type]
- switch $phaseType {
- "ObjectDesign" {
- importBuiltins [location config]
- # puts ""
- puts "'Configure PowerBuilder Environment' finished for phase '${phaseType}'."
- }
- "Implementation" {
- m4copydir [location config]
- makeCfgSystems
- # puts ""
- puts "'Configure PowerBuilder Environment' finished for phase '${phaseType}'."
- }
- default {
- puts "'Configure PowerBuilder Environment' failed: invalid phase type '$phaseType'."
- }
- }
-