From 31971e1c181b981264eef8d6e5374fa2e3becfe4 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 4 Jul 2024 16:33:57 +0200 Subject: [PATCH 1/2] feat: customize binary path --- .../platforms/android/src/commands/platforms/UnixProfiler.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/platforms/android/src/commands/platforms/UnixProfiler.ts b/packages/platforms/android/src/commands/platforms/UnixProfiler.ts index d6983c17..176725ba 100644 --- a/packages/platforms/android/src/commands/platforms/UnixProfiler.ts +++ b/packages/platforms/android/src/commands/platforms/UnixProfiler.ts @@ -26,9 +26,8 @@ export const CppProfilerName = `BAMPerfProfiler`; // into the Flipper plugin directory // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error -const binaryFolder = global.Flipper - ? `${__dirname}/bin` - : `${__dirname}/../../..${__dirname.includes("dist") ? "/.." : ""}/cpp-profiler/bin`; +const defaultBinaryFolder = `${__dirname}/../../..${__dirname.includes("dist") ? "/.." : ""}/cpp-profiler/bin`; +const binaryFolder = process.env.FLASHLIGHT_BINARY_PATH || defaultBinaryFolder; export abstract class UnixProfiler implements Profiler { stop(): void { From 8983886f37afa63eecef577537f0d93ee0489b03 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 5 Jul 2024 14:11:36 +0200 Subject: [PATCH 2/2] fix: TS/eslint issues --- .../platforms/android/src/commands/platforms/UnixProfiler.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/platforms/android/src/commands/platforms/UnixProfiler.ts b/packages/platforms/android/src/commands/platforms/UnixProfiler.ts index 176725ba..1dd7c445 100644 --- a/packages/platforms/android/src/commands/platforms/UnixProfiler.ts +++ b/packages/platforms/android/src/commands/platforms/UnixProfiler.ts @@ -22,11 +22,8 @@ import { processOutput as processRamOutput } from "../ram/pollRamUsage"; export const CppProfilerName = `BAMPerfProfiler`; -// Since Flipper uses esbuild, we copy the bin folder directly -// into the Flipper plugin directory -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-expect-error const defaultBinaryFolder = `${__dirname}/../../..${__dirname.includes("dist") ? "/.." : ""}/cpp-profiler/bin`; +// Allow overriding the binary folder with an environment variable const binaryFolder = process.env.FLASHLIGHT_BINARY_PATH || defaultBinaryFolder; export abstract class UnixProfiler implements Profiler {