Warn, but don't fail if prebuilt Dart SDK could not be fetched (flutter/engine#27546)
This commit is contained in:
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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',
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user