]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Common/GlobalData.py
BaseTools/Ecc: Fix an issue of path separator compatibility
[mirror_edk2.git] / BaseTools / Source / Python / Common / GlobalData.py
1 ## @file
2 # This file is used to define common static strings used by INF/DEC/DSC files
3 #
4 # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
5 # SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 import re
8
9 gIsWindows = None
10 gWorkspace = "."
11 gOptions = None
12 gCaseInsensitive = False
13 gAllFiles = None
14 gCommand = None
15 gSKUID_CMD = None
16
17 gGlobalDefines = {}
18 gPlatformDefines = {}
19 # PCD name and value pair for fixed at build and feature flag
20 gPlatformPcds = {}
21 # PCDs with type that are not fixed at build and feature flag
22 gPlatformOtherPcds = {}
23 gActivePlatform = None
24 gCommandLineDefines = {}
25 gEdkGlobal = {}
26 gCommandMaxLength = 4096
27 # for debug trace purpose when problem occurs
28 gProcessingFile = ''
29 gBuildingModule = ''
30 gSkuids = []
31 gDefaultStores = []
32 gGuidDict = {}
33
34 # definition for a MACRO name. used to create regular expressions below.
35 _MacroNamePattern = "[A-Z][A-Z0-9_]*"
36
37 ## Regular expression for matching macro used in DSC/DEC/INF file inclusion
38 gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern), re.UNICODE)
39 gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
40 gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))
41
42 # definition for a GUID. used to create regular expressions below.
43 _HexChar = r"[0-9a-fA-F]"
44 _GuidPattern = r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{12}}".format(Hex=_HexChar)
45
46 ## Regular expressions for GUID matching
47 gGuidPattern = re.compile(r'{}'.format(_GuidPattern))
48 gGuidPatternEnd = re.compile(r'{}$'.format(_GuidPattern))
49
50 ## Regular expressions for HEX matching
51 g4HexChar = re.compile(r'{}{{4}}'.format(_HexChar))
52 gHexPattern = re.compile(r'0[xX]{}+'.format(_HexChar))
53 gHexPatternAll = re.compile(r'0[xX]{}+$'.format(_HexChar))
54
55 ## Regular expressions for string identifier checking
56 gIdentifierPattern = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE)
57 ## Regular expression for GUID c structure format
58 _GuidCFormatPattern = r"{{\s*0[xX]{Hex}{{1,8}}\s*,\s*0[xX]{Hex}{{1,4}}\s*,\s*0[xX]{Hex}{{1,4}}" \
59 r"\s*,\s*{{\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
60 r"\s*,\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
61 r"\s*,\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
62 r"\s*,\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}\s*}}\s*}}".format(Hex=_HexChar)
63 gGuidCFormatPattern = re.compile(r"{}".format(_GuidCFormatPattern))
64
65 #
66 # A global variable for whether current build in AutoGen phase or not.
67 #
68 gAutoGenPhase = False
69
70 #
71 # The Conf dir outside the workspace dir
72 #
73 gConfDirectory = ''
74 gCmdConfDir = ''
75 gBuildDirectory = ''
76 #
77 # The relative default database file path
78 #
79 gDatabasePath = ".cache/build.db"
80
81 #
82 # Build flag for binary build
83 #
84 gIgnoreSource = False
85
86 #
87 # FDF parser
88 #
89 gFdfParser = None
90
91 BuildOptionPcd = []
92
93 #
94 # Mixed PCD name dict
95 #
96 MixedPcd = {}
97
98 # Structure Pcd dict
99 gStructurePcd = {}
100 gPcdSkuOverrides={}
101 # Pcd name for the Pcd which used in the Conditional directives
102 gConditionalPcds = []
103
104 gUseHashCache = None
105 gBinCacheDest = None
106 gBinCacheSource = None
107 gPlatformHash = None
108 gPlatformHashFile = None
109 gPackageHash = None
110 gPackageHashFile = None
111 gModuleHashFile = None
112 gCMakeHashFile = None
113 gHashChainStatus = None
114 gModulePreMakeCacheStatus = None
115 gModuleMakeCacheStatus = None
116 gFileHashDict = None
117 gModuleAllCacheStatus = None
118 gModuleCacheHit = None
119
120 gEnableGenfdsMultiThread = True
121 gSikpAutoGenCache = set()
122 # Common lock for the file access in multiple process AutoGens
123 file_lock = None
124