From 1025499a0c8cae18c4e049bfd6d9de82fcb1edba Mon Sep 17 00:00:00 2001 From: Artalus Date: Sun, 24 May 2026 23:32:46 +0400 Subject: [PATCH] fix: (cake) postpone exe verification should fix CI failing to build w/ server.tgz w/o .exe inside --- VinTest.Cake/ContextBase.cs | 31 +++++++++++++++++++++++++++++-- VinTest.Cake/GameTestsTaskBase.cs | 6 +++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/VinTest.Cake/ContextBase.cs b/VinTest.Cake/ContextBase.cs index 01cbda3..dbf4223 100644 --- a/VinTest.Cake/ContextBase.cs +++ b/VinTest.Cake/ContextBase.cs @@ -1,5 +1,6 @@ using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Xml.Linq; using Cake.Common; using Cake.Core; @@ -85,6 +86,17 @@ public abstract class ContextBase : FrostingContext /// public string PidFilePath => Path.Combine(DataPath, TestResultsDirName, "vs.pid"); + /// + /// Absolute path to VS executable (Vintagestory.exe on Windows, Vintagestory on Linux). + /// + public string VsExePath => + Path.Combine( + VsPath, + RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? "Vintagestory.exe" + : "Vintagestory" + ); + /// protected ContextBase(ICakeContext context) : base(context) @@ -110,8 +122,23 @@ protected ContextBase(ICakeContext context) + " or set VINTAGE_STORY environment variable." ); VsPath = Path.GetFullPath(vspathCandidate); - if (!File.Exists(Path.Combine(VsPath, "VintageStory.exe"))) - throw new CakeException($"Vintage Story executable not found in {VsPath}"); + + // Check if VintagestoryAPI.dll exists + string dllPath = Path.Combine(VsPath, "VintagestoryAPI.dll"); + if (!File.Exists(dllPath)) + throw new CakeException( + $"{VsPath} does not look like a valid Vintage Story installation" + + " (missing VintagestoryAPI.dll)." + ); + + if (!File.Exists(VsExePath)) + { + Log.Warning( + $"WARNING: Vintage Story executable '{VsExePath}' not found." + + "\nCake Will not be able to run tests!" + ); + Log.Information("This is OK in CI environments building against a vs_server.tar.gz"); + } DataPath = Path.GetFullPath(context.Argument("data-path", "../gamedata")); TestWorldName = context.Argument("test-world", "autotest"); TestRunTimeoutSeconds = context.Argument("test-timeout", 300); diff --git a/VinTest.Cake/GameTestsTaskBase.cs b/VinTest.Cake/GameTestsTaskBase.cs index 52a662e..50126c8 100644 --- a/VinTest.Cake/GameTestsTaskBase.cs +++ b/VinTest.Cake/GameTestsTaskBase.cs @@ -157,15 +157,13 @@ .. LogSuppressions.Select(s => /// public sealed override void Run(TContext context) { - var vsExe = Path.Combine(context.VsPath, "VintageStory.exe"); - Cleanup(context); WriteVintestConfig(context); Prepare(context); Build(context); var proc = LaunchVintageStory( context, - vsExe, + context.VsExePath, GetModBinaryPaths(context), GetAssetsPaths(context) ); @@ -251,6 +249,8 @@ private static Process LaunchVintageStory( IEnumerable assetsPaths ) { + if (!File.Exists(vsExe)) + throw new CakeException($"Vintage Story executable does not exist: {vsExe}"); if (!modPaths.Any()) throw new CakeException("No valid mod paths provided"); var mods = ValidatePaths(modPaths, "MOD");