From d80a3628c914b91449fc9a1d44dadfafc94603d0 Mon Sep 17 00:00:00 2001 From: charlie-runreal Date: Fri, 12 Sep 2025 09:30:53 -0500 Subject: [PATCH] Added resave command and build graph snippet --- assets/buildgraphsnippets.xml | 16 ++++++++++ src/commands/run/index.ts | 2 ++ src/commands/run/resave.ts | 60 +++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 assets/buildgraphsnippets.xml create mode 100644 src/commands/run/resave.ts diff --git a/assets/buildgraphsnippets.xml b/assets/buildgraphsnippets.xml new file mode 100644 index 0000000..c9dfe4d --- /dev/null +++ b/assets/buildgraphsnippets.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/src/commands/run/index.ts b/src/commands/run/index.ts index 1691ac5..182a6c2 100644 --- a/src/commands/run/index.ts +++ b/src/commands/run/index.ts @@ -7,6 +7,7 @@ import { editor } from './editor.ts' import { game } from './game.ts' import { python } from './python.ts' import { server } from './server.ts' +import { resave } from './resave.ts' export const run = new Command() .description('Run the game, editor, or commandlet') @@ -19,3 +20,4 @@ export const run = new Command() .command('game', game) .command('python', python) .command('server', server) + .command('resave', resave) diff --git a/src/commands/run/resave.ts b/src/commands/run/resave.ts new file mode 100644 index 0000000..f4121f5 --- /dev/null +++ b/src/commands/run/resave.ts @@ -0,0 +1,60 @@ +import { Command } from '@cliffy/command' + +import { createProject } from '../../lib/project.ts' +import type { GlobalOptions } from '../../lib/types.ts' +import { Config } from '../../lib/config.ts' +import { EngineConfiguration, EnginePlatform, EngineTarget } from '../../lib/engine.ts' + +export type ResaveOptions = typeof resave extends Command + ? Options + : never + +export const resave = new Command() + .description('Run resave commandlet Unreal Engine headless mode') + .arguments('[runArguments...]') + .option('--dry-run', 'Dry run', { default: false }) + .option('--fixup-redirects', 'Fixup redirects', { default: false }) + .option('--compile', 'Build the target prior to running it', { default: false }) + .stopEarly() + .action( + async ( + options, + ...runArguments: Array + ) => { + const { dryRun, compile, fixupRedirects } = options as ResaveOptions + const cfg = Config.instance().process(options) + const project = await createProject(cfg.engine.path, cfg.project.path) + + if (compile) { + await project.compile({ + target: EngineTarget.Editor, + configuration: EngineConfiguration.Development, + dryRun: dryRun, + extraArgs: runArguments, + }) + } + const args = [ + `-run=ResavePackages`, + '-PROJECTONLY', + '-BatchPackageLimit=10', + '-SKIPFAILS', + '-AutoCheckOut', + '-BatchSourceControl', + '-AutoCheckIn', + '-IgnoreChangelist', + '-SkipFailedCheckouts', + '-P4', + '-stdout', + '-nosplash', + '-nopause', + '-nosound', + ...runArguments, + ] + + if (fixupRedirects) { + args.push('-FixupRedirects') + } + + await project.runEditor({ extraArgs: args, useCmd: true }) + }, + )