`os` template function doesn't match against `BAKE_OS`
bryantdrewjones opened this issue · comments
When the target OS is specified in the BAKE_OS
environment variable, and when the target OS is different than the host OS, os
template functions will fail to match against the target OS. For example:
In bake.json:
{
"environment": {
"ios": {
"BAKE_OS": "ios",
"BAKE_ARCHITECTURE": "arm64"
}
}
}
In project.json
"${os ios}": {
"cflags": [
"-target $BAKE_ARCHITECTURE-apple-$BAKE_OS"
]
}
The os
check here fails to match because it compares against the host OS ("Darwin" in my case).
This could be intended behaviour, but, if so, I don't see any other mechanism in Bake for branching project settings off of the build target 😕
bake.load
looks like it manages a similar set of OS-related strings as bake.util.os
. And bake.load.ut_load_init(...)
has this nice bit of code:
if (!os) {
os = ut_getenv("BAKE_OS");
if (!os) {
os = UT_OS_STRING;
}
}
// ...
UT_OS = ut_strdup(os);
// ...
ut_setenv("BAKE_OS", UT_OS);
UT_OS_STRING
is always a representation of the host OS, and BAKE_OS
is the same unless the user overrides it in their config. Given that, would it be safe and reasonable to change the OS-matching logic to compare against BAKE_OS
instead of UT_OS_STRING
?