Skip to content
Closed
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
345 changes: 345 additions & 0 deletions buildgraph/CoreBuildGraph.xml

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/commands/buildgraph/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const run = new Command<GlobalOptions>()
})

const project = await createProject(enginePath, projectPath)
const { success, code } = await project.runBuildGraph(buildGraphScript, buildGraphArgs)
const { success, code } = await project.runCustomBuildGraph(buildGraphScript, buildGraphArgs)
if (!success) {
const logs = await project.engine.getAutomationToolLogs(enginePath)

Expand All @@ -36,6 +36,7 @@ export const run = new Command<GlobalOptions>()
await writeMarkdownReport(logs, options.buildgraphReportErrors)
}

Deno.exit(code)
//Deno.exit(code)
Deno.exit(1)
}
})
3 changes: 2 additions & 1 deletion src/commands/project/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const compile = new Command<GlobalOptions>()
.option('-c, --configuration <configuration:Configuration>', 'Configuration', {
default: EngineConfiguration.Development,
})
.option('--buildgraph', 'Build Graph', { default: false })
.option('--dry-run', 'Dry run', { default: false })
.arguments('<target:string>')
.action(async (options, target = EngineTarget.Editor) => {
Expand All @@ -25,7 +26,7 @@ export const compile = new Command<GlobalOptions>()
const { engine: { path: enginePath }, project: { path: projectPath } } = config.mergeConfigCLIConfig({
cliOptions: options,
})
const project = await createProject(enginePath, projectPath)
const project = await createProject(enginePath, projectPath, options.buildgraph)
await project.compile({
target: target as EngineTarget,
configuration: configuration as EngineConfiguration,
Expand Down
11 changes: 8 additions & 3 deletions src/commands/project/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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 const editor = new Command<GlobalOptions>()
.description('Run the editor')
Expand All @@ -25,8 +26,12 @@ export const editor = new Command<GlobalOptions>()
console.log(`Running editor with ${editorArguments}`)

if (options.compile) {
await project.compileAndRunEditor({ extraRunArgs: editorArguments })
} else {
await project.runEditor({ extraArgs: editorArguments })
await project.compile({
target: EngineTarget.Editor,
configuration: EngineConfiguration.Development,
dryRun: options.dryRun,
platform: EnginePlatform.Windows,
})
}
await project.runEditor({ extraArgs: editorArguments })
})
20 changes: 15 additions & 5 deletions src/commands/project/pkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Engine, EngineConfiguration, EnginePlatform } from '../../lib/engine.ts
import { Config } from '../../lib/config.ts'
import type { GlobalOptions } from '../../lib/types.ts'
import { createProject } from '../../lib/project.ts'
import { formatIsoTimestamp } from '../../lib/utils.ts'

export type PkgOptions = typeof pkg extends Command<void, void, infer Options, [], GlobalOptions> ? Options
: never
Expand All @@ -18,8 +19,9 @@ export const pkg = new Command<GlobalOptions>()
})
.option('-a, --archive-directory <path:file>', 'Path to archive directory')
.option('-z, --zip', 'Should we zip the archive')
.option('-d, --dry-run', 'Dry run')
.option('--compile', 'Use the precompiled binaries', { default: false })
.option('--buildgraph', 'Build Graph', { default: false })
.option('-d, --dry-run', 'Dry run', { default: false })
.option('--compile', 'Compile the editor', { default: false })
.option('--profile <profile:string>', 'Build profile', { default: 'client', required: true })
.stopEarly()
.action(async (options, ...pkgArguments: Array<string>) => {
Expand All @@ -29,8 +31,16 @@ export const pkg = new Command<GlobalOptions>()
cliOptions: options,
})

const args = pkg.getLiteralArgs().concat(pkgArguments)
const buildId = `${
formatIsoTimestamp(cfg.getConfig().metadata?.ts)
}-${cfg.getBuildId()}-${cfg.getConfig().buildkite?.buildNumber}`

const project = await createProject(enginePath, projectPath)
project.package({ archiveDirectory: archiveDirectory, profile: profile, extraArgs: args })
const project = await createProject(enginePath, projectPath, options.buildgraph)
project.package({
archiveDirectory: archiveDirectory,
profile: profile,
buildId: buildId,
extraArgs: pkgArguments,
dryRun: options.dryRun,
})
})
11 changes: 8 additions & 3 deletions src/commands/project/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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 const run = new Command<GlobalOptions>()
.description('Run the game')
Expand All @@ -19,8 +20,12 @@ export const run = new Command<GlobalOptions>()
const project = await createProject(enginePath, projectPath)

