Fixes for relative vs absolute file paths when building (#193)

The output binary is saved alongside the makefile initially, and moved after the fact. This was done to account for Windows and cross-drive issues due to temp filesystems. Because we are saving alongside the makefile, we can just use a relative path, ie the basename of the engine binary, to avoid possible issues in some engine build scripts.

Also, check process exitcode instead of just checking for the binary when building
Also, pretty-print the compiler error, even though it is sent to the server
This commit is contained in:
Andrew Grant authored and GitHub committed 2024-02-20 18:10:45 -05:00
1 parent fc68330d95
commit b54719ee77
2 files changed
+12 -1

No files matched your search

+6 -1
View File
@@ -296,12 +296,17 @@ def download_public_engine(engine, net_path, branch, source, make_path, out_path
# Prepare the MAKEFILE command
make_path = os.path.join(src_path, make_path)
bin_path = os.path.join(make_path, os.path.basename(out_path))
make_cmd = makefile_command(net_path, make_path, bin_path, compiler)
make_cmd = makefile_command(net_path, make_path, os.path.basename(out_path), compiler)
# Build the engine, which will produce a binary to bin_path, to be moved after
process = subprocess.Popen(make_cmd, cwd=make_path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
comp_output = process.communicate()[0].decode('utf-8')
# Verify that the compilation subprocess did not exit with errors
if process.returncode:
message = 'Error during compilation. The logs have been sent to the server'
raise OpenBenchBuildFailedException(message, comp_output)
# Move the binary to the proper out_path, account for Windows and cross-drive moves
if check_for_engine_binary(bin_path):
shutil.move(check_for_engine_binary(bin_path), os.path.dirname(out_path))