Skip to content

Commit

Permalink
BaseTools: build: Always log respfilelist.txt
Browse files Browse the repository at this point in the history
Currently, the build flags located in the respfilelist.txt file (if it
exists) are only logged if the command fails,. Thus, The typical log
message for a build command that exceeds 4096 characters is the command
itself, followed by the flag pointing at the respfilelist.txt. This
makes a review of the build log harder than it needs to be. This commit
changes the logic such that the build flags are always logged, making it
easier to review the build logs, rather than needing to navigate to the
respfilelist.txt file.

Signed-off-by: Joey Vagedes <[email protected]>
  • Loading branch information
Javagedes committed Jun 28, 2024
1 parent a12049a commit 1748a3c
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions BaseTools/Source/Python/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,40 @@ def LaunchCommand(Command, WorkingDir,ModuleAuto = None):
if Proc.stdout:
StdOutThread.join()

# check the return code of the program
if Proc.returncode != 0:
if not isinstance(Command, type("")):
Command = " ".join(Command)
# print out the Response file and its content when make failure
RespFile = os.path.join(WorkingDir, 'OUTPUT', 'respfilelist.txt')
if os.path.isfile(RespFile):
f = open(RespFile)
RespContent = f.read()
f.close()
EdkLogger.info(RespContent)
# MU_CHANGE begin
# # check the return code of the program
# if Proc.returncode != 0:
# if not isinstance(Command, type("")):
# Command = " ".join(Command)
# # print out the Response file and its content when make failure
# RespFile = os.path.join(WorkingDir, 'OUTPUT', 'respfilelist.txt')
# if os.path.isfile(RespFile):
# f = open(RespFile)
# RespContent = f.read()
# f.close()
# EdkLogger.info(RespContent)

# EdkLogger.error("build", COMMAND_FAILURE, ExtraData="%s [%s]" % (Command, WorkingDir))

RespFile = os.path.join(WorkingDir, 'OUTPUT', 'respfilelist.txt')
if os.path.isfile(RespFile):
f = open(RespFile)
RespContent = f.read().splitlines()
f.close()

EdkLogger.info("Built with Respfile ... %s", WorkingDir)

for i in range(0, len(RespContent), 2):
cmd = RespContent[i]
cmd = cmd[cmd.find("OUTPUT")+7 : cmd.find("_resp.txt")]
flags = RespContent[i+1]
EdkLogger.info(" \"%s_FLAGS\" : %s" % (cmd.upper(), flags))

if Proc.returncode != 0:
Command = " ".join(Command)
EdkLogger.error("build", COMMAND_FAILURE, ExtraData="%s [%s]" % (Command, WorkingDir))
# MU_CHANGE end

if ModuleAuto:
iau = IncludesAutoGen(WorkingDir,ModuleAuto)
if ModuleAuto.ToolChainFamily == TAB_COMPILER_MSFT:
Expand Down

0 comments on commit 1748a3c

Please sign in to comment.