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

SCons: Refactor profile option for custom.py-style overrides #91794

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Finally reading the docs for `SCons.Variables.Update` let me find this optional
parameter, which solves the hacks and pain we've dealt with for years:

> args (optional) – a dictionary of keys and values to update in env.
> If omitted, uses the variables from the commandline.

By passing the environment itself, we preserve the values we've overridden in
`SConstruct` or `detect.py`.
Some of the logic in SCons depends on flags that get overridden in the
platform-specific `detect.py`, so it needs to be processed first.

For example the Android/iOS/Web platforms override the default `target`
to `template_debug`, but this was processed too late so e.g. the logic
that sets `env.editor_build` would set it to true due to the default
`target` value in the environment being `editor`.
@akien-mga akien-mga changed the title Scons refactor profile parameter overrides SCons: Refactor profile option for custom.py-style overrides May 10, 2024
@akien-mga akien-mga changed the title SCons: Refactor profile option for custom.py-style overrides SCons: Refactor profile option for custom.py-style overrides May 10, 2024
@akien-mga akien-mga force-pushed the scons-refactor-profile-parameter-overrides branch from 06bb82b to d84e4a4 Compare May 10, 2024 15:12
Comment on lines +307 to +308
# Update the variables based on the profiles.
opts.Update(env, {**ARGUMENTS, **custom_args, **env})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to reason a bit on the order of merging overlapping arguments from command line, custom.py, and then potential further additions to the env. Will need to do more testing on this PR.

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

Successfully merging this pull request may close these issues.

None yet

1 participant