-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Fix --generate-mono-glue
printing an unknown CLI argument warning
#99294
Conversation
238917d
to
21d6cc2
Compare
- Fix unknown CLI argument warning messages not being visible on Windows. - Fix `--test` error message not being visible on Windows on builds with tests disabled.
21d6cc2
to
83e62aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I can confirm this fixes the --generate-mono-glue
issue.
// Handle arguments specific to C#-enabled builds. | ||
const bool using_mono_args = arg == "--generate-mono-glue"; | ||
#ifndef MODULE_MONO_ENABLED | ||
if (using_mono_args) { | ||
OS::get_singleton()->print( | ||
"`--generate-mono-glue` was specified on the command line, but this Godot binary was compiled without .NET support. Aborting.\n" | ||
"To be able to generate C# glue code, use the `module_mono_enabled=yes` SCons option when compiling Godot.\n"); | ||
goto error; | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're starting to accumulate a lot of hacks in main.cpp
for the Mono module... I'm not fond of increasing the tech debt further here.
There's also --class-db-json
in the Mono module that's not being handled here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And basically any module that would want to "handle" a command line argument unique to itself by parsing OS::get_cmdline_args
would have the same issue.
There are more:
modules/gdscript/tests/gdscript_test_runner_suite.h
44: bool print_filenames = OS::get_singleton()->get_cmdline_args().find("--print-filenames") != nullptr;
45: bool use_binary_tokens = OS::get_singleton()->get_cmdline_args().find("--use-binary-tokens") != nullptr;
I think it's better to go back to the drawing board for how to detect invalid arguments. We can't add special cases in main.cpp
for all arguments parsed by first-party and third-party modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also #99224.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also
--class-db-json
in the Mono module that's not being handled here.
I don't think anybody's using this, it's an undocumented option and could probably be replaced with --dump-extension-api
.
Superseded by #99300. |
--generate-mono-glue
on builds without C# support (similar to--test
on builds with tests disabled).--test
error message not being visible on Windows on builds with tests disabled.The issue about prints not being visible is due to how
ERR_PRINT()
andWARN_PRINT()
work. We don't need their stack trace to be visible here anyway. We can reinstate the coloring later in a future PR (which will apply to all CLI arguments by adding a new method for it).