BaseTools: Update Build tool to support multiple workspaces

WORKSPACE is still kept.
New PACKAGES_PATH is introduced to specify the additional WORKSPACEs.
In PACKAGES_PATH, ';' is separator in Windows, ':' is separator in Linux.

Build directory is in WORKSPACE. Package, BaseTools and Conf directory
will be found from WORKSPACE and PACKAGES_PATH.

In implementation, BaseTools adds MultipleWorkspace class for
the file path conversion from WORKSPACE and PACKAGES_PATH.

Verify two tree layouts.
Root\edk2\MdePkg
Root\edk2\MdeMdeModulePkg
Root\edk2\...
1. set WORKSPACE=Root\edk2
2. set WORKSPACE=Root, and set PACKAGES_PATH=Root\edk2

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Li YangX <yangx.li@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18579 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Li YangX
2015-10-08 09:27:14 +00:00
committed by lgao4
parent 6fa04d934b
commit 05cc51ad58
15 changed files with 232 additions and 35 deletions

View File

@ -21,6 +21,7 @@ import uuid
import Common.EdkLogger as EdkLogger
import Common.GlobalData as GlobalData
from Common.MultipleWorkspace import MultipleWorkspace as mws
from Common.String import *
from Common.DataType import *
@ -166,7 +167,7 @@ class DscBuildData(PlatformBuildClassObject):
ModuleFile = PathClass(NormPath(Record[0]), GlobalData.gWorkspace, Arch=self._Arch)
RecordList = self._RawData[MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH, self._Arch, None, ModuleId]
if RecordList != []:
SourceOverridePath = os.path.join(GlobalData.gWorkspace, NormPath(RecordList[0][0]))
SourceOverridePath = mws.join(GlobalData.gWorkspace, NormPath(RecordList[0][0]))
# Check if the source override path exists
if not os.path.isdir(SourceOverridePath):
@ -2179,8 +2180,11 @@ class InfBuildData(ModuleBuildClassObject):
if self.AutoGenVersion < 0x00010005:
Macros["EDK_SOURCE"] = GlobalData.gEcpSource
Macros['PROCESSOR'] = self._Arch
SourceFile = NormPath(Record[0], Macros)
if SourceFile[0] == os.path.sep:
SourceFile = mws.join(GlobalData.gWorkspace, SourceFile[1:])
# old module source files (Edk)
File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, self._SourceOverridePath,
File = PathClass(SourceFile, self._ModuleDir, self._SourceOverridePath,
'', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
# check the file validation
ErrorCode, ErrorInfo = File.Validate(CaseSensitive=False)
@ -2343,10 +2347,21 @@ class InfBuildData(ModuleBuildClassObject):
if File[0] == '.':
File = os.path.join(self._ModuleDir, File)
else:
File = os.path.join(GlobalData.gWorkspace, File)
File = mws.join(GlobalData.gWorkspace, File)
File = RealPath(os.path.normpath(File))
if File:
self._Includes.append(File)
if not File and Record[0].find('EFI_SOURCE') > -1:
# tricky to regard WorkSpace as EFI_SOURCE
Macros['EFI_SOURCE'] = GlobalData.gWorkspace
File = NormPath(Record[0], Macros)
if File[0] == '.':
File = os.path.join(self._ModuleDir, File)
else:
File = os.path.join(GlobalData.gWorkspace, File)
File = RealPath(os.path.normpath(File))
if File:
self._Includes.append(File)
return self._Includes
## Retrieve packages this module depends on
@ -2797,7 +2812,7 @@ class WorkspaceDatabase(object):
def __init__(self, DbPath, RenewDb=False):
self._DbClosedFlag = False
if not DbPath:
DbPath = os.path.normpath(os.path.join(GlobalData.gWorkspace, 'Conf', GlobalData.gDatabasePath))
DbPath = os.path.normpath(mws.join(GlobalData.gWorkspace, 'Conf', GlobalData.gDatabasePath))
# don't create necessary path for db in memory
if DbPath != ':memory:':