Skip to content

Commit

Permalink
Workaround for build errors caused by vcvarsall.bat returning ERRORLE…
Browse files Browse the repository at this point in the history
…VEL=1

Summary:
An update to the Windows toolchain broke OSS getdeps builds. This was caused by the execution of `vcvarsall.bat` returning an ERRORLEVEL=1 when any extension (optional tools) was absent. Given we don't install many extensions this meant that the setup script was failing. The resultant behavior was to fail all build steps.

The fix was to wrap the invocation of `vcvarsall.bat` in a different batch file that always returns ERRORLEVEL=0. This should be OK as any real build failures will come by running the actual build scripts.

NOTE: There are other known failures (i.e. folly not building due to new compiler) that will be exposed after this change. They will not be causing any new job failures, but should be addressed as well.

Reviewed By: chadaustin

Differential Revision: D54280190

fbshipit-source-id: 7bf38bb2cb084cf5c4cd5650b5f0f06bb1dbcd9b
  • Loading branch information
jdelliot authored and facebook-github-bot committed Feb 28, 2024
1 parent 14e3e98 commit f60845f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion build/fbcode_builder/getdeps/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,18 @@ def _get_cmd_prefix(self):
# the cmd quoting rules to assemble a command that calls the script
# to prep the environment and then triggers the actual command that
# we wanted to run.
return [vcvarsall, "amd64", "&&"]

# Due to changes in vscrsall.bat, it now reports an ERRORLEVEL of 1
# even when succeeding. This occurs when an extension is not present.
# To continue, we must ignore the ERRORLEVEL returned. We do this by
# wrapping the call in a batch file that always succeeds.
wrapper = os.path.join(self.build_dir, "succeed.bat")
with open(wrapper, "w") as f:
f.write("@echo off\n")
f.write(f"call {vcvarsall} amd64\n")
f.write("set ERRORLEVEL=0\n")
f.write("exit /b 0\n")
return [wrapper, "&&"]
return []

def _run_cmd(
Expand Down

0 comments on commit f60845f

Please sign in to comment.