QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
139 lines
6.2 KiB
C#
139 lines
6.2 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using static Bullseye.Targets;
|
|
using static Scripts.CentronPaths;
|
|
using static Scripts.FileHelper;
|
|
using static Scripts.RunHelper;
|
|
using static Scripts.SignHelper;
|
|
|
|
namespace Scripts
|
|
{
|
|
public static class Program
|
|
{
|
|
public static async Task Main(string[] args)
|
|
{
|
|
Target("clean", () =>
|
|
{
|
|
DeleteDirectory(ArtifactsDirectory);
|
|
Console.WriteLine("Cleaned artifacts directory");
|
|
|
|
DeleteDirectory(Installer.InputDirectory);
|
|
Console.WriteLine("Cleaned installer input directory");
|
|
|
|
foreach (var directory in BinAndObjDirectories)
|
|
{
|
|
DeleteDirectory(directory);
|
|
}
|
|
Console.WriteLine("Cleaned all bin and obj directories");
|
|
});
|
|
|
|
Target("test", ["clean"], () =>
|
|
{
|
|
RunDotNetTest($"\"{Tests.CsProj}\" -c Release -f {Tests.TargetFramework} --logger \"trx;LogFileName={Tests.ArtifactsFileName}\" --results-directory \"{ArtifactsDirectory}\"");
|
|
Console.WriteLine("Executed all tests");
|
|
});
|
|
|
|
Target("build", ["test"], () =>
|
|
{
|
|
RunDotNet($"publish \"{CentronNexus.CsProj}\" -r win-x64 --self-contained true -c \"Release\" -f {CentronNexus.TargetFramework}");
|
|
Console.WriteLine("Published the CentronNexus project");
|
|
|
|
DeleteFiles(CentronNexus.PublishDirectory, "appsettings.Development.json");
|
|
DeleteSubDirectoriesOtherThan(CentronNexus.PublishDirectory, "wwwroot", "de", "en-US");
|
|
Console.WriteLine("Deleted unneeded files");
|
|
|
|
if (SignFiles("c-entron Nexus",
|
|
EnvironmentVariables.CodeSigningCertificateCentron,
|
|
EnvironmentVariables.CodeSigningCertificatePasswordCentron,
|
|
CentronNexus.PublishedFilesToSign))
|
|
{
|
|
Console.WriteLine("Signed the c-entron Nexus files");
|
|
}
|
|
|
|
ZipDirectory(CentronNexus.PublishDirectory, CentronNexus.ArtifactsFile);
|
|
Console.WriteLine("Created a zip-archive of all the source-code files");
|
|
});
|
|
|
|
Target("build-linux", ["test"], () =>
|
|
{
|
|
RunDotNet($"publish \"{CentronNexus.CsProj}\" -r linux-x64 --self-contained false -c \"Release\" -f {CentronNexus.TargetFramework}");
|
|
Console.WriteLine("Published the CentronNexus project");
|
|
|
|
DeleteFiles(CentronNexus.Linux.PublishDirectory, "appsettings.Development.json");
|
|
DeleteSubDirectoriesOtherThan(CentronNexus.Linux.PublishDirectory, "wwwroot");
|
|
Console.WriteLine("Deleted unneeded files");
|
|
|
|
ZipDirectory(CentronNexus.Linux.PublishDirectory, CentronNexus.Linux.ArtifactsFile);
|
|
Console.WriteLine("Created a zip-archive of all the source-code files");
|
|
});
|
|
|
|
Target("build-installer", ["build"], () =>
|
|
{
|
|
ExtractZip(CentronNexus.ArtifactsFile, Installer.InputDirectory);
|
|
Console.WriteLine("Extracted the build artifacts into the installer input directory");
|
|
|
|
RunDotNet($"build \"{Installer.CsProj}\" -c \"Release\"");
|
|
Console.WriteLine("Built the installer project");
|
|
|
|
Run(Installer.PublishedApplication, string.Empty, Installer.PublishDirectory);
|
|
Console.WriteLine("Created the installer");
|
|
|
|
if (SignFiles("c-entron Nexus Installer",
|
|
EnvironmentVariables.CodeSigningCertificateCentron,
|
|
EnvironmentVariables.CodeSigningCertificatePasswordCentron,
|
|
Installer.PublishedInstaller))
|
|
{
|
|
Console.WriteLine("Signed the c-entron Nexus Installer");
|
|
}
|
|
|
|
ZipSingleFile(Installer.PublishedInstaller, Installer.ArtifactsFile);
|
|
Console.WriteLine("Moved the installer into the artifacts directory");
|
|
});
|
|
|
|
Target("build-nexus", () =>
|
|
{
|
|
RunDotNet($"publish \"{CentronNexus.CsProj}\" -r win-x64 --self-contained true -c \"Release\" -f {CentronNexus.TargetFramework}");
|
|
Console.WriteLine("Published the CentronNexus project");
|
|
|
|
DeleteFiles(CentronNexus.PublishDirectory, "appsettings.Development.json");
|
|
DeleteSubDirectoriesOtherThan(CentronNexus.PublishDirectory, "wwwroot", "de", "en-US");
|
|
Console.WriteLine("Deleted unneeded files");
|
|
});
|
|
|
|
Target("zip-nexus-directory", () =>
|
|
{
|
|
ZipDirectory(CentronNexus.PublishDirectory, CentronNexus.ArtifactsFile);
|
|
Console.WriteLine("Created a zip-archive of all the source-code files");
|
|
});
|
|
|
|
Target("build-nexus-installer", () =>
|
|
{
|
|
ExtractZip(CentronNexus.ArtifactsFile, Installer.InputDirectory);
|
|
Console.WriteLine("Extracted the build artifacts into the installer input directory");
|
|
|
|
RunDotNet($"build \"{Installer.CsProj}\" -c \"Release\"");
|
|
Console.WriteLine("Built the installer project");
|
|
|
|
Run(Installer.PublishedApplication, string.Empty, Installer.PublishDirectory);
|
|
Console.WriteLine($"Created the installer at '{Installer.PublishedInstaller}'");
|
|
});
|
|
|
|
Target("zip-nexus-singleFile", () =>
|
|
{
|
|
ZipSingleFile(Installer.PublishedInstaller, Installer.ArtifactsFile);
|
|
Console.WriteLine("Moved the installer into the artifacts directory");
|
|
});
|
|
|
|
Target("test-only", () =>
|
|
{
|
|
RunDotNetTest($"\"{Tests.CsProj}\" -c Release -f {Tests.TargetFramework} --logger \"trx;LogFileName={Tests.ArtifactsFileName}\" --results-directory \"{ArtifactsDirectory}\"");
|
|
Console.WriteLine("Executed all tests");
|
|
});
|
|
|
|
Target("default", ["build-installer"]);
|
|
|
|
await RunTargetsAndExitAsync(args);
|
|
}
|
|
}
|
|
}
|