Skip to content

Commit

Permalink
Code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que committed Dec 13, 2024
1 parent b8c6635 commit 155dc82
Showing 1 changed file with 58 additions and 42 deletions.
100 changes: 58 additions & 42 deletions UET/uet/Commands/Build/BuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ public Options(

Platform = new Option<string[]>(
"--platform",
description: "Add this platform to the build. You can pass this option multiple times to target many platforms. The host platform is always built.");
Platform.ArgumentGroupName = uprojectpluginOptions;
description: "Add this platform to the build. You can pass this option multiple times to target many platforms. The host platform is always built.")
{
ArgumentGroupName = uprojectpluginOptions
};

PluginPackage = new Option<string>(
"--plugin-package",
Expand All @@ -158,8 +160,10 @@ Set the plugin package to use this version name instead of the auto-generated de
If this option is not provided, and you are not building on a CI server, the version will be set to 'Unversioned'.
If this option is not provided, and you are building on a CI server, UET will use the format, generating versions such as '2023.12.30-5.2-1aeb4233'.
If you are building on a CI server and only want to override the date component of the auto-generated version, you can set the 'OVERRIDE_DATE_VERSION' environment variable instead of using this option.
""");
PluginVersionName.ArgumentGroupName = pluginOptions;
""")
{
ArgumentGroupName = pluginOptions
};

PluginVersionNumber = new Option<long?>(
"--plugin-version-number",
Expand All @@ -168,15 +172,19 @@ Set the plugin package to use this version name instead of the auto-generated de
Set the plugin package to use this version number instead of the auto-generated default.
If this option is not provided, and you are not building on a CI server, the version number will be set to 10000.
If this option is not provided, and you are building on a CI server, UET will compute a version number from the UNIX timestamp and engine version number.
""");
PluginVersionNumber.ArgumentGroupName = pluginOptions;
""")
{
ArgumentGroupName = pluginOptions
};

// ==== Project options, regardless of build type

ProjectStagingDirectory = new Option<string>(
"--project-staging-directory",
description: "When building a project, either as a .uproject or via BuildConfig.json, overrides the path that project builds are staged to. The default is __REPOSITORY_ROOT__/Saved/StagedBuilds which places builds underneath the 'Saved/StagedBuilds' folder in the project. You can use absolute paths here and you can use __REPOSITORY_ROOT__ to refer to the project folder.");
ProjectStagingDirectory.ArgumentGroupName = projectOptions;
description: "When building a project, either as a .uproject or via BuildConfig.json, overrides the path that project builds are staged to. The default is __REPOSITORY_ROOT__/Saved/StagedBuilds which places builds underneath the 'Saved/StagedBuilds' folder in the project. You can use absolute paths here and you can use __REPOSITORY_ROOT__ to refer to the project folder.")
{
ArgumentGroupName = projectOptions
};

// ==== CI/CD options

Expand All @@ -190,38 +198,52 @@ Set the plugin package to use this version number instead of the auto-generated

ExecutorOutputFile = new Option<string>(
"--executor-output-file",
description: "If the executor runs the build externally (e.g. a build server), this is the path to the emitted file that should be passed as the job or build description into the build server.");
ExecutorOutputFile.ArgumentGroupName = cicdOptions;
description: "If the executor runs the build externally (e.g. a build server), this is the path to the emitted file that should be passed as the job or build description into the build server.")
{
ArgumentGroupName = cicdOptions
};

WindowsSharedStoragePath = new Option<string?>(
"--windows-shared-storage-path",
description: "If the build is running across multiple machines (depending on the executor), this is the network share for Windows machines to access.");
WindowsSharedStoragePath.ArgumentGroupName = cicdOptions;
description: "If the build is running across multiple machines (depending on the executor), this is the network share for Windows machines to access.")
{
ArgumentGroupName = cicdOptions
};

WindowsSdksPath = new Option<string?>(
"--windows-sdks-path",
description: "The path that UET will automatically manage and install platform SDKs, and store them in the provided path on Windows machines. This should be a local path; the SDKs will be installed on each machine as they're needed.");
WindowsSdksPath.ArgumentGroupName = cicdOptions;
description: "The path that UET will automatically manage and install platform SDKs, and store them in the provided path on Windows machines. This should be a local path; the SDKs will be installed on each machine as they're needed.")
{
ArgumentGroupName = cicdOptions
};

MacSharedStoragePath = new Option<string?>(
"--mac-shared-storage-path",
description: "If the build is running across multiple machines (depending on the executor), this is the local path on macOS pre-mounted to the network share.");
MacSharedStoragePath.ArgumentGroupName = cicdOptions;
description: "If the build is running across multiple machines (depending on the executor), this is the local path on macOS pre-mounted to the network share.")
{
ArgumentGroupName = cicdOptions
};

MacSdksPath = new Option<string?>(
"--mac-sdks-path",
description: "The path that UET will automatically manage and install platform SDKs, and store them in the provided path on macOS machines. This should be a local path; the SDKs will be installed on each machine as they're needed.");
MacSdksPath.ArgumentGroupName = cicdOptions;
description: "The path that UET will automatically manage and install platform SDKs, and store them in the provided path on macOS machines. This should be a local path; the SDKs will be installed on each machine as they're needed.")
{
ArgumentGroupName = cicdOptions
};

