Extract the prebuilt Dart SDK to a temp directory and then move it after the extraction completes (flutter/engine#27569)

* Extract the prebuilt Dart SDK to a temp directory and then move it after the extraction completes

This ensures that the GN script will not see an invalid Dart SDK at the
expected path if the extract fails.

* Add os_arch to temp extraction path

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
This commit is contained in:
Jason Simmons 2021-07-20 08:35:52 -07:00 committed by GitHub
parent 108f9b0a26
commit ab998239a4

View File

@ -150,7 +150,9 @@ def ExtractDartSDK(archive, os_name, arch, verbose):
if os.path.isdir(dart_sdk):
shutil.rmtree(dart_sdk)
extract_dest = os.path.join(FLUTTER_PREBUILTS_DIR, os_arch)
extract_dest = os.path.join(FLUTTER_PREBUILTS_DIR, os_arch, 'temp')
if os.path.isdir(extract_dest):
shutil.rmtree(extract_dest)
os.makedirs(extract_dest, exist_ok=True)
if verbose:
@ -159,6 +161,8 @@ def ExtractDartSDK(archive, os_name, arch, verbose):
with ZipFileWithPermissions(archive, "r") as z:
z.extractall(extract_dest)
shutil.move(os.path.join(extract_dest, 'dart-sdk'), dart_sdk)
def PrintFileIfSmall(file):
if not os.path.isfile(file):