From 674dba597ab1ce4b81ab9b0f0149474e2ef8e492 Mon Sep 17 00:00:00 2001 From: Michael Maltsev <4129781+m417z@users.noreply.github.com> Date: Sat, 21 Dec 2024 20:45:46 +0200 Subject: [PATCH] Fix using cached compiled mods in deploy --- deploy.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/deploy.ts b/deploy.ts index 4e70acd2..877ca9c1 100644 --- a/deploy.ts +++ b/deploy.ts @@ -174,9 +174,20 @@ function generateModData(modId: string, changelogPath: string, modDir: string) { const modVersionCompiled64FilePath = path.join(modDir, `${metadata.version}_64.dll`); const cachedMod32Path = findCachedMod(modId, metadata.version, '32'); const cachedMod64Path = findCachedMod(modId, metadata.version, '64'); - if (cachedMod32Path && cachedMod64Path) { - fs.copyFileSync(cachedMod32Path, modVersionCompiled32FilePath); - fs.copyFileSync(cachedMod64Path, modVersionCompiled64FilePath); + if (cachedMod32Path || cachedMod64Path) { + const modHas32 = metadata.architecture?.includes('x86') ?? true; + const modHas64 = metadata.architecture?.includes('x86-64') ?? true; + if (modHas32 != !!cachedMod32Path || modHas64 != !!cachedMod64Path) { + throw new Error(`Mod ${modId} architecture mismatch`); + } + + if (cachedMod32Path) { + fs.copyFileSync(cachedMod32Path, modVersionCompiled32FilePath); + } + + if (cachedMod64Path) { + fs.copyFileSync(cachedMod64Path, modVersionCompiled64FilePath); + } } else { compileMod(modVersionFilePath, modVersionCompiled32FilePath, modVersionCompiled64FilePath); }