GBS Logo HOME Generic Build Support (GBS) - User Manual
The switch.gbs batch file Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Purpose| General| Calling| Environment Variables| Additional Available Environment Variables| Layout| Notes
Example of a switch.gbs.bat
Example of a switch.gbs.sh

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The switch.gbs batch file is located in the GBS_ROOT_PATH directory and is used to define the environment in which the System has to function.
Here all external items must be defined. e.g.:

In GBS the switch.gbs file is the only file allowed to contain absolute disk-addresses

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Special considerations:

Calling Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

The switch.gbs file is called:
When you enter a System (swr or startup)
GBS_ROOT_PATH:switch.gbs is called with parameter entry
When you leave a System (swr)
GBS_ROOT_PATH:switch.gbs is called with parameter exit

Environment Variables Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Environment Variables defined in the switch.gbs file should be in uppercase.
When referring to external data (directories/files) they should be prefixed with GBSEXT_. (Not GBS_EXT_)
When exiting a Root (System) GBS will unset all Environment Variables starting with GBSEXT_.
This is done before the switch.gbs is called with the 'exit' parameter. Note that at the moment of invocation all GBS internal Environment Variables for that Root have been set.

Additional Available Environment Variables Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

These are defined before execution of the switch.gbs file and can be used to control additional settings.
They should not be changed!
GBS_SITE
Preset by user (Install or gbssetup)
Specifies the site where this user is working
More info in Install Notes
GBS_BUILD
A full numeric value that identifies the current build of GBS
A combination of the GBS version and version_date
GBS_PLATFORM
Use to distinguish on which platform GBS is running. e.g.:
    linux, MSWin32, etc
GBS_ROOT_PARENT
The name of the parent directory (not the path) of the Root.
It can be used to define a Log-directory dependent on the Root. E.g.:
SET GBS_LOG_PATH=\%GBS_ROOT_PARENT%
GBS_IS_INTEGRATOR
0 or 1
Specifies that the user has GBS Integrator privileges
GBS_IS_ADMINISTRATOR
0 or 1
Specifies that the user has GBS Administrator privileges

Layout Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

The file consists of two mayor parts:

Entry

This part is executed when you 'enter' a Root / System (make it current)
It consists of 2 sub-parts

Root / Site sub-part

This sub-part is where you have the Site dependent stuff.
Here you will typically set GBSEXT_..._ROOT EnvVars to their Site-dependent locations

General sub-part

This sub-part is where you set the GBSEXT_..._REL
And the assembly of GBSEXT_..._ROOT and GBSEXT_..._REL to GBSEXT_..._PATH

Exit

This part is executed when you 'exit' a Root / System (un-current it)
Here you cleanup all non GBSEXT_ stuff

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Example of a switch.gbs.bat: Bottom Doc. Button Top Document Button Down Section Button Up Section Button


@ECHO OFF
::========================================
::    %FILE% [%SYSTEM_NAME%]
::========================================
if NOT [%1] == [entry] goto :exit
    ::
    ::    set items
    ::

    if NOT [%GBS_SITE%] == [%SITE%] goto :NOT_%SITE%
        ::
        ::  %SITE%
        ::

	::
	::  Version Control
	::
	::set GBSEXT_CC_PATH=PATH
	::set GBSEXT_CCM_PATH=PATH
	::set GBSEXT_GIT_PATH=PATH
	::set GBSEXT_SVN_PATH=PATH

	::
	::  Targets
	::
        ::set GBSEXT_MSVS2012_ROOT=C:\Program Files (x86)\Microsoft Visual Studio 11.0
        ::set GBSEXT_MSVS2012_SDK_ROOT=C:\Program Files (x86)\Microsoft SDKs\Windows
        ::set GBSEXT_MSBUILD_ROOT=C:\Windows\Microsoft.NET\Framework

	::set GBSEXT_MINGW_ROOT=C:\MinGW

	::
	::  Audits
	::
	::set GBSEXT_QAC_ROOT=C:\MyPrograms\PRQA\QAC

	::set GBSEXT_QACPP_ROOT=C:\MyPrograms\PRQA\QACPP

	::set GBSEXT_PCLINT_ROOT=C:\MyPrograms\PC-Lint

	::
	::  Tools
	::
	::set GBSEXT_DOXYGEN_ROOT=C:\MyPrograms\doxygen

	::
	::  GBS Settings
	::

        goto :end_site
    :NOT_%SITE%
    if NOT [%GBS_SITE%] == [OTHER] goto :NOT_OTHER
        ::
        ::      OTHER
        ::
        goto :end_site
    :NOT_OTHER
    	echo *******
    	echo **  Unknown site '%GBS_SITE%'
    	echo **  Must be one of [ %SITE% OTHER ]
	echo *******
	::false
	goto :error_exit
    :end_site

    ::
    ::	Version Control
    ::
    ::set GBSEXT_SVN_PATH="C:\Program Files\TortoiseSVN\bin"
    ::set GBSEXT_SVN_PATH=PATH

    ::
    ::  Targets
    ::
    ::set GBSEXT_MSVS2012_CONS_REL=2012
    ::set GBSEXT_MSVS2012_CONS_PATH=%GBSEXT_MSVS2012_ROOT%
    ::set GBSEXT_MSVS2012_SDK_REL=v7.1A
    ::set GBSEXT_MSVS2012_SDK_PATH=%GBSEXT_MSVS2012_SDK_ROOT%\%GBSEXT_MSVS2012_SDK_REL%
    ::set GBSEXT_MSBUILD_REL=v4.0.30319
    ::set GBSEXT_MSBUILD_PATH=%GBSEXT_MSBUILD_ROOT%\%GBSEXT_MSBUILD_REL%

    ::set GBSEXT_MINGW_BASE_REL=2013072200
    ::set GBSEXT_MINGW_GCC_PATH=%GBSEXT_MINGW_ROOT%\%GBSEXT_MINGW_BASE_REL%
    ::set GBSEXT_MINGW_GCC_REL=4.8.1

    ::set GBSEXT_MINGW_BASE_REL=2013072200
    ::set GBSEXT_MINGW_CPP_PATH=%GBSEXT_MINGW_ROOT%\%GBSEXT_MINGW_BASE_REL%
    ::set GBSEXT_MINGW_CPP_REL=4.8.1

    ::
    ::  Audits
    ::
    ::set GBSEXT_QAC_REL=8.1-R
    ::set GBSEXT_QAC_PATH=%GBSEXT_QAC_ROOT%-%GBSEXT_QAC_REL%

    ::set GBSEXT_QACPP_REL=3.0-R
    ::set GBSEXT_QACPP_PATH=%GBSEXT_QACPP_ROOT%-%GBSEXT_QACPP_REL%

    ::set GBSEXT_PCLINT_REL=8.00x
    ::set GBSEXT_PCLINT_PATH=%GBSEXT_PCLINT_ROOT%\%GBSEXT_PCLINT_REL%

    ::
    ::	Tools
    ::
    ::set GBSEXT_DOXYGEN_REL=3.5
    ::set GBSEXT_DOXYGEN_PATH=%GBSEXT_DOXYGEN_ROOT%

    ::
    ::	Audit Tools
    ::
    ::set QAC_REL=%GBSEXT_QAC_REL%
    ::set QACROOT=%GBSEXT_QAC_PATH%

    ::set QACPP_REL=%GBSEXT_QACPP_REL%
    ::set QACPPROOT=%GBSEXT_QACPP_PATH%

    goto end_entry_exit
