Skip to content

Commit

Permalink
Updated source packaging tool to include part of the git history
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyyrylainen committed Jan 22, 2024
1 parent 1bb4acb commit b39050e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions Scripts/SourceTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ await GitRunHelpers.Archive(submodule, "HEAD", moduleTar, $"Thrive-Launcher/{sub
await Compression.CombineTar(targetArchiveName, moduleTar, cancellationToken);
}

// Include git info
ColourConsole.WriteNormalLine("Making a clean copy of the repo to include git info in source");
var cleanGitFolder = "clean-git";

if (Directory.Exists(cleanGitFolder))
Directory.Delete(cleanGitFolder, true);

await GitRunHelpers.CloneLocalRepo(".", cleanGitFolder, cancellationToken);

// Fudge the directory structure to be correct for adding to the tar
var fudgedPath = Path.Join(cleanGitFolder, "Thrive-Launcher");

if (Directory.Exists(fudgedPath))
Directory.Delete(fudgedPath, true);

Directory.CreateDirectory(fudgedPath);

Directory.Move(Path.Join(cleanGitFolder, ".git"), Path.Join(fudgedPath, ".git"));

await Compression.AddFilesToTar(targetArchiveName, cleanGitFolder, new[] { "Thrive-Launcher" },
cancellationToken);

Directory.Delete(cleanGitFolder, true);

ColourConsole.WriteNormalLine("Compressing source archive with xz");

await Compression.XzCompressFile(targetArchiveName, cancellationToken, 9);
Expand Down

0 comments on commit b39050e

Please sign in to comment.