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
5 changes: 5 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"type": "string",
"description": "git source repository"
},
"gitBranch": {
"type": "string",
"description": "git branch to checkout",
"default": "main"
},
"gitDependenciesCachePath": {
"type": "string",
"description": "Path to git dependencies cache folder <RUNREAL_GIT_DEPENDENCIES_CACHE_PATH>"
Expand Down
15 changes: 8 additions & 7 deletions src/commands/engine/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const update = new Command<GlobalOptions>()
.option(
'-b, --branch <checkout:string>',
'git checkout (branch | tag | commit)',
{ default: 'main' },
)
.option('-r, --remote <remote:string>', 'git remote', { default: 'origin' })
.option('-c, --clean', 'if we should run a git clean before updating', {
Expand All @@ -41,35 +40,37 @@ export const update = new Command<GlobalOptions>()
} = options as UpdateOptions

const cfg = Config.getInstance().mergeConfigCLIConfig({ cliOptions: options })
const branchArg = branch || cfg.engine.gitBranch

const isRepo = await isGitRepo(cfg.engine.path)
if (!isRepo) {
throw new ValidationError(
`Engine path ${cfg.engine.path} is not a git repository`,
)
}
if (clean) {
const clean = await exec('git', [
const _clean = await exec('git', [
'clean',
gitCleanFlags ? gitCleanFlags : '-fxd',
], { cwd: cfg.engine.path, dryRun })
}
// Prevent the default engine hooks from running
await deleteEngineHooks(cfg.engine.path)

const fetch = await exec('git', [
const _fetch = await exec('git', [
'fetch',
remote,
branch,
branchArg,
], { cwd: cfg.engine.path, dryRun })

const checkout = await exec('git', [
const _checkout = await exec('git', [
'checkout',
'--quiet',
'--force',
branch,
branchArg,
], { cwd: cfg.engine.path, dryRun })

const reset = await exec('git', [
const _reset = await exec('git', [
'reset',
'--hard',
'FETCH_HEAD',
Expand Down
1 change: 1 addition & 0 deletions src/lib/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const ConfigSchema = z.object({
path: z.string().describe('Path to the engine folder'),
repoType: z.string().describe('git or perforce'),
gitSource: z.string().optional().describe('git source repository'),
gitBranch: z.string().optional().describe('git branch to checkout').default('main'),
gitDependenciesCachePath: z
.string()
.optional()
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export const runEngineSetup = async (

const deps = await exec(engine.getGitDependencesBin(), args, { cwd: enginePath, dryRun })

await exec(engine.getGenerateScript(), [])
await exec(engine.getGenerateScript(), [], { dryRun })
}

export const deleteEngineHooks = async (enginePath: string) => {
Expand Down