mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
abstract
This commit is contained in:
36
build.cake
36
build.cake
@@ -5,11 +5,17 @@ var configuration = Argument("configuration", "Release");
|
||||
var version = HasArgument("Version") ? Argument<string>("Version") : throw new Exception("Empty Version");
|
||||
var pw = HasArgument("pw") ? Argument<string>("pw") : throw new Exception("Empty pw");
|
||||
|
||||
var solution = System.IO.Path.Combine(AzurePipelines.Environment.Build.SourcesDirectory.FullPath, "src", "Snap.Hutao", "Snap.Hutao.sln");
|
||||
var project = System.IO.Path.Combine(AzurePipelines.Environment.Build.SourcesDirectory.FullPath, "src", "Snap.Hutao", "Snap.Hutao", "Snap.Hutao.csproj");
|
||||
var binPath = System.IO.Path.Combine(AzurePipelines.Environment.Build.SourcesDirectory.FullPath, "src", "Snap.Hutao", "Snap.Hutao", "bin", "x64", "Release", "net8.0-windows10.0.22621.0", "win-x64");
|
||||
// Default Azure Pipelines
|
||||
|
||||
var repoDir = AzurePipelines.Environment.Build.SourcesDirectory.FullPath;
|
||||
var outputPath = AzurePipelines.Environment.Build.ArtifactStagingDirectory.FullPath;
|
||||
|
||||
var solution = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao.sln");
|
||||
var project = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "Snap.Hutao.csproj");
|
||||
var binPath = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "bin", "x64", "Release", "net8.0-windows10.0.22621.0", "win-x64");
|
||||
|
||||
var pfxFile = System.IO.Path.Combine(AzurePipelines.Environment.Agent.HomeDirectory.FullPath, "_work", "_temp", "DGP_Studio_CI.pfx");
|
||||
|
||||
Task("Build")
|
||||
.IsDependentOn("Build binary package")
|
||||
.IsDependentOn("Copy files")
|
||||
@@ -20,11 +26,13 @@ Task("NuGet Restore")
|
||||
.Does(() =>
|
||||
{
|
||||
Information("Restoring packages...");
|
||||
|
||||
var nugetConfig = System.IO.Path.Combine(repoDir, "NuGet.Config");
|
||||
DotNetRestore(project, new DotNetRestoreSettings
|
||||
{
|
||||
Verbosity = DotNetVerbosity.Detailed,
|
||||
Interactive = false,
|
||||
ConfigFile = System.IO.Path.Combine(AzurePipelines.Environment.Build.SourcesDirectory.FullPath, "NuGet.Config")
|
||||
ConfigFile = nugetConfig
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,18 +41,18 @@ Task("Generate AppxManifest")
|
||||
{
|
||||
Information("Generating AppxManifest...");
|
||||
|
||||
var manifestPath = System.IO.Path.Combine(AzurePipelines.Environment.Build.SourcesDirectory.FullPath, "src", "Snap.Hutao", "Snap.Hutao", "Package.appxmanifest");
|
||||
var manifest = System.IO.File.ReadAllText(manifestPath);
|
||||
var manifest = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "Package.appxmanifest");
|
||||
var content = System.IO.File.ReadAllText(manifest);
|
||||
|
||||
manifest = manifest
|
||||
content = content
|
||||
.Replace("Snap Hutao", "Snap Hutao Alpha")
|
||||
.Replace("胡桃", "胡桃 Alpha")
|
||||
.Replace("DGP Studio", "DGP Studio CI");
|
||||
manifest = System.Text.RegularExpressions.Regex.Replace(manifest, " Name=\"([^\"]*)\"", " Name=\"7f0db578-026f-4e0b-a75b-d5d06bb0a74c\"");
|
||||
manifest = System.Text.RegularExpressions.Regex.Replace(manifest, " Publisher=\"([^\"]*)\"", " Publisher=\"CN=DGP Studio CI\"");
|
||||
manifest = System.Text.RegularExpressions.Regex.Replace(manifest, " Version=\"([0-9\\.]+)\"", $" Version=\"{version}\"");
|
||||
content = System.Text.RegularExpressions.Regex.Replace(content, " Name=\"([^\"]*)\"", " Name=\"7f0db578-026f-4e0b-a75b-d5d06bb0a74c\"");
|
||||
content = System.Text.RegularExpressions.Regex.Replace(content, " Publisher=\"([^\"]*)\"", " Publisher=\"CN=DGP Studio CI\"");
|
||||
content = System.Text.RegularExpressions.Regex.Replace(content, " Version=\"([0-9\\.]+)\"", $" Version=\"{version}\"");
|
||||
|
||||
System.IO.File.WriteAllText(manifestPath, manifest);
|
||||
System.IO.File.WriteAllText(manifest, content);
|
||||
|
||||
Information("Generated.");
|
||||
});
|
||||
@@ -79,13 +87,13 @@ Task("Copy files")
|
||||
{
|
||||
Information("Copying assets...");
|
||||
CopyDirectory(
|
||||
System.IO.Path.Combine(AzurePipelines.Environment.Build.SourcesDirectory.FullPath, "src", "Snap.Hutao", "Snap.Hutao", "Assets"),
|
||||
System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "Assets"),
|
||||
System.IO.Path.Combine(binPath, "Assets")
|
||||
);
|
||||
|
||||
Information("Copying resource...");
|
||||
CopyDirectory(
|
||||
System.IO.Path.Combine(AzurePipelines.Environment.Build.SourcesDirectory.FullPath, "src", "Snap.Hutao", "Snap.Hutao", "Resource"),
|
||||
System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "Resource"),
|
||||
System.IO.Path.Combine(binPath, "Resource")
|
||||
);
|
||||
});
|
||||
@@ -116,7 +124,7 @@ Task("Sign MSIX")
|
||||
"signtool.exe",
|
||||
new ProcessSettings
|
||||
{
|
||||
Arguments = "sign /debug /v /a /fd SHA256 /f " + System.IO.Path.Combine(AzurePipelines.Environment.Agent.HomeDirectory.FullPath, "_work", "_temp", "DGP_Studio_CI.pfx") + " /p " + pw + " " + System.IO.Path.Combine(outputPath, $"Snap.Hutao.Alpha-{version}.msix")
|
||||
Arguments = "sign /debug /v /a /fd SHA256 /f " + pfxFile + " /p " + pw + " " + System.IO.Path.Combine(outputPath, $"Snap.Hutao.Alpha-{version}.msix")
|
||||
}
|
||||
);
|
||||
if (p != 0)
|
||||
|
||||
Reference in New Issue
Block a user