Skip to content

Commit

Permalink
fail build when Tcl can't be found
Browse files Browse the repository at this point in the history
But only if the user asks for Tcl specifically. We should probably have similar
logic for the other SML languages, but Tcl is especially troublesome.
  • Loading branch information
garfieldnate committed Oct 12, 2023
1 parent 6156bec commit c12e69a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
env:
# instructs SCons to print debug statements to stdout
SCONS_MSCOMMON_DEBUG: '-'
run: python3 scons/scons.py --scu --opt --verbose all performance_tests
run: python3 scons/scons.py --scu --opt --verbose all performance_tests sml_tcl

- name: Pack artifacts
run: tar -czvf build.tar.gz out/
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
# instructs SCons to print debug statements to stdout
SCONS_MSCOMMON_DEBUG: '-'
run: |
./build.bat --scu --opt --verbose --tcl="$env:TCL_HOME" all performance_tests
./build.bat --scu --opt --verbose --tcl="$env:TCL_HOME" all performance_tests sml_tcl
if ($lastexitcode -ne 0) {
throw "build.bat exit code: $lastexitcode"
}
Expand Down
2 changes: 2 additions & 0 deletions Core/ClientSMLSWIG/Tcl/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ LIB_NAME = 'Tcl_sml_ClientInterface'

if clone.PrepareForCompilingWithTcl(clone["TCL_PATH"], clone["TCL_SUFFIX"]):
print(f'{env["INDENT"]}Tcl SML library is buildable')
elif clone['TCL_REQUIRED']:
raise ValueError('Tcl was requested by user explicitly, but Tcl is not available')
else:
print(f'{env["INDENT"]}Tcl SML library is *not* buildable')
Return()
Expand Down
4 changes: 4 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ env = Environment(
OUT_DIR=os.path.realpath(GetOption('outdir')),
TCL_PATH = GetOption('tcl'),
TCL_SUFFIX = GetOption('tcl_suffix'),
# We fail the build immediately if Tcl cannot be loaded but was specifically requested.
# This is done because the Tcl build is super fragile and it's easy to accidentally
# build without it.
TCL_REQUIRED = 'tclsoarlib' in COMMAND_LINE_TARGETS or 'sml_tcl' in COMMAND_LINE_TARGETS,
SOAR_VERSION=SOAR_VERSION,
VISHIDDEN=False, # needed by swig
JAVAVERSION='11.0',
Expand Down
2 changes: 2 additions & 0 deletions Tcl/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ LIB_NAME = 'tclsoarlib'

if clone.PrepareForCompilingWithTcl(clone["TCL_PATH"], clone["TCL_SUFFIX"]):
print(f'{env["INDENT"]}TclSoarLib is buildable')
elif clone['TCL_REQUIRED']:
raise ValueError('Tcl was requested by user explicitly, but Tcl is not available')
else:
print(f'{env["INDENT"]}TclSoarLib is *not* buildable')
Return()
Expand Down

0 comments on commit c12e69a

Please sign in to comment.