From 44ac00420afaf1eb2291b8e88810dbf980b8ad22 Mon Sep 17 00:00:00 2001 From: Maciej Stosio Date: Fri, 6 Dec 2024 17:21:59 +0100 Subject: [PATCH 1/7] chore: extract path from eas build --- .../vscode-extension/src/builders/customBuild.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/vscode-extension/src/builders/customBuild.ts b/packages/vscode-extension/src/builders/customBuild.ts index b6b997ec6..7f9b4ab8c 100644 --- a/packages/vscode-extension/src/builders/customBuild.ts +++ b/packages/vscode-extension/src/builders/customBuild.ts @@ -7,6 +7,8 @@ import { getAppRootFolder } from "../utilities/extensionContext"; type Env = Record | undefined; +const EXPO_LOCAL_BUILD_PATH_REGEX = new RegExp('You can find the build artifacts in (.*)'); + export async function runExternalBuild(cancelToken: CancelToken, buildCommand: string, env: Env) { const output = await runExternalScript(buildCommand, env, cancelToken); @@ -14,7 +16,17 @@ export async function runExternalBuild(cancelToken: CancelToken, buildCommand: s return undefined; } - const binaryPath = output.lastLine; + let binaryPath = output.lastLine; + + // We test if the output of the command matches eas build output. + // If it does we extract the bath to binary. + if (EXPO_LOCAL_BUILD_PATH_REGEX.test(output.lastLine)) { + const groups = EXPO_LOCAL_BUILD_PATH_REGEX.exec(output.lastLine); + if (groups?.[1]) { + binaryPath = groups[1]; + } + } + if (binaryPath && !fs.existsSync(binaryPath)) { Logger.error( `External script: ${buildCommand} failed to output any existing app path, got: ${binaryPath}` From 066386808ffbff137afcce907d2a51bcbd0082e1 Mon Sep 17 00:00:00 2001 From: Maciej Stosio Date: Thu, 19 Dec 2024 12:46:51 +0100 Subject: [PATCH 2/7] chore: handle compressed files --- .../src/builders/customBuild.ts | 12 ++++++- packages/vscode-extension/src/builders/eas.ts | 32 ++--------------- .../vscode-extension/src/builders/utils.ts | 36 +++++++++++++++++++ 3 files changed, 50 insertions(+), 30 deletions(-) create mode 100644 packages/vscode-extension/src/builders/utils.ts diff --git a/packages/vscode-extension/src/builders/customBuild.ts b/packages/vscode-extension/src/builders/customBuild.ts index 7f9b4ab8c..895758df7 100644 --- a/packages/vscode-extension/src/builders/customBuild.ts +++ b/packages/vscode-extension/src/builders/customBuild.ts @@ -1,9 +1,12 @@ import path from "path"; import fs from "fs"; +import os from "os"; +import { mkdtemp} from "fs/promises"; import { Logger } from "../Logger"; import { command, lineReader } from "../utilities/subprocess"; import { CancelToken } from "./cancelToken"; import { getAppRootFolder } from "../utilities/extensionContext"; +import { extractTarApp } from "./utils"; type Env = Record | undefined; @@ -34,7 +37,14 @@ export async function runExternalBuild(cancelToken: CancelToken, buildCommand: s return undefined; } - return binaryPath; + const shouldExtractArchive = binaryPath.endsWith('.tar.gz'); + if (!shouldExtractArchive) { + return binaryPath; + } + + const tmpDirectory = await mkdtemp(path.join(os.tmpdir(), "rn-ide-custom-build-")); + + return await extractTarApp(binaryPath, tmpDirectory, cancelToken); } export async function runfingerprintCommand(externalCommand: string, env: Env) { diff --git a/packages/vscode-extension/src/builders/eas.ts b/packages/vscode-extension/src/builders/eas.ts index 2b84928e1..c29df7ce3 100644 --- a/packages/vscode-extension/src/builders/eas.ts +++ b/packages/vscode-extension/src/builders/eas.ts @@ -1,15 +1,15 @@ import path from "path"; import os from "os"; -import { mkdtemp, readdir } from "fs/promises"; +import { mkdtemp} from "fs/promises"; import maxBy from "lodash/maxBy"; import { DevicePlatform } from "../common/DeviceManager"; import { EasConfig } from "../common/LaunchConfig"; import { Logger } from "../Logger"; import { CancelToken } from "./cancelToken"; -import { exec } from "../utilities/subprocess"; import { downloadBinary } from "../utilities/common"; import { EASBuild, listEasBuilds, viewEasBuild } from "./easCommand"; +import { extractTarApp } from "./utils"; export async function fetchEasBuild( cancelToken: CancelToken, @@ -84,10 +84,6 @@ async function downloadAppFromEas( platform: DevicePlatform, cancelToken: CancelToken ) { - function isAppFile(name: string) { - return name.endsWith(".app"); - } - const { id, binaryUrl } = build; const tmpDirectory = await mkdtemp(path.join(os.tmpdir(), "rn-ide-eas-build-")); @@ -107,27 +103,5 @@ async function downloadAppFromEas( return binaryPath; } - const { failed } = await cancelToken.adapt( - tarCommand({ archivePath: binaryPath, extractDir: tmpDirectory }) - ); - if (failed) { - Logger.error(`Failed to extract archive '${binaryPath}' to '${tmpDirectory}'.`); - return undefined; - } - - // assuming that the archive contains only one .app file - const appName = (await readdir(tmpDirectory)).find(isAppFile); - if (!appName) { - Logger.error(`Failed to find .app in extracted archive '${binaryPath}'.`); - return undefined; - } - - const appPath = path.join(tmpDirectory, appName); - Logger.debug(`Extracted app archive to '${appPath}'.`); - return appPath; -} - -type TarCommandArgs = { archivePath: string; extractDir: string }; -function tarCommand({ archivePath, extractDir }: TarCommandArgs) { - return exec("tar", ["-xf", archivePath, "-C", extractDir]); + return await extractTarApp(binaryPath, tmpDirectory, cancelToken); } diff --git a/packages/vscode-extension/src/builders/utils.ts b/packages/vscode-extension/src/builders/utils.ts new file mode 100644 index 000000000..d6a707228 --- /dev/null +++ b/packages/vscode-extension/src/builders/utils.ts @@ -0,0 +1,36 @@ +import { readdir } from "fs/promises"; +import path from "path"; +import { Logger } from "../Logger"; +import { exec } from "../utilities/subprocess"; +import { CancelToken } from "./cancelToken"; + +function isAppFile(name: string) { + return name.endsWith(".app"); +} + +export async function extractTarApp(binaryPath: string, pathToExtract: string, cancelToken: CancelToken) { + const { failed } = await cancelToken.adapt( + tarCommand({ archivePath: binaryPath, extractDir: pathToExtract }) + ); + + if (failed) { + Logger.error(`Failed to extract archive '${binaryPath}' to '${pathToExtract}'.`); + return undefined; + } + + // assuming that the archive contains only one .app file + const appName = (await readdir(pathToExtract)).find(isAppFile); + if (!appName) { + Logger.error(`Failed to find .app in extracted archive '${binaryPath}'.`); + return undefined; + } + + const appPath = path.join(pathToExtract, appName); + Logger.debug(`Extracted app archive to '${appPath}'.`); + return appPath; +} + +type TarCommandArgs = { archivePath: string; extractDir: string }; +function tarCommand({ archivePath, extractDir }: TarCommandArgs) { + return exec("tar", ["-xf", archivePath, "-C", extractDir]); +} From 3ce3cf7df321cc034d9c160bb52ebda7908709de Mon Sep 17 00:00:00 2001 From: Maciej Stosio Date: Thu, 19 Dec 2024 15:42:36 +0100 Subject: [PATCH 3/7] chore: fix lint --- .../src/builders/customBuild.ts | 8 ++-- packages/vscode-extension/src/builders/eas.ts | 2 +- .../vscode-extension/src/builders/utils.ts | 42 ++++++++++--------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/packages/vscode-extension/src/builders/customBuild.ts b/packages/vscode-extension/src/builders/customBuild.ts index 895758df7..570ffed81 100644 --- a/packages/vscode-extension/src/builders/customBuild.ts +++ b/packages/vscode-extension/src/builders/customBuild.ts @@ -1,7 +1,7 @@ import path from "path"; import fs from "fs"; import os from "os"; -import { mkdtemp} from "fs/promises"; +import { mkdtemp } from "fs/promises"; import { Logger } from "../Logger"; import { command, lineReader } from "../utilities/subprocess"; import { CancelToken } from "./cancelToken"; @@ -10,7 +10,7 @@ import { extractTarApp } from "./utils"; type Env = Record | undefined; -const EXPO_LOCAL_BUILD_PATH_REGEX = new RegExp('You can find the build artifacts in (.*)'); +const EXPO_LOCAL_BUILD_PATH_REGEX = new RegExp("You can find the build artifacts in (.*)"); export async function runExternalBuild(cancelToken: CancelToken, buildCommand: string, env: Env) { const output = await runExternalScript(buildCommand, env, cancelToken); @@ -22,7 +22,7 @@ export async function runExternalBuild(cancelToken: CancelToken, buildCommand: s let binaryPath = output.lastLine; // We test if the output of the command matches eas build output. - // If it does we extract the bath to binary. + // If it does we extract the bath to binary. if (EXPO_LOCAL_BUILD_PATH_REGEX.test(output.lastLine)) { const groups = EXPO_LOCAL_BUILD_PATH_REGEX.exec(output.lastLine); if (groups?.[1]) { @@ -37,7 +37,7 @@ export async function runExternalBuild(cancelToken: CancelToken, buildCommand: s return undefined; } - const shouldExtractArchive = binaryPath.endsWith('.tar.gz'); + const shouldExtractArchive = binaryPath.endsWith(".tar.gz"); if (!shouldExtractArchive) { return binaryPath; } diff --git a/packages/vscode-extension/src/builders/eas.ts b/packages/vscode-extension/src/builders/eas.ts index c29df7ce3..6c773e6e7 100644 --- a/packages/vscode-extension/src/builders/eas.ts +++ b/packages/vscode-extension/src/builders/eas.ts @@ -1,6 +1,6 @@ import path from "path"; import os from "os"; -import { mkdtemp} from "fs/promises"; +import { mkdtemp } from "fs/promises"; import maxBy from "lodash/maxBy"; import { DevicePlatform } from "../common/DeviceManager"; diff --git a/packages/vscode-extension/src/builders/utils.ts b/packages/vscode-extension/src/builders/utils.ts index d6a707228..a3f9dd50f 100644 --- a/packages/vscode-extension/src/builders/utils.ts +++ b/packages/vscode-extension/src/builders/utils.ts @@ -5,29 +5,33 @@ import { exec } from "../utilities/subprocess"; import { CancelToken } from "./cancelToken"; function isAppFile(name: string) { - return name.endsWith(".app"); + return name.endsWith(".app"); } -export async function extractTarApp(binaryPath: string, pathToExtract: string, cancelToken: CancelToken) { - const { failed } = await cancelToken.adapt( - tarCommand({ archivePath: binaryPath, extractDir: pathToExtract }) - ); - - if (failed) { - Logger.error(`Failed to extract archive '${binaryPath}' to '${pathToExtract}'.`); - return undefined; - } +export async function extractTarApp( + binaryPath: string, + pathToExtract: string, + cancelToken: CancelToken +) { + const { failed } = await cancelToken.adapt( + tarCommand({ archivePath: binaryPath, extractDir: pathToExtract }) + ); - // assuming that the archive contains only one .app file - const appName = (await readdir(pathToExtract)).find(isAppFile); - if (!appName) { - Logger.error(`Failed to find .app in extracted archive '${binaryPath}'.`); - return undefined; - } + if (failed) { + Logger.error(`Failed to extract archive '${binaryPath}' to '${pathToExtract}'.`); + return undefined; + } - const appPath = path.join(pathToExtract, appName); - Logger.debug(`Extracted app archive to '${appPath}'.`); - return appPath; + // assuming that the archive contains only one .app file + const appName = (await readdir(pathToExtract)).find(isAppFile); + if (!appName) { + Logger.error(`Failed to find .app in extracted archive '${binaryPath}'.`); + return undefined; + } + + const appPath = path.join(pathToExtract, appName); + Logger.debug(`Extracted app archive to '${appPath}'.`); + return appPath; } type TarCommandArgs = { archivePath: string; extractDir: string }; From c8904a770386e0eefc10c33fce8792662a7feb5a Mon Sep 17 00:00:00 2001 From: Maciej Stosio Date: Fri, 10 Jan 2025 12:29:28 +0100 Subject: [PATCH 4/7] feat: relax regex to match any path and take the first one --- .../vscode-extension/src/builders/customBuild.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/vscode-extension/src/builders/customBuild.ts b/packages/vscode-extension/src/builders/customBuild.ts index 570ffed81..2018a5487 100644 --- a/packages/vscode-extension/src/builders/customBuild.ts +++ b/packages/vscode-extension/src/builders/customBuild.ts @@ -10,7 +10,8 @@ import { extractTarApp } from "./utils"; type Env = Record | undefined; -const EXPO_LOCAL_BUILD_PATH_REGEX = new RegExp("You can find the build artifacts in (.*)"); +// Extracts all paths from the last line, both Unix and Windows format +const BUILD_PATH_REGEX = /(\/.*?\.\S*)|([a-zA-Z]:\\.*?\.\S*)/g; export async function runExternalBuild(cancelToken: CancelToken, buildCommand: string, env: Env) { const output = await runExternalScript(buildCommand, env, cancelToken); @@ -21,13 +22,10 @@ export async function runExternalBuild(cancelToken: CancelToken, buildCommand: s let binaryPath = output.lastLine; - // We test if the output of the command matches eas build output. - // If it does we extract the bath to binary. - if (EXPO_LOCAL_BUILD_PATH_REGEX.test(output.lastLine)) { - const groups = EXPO_LOCAL_BUILD_PATH_REGEX.exec(output.lastLine); - if (groups?.[1]) { - binaryPath = groups[1]; - } + // We run regex to extract paths from the first line and we take the first one + const groups = output.lastLine.match(BUILD_PATH_REGEX); + if (groups?.[0]) { + binaryPath = groups[0]; } if (binaryPath && !fs.existsSync(binaryPath)) { From 8f47423c7ee5812e0f51d76aad28ecffc5fd484c Mon Sep 17 00:00:00 2001 From: Maciej Stosio Date: Mon, 13 Jan 2025 12:18:38 +0100 Subject: [PATCH 5/7] chore: improve logging and format checking --- .../src/builders/buildAndroid.ts | 2 +- .../vscode-extension/src/builders/buildIOS.ts | 2 +- .../src/builders/customBuild.ts | 31 +++++++++++++++---- packages/vscode-extension/src/builders/eas.ts | 2 +- .../vscode-extension/src/builders/utils.ts | 16 +++++++--- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/packages/vscode-extension/src/builders/buildAndroid.ts b/packages/vscode-extension/src/builders/buildAndroid.ts index 3336e18f4..3af076674 100644 --- a/packages/vscode-extension/src/builders/buildAndroid.ts +++ b/packages/vscode-extension/src/builders/buildAndroid.ts @@ -89,7 +89,7 @@ export async function buildAndroid( } if (customBuild?.android?.buildCommand) { - const apkPath = await runExternalBuild(cancelToken, customBuild.android.buildCommand, env); + const apkPath = await runExternalBuild(cancelToken, customBuild.android.buildCommand, env, DevicePlatform.Android); if (!apkPath) { throw new Error("Failed to build Android app using custom script."); } diff --git a/packages/vscode-extension/src/builders/buildIOS.ts b/packages/vscode-extension/src/builders/buildIOS.ts index 31fa534c4..f9392964c 100644 --- a/packages/vscode-extension/src/builders/buildIOS.ts +++ b/packages/vscode-extension/src/builders/buildIOS.ts @@ -89,7 +89,7 @@ export async function buildIos( if (customBuild?.ios?.buildCommand) { // We don't autoinstall Pods here to make custom build scripts more flexible - const appPath = await runExternalBuild(cancelToken, customBuild.ios.buildCommand, env); + const appPath = await runExternalBuild(cancelToken, customBuild.ios.buildCommand, env, DevicePlatform.IOS); if (!appPath) { throw new Error("Failed to build iOS app using custom script."); } diff --git a/packages/vscode-extension/src/builders/customBuild.ts b/packages/vscode-extension/src/builders/customBuild.ts index 2018a5487..32a8f3944 100644 --- a/packages/vscode-extension/src/builders/customBuild.ts +++ b/packages/vscode-extension/src/builders/customBuild.ts @@ -6,14 +6,16 @@ import { Logger } from "../Logger"; import { command, lineReader } from "../utilities/subprocess"; import { CancelToken } from "./cancelToken"; import { getAppRootFolder } from "../utilities/extensionContext"; -import { extractTarApp } from "./utils"; +import { extractTarApp, isApkFile, isAppFile } from "./utils"; +import { DevicePlatform } from "../common/DeviceManager"; +import { Platform } from "../utilities/platform"; type Env = Record | undefined; // Extracts all paths from the last line, both Unix and Windows format const BUILD_PATH_REGEX = /(\/.*?\.\S*)|([a-zA-Z]:\\.*?\.\S*)/g; -export async function runExternalBuild(cancelToken: CancelToken, buildCommand: string, env: Env) { +export async function runExternalBuild(cancelToken: CancelToken, buildCommand: string, env: Env, platform: DevicePlatform) { const output = await runExternalScript(buildCommand, env, cancelToken); if (!output) { @@ -36,13 +38,30 @@ export async function runExternalBuild(cancelToken: CancelToken, buildCommand: s } const shouldExtractArchive = binaryPath.endsWith(".tar.gz"); - if (!shouldExtractArchive) { - return binaryPath; + if (shouldExtractArchive) { + const tmpDirectory = await mkdtemp(path.join(os.tmpdir(), "rn-ide-custom-build-")); + const extractedFile = await extractTarApp(binaryPath, tmpDirectory, cancelToken, platform); + + Logger.info(`External script: ${buildCommand} output app path: ${binaryPath}`); + return extractedFile; } - const tmpDirectory = await mkdtemp(path.join(os.tmpdir(), "rn-ide-custom-build-")); + if (platform === DevicePlatform.Android && !isApkFile(binaryPath)) { + Logger.error( + `External script: ${buildCommand} failed to output .apk file, got: ${binaryPath}` + ); + return undefined; + } - return await extractTarApp(binaryPath, tmpDirectory, cancelToken); + if (platform === DevicePlatform.IOS && !isAppFile(binaryPath)) { + Logger.error( + `External script: ${buildCommand} failed to output .app file, got: ${binaryPath}` + ); + return undefined; + } + + Logger.info(`External script: ${buildCommand} output app path: ${binaryPath}`); + return binaryPath; } export async function runfingerprintCommand(externalCommand: string, env: Env) { diff --git a/packages/vscode-extension/src/builders/eas.ts b/packages/vscode-extension/src/builders/eas.ts index 6c773e6e7..ad97b98a1 100644 --- a/packages/vscode-extension/src/builders/eas.ts +++ b/packages/vscode-extension/src/builders/eas.ts @@ -103,5 +103,5 @@ async function downloadAppFromEas( return binaryPath; } - return await extractTarApp(binaryPath, tmpDirectory, cancelToken); + return await extractTarApp(binaryPath, tmpDirectory, cancelToken, DevicePlatform.IOS); } diff --git a/packages/vscode-extension/src/builders/utils.ts b/packages/vscode-extension/src/builders/utils.ts index a3f9dd50f..a99448813 100644 --- a/packages/vscode-extension/src/builders/utils.ts +++ b/packages/vscode-extension/src/builders/utils.ts @@ -3,15 +3,21 @@ import path from "path"; import { Logger } from "../Logger"; import { exec } from "../utilities/subprocess"; import { CancelToken } from "./cancelToken"; +import { DevicePlatform } from "../common/DeviceManager"; -function isAppFile(name: string) { +export function isAppFile(name: string) { return name.endsWith(".app"); } +export function isApkFile(name: string) { + return name.endsWith(".apk"); +} + export async function extractTarApp( binaryPath: string, pathToExtract: string, - cancelToken: CancelToken + cancelToken: CancelToken, + platform: DevicePlatform ) { const { failed } = await cancelToken.adapt( tarCommand({ archivePath: binaryPath, extractDir: pathToExtract }) @@ -22,10 +28,10 @@ export async function extractTarApp( return undefined; } - // assuming that the archive contains only one .app file - const appName = (await readdir(pathToExtract)).find(isAppFile); + // assuming that the archive contains only one app file + const appName = (await readdir(pathToExtract)).find(platform === DevicePlatform.Android ? isApkFile : isAppFile); if (!appName) { - Logger.error(`Failed to find .app in extracted archive '${binaryPath}'.`); + Logger.error(`Failed to find the ${platform === DevicePlatform.Android ? '.apk' : '.app'} file in extracted archive '${binaryPath}'.`); return undefined; } From beb4e2bcc0ff76bf6a175947adec084a6e4015ca Mon Sep 17 00:00:00 2001 From: Maciej Stosio Date: Mon, 13 Jan 2025 13:47:18 +0100 Subject: [PATCH 6/7] Fix lint --- .../src/builders/buildAndroid.ts | 7 ++++++- .../vscode-extension/src/builders/buildIOS.ts | 7 ++++++- .../src/builders/customBuild.ts | 19 ++++++++++--------- .../vscode-extension/src/builders/utils.ts | 10 ++++++++-- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/packages/vscode-extension/src/builders/buildAndroid.ts b/packages/vscode-extension/src/builders/buildAndroid.ts index c5ba07f3e..8e74d13ea 100644 --- a/packages/vscode-extension/src/builders/buildAndroid.ts +++ b/packages/vscode-extension/src/builders/buildAndroid.ts @@ -93,7 +93,12 @@ export async function buildAndroid( getTelemetryReporter().sendTelemetryEvent("build:custom-build-requested", { platform: DevicePlatform.Android, }); - const apkPath = await runExternalBuild(cancelToken, customBuild.android.buildCommand, env, DevicePlatform.Android); + const apkPath = await runExternalBuild( + cancelToken, + customBuild.android.buildCommand, + env, + DevicePlatform.Android + ); if (!apkPath) { throw new Error("Failed to build Android app using custom script."); } diff --git a/packages/vscode-extension/src/builders/buildIOS.ts b/packages/vscode-extension/src/builders/buildIOS.ts index a35e42ca4..2be927d08 100644 --- a/packages/vscode-extension/src/builders/buildIOS.ts +++ b/packages/vscode-extension/src/builders/buildIOS.ts @@ -93,7 +93,12 @@ export async function buildIos( }); // We don't autoinstall Pods here to make custom build scripts more flexible - const appPath = await runExternalBuild(cancelToken, customBuild.ios.buildCommand, env, DevicePlatform.IOS); + const appPath = await runExternalBuild( + cancelToken, + customBuild.ios.buildCommand, + env, + DevicePlatform.IOS + ); if (!appPath) { throw new Error("Failed to build iOS app using custom script."); } diff --git a/packages/vscode-extension/src/builders/customBuild.ts b/packages/vscode-extension/src/builders/customBuild.ts index 32a8f3944..82dc58612 100644 --- a/packages/vscode-extension/src/builders/customBuild.ts +++ b/packages/vscode-extension/src/builders/customBuild.ts @@ -15,7 +15,12 @@ type Env = Record | undefined; // Extracts all paths from the last line, both Unix and Windows format const BUILD_PATH_REGEX = /(\/.*?\.\S*)|([a-zA-Z]:\\.*?\.\S*)/g; -export async function runExternalBuild(cancelToken: CancelToken, buildCommand: string, env: Env, platform: DevicePlatform) { +export async function runExternalBuild( + cancelToken: CancelToken, + buildCommand: string, + env: Env, + platform: DevicePlatform +) { const output = await runExternalScript(buildCommand, env, cancelToken); if (!output) { @@ -41,25 +46,21 @@ export async function runExternalBuild(cancelToken: CancelToken, buildCommand: s if (shouldExtractArchive) { const tmpDirectory = await mkdtemp(path.join(os.tmpdir(), "rn-ide-custom-build-")); const extractedFile = await extractTarApp(binaryPath, tmpDirectory, cancelToken, platform); - + Logger.info(`External script: ${buildCommand} output app path: ${binaryPath}`); return extractedFile; } if (platform === DevicePlatform.Android && !isApkFile(binaryPath)) { - Logger.error( - `External script: ${buildCommand} failed to output .apk file, got: ${binaryPath}` - ); + Logger.error(`External script: ${buildCommand} failed to output .apk file, got: ${binaryPath}`); return undefined; } if (platform === DevicePlatform.IOS && !isAppFile(binaryPath)) { - Logger.error( - `External script: ${buildCommand} failed to output .app file, got: ${binaryPath}` - ); + Logger.error(`External script: ${buildCommand} failed to output .app file, got: ${binaryPath}`); return undefined; } - + Logger.info(`External script: ${buildCommand} output app path: ${binaryPath}`); return binaryPath; } diff --git a/packages/vscode-extension/src/builders/utils.ts b/packages/vscode-extension/src/builders/utils.ts index a99448813..504741352 100644 --- a/packages/vscode-extension/src/builders/utils.ts +++ b/packages/vscode-extension/src/builders/utils.ts @@ -29,9 +29,15 @@ export async function extractTarApp( } // assuming that the archive contains only one app file - const appName = (await readdir(pathToExtract)).find(platform === DevicePlatform.Android ? isApkFile : isAppFile); + const appName = (await readdir(pathToExtract)).find( + platform === DevicePlatform.Android ? isApkFile : isAppFile + ); if (!appName) { - Logger.error(`Failed to find the ${platform === DevicePlatform.Android ? '.apk' : '.app'} file in extracted archive '${binaryPath}'.`); + Logger.error( + `Failed to find the ${ + platform === DevicePlatform.Android ? ".apk" : ".app" + } file in extracted archive '${binaryPath}'.` + ); return undefined; } From f3d1821bf979ead16607662ece5e4910d089ee58 Mon Sep 17 00:00:00 2001 From: Maciej Stosio Date: Tue, 14 Jan 2025 13:11:42 +0100 Subject: [PATCH 7/7] Fix lint --- packages/vscode-extension/src/builders/customBuild.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/vscode-extension/src/builders/customBuild.ts b/packages/vscode-extension/src/builders/customBuild.ts index 82dc58612..b4f6e8a3d 100644 --- a/packages/vscode-extension/src/builders/customBuild.ts +++ b/packages/vscode-extension/src/builders/customBuild.ts @@ -8,7 +8,6 @@ import { CancelToken } from "./cancelToken"; import { getAppRootFolder } from "../utilities/extensionContext"; import { extractTarApp, isApkFile, isAppFile } from "./utils"; import { DevicePlatform } from "../common/DeviceManager"; -import { Platform } from "../utilities/platform"; type Env = Record | undefined;