if (options.compile) {
await project.runEditor({ extraArgs: ['-game', ...runArguments] })
} else {
await project.compileAndRunEditor({ extraRunArgs: ['-game', ...runArguments] })
await project.compile({
target: EngineTarget.Editor,
configuration: EngineConfiguration.Development,
dryRun: options.dryRun,
platform: EnginePlatform.Windows,
})
}
await project.runEditor({ extraArgs: ['-game', ...runArguments] })
})
122 changes: 122 additions & 0 deletions src/lib/buildgraph.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
export interface BuildGraphArgs {
buildId?: string
editorTarget?: string
gameTargets?: string[] | string
licensee?: string
versioned?: string
promoted?: string
archiveStream?: string
forceSubmit?: string
preferredAgent?: string
archiveName?: string
symbolStorePath?: string
clientPlatforms?: string[] | string
serverPlatforms?: string[] | string
clientConfigurations?: string[] | string
serverConfigurations?: string[] | string
clientTargetType?: string
outputDir?: string
extraCompileArguments?: string[] | string
extraCookArguments?: string[] | string
extraPackageArguments?: string[] | string
additionalTools?: string[] | string
dryRun?: boolean
}

function buildGraphArgToString(arg: string[] | string, separator: string = ';') {
if (Array.isArray(arg)) {
return `${(arg as string[]).join(separator).replaceAll(' ', '')}`
} else {
return `${(arg as string)}`
}
}

export function buildCommandLine(buildGraphArgs: BuildGraphArgs): string[] {
const outArgs: string[] = []

if (buildGraphArgs.buildId) {
outArgs.push(`-Set:buildId=${buildGraphArgToString(buildGraphArgs.buildId)}`)
}

if (buildGraphArgs.editorTarget) {
outArgs.push(`-Set:editorTarget=${buildGraphArgToString(buildGraphArgs.editorTarget)}`)
}

if (buildGraphArgs.gameTargets) {
outArgs.push(`-Set:gameTargets=${buildGraphArgToString(buildGraphArgs.gameTargets, ';')}`)
}

if (buildGraphArgs.versioned) {
outArgs.push(`-Set:versioned=${buildGraphArgToString(buildGraphArgs.versioned)}`)
}

if (buildGraphArgs.promoted) {
outArgs.push(`-Set:promoted=${buildGraphArgToString(buildGraphArgs.promoted)}`)
}

if (buildGraphArgs.archiveStream) {
outArgs.push(`-Set:archiveStream=${buildGraphArgToString(buildGraphArgs.archiveStream)}`)
}

if (buildGraphArgs.forceSubmit) {
outArgs.push(`-Set:forceSubmit=${buildGraphArgToString(buildGraphArgs.forceSubmit)}`)
}

if (buildGraphArgs.preferredAgent) {
outArgs.push(`-Set:preferredAgent=${buildGraphArgToString(buildGraphArgs.preferredAgent)}`)
}

if (buildGraphArgs.archiveName) {
outArgs.push(`-Set:archiveName=${buildGraphArgToString(buildGraphArgs.archiveName)}`)
}

if (buildGraphArgs.symbolStorePath) {
outArgs.push(`-Set:symbolStorePath=${buildGraphArgToString(buildGraphArgs.symbolStorePath)}`)
}

if (buildGraphArgs.clientPlatforms) {
outArgs.push(`-Set:clientPlatforms=${buildGraphArgToString(buildGraphArgs.clientPlatforms)}`)
}

if (buildGraphArgs.serverPlatforms) {
outArgs.push(`-Set:serverPlatforms=${buildGraphArgToString(buildGraphArgs.serverPlatforms)}`)
}

if (buildGraphArgs.clientConfigurations) {
outArgs.push(`-Set:clientConfigurations=${buildGraphArgToString(buildGraphArgs.clientConfigurations)}`)
}

if (buildGraphArgs.serverConfigurations) {
outArgs.push(`-Set:serverConfigurations=${buildGraphArgToString(buildGraphArgs.serverConfigurations)}`)
}

if (buildGraphArgs.clientTargetType) {
outArgs.push(`-Set:clientTargetType=${buildGraphArgToString(buildGraphArgs.clientTargetType)}`)
}

if (buildGraphArgs.outputDir) {
outArgs.push(`-Set:outputDir=${buildGraphArgToString(buildGraphArgs.outputDir)}`)
}

if (buildGraphArgs.extraCompileArguments) {
outArgs.push(`-Set:extraCompileArguments=${buildGraphArgToString(buildGraphArgs.extraCompileArguments)}`)
}

if (buildGraphArgs.extraCookArguments) {
outArgs.push(`-Set:extraCookArguments=${buildGraphArgToString(buildGraphArgs.extraCookArguments)}`)
}

if (buildGraphArgs.extraPackageArguments) {
outArgs.push(`-Set:extraPackageArguments=${buildGraphArgToString(buildGraphArgs.extraPackageArguments)}`)
}

if (buildGraphArgs.additionalTools) {
outArgs.push(`-Set:additionalTools=${buildGraphArgToString(buildGraphArgs.additionalTools)}`)
}

if (buildGraphArgs.dryRun) {
outArgs.push('-ListOnly')
}

return outArgs
}
2 changes: 1 addition & 1 deletion src/lib/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export abstract class Engine {
const buildScript = this.getBuildScript()
const args = [target, configuration, platform, ...extraArgs]
console.log('[runUBT]', args)
if (dryRun) return
if (dryRun) return { success: true, code: 0, signal: null, output: '' }
return await exec(buildScript, args)
}

Expand Down
Loading