Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os template function doesn't match against BAKE_OS #68

Open
heybdj opened this issue May 21, 2020 · 0 comments
Open

os template function doesn't match against BAKE_OS #68

heybdj opened this issue May 21, 2020 · 0 comments

Comments

@heybdj
Copy link
Contributor

heybdj commented May 21, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant