From 561ec860ede8eb1c57aaec9a01a04acefa57e2f9 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Mon, 7 Aug 2023 15:44:39 -0700 Subject: [PATCH] Makefile: fix JAVA_HOME detection on macOS I had tested against an old Android Studio, newer ones should prefer the `jbr` directory. The Makefile also required proper quotation around the file paths that will typically contain a space. Fixes tailscale/tailscale#8799 --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 238481e..7b7b4cf 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ export ANDROID_HOME ?= $(ANDROID_SDK_ROOT) ANDROID_STUDIO_ROOT ?= $(shell find ~/android-studio /usr/local/android-studio /opt/android-studio /Applications/Android\ Studio.app $(PROGRAMFILES)/Android/Android\ Studio -type d -maxdepth 1 2>/dev/null | head -n 1) # Set JAVA_HOME to the Android Studio bundled JDK. -export JAVA_HOME ?= $(shell find $(ANDROID_STUDIO_ROOT)/jre $(ANDROID_STUDIO_ROOT)/jbr $(ANDROID_STUDIO_ROOT)/Contents/jre/Contents/Home -maxdepth 1 -type d 2>/dev/null | head -n 1) +export JAVA_HOME ?= $(shell find "$(ANDROID_STUDIO_ROOT)/jbr" "$(ANDROID_STUDIO_ROOT)/jre" "$(ANDROID_STUDIO_ROOT)/Contents/jbr/Contents/Home" "$(ANDROID_STUDIO_ROOT)/Contents/jre/Contents/Home" -maxdepth 1 -type d 2>/dev/null | head -n 1) # Go toolchain path, by default pulled from Tailscale prebuilts pinned to the # version in tailscale.com/cmd/printdep. @@ -68,6 +68,7 @@ env: @echo PATH=$(PATH) @echo ANDROID_SDK_ROOT=$(ANDROID_SDK_ROOT) @echo ANDROID_HOME=$(ANDROID_HOME) + @echo ANDROID_STUDIO_ROOT=$(ANDROID_STUDIO_ROOT) @echo JAVA_HOME=$(JAVA_HOME) @echo TOOLCHAINDIR=$(TOOLCHAINDIR)