Skip to content

Commit a448cfa

Browse files
feat: new commands for local dev (#80)
1 parent 0bb3534 commit a448cfa

39 files changed

+1161
-336
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ steps:
5050
label: ":cityscape: acme build"
5151
build:
5252
message: ":test_tube: test runreal/cli ${BUILDKITE_BRANCH}-${BUILDKITE_COMMIT}"
53+
branch: ${RUNREAL_ACME_BRANCH:-main}
5354
env:
5455
RUNREAL_FROM_SOURCE: true
5556
RUNREAL_FROM_REF: $BUILDKITE_COMMIT

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build
2+
!src/commands/build
23
scratch/
34
# This file is generated by the runreal CLI during the test
45
.runreal

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@
2424

2525
## Getting Started
2626
```sh
27-
# Compile the editor
28-
runreal project compile Editor
27+
# Build the editor
28+
runreal project build Editor
2929

30-
# Compile your project targets
31-
runreal project compile Client
30+
# Build your project targets
31+
runreal project build Client
3232

3333
# List available build targets
34-
runreal list-targets
34+
runreal info list-targets
35+
36+
# Run your editor
37+
runreal run Editor
3538

3639
# Run your game
37-
runreal project run
40+
runreal run Game
3841

3942
# Package your project
40-
runreal project pkg -p Win64 -c Development
43+
runreal project pkg Game Win64 Development nopak
4144

4245
# Execute a buildgraph script
4346
runreal buildgraph run <script.xml>

src/cmd.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ import { Config } from './lib/config.ts'
44
import { logger, LogLevel } from './lib/logger.ts'
55
import { VERSION } from './version.ts'
66

7-
import { debug } from './commands/debug/index.ts'
7+
import { buildgraph } from './commands/buildgraph/index.ts'
8+
import { run } from './commands/run/index.ts'
89
import { engine } from './commands/engine/index.ts'
10+
import { info } from './commands/info/index.ts'
11+
import { build } from './commands/build/index.ts'
12+
import { sln } from './commands/sln/index.ts'
913
import { init } from './commands/init.ts'
14+
import { cook } from './commands/cook.ts'
15+
import { pkg } from './commands/pkg.ts'
1016
import { uat } from './commands/uat.ts'
1117
import { ubt } from './commands/ubt.ts'
12-
import { buildgraph } from './commands/buildgraph/index.ts'
1318
import { workflow } from './commands/workflow/index.ts'
1419
import { script } from './commands/script.ts'
1520
import { uasset } from './commands/uasset/index.ts'
1621
import { auth } from './commands/auth.ts'
17-
import { project } from './commands/project/index.ts'
18-
import { listTargets } from './commands/list-targets.ts'
1922
const LogLevelType = new EnumType(LogLevel)
2023

2124
export const cmd = new Command()
@@ -51,15 +54,18 @@ export const cli = cmd
5154
.action(function () {
5255
this.showHelp()
5356
})
54-
.command('init', init)
55-
.command('debug', debug)
56-
.command('list-targets', listTargets)
57+
.command('buildgraph', buildgraph)
58+
.command('run', run)
5759
.command('engine', engine)
60+
.command('build', build)
61+
.command('cook', cook)
62+
.command('pkg', pkg)
63+
.command('sln', sln)
64+
.command('uasset', uasset)
65+
.command('workflow', workflow)
66+
.command('info', info)
67+
.command('init', init)
5868
.command('uat', uat)
5969
.command('ubt', ubt)
60-
.command('buildgraph', buildgraph)
61-
.command('workflow', workflow)
6270
.command('script', script)
6371
.command('auth', auth)
64-
.command('uasset', uasset)
65-
.command('project', project)
Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,45 @@
1-
import { Command, EnumType, ValidationError } from '@cliffy/command'
1+
import { Command, EnumType } from '@cliffy/command'
22

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

8-
export type CompileOptions = typeof compile extends Command<void, void, infer Options, infer Argument, GlobalOptions>
8+
export type CleanOptions = typeof clean extends Command<void, void, infer Options, infer Argument, GlobalOptions>
99
? Options
1010
: never
1111

12-
export const compile = new Command<GlobalOptions>()
13-
.description('Compile a project')
12+
export const clean = new Command<GlobalOptions>()
13+
.description('Cleans the output of a target build')
14+
.type('Target', new EnumType(EngineTarget))
1415
.type('Configuration', new EnumType(EngineConfiguration))
1516
.type('Platform', new EnumType(EnginePlatform))
16-
.option('-p, --platform <platform:Platform>', 'Platform', { default: Engine.getCurrentPlatform() })
17-
.option('-c, --configuration <configuration:Configuration>', 'Configuration', {
17+
.arguments('<target:Target> [ubtArgs...]')
18+
.option('--projected', 'Add the -project argument. Defaults to true', { default: true })
19+
.option('-p, --platform <platform:Platform>', 'Platform to build, defaults to host platform', {
20+
default: Engine.getCurrentPlatform(),
21+
})
22+
.option('-c, --configuration <configuration:Configuration>', 'Configuration to build, defaults to Development', {
1823
default: EngineConfiguration.Development,
1924
})
2025
.option('--dry-run', 'Dry run', { default: false })
21-
.arguments('<target:string>')
22-
.action(async (options, target = EngineTarget.Editor) => {
23-
const { platform, configuration, dryRun } = options as CompileOptions
26+
.stopEarly()
27+
.action(async (options, target = EngineTarget.Editor, ...ubtArgs: Array<string>) => {
28+
const { platform, configuration, dryRun, projected } = options as CleanOptions
29+
2430
const config = Config.getInstance()
2531
const { engine: { path: enginePath }, project: { path: projectPath } } = config.mergeConfigCLIConfig({
2632
cliOptions: options,
2733
})
2834
const project = await createProject(enginePath, projectPath)
35+
2936
await project.compile({
3037
target: target as EngineTarget,
3138
configuration: configuration as EngineConfiguration,
3239
platform: platform as EnginePlatform,
3340
dryRun: dryRun,
41+
clean: true,
42+
projected: projected,
43+
extraArgs: ubtArgs,
3444
})
3545
})

src/commands/build/client.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { Command, EnumType } from '@cliffy/command'
2+
3+
import { Engine, EngineConfiguration, EnginePlatform, EngineTarget } from '../../lib/engine.ts'
4+
import { createProject } from '../../lib/project.ts'
5+
import type { GlobalOptions } from '../../lib/types.ts'
6+
import { Config } from '../../lib/config.ts'
7+
8+
export type CompileOptions = typeof client extends Command<void, void, infer Options, infer Argument, GlobalOptions>
9+
? Options
10+
: never
11+
12+
export const client = new Command<GlobalOptions>()
13+
.description('Builds the client runtime')
14+
.type('Configuration', new EnumType(EngineConfiguration))
15+
.type('Platform', new EnumType(EnginePlatform))
16+
.arguments('[ubtArgs...]')
17+
.option('--projected', 'Add the -project argument. Defaults to true', { default: true })
18+
.option('-p, --platform <platform:Platform>', 'Platform to build, defaults to host platform', {
19+
default: Engine.getCurrentPlatform(),
20+
})
21+
.option('-c, --configuration <configuration:Configuration>', 'Configuration to build, defaults to Development', {
22+
default: EngineConfiguration.Development,
23+
})
24+
.option('--clean', 'Clean the current build first', { default: false })
25+
.option('--nouht', 'Skips building UnrealHeaderTool', { default: false })
26+
.option('--noxge', 'Disables Incredibuild', { default: true })
27+
.option('--dry-run', 'Dry run', { default: false })
28+
.stopEarly()
29+
.action(async (options, ...ubtArgs: Array<string>) => {
30+
const { platform, configuration, dryRun, clean, nouht, noxge, projected } = options as CompileOptions
31+
32+
const config = Config.getInstance()
33+
const { engine: { path: enginePath }, project: { path: projectPath } } = config.mergeConfigCLIConfig({
34+
cliOptions: options,
35+
})
36+
const project = await createProject(enginePath, projectPath)
37+
38+
if (clean) {
39+
await project.compile({
40+
target: EngineTarget.Client,
41+
configuration: configuration as EngineConfiguration,
42+
platform: platform as EnginePlatform,
43+
dryRun: dryRun,
44+
clean: true,
45+
projected: projected,
46+
})
47+
}
48+
49+
await project.compile({
50+
target: EngineTarget.Client,
51+
configuration: configuration as EngineConfiguration,
52+
platform: platform as EnginePlatform,
53+
dryRun: dryRun,
54+
extraArgs: ubtArgs,
55+
clean: false,
56+
nouht: nouht,
57+
noxge: noxge,
58+
projected: projected,
59+
})
60+
})

src/commands/build/editor.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { Command, EnumType } from '@cliffy/command'
2+
3+
import { Engine, EngineConfiguration, EnginePlatform, EngineTarget } from '../../lib/engine.ts'
4+
import { createProject } from '../../lib/project.ts'
5+
import type { GlobalOptions } from '../../lib/types.ts'
6+
import { Config } from '../../lib/config.ts'
7+
8+
export type CompileOptions = typeof editor extends Command<void, void, infer Options, infer Argument, GlobalOptions>
9+
? Options
10+
: never
11+
12+
export const editor = new Command<GlobalOptions>()
13+
.description('Builds the editor')
14+
.type('Configuration', new EnumType(EngineConfiguration))
15+
.type('Platform', new EnumType(EnginePlatform))
16+
.arguments('[ubtArgs...]')
17+
.option('--projected', 'Add the -project argument. Defaults to true', { default: true })
18+
.option('-p, --platform <platform:Platform>', 'Platform to build, defaults to host platform', {
19+
default: Engine.getCurrentPlatform(),
20+
})
21+
.option('-c, --configuration <configuration:Configuration>', 'Configuration to build, defaults to Development', {
22+
default: EngineConfiguration.Development,
23+
})
24+
.option('--clean', 'Clean the current build first', { default: false })
25+
.option('--nouht', 'Skips building UnrealHeaderTool', { default: false })
26+
.option('--noxge', 'Disables Incredibuild', { default: true })
27+
.option('--dry-run', 'Dry run', { default: false })
28+
.stopEarly()
29+
.action(async (options, ...ubtArgs: Array<string>) => {
30+
const { platform, configuration, dryRun, clean, nouht, noxge, projected } = options as CompileOptions
31+
32+
const config = Config.getInstance()
33+
const { engine: { path: enginePath }, project: { path: projectPath } } = config.mergeConfigCLIConfig({
34+
cliOptions: options,
35+
})
36+
const project = await createProject(enginePath, projectPath)
37+
38+
if (clean) {
39+
await project.compile({
40+
target: EngineTarget.Editor,
41+
configuration: configuration as EngineConfiguration,
42+
platform: platform as EnginePlatform,
43+
dryRun: dryRun,
44+
clean: true,
45+
projected: projected,
46+
})
47+
}
48+
49+
await project.compile({
50+
target: EngineTarget.Editor,
51+
configuration: configuration as EngineConfiguration,
52+
platform: platform as EnginePlatform,
53+
dryRun: dryRun,
54+
extraArgs: ubtArgs,
55+
clean: false,
56+
nouht: nouht,
57+
noxge: noxge,
58+
projected: projected,
59+
})
60+
})

src/commands/build/game.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { Command, EnumType } from '@cliffy/command'
2+
3+
import { Engine, EngineConfiguration, EnginePlatform, EngineTarget } from '../../lib/engine.ts'
4+
import { createProject } from '../../lib/project.ts'
5+
import type { GlobalOptions } from '../../lib/types.ts'
6+
import { Config } from '../../lib/config.ts'
7+
8+
export type CompileOptions = typeof game extends Command<void, void, infer Options, infer Argument, GlobalOptions>
9+
? Options
10+
: never
11+
12+
export const game = new Command<GlobalOptions>()
13+
.description('Builds the game runtime')
14+
.type('Configuration', new EnumType(EngineConfiguration))
15+
.type('Platform', new EnumType(EnginePlatform))
16+
.arguments('[ubtArgs...]')
17+
.option('--projected', 'Add the -project argument. Defaults to true', { default: true })
18+
.option('-p, --platform <platform:Platform>', 'Platform to build, defaults to host platform', {
19+
default: Engine.getCurrentPlatform(),
20+
})
21+
.option('-c, --configuration <configuration:Configuration>', 'Configuration to build, defaults to Development', {
22+
default: EngineConfiguration.Development,
23+
})
24+
.option('--clean', 'Clean the current build first', { default: false })
25+
.option('--nouht', 'Skips building UnrealHeaderTool', { default: false })
26+
.option('--noxge', 'Disables Incredibuild', { default: true })
27+
.option('--dry-run', 'Dry run', { default: false })
28+
.stopEarly()
29+
.action(async (options, ...ubtArgs: Array<string>) => {
30+
const { platform, configuration, dryRun, clean, nouht, noxge, projected } = options as CompileOptions
31+
32+
const config = Config.getInstance()
33+
const { engine: { path: enginePath }, project: { path: projectPath } } = config.mergeConfigCLIConfig({
34+
cliOptions: options,
35+
})
36+
const project = await createProject(enginePath, projectPath)
37+
38+
if (clean) {
39+
await project.compile({
40+
target: EngineTarget.Game,
41+
configuration: configuration as EngineConfiguration,
42+
platform: platform as EnginePlatform,
43+
dryRun: dryRun,
44+
clean: true,
45+
projected: projected,
46+
})
47+
}
48+
49+
await project.compile({
50+
target: EngineTarget.Game,
51+
configuration: configuration as EngineConfiguration,
52+
platform: platform as EnginePlatform,
53+
dryRun: dryRun,
54+
extraArgs: ubtArgs,
55+
clean: false,
56+
nouht: nouht,
57+
noxge: noxge,
58+
projected: projected,
59+
})
60+
})

src/commands/build/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Command } from '@cliffy/command'
2+
3+
import type { GlobalOptions } from '../../lib/types.ts'
4+
5+
import { client } from './client.ts'
6+
import { clean } from './clean.ts'
7+
import { editor } from './editor.ts'
8+
import { game } from './game.ts'
9+
import { program } from './program.ts'
10+
import { server } from './server.ts'
11+
12+
export const build = new Command<GlobalOptions>()
13+
.description('build')
14+
.action(function () {
15+
this.showHelp()
16+
})
17+
.command('client', client)
18+
.command('clean', clean)
19+
.command('editor', editor)
20+
.command('game', game)
21+
.command('program', program)
22+
.command('server', server)

0 commit comments

Comments
 (0)