From f6a4e4f20f0d3b5fe2aad171cded9aba06d3c8f8 Mon Sep 17 00:00:00 2001 From: Raouf Date: Tue, 7 Feb 2023 07:00:14 -0800 Subject: [PATCH] update `asdf-vm` setup to use `$ASDF_DIR` to work if user defined custom directory (#36043) Summary: Update setup of sourcing `asdf-vm` in `find-node-for-xcode.sh` in case of user has custom defined of `$ASDF_DIR` by default `$ASDF_DIR` point to `$HOME/.asdf`, but if user has custom directory (like XDG convention) this script wont work without this change. ## Changelog [GENERAL] [CHANGED] - Find node binary when using asdf as the node version manager with custom `$ASDF_DIR` Pull Request resolved: https://github.com/facebook/react-native/pull/36043 Test Plan: use a defualt/custom `$ASDF_DIR` while using `asdf-vm` as node version manager then make iOS build. Reviewed By: cortinico Differential Revision: D42990407 Pulled By: cipolleschi fbshipit-source-id: 1fe3fdc786bddf741ff422e7bec55a6c9cc8ed83 --- scripts/find-node-for-xcode.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/find-node-for-xcode.sh b/scripts/find-node-for-xcode.sh index 0a49e25ce6d..e928cd8e31b 100644 --- a/scripts/find-node-for-xcode.sh +++ b/scripts/find-node-for-xcode.sh @@ -58,7 +58,10 @@ if [[ ! -x node && -d ${HOME}/.anyenv/bin ]]; then fi # Set up asdf-vm if present -if [[ -f "$HOME/.asdf/asdf.sh" ]]; then +if [[ -f "$ASDF_DIR/asdf.sh" ]]; then + # shellcheck source=/dev/null + . "$ASDF_DIR/asdf.sh" +elif [[ -f "$HOME/.asdf/asdf.sh" ]]; then # shellcheck source=/dev/null . "$HOME/.asdf/asdf.sh" elif [[ -x "$(command -v brew)" && -f "$(brew --prefix asdf)/asdf.sh" ]]; then