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
```
This commit is contained in:
Martin Kustermann
2021-08-20 16:03:43 +02:00
committed by GitHub
parent c338ce8721
commit d915f0c519

View File

@@ -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):