(Source, Target, IncludePathFile)
| 321 | # @param IncludePathFile The file to log the external include path |
| 322 | # |
| 323 | def TrimAslFile(Source, Target, IncludePathFile): |
| 324 | CreateDirectory(os.path.dirname(Target)) |
| 325 | |
| 326 | SourceDir = os.path.dirname(Source) |
| 327 | if SourceDir == '': |
| 328 | SourceDir = '.' |
| 329 | |
| 330 | # |
| 331 | # Add source directory as the first search directory |
| 332 | # |
| 333 | IncludePathList = [SourceDir] |
| 334 | |
| 335 | # |
| 336 | # If additional include path file is specified, append them all |
| 337 | # to the search directory list. |
| 338 | # |
| 339 | if IncludePathFile: |
| 340 | try: |
| 341 | LineNum = 0 |
| 342 | with open(IncludePathFile, 'r') as File: |
| 343 | FileLines = File.readlines() |
| 344 | for Line in FileLines: |
| 345 | LineNum += 1 |
| 346 | if Line.startswith("/I") or Line.startswith ("-I"): |
| 347 | IncludePathList.append(Line[2:].strip()) |
| 348 | else: |
| 349 | EdkLogger.warn("Trim", "Invalid include line in include list file.", IncludePathFile, LineNum) |
| 350 | except: |
| 351 | EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=IncludePathFile) |
| 352 | |
| 353 | Lines = DoInclude(Source, '', IncludePathList) |
| 354 | |
| 355 | # |
| 356 | # Undef MIN and MAX to avoid collision in ASL source code |
| 357 | # |
| 358 | Lines.insert(0, "#undef MIN\n#undef MAX\n") |
| 359 | |
| 360 | # save all lines trimmed |
| 361 | try: |
| 362 | with open(Target, 'w') as File: |
| 363 | File.writelines(Lines) |
| 364 | except: |
| 365 | EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) |
| 366 | |
| 367 | def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): |
| 368 | VfrNameList = [] |
no test coverage detected