WindowsSharedGitCachePath = new Option<string?>(
"--windows-shared-git-cache-path",
description: "If the build is running across multiple machines (depending on the executor), this is the network share where Git commits and Git dependencies are cached, so that they don't need to be re-downloaded on each machine. If not specified, each machine will download their own copy of the commits and Git dependencies.");
WindowsSharedGitCachePath.ArgumentGroupName = cicdEngineOptions;
description: "If the build is running across multiple machines (depending on the executor), this is the network share where Git commits and Git dependencies are cached, so that they don't need to be re-downloaded on each machine. If not specified, each machine will download their own copy of the commits and Git dependencies.")
{
ArgumentGroupName = cicdEngineOptions
};

MacSharedGitCachePath = new Option<string?>(
"--mac-shared-git-cache-path",
description: "If the build is running across multiple machines (depending on the executor), this is the local path on macOS pre-mounted to the network share where Git commits and Git dependencies are cached, so that they don't need to be re-downloaded on each machine. If not specified, each machine will download their own copy of the commits and Git dependencies.");
MacSharedGitCachePath.ArgumentGroupName = cicdEngineOptions;
description: "If the build is running across multiple machines (depending on the executor), this is the local path on macOS pre-mounted to the network share where Git commits and Git dependencies are cached, so that they don't need to be re-downloaded on each machine. If not specified, each machine will download their own copy of the commits and Git dependencies.")
{
ArgumentGroupName = cicdEngineOptions
};
}
}

Expand Down Expand Up @@ -365,7 +387,7 @@ public async Task<int> ExecuteAsync(InvocationContext context)
_logger.LogInformation($"--deploy: {(deploy ? "yes" : "no")}");
_logger.LogInformation($"--strict-includes: {(strictIncludes ? "yes" : "no")}");
_logger.LogInformation($"--storage-virtualisation: {(storageVirtualisation ? "yes" : "no")}");
_logger.LogInformation($"--platforms: {string.Join(", ", platforms ?? Array.Empty<string>())}");
_logger.LogInformation($"--platforms: {string.Join(", ", platforms ?? [])}");
_logger.LogInformation($"--plugin-package: {pluginPackage}");
_logger.LogInformation($"--plugin-version-name: {pluginVersionName}");
_logger.LogInformation($"--plugin-version-number: {pluginVersionNumber}");
Expand Down Expand Up @@ -418,18 +440,12 @@ public async Task<int> ExecuteAsync(InvocationContext context)
}

// @note: We need the build executor to get the pipeline ID, which is also used as an input to compute the derived storage path that's specific for this build.
IBuildExecutor executor;
switch (executorName)
var executor = executorName switch
{
case "local":
executor = _localBuildExecutorFactory.CreateExecutor();
break;
case "gitlab":
executor = _gitLabBuildExecutorFactory.CreateExecutor(executorOutputFile!);
break;
default:
throw new NotSupportedException();
}
"local" => _localBuildExecutorFactory.CreateExecutor(),
"gitlab" => _gitLabBuildExecutorFactory.CreateExecutor(executorOutputFile!),
_ => throw new NotSupportedException(),
};

// Compute the shared storage name for this build.
var pipelineId = executor.DiscoverPipelineId();
Expand Down Expand Up @@ -533,7 +549,7 @@ public async Task<int> ExecuteAsync(InvocationContext context)
path,
shipping,
strictIncludes,
platforms ?? Array.Empty<string>(),
platforms ?? [],
projectStagingDirectory);
break;
case PathSpecType.UPlugin:
Expand All @@ -543,7 +559,7 @@ public async Task<int> ExecuteAsync(InvocationContext context)
path,
shipping,
strictIncludes,
platforms ?? Array.Empty<string>(),
platforms ?? [],
package: (pluginPackage ?? "none") != "none",
packageType: (pluginPackage ?? "none") switch
{
Expand Down Expand Up @@ -583,21 +599,21 @@ public async Task<int> ExecuteAsync(InvocationContext context)
else
{
_logger.LogError($"One or more build jobs {Bright.Red("failed")}:");
foreach (var kv in executionEvents.GetResults())
foreach (var (nodeName, resultStatus) in executionEvents.GetResults())
{
switch (kv.resultStatus)
switch (resultStatus)
{
case BuildResultStatus.Success:
_logger.LogInformation($"{kv.nodeName} = {Bright.Green("Passed")}");
_logger.LogInformation($"{nodeName} = {Bright.Green("Passed")}");
break;
case BuildResultStatus.Failed:
_logger.LogInformation($"{kv.nodeName} = {Bright.Red("Failed")}");
_logger.LogInformation($"{nodeName} = {Bright.Red("Failed")}");
break;
case BuildResultStatus.Cancelled:
_logger.LogInformation($"{kv.nodeName} = {Bright.Yellow("Cancelled")}");
_logger.LogInformation($"{nodeName} = {Bright.Yellow("Cancelled")}");
break;
case BuildResultStatus.NotRun:
_logger.LogInformation($"{kv.nodeName} = {Bright.Cyan("Not Run")}");
_logger.LogInformation($"{nodeName} = {Bright.Cyan("Not Run")}");
break;
}
}
Expand Down

0 comments on commit 155dc82

Please sign in to comment.