Adding support for DebugGame Editor to the UShell cook

We encountered an issue where the cook would occasionally fail for local users when using ushell. We tracked the issue down to some users running the Editor in DebugGame, but the ushell cook was launching an old, outdated Editor Development build instead. I had a look at the cook.py and it looks to currently support Debug and Development, but not DebugGame, so we weren’t able to pass that as a option as part of our channel extensions.

We were hoping to confirm if this was the right approach, or if it meant we weren’t using ushell as you would expect / recommend?

We were able to patch it locally with some small additions. We added debuggame as a new option for the _Cook and then updated the variant check on line #53 to check for it. These are the changes we made in Engine\Extras\ushell\channels\unreal\core\cmds\cook.py:

// Original (Line #27)
class _Cook(unrealcmd.MultiPlatformCmd):
    cookargs     = unrealcmd.Arg([str], "Additional arguments passed to the cook commandlet")
    cultures     = unrealcmd.Opt("en", "Cultures to cook (comma separated, defaults to 'en')")
    onthefly     = unrealcmd.Opt(False, "Launch as an on-the-fly server")
    iterate      = unrealcmd.Opt(False, "Cook iteratively on top of the previous cook")
    noxge        = unrealcmd.Opt(False, "Disable XGE-based shader compilation")
    unpretty     = unrealcmd.Opt(False, "Turns off colourful pretty-printing")
    attach       = unrealcmd.Opt(False, "Attach a debugger to the cook")
    build        = unrealcmd.Opt(False, "Build editor binaries prior to cooking")
    debug        = unrealcmd.Opt(False, "Use debug executables")
    nounattended = unrealcmd.Opt(False, "Skip implicitly specified '-unattended'")
    versioned    = unrealcmd.Opt(False, "Skip implicitly specified '-unversioned'")

// New
class _Cook(unrealcmd.MultiPlatformCmd):
    cookargs     = unrealcmd.Arg([str], "Additional arguments passed to the cook commandlet")
    cultures     = unrealcmd.Opt("en", "Cultures to cook (comma separated, defaults to 'en')")
    onthefly     = unrealcmd.Opt(False, "Launch as an on-the-fly server")
    iterate      = unrealcmd.Opt(False, "Cook iteratively on top of the previous cook")
    noxge        = unrealcmd.Opt(False, "Disable XGE-based shader compilation")
    unpretty     = unrealcmd.Opt(False, "Turns off colourful pretty-printing")
    attach       = unrealcmd.Opt(False, "Attach a debugger to the cook")
    build        = unrealcmd.Opt(False, "Build editor binaries prior to cooking")
    debug        = unrealcmd.Opt(False, "Use debug executables")
    debuggame    = unrealcmd.Opt(False, "Use DebugGame executables")
    nounattended = unrealcmd.Opt(False, "Skip implicitly specified '-unattended'")
    versioned    = unrealcmd.Opt(False, "Skip implicitly specified '-unversioned'")

// Original (Line #53)
variant = "debug" if self.args.debug else "development"

// New
if self.args.debug:
  variant = "debug"
elif self.args.debuggame:
  variant = "debuggame"
else:
  variant = "development"

[Attachment Removed]

Thank you for reaching out. You’re certainly using ushell as intended and excluding DebugGame variant selection was more an oversight on my part. Thank you for providing the diff. I submitted a version of it, with a small change to use ushell’s less-known tri-opt style such that one can use `--debug` or `--debug=debuggame`. This went in in changelist 54540158, if you’d like reduce your divergence.

-Martin.

[Attachment Removed]

That’s fantastic. I’ve backported your fix, and replaced our local one. Thanks for the tip about the tri-opt style, I’ll definitely keep that in mind for the future.

One thing I did notice while applying your fix is that the “--attach” flow (lines #84-88) looks to still only use debug. Not a blocker for us at the moment, but for consistency it looks like you could apply a similar fix to those lines and then the debug / debuggame arg would flow through there too.

Thanks again for the quick response and resolution!

[Attachment Removed]

Good catch regarding “--attach”, I had missed that. It’s been updated and will show up in Perforce at some point. Thanks!

[Attachment Removed]