Skip to content

Commit 2127d2c

Browse files
Build - add variable validation for scripts.
1 parent 3946f08 commit 2127d2c

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

scripts/internal/build_mmSolverLibs_linux.bash

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
# a non-zero exit code.
3131
set -ev
3232

33+
# Validate required environment variables.
34+
echo "Validating required environment variables..."
35+
for var in MAYA_VERSION CMAKE_EXE RUST_CARGO_EXE VFX_PLATFORM CXX_STANDARD; do
36+
if [ -z "${!var}" ]; then
37+
echo "ERROR: Required environment variable '$var' is not set."
38+
echo "This script must be called by a parent build script that sets all required variables."
39+
exit 1
40+
fi
41+
done
42+
echo "All required environment variables are set."
43+
3344
# Store the current working directory, to return to.
3445
CWD=`pwd`
3546

scripts/internal/build_mmSolverLibs_windows64.bat

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,35 @@
2626
:: This file assumes the variables MAYA_VERSION and RUST_CARGO_EXE
2727
:: have been set.
2828

29+
:: Validate required environment variables.
30+
ECHO Validating required environment variables...
31+
IF "%MAYA_VERSION%"=="" (
32+
ECHO ERROR: Required environment variable MAYA_VERSION is not set.
33+
ECHO This script must be called by a parent build script that sets all required variables.
34+
EXIT /B 1
35+
)
36+
IF "%CMAKE_EXE%"=="" (
37+
ECHO ERROR: Required environment variable CMAKE_EXE is not set.
38+
ECHO This script must be called by a parent build script that sets all required variables.
39+
EXIT /B 1
40+
)
41+
IF "%RUST_CARGO_EXE%"=="" (
42+
ECHO ERROR: Required environment variable RUST_CARGO_EXE is not set.
43+
ECHO This script must be called by a parent build script that sets all required variables.
44+
EXIT /B 1
45+
)
46+
IF "%VFX_PLATFORM%"=="" (
47+
ECHO ERROR: Required environment variable VFX_PLATFORM is not set.
48+
ECHO This script must be called by a parent build script that sets all required variables.
49+
EXIT /B 1
50+
)
51+
IF "%CXX_STANDARD%"=="" (
52+
ECHO ERROR: Required environment variable CXX_STANDARD is not set.
53+
ECHO This script must be called by a parent build script that sets all required variables.
54+
EXIT /B 1
55+
)
56+
ECHO All required environment variables are set.
57+
2958
:: The root of this project.
3059
SET PROJECT_ROOT=%CD%
3160
ECHO Project Root: %PROJECT_ROOT%

0 commit comments

Comments
 (0)