From d915f0c519490163a8f164dc64040bb685036308 Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Fri, 20 Aug 2021 16:03:43 +0200 Subject: [PATCH] Normalize the path that ANDROID_HOME uses (flutter/engine#28222) The gradle/android tooling will validate that ANDROID_HOME and ANDROID_SDK_ROOT are precisely the same. So if they point to the same directory but are not normalized this check will fail. Fixes Dart-Flutter Head-Head-Head bot which failed with ``` Several environment variables and/or system properties contain different paths to the SDK. Please correct and use only one way to inject the SDK location. ANDROID_HOME: /b/s/w/ir/cache/builder/engine/src/flutter/testing/rules/../../../third_party/android_tools/sdk ANDROID_SDK_ROOT: /b/s/w/ir/cache/builder/engine/src/third_party/android_tools/sdk ``` --- engine/src/flutter/testing/rules/run_gradle.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/testing/rules/run_gradle.py b/engine/src/flutter/testing/rules/run_gradle.py index 2ca3f0f4b2..bb625fe068 100644 --- a/engine/src/flutter/testing/rules/run_gradle.py +++ b/engine/src/flutter/testing/rules/run_gradle.py @@ -14,12 +14,15 @@ import subprocess import platform SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)) -ANDROID_HOME = os.path.join(SCRIPT_PATH, '..', '..', '..', 'third_party', 'android_tools', 'sdk') +ANDROID_HOME = os.path.normpath(os.path.join(SCRIPT_PATH, '..', '..', '..', + 'third_party', 'android_tools', 'sdk')) if platform.system() == 'Darwin': - JAVA_HOME = os.path.join(SCRIPT_PATH, '..', '..', '..', 'third_party', 'java', 'openjdk', 'Contents', 'Home') + JAVA_HOME = os.path.normpath(os.path.join(SCRIPT_PATH, '..', '..', '..', + 'third_party', 'java', 'openjdk', 'Contents', 'Home')) else: - JAVA_HOME = os.path.join(SCRIPT_PATH, '..', '..', '..', 'third_party', 'java', 'openjdk') + JAVA_HOME = os.path.normpath(os.path.join(SCRIPT_PATH, '..', '..', '..', + 'third_party', 'java', 'openjdk')) def main(): if not os.path.isdir(ANDROID_HOME):