Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions assets/buildgraphsnippets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version='1.0' ?>
<BuildGraph xmlns="http://www.epicgames.com/BuildGraph" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.epicgames.com/BuildGraph ../Schema.xsd" >

<!-- PROJECT CONFIGURATION -->
<Option Name="ProjectName" DefaultValue="" Restrict="" Description="Name of Project"/>
<Option Name="ProjectPath" DefaultValue="" Restrict="" Description="Path to the folder that contains your .uproject file"/>
<Property Name="Project" Value="$(ProjectPath)/$(ProjectName).uproject"/>

<!-- COMMANDLETS -->
<Agent Name="COMMANDLET" Type="Any">
<Node Name="Resave Packages">
<Commandlet Name="ResavePackages" Project="$(Project)" Arguments="-PROJECTONLY -BatchPackageLimit=10 -SKIPFAILS -AutoCheckOut -BatchSourceControl -AutoCheckIn -IgnoreChangelist -SkipFailedCheckouts -P4 -stdout -nosplash -nopause -nosound"/>
</Node>
</Agent>

</BuildGraph>
2 changes: 2 additions & 0 deletions src/commands/run/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<GlobalOptions>()
.description('Run the game, editor, or commandlet')
Expand All @@ -19,3 +20,4 @@ export const run = new Command<GlobalOptions>()
.command('game', game)
.command('python', python)
.command('server', server)
.command('resave', resave)
60 changes: 60 additions & 0 deletions src/commands/run/resave.ts
Original file line number Diff line number Diff line change
@@ -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<void, void, infer Options, infer Argument, GlobalOptions>
? Options
: never

export const resave = new Command<GlobalOptions>()
.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<string>
) => {
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 })
},
)