-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'uet internal engine-checkout' command (#45)
* Add internal engine-checkout command for syncing engine to a specific directory * Set GIT_LFS_FORCE_PROGRESS=1 so we always get LFS progress
- Loading branch information
Showing
9 changed files
with
110 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
UET/Redpoint.Uet.Workspace/Descriptors/GitWorkspaceDescriptorBuildType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Redpoint.Uet.Workspace.Descriptors | ||
{ | ||
public enum GitWorkspaceDescriptorBuildType | ||
{ | ||
/// <summary> | ||
/// This is a project or plugin build. | ||
/// </summary> | ||
Generic, | ||
|
||
/// <summary> | ||
/// This is a checkout of the engine itself, instead of a project or plugin, from the Unreal Engine GitHub repository where we need to run GitDeps and potentially copy console files. | ||
/// </summary> | ||
Engine, | ||
|
||
/// <summary> | ||
/// This is a checkout of the engine itself, where all the engine files have been stored in a Git repository with LFS (and there's no external console folders or GitDeps to run). This is the case if you externally sync Perforce into a Git repository with LFS. | ||
/// </summary> | ||
EngineLfs, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
UET/uet/Commands/Internal/EngineCheckout/EngineCheckoutCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
namespace UET.Commands.Internal.EngineCheckout | ||
{ | ||
using Microsoft.Extensions.Logging; | ||
using Redpoint.Uet.Workspace; | ||
using Redpoint.Uet.Workspace.Descriptors; | ||
using Redpoint.Uet.Workspace.PhysicalGit; | ||
using System.CommandLine; | ||
using System.CommandLine.Invocation; | ||
using System.Threading.Tasks; | ||
|
||
internal sealed class EngineCheckoutCommand | ||
{ | ||
internal sealed class Options | ||
{ | ||
public Option<string> Path; | ||
public Option<string> RepositoryUri; | ||
public Option<string> Branch; | ||
|
||
public Options() | ||
{ | ||
Path = new Option<string>("--path"); | ||
RepositoryUri = new Option<string>("--uri"); | ||
Branch = new Option<string>("--branch"); | ||
} | ||
} | ||
|
||
public static Command CreateEngineCheckoutCommand() | ||
{ | ||
var options = new Options(); | ||
var command = new Command("engine-checkout"); | ||
command.AddAllOptions(options); | ||
command.AddCommonHandler<EngineCheckoutCommandInstance>(options); | ||
return command; | ||
} | ||
|
||
private sealed class EngineCheckoutCommandInstance : ICommandInstance | ||
{ | ||
private readonly ILogger<EngineCheckoutCommandInstance> _logger; | ||
private readonly IPhysicalGitCheckout _physicalGitCheckout; | ||
private readonly Options _options; | ||
|
||
public EngineCheckoutCommandInstance( | ||
ILogger<EngineCheckoutCommandInstance> logger, | ||
IPhysicalGitCheckout physicalGitCheckout, | ||
Options options) | ||
{ | ||
_logger = logger; | ||
_physicalGitCheckout = physicalGitCheckout; | ||
_options = options; | ||
} | ||
|
||
public async Task<int> ExecuteAsync(InvocationContext context) | ||
{ | ||
Directory.CreateDirectory(context.ParseResult.GetValueForOption(_options.Path)!); | ||
|
||
await _physicalGitCheckout.PrepareGitWorkspaceAsync( | ||
context.ParseResult.GetValueForOption(_options.Path)!, | ||
new GitWorkspaceDescriptor | ||
{ | ||
RepositoryUrl = context.ParseResult.GetValueForOption(_options.RepositoryUri)!, | ||
RepositoryCommitOrRef = context.ParseResult.GetValueForOption(_options.Branch)!, | ||
AdditionalFolderLayers = [], | ||
AdditionalFolderZips = [], | ||
WorkspaceDisambiguators = [], | ||
WindowsSharedGitCachePath = null, | ||
MacSharedGitCachePath = null, | ||
ProjectFolderName = null, | ||
BuildType = GitWorkspaceDescriptorBuildType.EngineLfs, | ||
}, | ||
context.GetCancellationToken()).ConfigureAwait(false); | ||
return 0; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters