From 69562c19f33244cbdbc8f6ff5fb0fb20ab68ceb3 Mon Sep 17 00:00:00 2001 From: David Kaya Date: Thu, 26 Mar 2026 16:14:14 +0100 Subject: [PATCH] fix: fix Inno Setup preprocessor defines via environment variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ISCC's /D command-line flag combined with Node.js spawn on Windows produces broken ISPP defines due to argument quoting conflicts. Switch to environment variables read via GetEnv() — robust and avoids all quoting issues. Product name and publisher are now hardcoded in the ISS (they never change). Verified: installer shows 'Aryx' and correct version in metadata. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- assets/installer/windows.iss | 41 ++++++++++++++++++------------------ scripts/create-installer.ts | 20 ++++++------------ 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/assets/installer/windows.iss b/assets/installer/windows.iss index 982f8da..f94b963 100644 --- a/assets/installer/windows.iss +++ b/assets/installer/windows.iss @@ -1,26 +1,27 @@ ; Inno Setup script for Aryx -; Metadata values are passed via /D preprocessor defines from the build script. +; Dynamic values are read from environment variables set by the build script. -#ifndef PRODUCT_NAME - #define PRODUCT_NAME "Aryx" -#endif -#ifndef PRODUCT_VERSION - #define PRODUCT_VERSION "0.0.0" -#endif -#ifndef PRODUCT_PUBLISHER - #define PRODUCT_PUBLISHER "David Kaya" -#endif -#ifndef SOURCE_DIR - #error "SOURCE_DIR must be defined (path to the packaged app directory)." -#endif -#ifndef OUTPUT_DIR - #error "OUTPUT_DIR must be defined (path to the output directory)." -#endif -#ifndef OUTPUT_FILENAME - #error "OUTPUT_FILENAME must be defined (output installer filename without extension)." -#endif +#define PRODUCT_NAME "Aryx" +#define PRODUCT_PUBLISHER "David Kaya" +#define PRODUCT_VERSION GetEnv("ARYX_BUILD_VERSION") +#define SOURCE_DIR GetEnv("ARYX_BUILD_SOURCE_DIR") +#define OUTPUT_DIR GetEnv("ARYX_BUILD_OUTPUT_DIR") +#define OUTPUT_FILENAME GetEnv("ARYX_BUILD_OUTPUT_FILENAME") +#define ICON_PATH GetEnv("ARYX_BUILD_ICON_PATH") -#ifndef ICON_PATH +#if PRODUCT_VERSION == "" + #error "ARYX_BUILD_VERSION environment variable must be set." +#endif +#if SOURCE_DIR == "" + #error "ARYX_BUILD_SOURCE_DIR environment variable must be set." +#endif +#if OUTPUT_DIR == "" + #error "ARYX_BUILD_OUTPUT_DIR environment variable must be set." +#endif +#if OUTPUT_FILENAME == "" + #error "ARYX_BUILD_OUTPUT_FILENAME environment variable must be set." +#endif +#if ICON_PATH == "" #define ICON_PATH SOURCE_DIR + "\" + PRODUCT_NAME + ".exe" #endif diff --git a/scripts/create-installer.ts b/scripts/create-installer.ts index 7bcee49..18841dd 100644 --- a/scripts/create-installer.ts +++ b/scripts/create-installer.ts @@ -86,19 +86,13 @@ async function createWindowsInstaller(version: string): Promise { const outputFilename = releaseTarget.installerAssetName.replace(/\.exe$/, ''); const iconPath = join(repositoryRoot, 'assets', 'icons', 'windows', 'icon.ico'); - await runCommand( - isccPath, - [ - `/DPRODUCT_NAME=${productName}`, - `/DPRODUCT_VERSION=${version}`, - `/DSOURCE_DIR=${packagedAppDirectory}`, - `/DOUTPUT_DIR=${releaseRootDirectory}`, - `/DOUTPUT_FILENAME=${outputFilename}`, - `/DICON_PATH=${iconPath}`, - issScript, - ], - repositoryRoot, - ); + process.env.ARYX_BUILD_VERSION = version; + process.env.ARYX_BUILD_SOURCE_DIR = packagedAppDirectory; + process.env.ARYX_BUILD_OUTPUT_DIR = releaseRootDirectory; + process.env.ARYX_BUILD_OUTPUT_FILENAME = outputFilename; + process.env.ARYX_BUILD_ICON_PATH = iconPath; + + await runCommand(isccPath, [issScript], repositoryRoot); } // --- macOS: DMG disk image ---