From d88cf41a246fa11cad7fc6b9faa210ecb027e979 Mon Sep 17 00:00:00 2001 From: Anton Kastritskiy Date: Tue, 14 Nov 2023 02:54:59 -0800 Subject: [PATCH] Always write ANDROID_HOME and ANDROID_SDK_ROOT Summary: When flipper starts it writes to both env vars the value from settings. This is needed for subprocesses to have access to them. The problem with the check for both env vars is - In prod environment applications does not have access to them - In dev, when developers launch flipper from terminal (`yarn run flipper-server`) it picks up these env vars if they are set which can cause different behaviour in dev and prod To make flipper work more deterministic, for users and us. I removed this check and now we always write to these env vars what the user has provided in flipper settings or the default. Reviewed By: lblasa Differential Revision: D51266495 fbshipit-source-id: cf3adfd4ba83a733a30b5b0b29c270b32ff3a61a --- desktop/flipper-server-core/src/FlipperServerImpl.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/desktop/flipper-server-core/src/FlipperServerImpl.tsx b/desktop/flipper-server-core/src/FlipperServerImpl.tsx index dd07f3889..1cef26dae 100644 --- a/desktop/flipper-server-core/src/FlipperServerImpl.tsx +++ b/desktop/flipper-server-core/src/FlipperServerImpl.tsx @@ -75,10 +75,8 @@ function setProcessState(settings: Settings) { const androidHome = settings.androidHome; const idbPath = settings.idbPath; - if (!process.env.ANDROID_HOME && !process.env.ANDROID_SDK_ROOT) { - process.env.ANDROID_HOME = androidHome; - process.env.ANDROID_SDK_ROOT = androidHome; - } + process.env.ANDROID_HOME = androidHome; + process.env.ANDROID_SDK_ROOT = androidHome; // emulator/emulator is more reliable than tools/emulator, so prefer it if // it exists