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 2 commits into
base: master
Choose a base branch
from

Conversation

@akien-mga akien-mga added this to the 4.3 milestone May 10, 2024
@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 +321
# 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that cli args should override profile args. Cli args + profile args = user args. User args should override env... Your current code does exactly opposite (prefers env over profile args over command line args)

And I would suggest to have separate variable for storing both cli and profile args (user_args or something like it). It will be handy in several places. And IIUC whole if (key not in ARGUMENTS or ARGUMENTS[key] == "auto") and key not in custom_args: could be then written shorter with user_args

akien-mga added 2 commits May 30, 2024 16:01
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 force-pushed the scons-refactor-profile-parameter-overrides branch from d84e4a4 to 2621189 Compare May 30, 2024 14:06
@akien-mga akien-mga modified the milestones: 4.3, 4.x May 30, 2024
@@ -209,6 +200,11 @@ opts.Add(BoolVariable("debug_paths_relative", "Make file paths in debug symbols
opts.Add(EnumVariable("lto", "Link-time optimization (production builds)", "none", ("none", "auto", "thin", "full")))
opts.Add(BoolVariable("production", "Set defaults to build Godot for use in production", False))
opts.Add(BoolVariable("threads", "Enable threading support", True))
opts.Add(
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure but before was only one file? What is the reason to have several profile files? You intend to create something like modularity? One common file and several platform specific?

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.

2 participants