118 lines
No EOL
5.2 KiB
C#
118 lines
No EOL
5.2 KiB
C#
using BetaVersionLauncher;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using TeaBox.Code;
|
|
using TeaBox.Macros;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace TeaBox.BuildVersion
|
|
{
|
|
public class MakeGgpPackageCommand : MakePackageCommand
|
|
{
|
|
public override string OutputDirectory => GgpConstants.OutputDirectory;
|
|
|
|
protected override IEnumerable<string> GetFilesList()
|
|
{
|
|
return new List<string>();
|
|
}
|
|
|
|
|
|
protected override void CopyDataFromOutput(IStep stepcontext)
|
|
{
|
|
Func<string, bool> keepFunc = file =>
|
|
{
|
|
var patterns = new[] { ".csv", ".txt", ".gp4"};
|
|
return !patterns.Any(file.Replace('\\', '/').Contains);
|
|
};
|
|
|
|
stepcontext.LogMessage("== Data copy step ==");
|
|
stepcontext.LogMessage($"Starting to copy data from {GameConstants.BundleOutputPath} to {DataWorkingDirectory}");
|
|
RoboCopy.ReplicateDirectory(GameConstants.BundleOutputPath, DataWorkingDirectory, stepcontext, deleteMissingFiles: false, @where: keepFunc);
|
|
|
|
/* To activate if patch needs to be included on the master
|
|
stepcontext.LogMessage("== Patch ( empty ) copy step ==");
|
|
stepcontext.LogMessage($"Starting to copy data from {UAFConstants.BundleOutput} to {DataWorkingDirectory}");
|
|
RoboCopy.ReplicateDirectory(UAFConstants.PatchOutput, DataWorkingDirectory, stepcontext, deleteMissingFiles: false, where: keepFunc); */
|
|
}
|
|
protected override void CopyExecutableFromOutput(IStep stepcontext)
|
|
{
|
|
// Exclude release engine files for final package and final engine for release package
|
|
var patterns = Variant == DevEnvBuildVariant.Final ? new[] { "_reserved9_ua_engine_r", "GGP.txt"} : new[] { "_reserved9_ua_engine_f" };
|
|
Func<string, bool> keepFunc = file => !patterns.Any(file.Replace('\\', '/').Contains);
|
|
|
|
stepcontext.LogMessage("== Executables copy step ==");
|
|
stepcontext.LogMessage($"Starting to copy engine from {EngineExecutable.DeliveredDirectory} to {CodeWorkingDirectory}");
|
|
RoboCopy.ReplicateDirectory(EngineExecutable.DeliveredDirectory, CodeWorkingDirectory, stepcontext, deleteMissingFiles: true, @where: keepFunc);
|
|
}
|
|
|
|
protected override void PrePackageImpl()
|
|
{
|
|
}
|
|
protected override void SetOnlineEnvironmentImpl()
|
|
{
|
|
// Environment none, uat are default ones, don't need to change anything on the disc layout
|
|
if (GameOnlineEnvironment == GameOnlineEnvironment.Default || GameOnlineEnvironment.ToString().ToLower() == "uat" ||
|
|
GameOnlineEnvironment.ToString().ToLower() == "")
|
|
{
|
|
Context.LogWarning($"Selected environment: - {GameOnlineEnvironment} - doesn't require any changes");
|
|
return;
|
|
}
|
|
}
|
|
protected override void GeneratePackageImpl()
|
|
{
|
|
PkgTool = GgpConstants.GetPackageTool();
|
|
//var packageName = $"JD2020_pkg_{DataChangelist}_{Variant}.tar";
|
|
var packageName = $"{UAFConstants.GameName}_pkg_{DataChangelist}_{Variant}.tar";
|
|
|
|
if (!System.IO.Directory.Exists(OutputDirectory))
|
|
{
|
|
System.IO.Directory.CreateDirectory(OutputDirectory);
|
|
}
|
|
else
|
|
{
|
|
// Make sure the outp
|
|
Directory.ForceDelete(OutputDirectory);
|
|
System.IO.Directory.CreateDirectory(OutputDirectory);
|
|
}
|
|
Context.AddStep("Creating package",
|
|
new GenericCommand(PkgTool, $"package create-image --content={WorkingDirectory} --image={Path.Combine(OutputDirectory, packageName)}").Execute);
|
|
|
|
Context.AddStep($"Stopping SDK processes",
|
|
new GenericCommand(GgpConstants.GetPackageTool(), $@"sdk stop").Execute);
|
|
}
|
|
|
|
protected override void PackageDataAssemblyImpl(IStep stepcontext)
|
|
{
|
|
base.PackageDataAssemblyImpl(stepcontext);
|
|
|
|
// we need to copy all the debug related files to debug_symbol folder
|
|
CopyDebugFilesToDebugSymbol(stepcontext);
|
|
}
|
|
|
|
private void CopyDebugFilesToDebugSymbol(IStep context)
|
|
{
|
|
var directoryInfo = new System.IO.DirectoryInfo(CodeWorkingDirectory);
|
|
|
|
// we are going to reach the output folder
|
|
if (directoryInfo.Exists)
|
|
{
|
|
// get all the files that are with _debug
|
|
var files = directoryInfo.GetFiles("*.debug", SearchOption.AllDirectories);
|
|
|
|
var destinationFolder = Path.Combine(directoryInfo.FullName, "debug_symbols");
|
|
|
|
// create a new folder and paste these files
|
|
Directory.CreateDirectory(destinationFolder);
|
|
|
|
foreach (var file in files)
|
|
{
|
|
var destinationFilePath = Path.Combine(destinationFolder, file.Name);
|
|
context.LogMessage($"copying file {file.FullName} to {destinationFilePath}");
|
|
File.Move(file.FullName, destinationFilePath);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |