Skip to content

Commit

Permalink
Pass env to custom build process
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-gonet committed Sep 24, 2024
1 parent 3fce6e6 commit 11e5395
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/vscode-extension/src/builders/buildAndroid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export async function buildAndroid(
const apkPath = await runExternalBuild(
cancelToken,
DevicePlatform.Android,
buildScript.android
buildScript.android,
env
);

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode-extension/src/builders/buildIOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 13 additions & 4 deletions packages/vscode-extension/src/builders/customBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ type EASBuild = {
export async function runExternalBuild(
cancelToken: CancelToken,
platform: DevicePlatform,
externalCommand: string
externalCommand: string,
env: Record<string, string> | undefined
): Promise<string> {
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) {
Expand All @@ -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<string, string> | undefined
) {
const process = cancelToken.adapt(command(externalCommand, { cwd: getAppRootFolder(), env }));
Logger.info(`Running external script: ${externalCommand}`);

let lastLine: string | undefined;
Expand Down

0 comments on commit 11e5395

Please sign in to comment.