hash inc files and require project for shards

This commit is contained in:
patchzyy
2026-10-21 16:17:42 +02:00
parent 5e337e6ecf
commit 9dfbef00f5
2 changed files with 11 additions and 5 deletions
@@ -16,15 +16,15 @@ internal static class ToolkitFingerprint
// v6/native-toolchain v2 forces one clean rebuild past a Ninja stale-object bug.
// translation v2 added runtime/src, which the translator regex-scans for native overrides;
// v3 replaced it with the native index extracted from it, whenever that index is current.
private const string Version = "mkwc-toolkit-compile-v6";
private const string TranslationVersion = "mkwc-toolkit-translation-v3";
private const string Version = "mkwc-toolkit-compile-v7";
private const string TranslationVersion = "mkwc-toolkit-translation-v4";
private const string NativeToolchainVersion = "mkwc-toolkit-native-toolchain-v2";
private const string PackageVersion = "mkwc-toolkit-package-v1";
private const string RuntimeAssetsVersion = "mkwc-product-runtime-assets-v3";
private const string RuntimeAssetsDescription = "The product runtime assets";
private static readonly string[] SourceExtensions =
[".c", ".cc", ".cpp", ".cxx", ".h", ".hh", ".hpp", ".inl", ".s", ".asm",
[".c", ".cc", ".cpp", ".cxx", ".h", ".hh", ".hpp", ".inl", ".inc", ".s", ".asm",
".cmake", ".txt", ".yml", ".yaml", ".toml", ".json", ".ps1", ".in", ".def", ".patch"];
/// <summary>
+8 -2
View File
@@ -221,7 +221,7 @@ int RunCheckBaseModAwareness(string[] argsTail)
RuntimeNativeIndex ResolveRegionalNativeIndex(string nativeSourceDirectory, string? indexPath)
{
var index = RuntimeNativeIndexBuilder.Resolve(nativeSourceDirectory, indexPath, Console.Error);
var region = GuestRegions.FromGameId(project?.Identity.GameId);
var region = GuestRegions.FromGameId(RequireProject().Identity.GameId);
var tablePath = GuestAddressTable.DefaultPath(nativeSourceDirectory);
// A runtime without a table can only be built for PAL.
if (region == GuestRegion.Pal && !File.Exists(tablePath))
@@ -231,6 +231,12 @@ RuntimeNativeIndex ResolveRegionalNativeIndex(string nativeSourceDirectory, stri
int RunEmitBuildShards(string[] argsTail)
{
// The project decides the guest region the shards are built for.
if (project is null)
{
Console.Error.WriteLine("emit-build-shards requires --project <path>.");
return 1;
}
var baseMetadata = OptionValue(argsTail, "--base-metadata") ?? Path.Combine(root, "generated", "base_translation_output.json");
var baseFunctions = OptionValue(argsTail, "--base-functions-dir") ?? Path.Combine(root, "generated", "functions");
var output = OptionValue(argsTail, "--out") ?? Path.Combine(root, "generated", "build_shards");
@@ -258,7 +264,7 @@ int RunEmitBuildShards(string[] argsTail)
string.IsNullOrWhiteSpace(resolvedProfile) ? null : Path.GetFullPath(resolvedProfile),
string.IsNullOrWhiteSpace(retroCpp) ? null : Path.GetFullPath(retroCpp),
NativeIndex: nativeIndex,
Region: GuestRegions.FromGameId(project?.Identity.GameId)));
Region: GuestRegions.FromGameId(project.Identity.GameId)));
Console.WriteLine("[translator] emitted stable translated build graph");
Console.WriteLine($" base functions: {result.BaseFunctionCount:N0}");
Console.WriteLine($" shared base functions: {result.SharedBaseFunctionCount:N0}");