Skip to content

Commit

Permalink
Warn, but don't fail if prebuilt Dart SDK could not be fetched (flutt…
Browse files Browse the repository at this point in the history
  • Loading branch information
zanderso authored Jul 19, 2021
1 parent a7e8858 commit 5f0f69f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 11 additions & 1 deletion tools/download_dart_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ def ExtractDartSDK(archive, os_name, arch, verbose):
z.extractall(extract_dest)


def PrintFileIfSmall(file):
if not os.path.isfile(file):
return
size = os.path.getsize(file)
if size < (1 << 14): # < 16KB
with open(file) as f:
contents = f.read()
eprint(contents)


def DownloadAndExtract(channel, version, os_name, arch, verbose):
archive = DownloadDartSDK(channel, version, os_name, arch, verbose)
Expand All @@ -171,6 +180,7 @@ def DownloadAndExtract(channel, version, os_name, arch, verbose):
ExtractDartSDK(archive, os_name, arch, verbose)
except Exception as e:
eprint('Failed to extract Dart SDK archive:\n%s' % e)
PrintFileIfSmall(archive)
return 1
try:
stamp_file = '{}.stamp'.format(archive)
Expand All @@ -187,7 +197,7 @@ def Main():
parser.add_argument(
'--fail-loudly',
action='store_true',
default='LUCI_CONTEXT' in os.environ,
default=False,
help="Return an error code if a prebuilt couldn't be fetched and extracted")
parser.add_argument(
'--verbose',
Expand Down
1 change: 0 additions & 1 deletion tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ def to_gn_args(args):
print('--prebuilt-dart-sdk was specified, but an appropriate prebuilt '
'could not be found! Try running '
'flutter/tools/download_dart_sdk.py manually.')
sys.exit(1)
elif args.target_os is None or args.target_os == 'linux':
# dart_platform_sdk is only defined for host builds, linux arm host builds
# specify target_os=linux.
Expand Down

0 comments on commit 5f0f69f

Please sign in to comment.