Skip to content
Merged
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
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ steps:
label: ":cityscape: acme build"
build:
message: ":test_tube: test runreal/cli ${BUILDKITE_BRANCH}-${BUILDKITE_COMMIT}"
branch: ${RUNREAL_ACME_BRANCH:-main}
env:
RUNREAL_FROM_SOURCE: true
RUNREAL_FROM_REF: $BUILDKITE_COMMIT
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
!src/commands/build
scratch/
# This file is generated by the runreal CLI during the test
.runreal
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,23 @@

## Getting Started
```sh
# Compile the editor
runreal project compile Editor
# Build the editor
runreal project build Editor

# Compile your project targets
runreal project compile Client
# Build your project targets
runreal project build Client

# List available build targets
runreal list-targets
runreal info list-targets

# Run your editor
runreal run Editor

# Run your game
runreal project run
runreal run Game

# Package your project
runreal project pkg -p Win64 -c Development
runreal project pkg Game Win64 Development nopak

# Execute a buildgraph script
runreal buildgraph run <script.xml>
Expand Down
28 changes: 17 additions & 11 deletions src/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import { Config } from './lib/config.ts'
import { logger, LogLevel } from './lib/logger.ts'
import { VERSION } from './version.ts'

import { debug } from './commands/debug/index.ts'
import { buildgraph } from './commands/buildgraph/index.ts'
import { run } from './commands/run/index.ts'
import { engine } from './commands/engine/index.ts'
import { info } from './commands/info/index.ts'
import { build } from './commands/build/index.ts'
import { sln } from './commands/sln/index.ts'
import { init } from './commands/init.ts'
import { cook } from './commands/cook.ts'
import { pkg } from './commands/pkg.ts'
import { uat } from './commands/uat.ts'
import { ubt } from './commands/ubt.ts'
import { buildgraph } from './commands/buildgraph/index.ts'
import { workflow } from './commands/workflow/index.ts'
import { script } from './commands/script.ts'
import { uasset } from './commands/uasset/index.ts'
import { auth } from './commands/auth.ts'
import { project } from './commands/project/index.ts'
import { listTargets } from './commands/list-targets.ts'
const LogLevelType = new EnumType(LogLevel)

export const cmd = new Command()
Expand Down Expand Up @@ -51,15 +54,18 @@ export const cli = cmd
.action(function () {
this.showHelp()
})
.command('init', init)
.command('debug', debug)
.command('list-targets', listTargets)
.command('buildgraph', buildgraph)
.command('run', run)
.command('engine', engine)
.command('build', build)
.command('cook', cook)
.command('pkg', pkg)
.command('sln', sln)
.command('uasset', uasset)
.command('workflow', workflow)
.command('info', info)
.command('init', init)
.command('uat', uat)
.command('ubt', ubt)
.command('buildgraph', buildgraph)
.command('workflow', workflow)
.command('script', script)
.command('auth', auth)
.command('uasset', uasset)
.command('project', project)
28 changes: 19 additions & 9 deletions src/commands/project/compile.ts → src/commands/build/clean.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
import { Command, EnumType, ValidationError } from '@cliffy/command'
import { Command, EnumType } from '@cliffy/command'

import { Engine, EngineConfiguration, EnginePlatform, EngineTarget } from '../../lib/engine.ts'
import { createProject } from '../../lib/project.ts'
import type { GlobalOptions } from '../../lib/types.ts'
import { Config } from '../../lib/config.ts'

export type CompileOptions = typeof compile extends Command<void, void, infer Options, infer Argument, GlobalOptions>
export type CleanOptions = typeof clean extends Command<void, void, infer Options, infer Argument, GlobalOptions>
? Options
: never

export const compile = new Command<GlobalOptions>()
.description('Compile a project')
export const clean = new Command<GlobalOptions>()
.description('Cleans the output of a target build')
.type('Target', new EnumType(EngineTarget))
.type('Configuration', new EnumType(EngineConfiguration))
.type('Platform', new EnumType(EnginePlatform))
.option('-p, --platform <platform:Platform>', 'Platform', { default: Engine.getCurrentPlatform() })
.option('-c, --configuration <configuration:Configuration>', 'Configuration', {
.arguments('<target:Target> [ubtArgs...]')
.option('--projected', 'Add the -project argument. Defaults to true', { default: true })
.option('-p, --platform <platform:Platform>', 'Platform to build, defaults to host platform', {
default: Engine.getCurrentPlatform(),
})
.option('-c, --configuration <configuration:Configuration>', 'Configuration to build, defaults to Development', {
default: EngineConfiguration.Development,
})
.option('--dry-run', 'Dry run', { default: false })
.arguments('<target:string>')
.action(async (options, target = EngineTarget.Editor) => {
const { platform, configuration, dryRun } = options as CompileOptions
.stopEarly()
.action(async (options, target = EngineTarget.Editor, ...ubtArgs: Array<string>) => {
const { platform, configuration, dryRun, projected } = options as CleanOptions

const config = Config.getInstance()
const { engine: { path: enginePath }, project: { path: projectPath } } = config.mergeConfigCLIConfig({
cliOptions: options,
})
const project = await createProject(enginePath, projectPath)

await project.compile({
target: target as EngineTarget,
configuration: configuration as EngineConfiguration,
platform: platform as EnginePlatform,
dryRun: dryRun,
clean: true,
projected: projected,
extraArgs: ubtArgs,
})
})
60 changes: 60 additions & 0 deletions src/commands/build/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { Command, EnumType } from '@cliffy/command'

import { Engine, EngineConfiguration, EnginePlatform, EngineTarget } from '../../lib/engine.ts'
import { createProject } from '../../lib/project.ts'
import type { GlobalOptions } from '../../lib/types.ts'
import { Config } from '../../lib/config.ts'

export type CompileOptions = typeof client extends Command<void, void, infer Options, infer Argument, GlobalOptions>
? Options
: never

export const client = new Command<GlobalOptions>()
.description('Builds the client runtime')
.type('Configuration', new EnumType(EngineConfiguration))
.type('Platform', new EnumType(EnginePlatform))
.arguments('[ubtArgs...]')
.option('--projected', 'Add the -project argument. Defaults to true', { default: true })
.option('-p, --platform <platform:Platform>', 'Platform to build, defaults to host platform', {
default: Engine.getCurrentPlatform(),
})
.option('-c, --configuration <configuration:Configuration>', 'Configuration to build, defaults to Development', {
default: EngineConfiguration.Development,
})
.option('--clean', 'Clean the current build first', { default: false })
.option('--nouht', 'Skips building UnrealHeaderTool', { default: false })
.option('--noxge', 'Disables Incredibuild', { default: true })
.option('--dry-run', 'Dry run', { default: false })
.stopEarly()
.action(async (options, ...ubtArgs: Array<string>) => {
const { platform, configuration, dryRun, clean, nouht, noxge, projected } = options as CompileOptions

const config = Config.getInstance()
const { engine: { path: enginePath }, project: { path: projectPath } } = config.mergeConfigCLIConfig({
cliOptions: options,
})
const project = await createProject(enginePath, projectPath)

if (clean) {
await project.compile({
target: EngineTarget.Client,
configuration: configuration as EngineConfiguration,
platform: platform as EnginePlatform,
dryRun: dryRun,
clean: true,
projected: projected,
})
}

await project.compile({
target: EngineTarget.Client,
configuration: configuration as EngineConfiguration,
platform: platform as EnginePlatform,
dryRun: dryRun,
extraArgs: ubtArgs,
clean: false,
nouht: nouht,
noxge: noxge,
projected: projected,
})
})
60 changes: 60 additions & 0 deletions src/commands/build/editor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { Command, EnumType } from '@cliffy/command'

import { Engine, EngineConfiguration, EnginePlatform, EngineTarget } from '../../lib/engine.ts'
import { createProject } from '../../lib/project.ts'
import type { GlobalOptions } from '../../lib/types.ts'
import { Config } from '../../lib/config.ts'

export type CompileOptions = typeof editor extends Command<void, void, infer Options, infer Argument, GlobalOptions>
? Options
: never

export const editor = new Command<GlobalOptions>()
.description('Builds the editor')
.type('Configuration', new EnumType(EngineConfiguration))
.type('Platform', new EnumType(EnginePlatform))
.arguments('[ubtArgs...]')
.option('--projected', 'Add the -project argument. Defaults to true', { default: true })
.option('-p, --platform <platform:Platform>', 'Platform to build, defaults to host platform', {
default: Engine.getCurrentPlatform(),
})
.option('-c, --configuration <configuration:Configuration>', 'Configuration to build, defaults to Development', {
default: EngineConfiguration.Development,
})
.option('--clean', 'Clean the current build first', { default: false })
.option('--nouht', 'Skips building UnrealHeaderTool', { default: false })
.option('--noxge', 'Disables Incredibuild', { default: true })
.option('--dry-run', 'Dry run', { default: false })
.stopEarly()
.action(async (options, ...ubtArgs: Array<string>) => {
const { platform, configuration, dryRun, clean, nouht, noxge, projected } = options as CompileOptions

const config = Config.getInstance()
const { engine: { path: enginePath }, project: { path: projectPath } } = config.mergeConfigCLIConfig({
cliOptions: options,
})
const project = await createProject(enginePath, projectPath)

if (clean) {
await project.compile({
target: EngineTarget.Editor,
configuration: configuration as EngineConfiguration,
platform: platform as EnginePlatform,
dryRun: dryRun,
clean: true,
projected: projected,
})
}

await project.compile({
target: EngineTarget.Editor,
configuration: configuration as EngineConfiguration,
platform: platform as EnginePlatform,
dryRun: dryRun,
extraArgs: ubtArgs,
clean: false,
nouht: nouht,
noxge: noxge,
projected: projected,
})
})
60 changes: 60 additions & 0 deletions src/commands/build/game.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { Command, EnumType } from '@cliffy/command'

import { Engine, EngineConfiguration, EnginePlatform, EngineTarget } from '../../lib/engine.ts'
import { createProject } from '../../lib/project.ts'
import type { GlobalOptions } from '../../lib/types.ts'
import { Config } from '../../lib/config.ts'

export type CompileOptions = typeof game extends Command<void, void, infer Options, infer Argument, GlobalOptions>
? Options
: never

export const game = new Command<GlobalOptions>()
.description('Builds the game runtime')
.type('Configuration', new EnumType(EngineConfiguration))
.type('Platform', new EnumType(EnginePlatform))
.arguments('[ubtArgs...]')
.option('--projected', 'Add the -project argument. Defaults to true', { default: true })
.option('-p, --platform <platform:Platform>', 'Platform to build, defaults to host platform', {
default: Engine.getCurrentPlatform(),
})
.option('-c, --configuration <configuration:Configuration>', 'Configuration to build, defaults to Development', {
default: EngineConfiguration.Development,
})
.option('--clean', 'Clean the current build first', { default: false })
.option('--nouht', 'Skips building UnrealHeaderTool', { default: false })
.option('--noxge', 'Disables Incredibuild', { default: true })
.option('--dry-run', 'Dry run', { default: false })
.stopEarly()
.action(async (options, ...ubtArgs: Array<string>) => {
const { platform, configuration, dryRun, clean, nouht, noxge, projected } = options as CompileOptions

const config = Config.getInstance()
const { engine: { path: enginePath }, project: { path: projectPath } } = config.mergeConfigCLIConfig({
cliOptions: options,
})
const project = await createProject(enginePath, projectPath)

if (clean) {
await project.compile({
target: EngineTarget.Game,
configuration: configuration as EngineConfiguration,
platform: platform as EnginePlatform,
dryRun: dryRun,
clean: true,
projected: projected,
})
}

await project.compile({
target: EngineTarget.Game,
configuration: configuration as EngineConfiguration,
platform: platform as EnginePlatform,
dryRun: dryRun,
extraArgs: ubtArgs,
clean: false,
nouht: nouht,
noxge: noxge,
projected: projected,
})
})
22 changes: 22 additions & 0 deletions src/commands/build/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Command } from '@cliffy/command'

import type { GlobalOptions } from '../../lib/types.ts'

import { client } from './client.ts'
import { clean } from './clean.ts'
import { editor } from './editor.ts'
import { game } from './game.ts'
import { program } from './program.ts'
import { server } from './server.ts'

export const build = new Command<GlobalOptions>()
.description('build')
.action(function () {
this.showHelp()
})
.command('client', client)
.command('clean', clean)
.command('editor', editor)
.command('game', game)
.command('program', program)
.command('server', server)
Loading