:exit
if NOT [%1] == [exit] goto :no_entry_exit
    ::
    ::	unset items
    ::	(GBSEXT_... are all unset by GBS)
    ::
    set QAC_REL=
    set QACROOT=

    set QACPP_REL=
    set QACPPROOT=

    goto :end_entry_exit
:no_entry_exit
    echo *****
    echo ** SYSTEM/switch.gbs: Usage = call switch.gbs.bat [ entry ^| exit ]
    echo *****
    goto :error_exit
:end_entry_exit
:: true
goto :EOF

:error_exit
::
::  Error-exit
::
set GBS_RC=1
goto :EOF

:::EOF:::

Example of a switch.gbs.sh: Bottom Doc. Button Top Document Button Blank Up Section Button


#========================================
#   %FILE% [%SYSTEM_NAME%]
#========================================
SWITCH_RC=0
if [[ $1 = "entry" ]]
then
    #
    #	set items
    #

    if [[ $GBS_SITE = "%SITE%" ]]
    then
	#
	#   %SITE%
	#

	#
	#   Version Control
	#
        #export GBSEXT_CC_PATH=PATH
	#export GBSEXT_CCM_PATH=PATH
	#export GBSEXT_GIT_PATH=PATH
	#export GBSEXT_SVN_PATH=PATH

	#
	#   Targets
	#
	#export GBSEXT_LGNU_GCC_ROOT=/usr/lib/gcc/x86_64-linux-gnu
	#export GBSEXT_LGNU_CPP_ROOT=/usr/lib/gcc/x86_64-linux-gnu

	#
	#   Audits
	#
	#export GBSEXT_QAC_ROOT=/apl/cadappl_linux_ia32/qac
	#export GBSEXT_QACPP_ROOT=/apl/cadappl_linux_ia32/qac++

	#
	#   Tools
	#

	#
	#   GBS Settings
	#

	true

    elif [[ $GBS_SITE = "OTHER" ]]
    then
	#
	#   OTHER
	#

    	true
    else
    	echo "SWITCH.GBS: *****"
    	echo "SWITCH.GBS: ** Unknown Site $GBS_SITE"
	echo "SWITCH.GBS: ** Must be one of '%SITE% OTHER'"
    	echo "SWITCH.GBS: *****"
    	SWITCH_RC=1
    fi
    #
    #	Targets
    #
    if [[ $SWITCH_RC = 0 ]]
    then
    	#
	#   Targets
	#
	#export GBSEXT_LGNU_GCC_REL=4.4.5
	#export GBSEXT_LGNU_GCC_PATH=$GBSEXT_LGNU_GCC_ROOT/$GBSEXT_LGNU_GCC_REL

	#export GBSEXT_LGNU_CPP_REL=4.4.5
	#export GBSEXT_LGNU_CPP_PATH=$GBSEXT_LGNU_CPP_ROOT/$GBSEXT_LGNU_CPP_REL

	#
	#   Audits
	#
        #set GBSEXT_QAC_REL=8.1-R
        #set GBSEXT_QAC_PATH=$GBSEXT_QAC_ROOT-$GBSEXT_QAC_REL

        #set GBSEXT_QACPP_REL=3.0-R
        #set GBSEXT_QACPP_PATH=$GBSEXT_QACPP_ROOT-$GBSEXT_QACPP_REL

	#
	#   Tools
	#

	true
    fi
elif [[ $1 = "exit" ]]
then
    #
    #	unset items
    #	(GBSEXT_... are all unset by GBS)
    #

    true
else
    echo "SWITCH.GBS: *****"
    echo "SWITCH.GBS: ** switch.gbs.sh: Usage = . switch.gbs.sh [ entry | exit ]"
    echo "SWITCH.GBS: *****"
    SWITCH_RC=1
fi

[[ $SWITCH_RC = 1 ]] && export GBS_RC=1
unset SWITCH_RC

##EOF##