SCons: Warn when passing unknown variables
Lifted largely from godot-cpp's implementation^1, albeit with formatting tweaked to be more in-line with recent SConstruct adjustments.
Example output:
Executing task: scons dev_build=yes compiledb=yes optimize=debug verbose=no tests=yes warnings=extra d3d12=yes module_text_server_fb_enabled=yes cpp_standard=23 ninja=no
scons: Reading SConscript files ...
Automatically detected platform: windows
WARNING: Unknown SCons variables were passed and will be ignored:
cpp_standard = 23
Auto-detected 32 CPU cores available for build parallelism. Using 31 cores by default. You can override it with the -j argument.
Double-checked to make sure the regressions from #56551 are no longer applicable. The mono-stuff is no longer relevant as that logic appears to have been removed entirely, or otherwise relocated to not use the argument system. The only regression I could replicate was the profile option, and that came down to it simply… Not being an option. By adding that as a proper variable, everything works as expected!
Just curious with which SCons version did you check it? If you still can run it without any issues...
Just curious with which SCons version did you check it? If you still can run it without any issues...
Reson why I had asked is that I tried to run your PR and it worked. With exception to the fact it also printed SCons internals :sweat_smile: something like this but with much more crap from SCons...
hh = hate_scons_twice
custom_hh = hate_scons_twice
osxcross_sdk = hate_scons
BUILDERS = {'StaticObject': <SCons.Builder.CompositeBuilder object at 0x7f786a283c50>, 'Object': <SCons.Builder.CompositeBuilder object at 0x7f786a283c50>, 'SharedObject': <SCons.Builder.CompositeBuilder object at 0x7f786a283f50>, 'StaticLibrary': <SCons.Builder.BuilderBase object at 0x7f786a283560>, 'Library': <SCons.Builder.BuilderBase object at 0x7f786a283560>, 'SharedLibrary': <SCons.Builder.BuilderBase object at 0x7f786a2835f0>, 'Program': <SCons.Builder.BuilderBase object at 0x7f786a282e40>, 'LoadableModule': <SCons.Builder.BuilderBase
I've tried both 4.8.1 and 3.1.2 (out current minimal :sweat_smile:)
Don't mind :sweat_smile:. Turned out that we polluted unknown variables by ourselves when do opts.Update(env, {**ARGUMENTS, **env.Dictionary()}) because Dictionary method returns all the variables including internals...
Superseded by #99690