From 11e539565ffcb51f911960e246bac8cf95d77ec2 Mon Sep 17 00:00:00 2001 From: Jakub Gonet Date: Tue, 24 Sep 2024 12:34:21 +0200 Subject: [PATCH] Pass env to custom build process --- .../src/builders/buildAndroid.ts | 3 ++- .../vscode-extension/src/builders/buildIOS.ts | 2 +- .../src/builders/customBuild.ts | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/vscode-extension/src/builders/buildAndroid.ts b/packages/vscode-extension/src/builders/buildAndroid.ts index 69215e72b..2a27cb360 100644 --- a/packages/vscode-extension/src/builders/buildAndroid.ts +++ b/packages/vscode-extension/src/builders/buildAndroid.ts @@ -84,7 +84,8 @@ export async function buildAndroid( const apkPath = await runExternalBuild( cancelToken, DevicePlatform.Android, - buildScript.android + buildScript.android, + env ); return { diff --git a/packages/vscode-extension/src/builders/buildIOS.ts b/packages/vscode-extension/src/builders/buildIOS.ts index d764f558d..873029330 100644 --- a/packages/vscode-extension/src/builders/buildIOS.ts +++ b/packages/vscode-extension/src/builders/buildIOS.ts @@ -88,7 +88,7 @@ export async function buildIos( const { buildScript, ios: buildOptions } = getLaunchConfiguration(); if (buildScript?.ios) { - const appPath = await runExternalBuild(cancelToken, DevicePlatform.IOS, buildScript.ios); + const appPath = await runExternalBuild(cancelToken, DevicePlatform.IOS, buildScript.ios, env); return { appPath, diff --git a/packages/vscode-extension/src/builders/customBuild.ts b/packages/vscode-extension/src/builders/customBuild.ts index 82b2e8c99..6b9b1eaa9 100644 --- a/packages/vscode-extension/src/builders/customBuild.ts +++ b/packages/vscode-extension/src/builders/customBuild.ts @@ -62,9 +62,14 @@ type EASBuild = { export async function runExternalBuild( cancelToken: CancelToken, platform: DevicePlatform, - externalCommand: string + externalCommand: string, + env: Record | undefined ): Promise { - const { stdout, lastLine: binaryPath } = await runExternalScript(cancelToken, externalCommand); + const { stdout, lastLine: binaryPath } = await runExternalScript( + cancelToken, + externalCommand, + env + ); let easBinaryPath = await downloadAppFromEas(stdout, platform, cancelToken); if (easBinaryPath) { @@ -81,8 +86,12 @@ export async function runExternalBuild( return binaryPath; } -async function runExternalScript(cancelToken: CancelToken, externalCommand: string) { - const process = cancelToken.adapt(command(externalCommand, { cwd: getAppRootFolder() })); +async function runExternalScript( + cancelToken: CancelToken, + externalCommand: string, + env: Record | undefined +) { + const process = cancelToken.adapt(command(externalCommand, { cwd: getAppRootFolder(), env })); Logger.info(`Running external script: ${externalCommand}`); let lastLine: string | undefined;