###################################################################################################
#
# Name: Common_Predefined.cfg
# Description: Sets up common ProjectWise Dynamic Configuration variables for
# both V8i and CE Bentley PowerPlatrform Products
# Author: Buddy Branham
# Date: 2022/02/28
# Version: 2.0.0.0
#
# THIS FILE SHOULD NOT BE EDITED
#
#--------------------------------------------------------------------------------------------------
# Notes:
# - 2021-02-23 Added _DYNAMIC_CEWORKSPACENAME & _DYNAMIC_CONFIGURATIONROOT
# - 2021-04-09 Syntax correction %else to %endif
# - 2021-04-12 Syntax correction %if !exists ($(_DYNAMIC_V8WORKSPACESROOT))
# - 2021-04-24 Added _DYNAMIC_V8WORKSPACESROOTNAME to match _DYNAMIC_CEWORKSPACENAME
# - 2021-05-13 Revised Configuration Name logic and general comments
# - 2021-05-13 Added CONNECT Workspace cfg file exists check
# - 2021-06-08 Updated Notes
# - 2021-06-10 Added CEWorkspaceRootNames Option
# - 2021-06-14 Added ConfigurationPWSetup Option (1.6.0)
# - 2021-07-09 Added _DYNAMIC_ORGANIZATIONROOT variable (1.6.2)
# - 2021-08-07 Added Config Match verification (1.7.0)
# - 2021-08-10 Added CONNECTED Project variables (1.7.0)
# - 2022-01-19 Improved readablitiy, various comments and added lock statements (1.7.1)
# - 2022-01-25 Improved readablitiy, various comments and added lock statements (1.7.1)
# - 2021-02-12 Added Build to Version for minor edit changes (2.0.0.0)
# - 2022-02-12 Improved readablitiy (1.8.8.0)
# - 2022-02-21 Added variable for verification error messages(2.0.0.0)
# - 2022-02-21 Moved PWSetup path definition to this cfg (2.0.0.0)
# - 2022-02-21 Added Summary (2.0.0.0)
# - 2022-02-28 Initial Release (2.0.0.0)
#
#--------------------------------------------------------------------------------------------------
# Available Variables previously defined
#
# Variable Description
# _DYNAMIC_DATASOURCE_BENTLEYROOT Points to this document in ProjectWise Datasource
#
###################################################################################################
###################################################################################################
# DYNAMIC CONFIG VARIABLE
#--------------------------------------------------------------------------------------------------
# The "_DYNAMIC_CONFIGS" variable can be appended in each cfg file to track
# loading of cfgs and other notations.
###################################################################################################
_DYNAMIC_CONFIGS > Common_Predefined.cfg 2.0.0.0
###################################################################################################
# DYNAMIC CONFIG *VERSION* VARIABLES
#--------------------------------------------------------------------------------------------------
# The version variables assist in verifing that associated cfg files are compatible
###################################################################################################
_DYNAMIC_COMMONPREDEFINED_GENERATION=1
_DYNAMIC_COMMONPREDEFINED_MAJOR=8
_DYNAMIC_COMMONPREDEFINED_MINOR=0
_DYNAMIC_COMMONPREDEFINED_BUILD=0
###################################################################################################
# The @: macro
#--------------------------------------------------------------------------------------------------
# The @: macro can be used to dynamically define the pw:datasource/documents/ directory as a variable
# For reference, _DYNAMIC_DATASOURCE is defined.
###################################################################################################
_DYNAMIC_DATASOURCE = @:
###################################################################################################
# _DYNAMIC_WORKAREAS
#--------------------------------------------------------------------------------------------------
# The "Dynamic" workarea variable assit in finding the workarea
# root folders and names using the _DGNDIR variable.
#
# The "if exist" allows the validation of the existence of a
# workarea. Subsequently, an "if defined" statement can be
# utilized if need to verufy if the variable should be used
###################################################################################################
#### CONNECTED PROJECT VARIABLE
%if exists ($(DMS_CONNECTEDPROJECT(_DGNDIR)))
_DYNAMIC_CONNECTEDPROJECT : $(DMS_CONNECTEDPROJECT(_DGNDIR))
_DYNAMIC_CONNECTEDPROJECTNAME : $(LASTDIRPIECE(_DYNAMIC_CONNECTEDPROJECT))
_USTN_CONNECT_PROJECTGUID : $(DMS_CONNECTEDPROJECTGUID(_DGNDIR))
%endif
##### _DYNAMIC_WORKAREA AND _DYNAMIC_WORKAREA_NAME
%if exists ($(DMS_PROJECT(_DGNDIR)))
_DYNAMIC_WORKAREA : $(DMS_PROJECT(_DGNDIR))
_DYNAMIC_WORKAREA_NAME : $(LASTDIRPIECE(_DYNAMIC_WORKAREA))
%endif
##### _DYNAMIC_PARENTWORKAREA AND _DYNAMIC_PARENTWORKAREA_NAME
%if exists ($(DMS_PARENTPROJECT(_DGNDIR)))
_DYNAMIC_PARENTWORKAREA : $(DMS_PARENTPROJECT(_DGNDIR))
_DYNAMIC_PARENTWORKAREA_NAME : $(LASTDIRPIECE(_DYNAMIC_PARENTWORKAREA))
%endif
###################################################################################################
# PATH VERIFICATION DEFAULT ERROR MESSAGE VARIABLES
#--------------------------------------------------------------------------------------------------
# Variables used in path verification messages.
###################################################################################################
_DYNAMIC_MSG_NOT_FOUND: NOT FOUND
_DYNAMIC_MSG_VERIFY_PATH: VERIFY PATH OF VARIABLE.
###################################################################################################
# USER CONFIGURATION OPTIONS (PWSetup)
#--------------------------------------------------------------------------------------------------
# PW Setup files allow for the customization of configurations without editing of delivered cfg files
###################################################################################################
##### _DYNAMIC_PWSETUP_PATH defines the typical PWSetup Path.
##### Note: This will affect all Configuration PWSetup Paths
_DYNAMIC_PWSETUP_PATH:_PWSetup/
_DYNAMIC_BENTLEY_PWSETUP:$(_DYNAMIC_DATASOURCE_BENTLEYROOT)$(_DYNAMIC_PWSETUP_PATH)
###### Includes Common_Predefined_PWSetup
%if exists ($(_DYNAMIC_BENTLEY_PWSETUP)Common_Predefined_PWSetup.cfg)
%include $(_DYNAMIC_BENTLEY_PWSETUP)Common_Predefined_PWSetup.cfg
%endif
###################################################################################################
# _DYNAMIC_V8WORKSPACENAME and _DYNAMIC_CEWORKSPACENAME
#--------------------------------------------------------------------------------------------------
# _DYNAMIC_V8WORKSPACENAME and _DYNAMIC_CEWORKSPACENAME correspond to the V8 and CONNECT Workspace
# names used in the Dynamic Managed Workspace.
# These should not be edited in this file (as they correspond to examples supplied with the template).
# Edit these variables in the Common_Predefined_PWSetup.cfg
###################################################################################################
%if defined (_VERSION_8_11)
##### Supplied Example V8 Workspace Name
_DYNAMIC_V8WORKSPACENAME : V8WorkspaceExample
%elif defined (_VERSION_10_0)
##### Supplied Example V8 Workspace Name
_DYNAMIC_CEWORKSPACENAME : CEWorkspaceExample
%endif
###################################################################################################
# DEFINE KEY PRIMARY FRAMEWORK VARIABLES
#--------------------------------------------------------------------------------------------------
# Define key standard and "dynamic" framework variables depending on the version being used.
###################################################################################################
##### V8 VARIABLES
%if defined (_VERSION_8_11)
##### Set V8 _USTN_WORKSPACEROOT to installed location.
_USTN_WORKSPACEROOT : $(_USTN_INSTALLED_WORKSPACEROOT)
##### Establish V8 Workspace path variables.
_DYNAMIC_V8WORKSPACESROOTNAME : V8Workspaces
_DYNAMIC_V8WORKSPACESROOT : $(_DYNAMIC_DATASOURCE_BENTLEYROOT)$(_DYNAMIC_V8WORKSPACESROOTNAME)/
##### Verify V8 Worksapces paths
%if !exists ($(_DYNAMIC_V8WORKSPACESROOT))
%error $(_DYNAMIC_MSG_NOT_FOUND) _DYNAMIC_V8WORKSPACESROOT: $(_DYNAMIC_V8WORKSPACESROOT). $(_DYNAMIC_MSG_VERIFY_PATH)
%endif
##### Optional Include: Include V8 Workspaces specific PW setup files
##### This can be used to replace Workspace PW Setup Predefined if all workspaces have the same PWSetup.
%include $(_DYNAMIC_V8WORKSPACESROOT)$(_DYNAMIC_PWSETUP_PATH)/V8WorkspacesPWSetup_Predefined*.cfg
_DYNAMIC_V8WORKSPACEROOT : $(_DYNAMIC_V8WORKSPACESROOT)$(_DYNAMIC_V8WORKSPACENAME)/
##### Verify V8 Worksapce paths
%if !exists ($(_DYNAMIC_V8WORKSPACEROOT))
%error $(_DYNAMIC_MSG_NOT_FOUND) _DYNAMIC_V8WORKSPACEROOT: $(_DYNAMIC_V8WORKSPACEROOT). $(_DYNAMIC_MSG_VERIFY_PATH)
%endif
##### Set standard PowerPlatform variables based on Dynamic variables
_USTN_SITE : $(_DYNAMIC_V8WORKSPACEROOT)Standards/
_USTN_PROJECTSROOT : $(_DYNAMIC_V8WORKSPACEROOT)Projects/
%if defined (_DYNAMIC_WORKAREA_NAME)
_USTN_PROJECTNAME : $(_DYNAMIC_WORKAREA_NAME)
_USTN_PROJECTDATA : $(_DYNAMIC_WORKAREA)/
%endif
##### Optional: Include Workspace specific PW setup files
%include $(_DYNAMIC_V8WORKSPACEROOT)_PWSetup/WorkspacePWSetup_Predefined*.cfg
##### Lock standard V8 Variables
##### Note: _USTN_WORKSPACEROOT not locked for V8 until this point to allow
##### WorkspacePWSetup_Predefined*.cfg redirect location if needed.
%lock _USTN_WORKSPACEROOT
%lock _USTN_SITE
%lock _USTN_PROJECTSROOT
%lock _USTN_PROJECTNAME
##### CONNECT EDITION VARIABLES
%elif defined (_VERSION_10_0)
##### Establish CONNECT Configuration path variables.
#_DYNAMIC_CONFIGURATIONNAME allows versions of full CONNECT configurations
_DYNAMIC_CONFIGURATIONNAME : Configuration
_DYNAMIC_CONFIGURATIONROOT :$(_DYNAMIC_DATASOURCE_BENTLEYROOT)$(_DYNAMIC_CONFIGURATIONNAME)/
##### Verify path of _DYNAMIC_CONFIGURATIONROOT
%if !exists ($(_DYNAMIC_CONFIGURATIONROOT))
%error $(_DYNAMIC_MSG_NOT_FOUND) _DYNAMIC_CONFIGURATIONROOT: $(_DYNAMIC_CONFIGURATIONROOT). $(_DYNAMIC_MSG_VERIFY_PATH)
%endif
##### Set and lock standard PowerPlatform variables based on Dynamic variables
_USTN_CONFIGURATION : $(_DYNAMIC_CONFIGURATIONROOT)
_USTN_CUSTOM_CONFIGURATION : $(_DYNAMIC_CONFIGURATIONROOT)
%lock _USTN_CONFIGURATION
%lock _USTN_CUSTOM_CONFIGURATION
##### Optional: Include Configuration specific PW setup files
##### This maybe needed to emulate WorkspaceSet.cfg syntax
##### This can be used to replace Workspace PW Setup Predefined if all workspaces have the same PWSetup.
%include $(_DYNAMIC_CONFIGURATIONROOT)$(_DYNAMIC_PWSETUP_PATH)/ConfigurationPWSetup_Predefined*.cfg
##### Set "Organization" variables
_DYNAMIC_CEORGANIZATIONROOTNAME : Organization
_DYNAMIC_CEORGANIZATIONROOT :$(_DYNAMIC_CONFIGURATIONROOT)$(_DYNAMIC_CEORGANIZATIONROOTNAME)/
##### Set standard PowerPlatform variable based on Dynamic variables
_USTN_ORGANIZATION :$(_DYNAMIC_CEORGANIZATIONROOT)
##### _USTN_WORKSPACEROOT and _USTN_WORKSPACE Variables and PWSetup
##### Sets and Verify Dynamic "Workspaces" location
_DYNAMIC_CEWORKSPACESROOTNAME : WorkSpaces
_DYNAMIC_CEWORKSPACESROOT : $(_USTN_CONFIGURATION)$(_DYNAMIC_CEWORKSPACESROOTNAME)/
%if !exists ($(_DYNAMIC_CEWORKSPACESROOT))
%error $(_DYNAMIC_NOT_FOUND) _DYNAMIC_CEWORKSPACESROOT: $(_DYNAMIC_CEWORKSPACESROOT). $(_DYNAMIC_MSG_VERIFY_PATH)
%endif
##### Sets and Verify Dynamic "Workspace" location
_DYNAMIC_CEWORKSPACEROOT : $(_DYNAMIC_CEWORKSPACESROOT)$(_DYNAMIC_CEWORKSPACENAME)/
%if !exists ($(_DYNAMIC_CEWORKSPACEROOT))
%error $(_DYNAMIC_MSG_NOT_FOUND) _DYNAMIC_CEWORKSPACEROOT: $(_DYNAMIC_CEWORKSPACEROOT). $(_DYNAMIC_MSG_VERIFY_PATH)
%endif
_DYNAMIC_WORKSPACECFG : $(_DYNAMIC_CEWORKSPACESROOT)$(_DYNAMIC_CEWORKSPACENAME).cfg
##### Set and lock Standard PowerPlatform Variables based on verified Dynamic Variables
_USTN_WORKSPACESROOT : $(_DYNAMIC_CEWORKSPACESROOT)
_USTN_WORKSPACENAME : $(_DYNAMIC_CEWORKSPACENAME)
_USTN_WORKSPACECFG : $(_DYNAMIC_WORKSPACECFG)
%lock _USTN_WORKSPACESROOT
%lock _USTN_WORKSPACENAME
%lock _USTN_WORKSPACECFG
##### Verify existence of named workspace cfg
%if !exists ($(_DYNAMIC_CEWORKSPACESROOT)$(_DYNAMIC_CEWORKSPACENAME).cfg)
%error $(_DYNAMIC_MSG_NOT_FOUND) CONNECT WORKSPACE CFG FILE: $(_DYNAMIC_CEWORKSPACESROOT)$(_DYNAMIC_CEWORKSPACENAME).cfg. $(_DYNAMIC_MSG_VERIFY_PATH)
%endif
##### Optional: Includes Workpace specific PW setup files
%include $(_DYNAMIC_CEWORKSPACEROOT)$(_DYNAMIC_PWSETUP_PATH)/WorkspacePWSetup_Predefined*.cfg
##### Set and lock Standard PowerPlatform Variables based on verified Dynamic Variables
%if defined (_DYNAMIC_WORKAREA_NAME) && exists ($(_DYNAMIC_WORKAREA))
_USTN_WORKSETNAME : $(_DYNAMIC_WORKAREA_NAME)
_USTN_WORKSETROOT : $(_DYNAMIC_WORKAREA)
%lock _USTN_WORKSETSROOT
%lock _USTN_WORKSETNAME
%endif
%else
%error Version Not Supported
%endif
###################################################################################################
# Summary of Variables
###################################################################################################
#--------------------------------------------------------------------------------------------------
# General Variables
#--------------------------------------------------------------------------------------------------
# _DYNAMIC_DATASOURCE = @:
# _DYNAMIC_CONNECTEDPROJECT : $(DMS_CONNECTEDPROJECT(_DGNDIR))
# _DYNAMIC_CONNECTEDPROJECTNAME : $(LASTDIRPIECE(_DYNAMIC_CONNECTEDPROJECT))
# _USTN_CONNECT_PROJECTGUID : $(DMS_CONNECTEDPROJECTGUID(_DGNDIR))
# _DYNAMIC_WORKAREA : $(DMS_PROJECT(_DGNDIR))
# _DYNAMIC_WORKAREA_NAME : $(LASTDIRPIECE(_DYNAMIC_WORKAREA))
# _DYNAMIC_PARENTWORKAREA : $(DMS_PARENTPROJECT(_DGNDIR))
# _DYNAMIC_PARENTWORKAREA_NAME : $(LASTDIRPIECE(_DYNAMIC_PARENTWORKAREA))
# _DYNAMIC_MSG_NOT_FOUND: NOT FOUND
# _DYNAMIC_MSG_VERIFY_PATH: VERIFY PATH OF VARIABLE.
# _DYNAMIC_PWSETUP_PATH:_PWSetup/
# _DYNAMIC_BENTLEY_PWSETUP:$(_DYNAMIC_DATASOURCE_BENTLEYROOT)$(_DYNAMIC_PWSETUP_PATH)
# %include $(_DYNAMIC_BENTLEY_PWSETUP)Common_Predefined_PWSetup.cfg
#--------------------------------------------------------------------------------------------------
# V8 Variables and Includes
#--------------------------------------------------------------------------------------------------
# _DYNAMIC_V8WORKSPACESROOTNAME : V8Workspaces
# _DYNAMIC_V8WORKSPACESROOT : $(_DYNAMIC_DATASOURCE_BENTLEYROOT)$(_DYNAMIC_V8WORKSPACESROOTNAME)/
# _DYNAMIC_V8WORKSPACENAME : V8WorkspaceExample
# _DYNAMIC_V8WORKSPACEROOT : $(_DYNAMIC_V8WORKSPACESROOT)$(_DYNAMIC_V8WORKSPACENAME)/
# _USTN_SITE : $(_DYNAMIC_V8WORKSPACEROOT)Standards/
# _USTN_PROJECTSROOT : $(_DYNAMIC_V8WORKSPACEROOT)Projects/
# _USTN_PROJECTNAME : $(_DYNAMIC_WORKAREA_NAME)
# _USTN_PROJECTDATA : $(_DYNAMIC_WORKAREA)/
# %include $(_DYNAMIC_V8WORKSPACEROOT)_PWSetup/WorkspacePWSetup_Predefined*.cfg
#--------------------------------------------------------------------------------------------------
# CONNECT Edition Variables and Includes
#--------------------------------------------------------------------------------------------------
# _DYNAMIC_CONFIGURATIONNAME : Configuration
# _DYNAMIC_CONFIGURATIONROOT : $(_DYNAMIC_DATASOURCE_BENTLEYROOT)$(_DYNAMIC_CONFIGURATIONNAME)/
# _DYNAMIC_CEORGANIZATIONROOTNAME : Organization
# _DYNAMIC_CEORGANIZATIONROOT : $(_DYNAMIC_CONFIGURATIONROOT)$(_DYNAMIC_CEORGANIZATIONROOTNAME)/
# _DYNAMIC_CEWORKSPACESROOTNAME : WorkSpaces
# _DYNAMIC_CEWORKSPACESROOT : $(_USTN_CONFIGURATION)$(_DYNAMIC_CEWORKSPACESROOTNAME)/
# _DYNAMIC_CEWORKSPACENAME : CEWorkspaceExample
# _DYNAMIC_CEWORKSPACEROOT : $(_DYNAMIC_CEWORKSPACESROOT)$(_DYNAMIC_CEWORKSPACENAME)/
# _DYNAMIC_WORKSPACECFG : $(_DYNAMIC_CEWORKSPACESROOT)$(_DYNAMIC_CEWORKSPACENAME).cfg
# _USTN_CONFIGURATION : $(_DYNAMIC_CONFIGURATIONROOT)
# _USTN_CUSTOM_CONFIGURATION : $(_DYNAMIC_CONFIGURATIONROOT)
# _USTN_ORGANIZATION : $(_DYNAMIC_CEORGANIZATIONROOT)
# _USTN_WORKSPACESROOT : $(_DYNAMIC_CEWORKSPACESROOT)
# _USTN_WORKSPACENAME : $(_DYNAMIC_CEWORKSPACENAME)
# _USTN_WORKSPACECFG : $(_DYNAMIC_WORKSPACECFG)
# _USTN_WORKSETNAME : $(_DYNAMIC_WORKAREA_NAME)
# _USTN_WORKSETROOT : $(_DYNAMIC_WORKAREA)
# %include $(_DYNAMIC_CEWORKSPACEROOT)$(_DYNAMIC_PWSETUP_PATH)/WorkspacePWSetup_Predefined*.cfg