Index: tools/download_latest_dev_sdk.py |
diff --git a/tools/download_latest_dev_sdk.py b/tools/download_latest_dev_sdk.py |
index c5de4202594eb48a830b103663b6751900f1cf29..d39cae4ee5353109b25ad3d6cf5120aebe94462f 100755 |
--- a/tools/download_latest_dev_sdk.py |
+++ b/tools/download_latest_dev_sdk.py |
@@ -18,9 +18,11 @@ HOST_OS = utils.GuessOS() |
HOST_ARCH = utils.GuessArchitecture() |
SCRIPT_DIR = os.path.dirname(sys.argv[0]) |
DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) |
+FUCHSIA_ROOT = os.path.realpath(os.path.join(DART_ROOT, '..')) |
+FLUTTER_ROOT = os.path.join(FUCHSIA_ROOT, 'lib', 'flutter') |
-DART_VERSION = '1.25.0-dev.7.0' |
-BASE_URL = 'http://gsdview.appspot.com/dart-archive/channels/dev/raw/' + DART_VERSION +'/sdk' |
+DEFAULT_DART_VERSION = 'latest' |
+BASE_URL = 'http://gsdview.appspot.com/dart-archive/channels/dev/raw/%s/sdk/%s' |
def host_os_for_sdk(host_os): |
if host_os.startswith('macos'): |
@@ -45,8 +47,18 @@ def main(argv): |
local_sha_path = os.path.join(sdk_path, sha_file) |
remote_sha_path = os.path.join(sdk_path, sha_file + '.remote') |
zip_path = os.path.join(sdk_path, zip_file) |
- sha_url = BASE_URL + '/' + sha_file |
- zip_url = BASE_URL + '/' + zip_file |
+ |
+ # If we're in a Fuchsia checkout with Flutter nearby, pull the same dev SDK |
+ # version that Flutter says it wants. Otherwise, pull the latest dev SDK. |
+ sdk_version_path = os.path.join( |
+ FLUTTER_ROOT, 'bin', 'internal', 'dart-sdk.version') |
+ sdk_version = DEFAULT_DART_VERSION |
+ if os.path.isfile(sdk_version_path): |
+ with open(sdk_version_path, 'r') as fp: |
+ sdk_version = fp.read().strip() |
+ |
+ sha_url = (BASE_URL % (sdk_version, sha_file)) |
+ zip_url = (BASE_URL % (sdk_version, zip_file)) |
local_sha = '' |
if os.path.isfile(local_sha_path): |