Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
21d0c374
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
21d0c374
编写于
7月 16, 2021
作者:
Z
Zachary Anderson
提交者:
GitHub
7月 16, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Verbose output on CI from download_dart_sdk.py (#27484)
上级
cf524b4d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
10 deletion
+54
-10
tools/download_dart_sdk.py
tools/download_dart_sdk.py
+54
-10
未找到文件。
tools/download_dart_sdk.py
浏览文件 @
21d0c374
...
...
@@ -68,13 +68,17 @@ def ArchitecturesForOS(os_name):
# Downloads a Dart SDK to //flutter/prebuilts.
def
DownloadDartSDK
(
channel
,
version
,
os_name
,
arch
):
def
DownloadDartSDK
(
channel
,
version
,
os_name
,
arch
,
verbose
):
file
=
'dartsdk-{}-{}-release.zip'
.
format
(
os_name
,
arch
)
url
=
'https://storage.googleapis.com/dart-archive/channels/{}/raw/{}/sdk/{}'
.
format
(
channel
,
version
,
file
,
)
dest
=
os
.
path
.
join
(
FLUTTER_PREBUILTS_DIR
,
file
)
if
verbose
:
print
(
'Dart SDK url: "%s"'
%
url
)
print
(
'Dart SDK destination path: "%s"'
%
dest
)
stamp_file
=
'{}.stamp'
.
format
(
dest
)
version_stamp
=
None
try
:
...
...
@@ -83,22 +87,40 @@ def DownloadDartSDK(channel, version, os_name, arch):
except
:
version_stamp
=
'none'
if
verbose
:
print
(
'Dart SDK version stamp = "%s"'
%
version_stamp
)
if
version
==
version_stamp
:
# The prebuilt Dart SDK is already up-to-date. Indicate that the download
# should be skipped by returning the empty string.
if
verbose
:
print
(
'Dart SDK stamp files match. Skipping download.'
)
return
''
if
os
.
path
.
isfile
(
dest
):
os
.
unlink
(
dest
)
curl_command
=
[
'curl'
,
url
,
'-o'
,
dest
]
curl_command
=
[
'curl'
,
'--retry'
,
'3'
,
'--continue-at'
,
'-'
,
'--location'
,
'--output'
,
dest
,
url
,
]
if
verbose
:
curl_command
.
append
(
'--verbose'
)
print
(
'Running: "%s"'
%
(
' '
.
join
(
curl_command
)))
curl_result
=
subprocess
.
run
(
curl_command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
universal_newlines
=
True
,
)
if
curl_result
.
returncode
!=
0
:
if
curl_result
.
returncode
==
0
and
verbose
:
print
(
'curl output:stdout:
\n
{}
\n
stderr:
\n
{}'
.
format
(
curl_result
.
stdout
,
curl_result
.
stderr
,
))
elif
curl_result
.
returncode
!=
0
:
eprint
(
'Failed to download: stdout:
\n
{}
\n
stderr:
\n
{}'
.
format
(
curl_result
.
stdout
,
curl_result
.
stderr
,
))
...
...
@@ -122,7 +144,7 @@ class ZipFileWithPermissions(zipfile.ZipFile):
# Extracts a Dart SDK in //fluter/prebuilts
def
ExtractDartSDK
(
archive
,
os_name
,
arch
):
def
ExtractDartSDK
(
archive
,
os_name
,
arch
,
verbose
):
os_arch
=
'{}-{}'
.
format
(
os_name
,
arch
)
dart_sdk
=
os
.
path
.
join
(
FLUTTER_PREBUILTS_DIR
,
os_arch
,
'dart-sdk'
)
if
os
.
path
.
isdir
(
dart_sdk
):
...
...
@@ -131,17 +153,25 @@ def ExtractDartSDK(archive, os_name, arch):
extract_dest
=
os
.
path
.
join
(
FLUTTER_PREBUILTS_DIR
,
os_arch
)
os
.
makedirs
(
extract_dest
,
exist_ok
=
True
)
if
verbose
:
print
(
'Extracting "%s" to "%s"'
%
(
archive
,
extract_dest
))
with
ZipFileWithPermissions
(
archive
,
"r"
)
as
z
:
z
.
extractall
(
extract_dest
)
def
DownloadAndExtract
(
channel
,
version
,
os_name
,
arch
):
archive
=
DownloadDartSDK
(
channel
,
version
,
os_name
,
arch
)
def
DownloadAndExtract
(
channel
,
version
,
os_name
,
arch
,
verbose
):
archive
=
DownloadDartSDK
(
channel
,
version
,
os_name
,
arch
,
verbose
)
if
archive
==
None
:
return
1
if
archive
==
''
:
return
0
ExtractDartSDK
(
archive
,
os_name
,
arch
)
try
:
ExtractDartSDK
(
archive
,
os_name
,
arch
,
verbose
)
except
Exception
as
e
:
eprint
(
'Failed to extract Dart SDK archive:
\n
%s'
%
e
)
return
1
try
:
stamp_file
=
'{}.stamp'
.
format
(
archive
)
with
open
(
stamp_file
,
"w"
)
as
fd
:
...
...
@@ -157,13 +187,21 @@ def Main():
parser
.
add_argument
(
'--fail-loudly'
,
action
=
'store_true'
,
default
=
False
,
default
=
'LUCI_CONTEXT'
in
os
.
environ
,
help
=
"Return an error code if a prebuilt couldn't be fetched and extracted"
)
parser
.
add_argument
(
'--verbose'
,
action
=
'store_true'
,
default
=
'LUCI_CONTEXT'
in
os
.
environ
,
help
=
'Emit verbose output'
)
args
=
parser
.
parse_args
()
fail_loudly
=
1
if
args
.
fail_loudly
else
0
verbose
=
args
.
verbose
prebuilt_enabled
=
os
.
environ
.
get
(
FLUTTER_PREBUILTS_ENV_VAR
,
'false'
)
if
prebuilt_enabled
==
'0'
or
prebuilt_enabled
.
lower
()
==
'false'
:
if
verbose
:
print
(
'Skipping prebuild Dart SDK download.'
)
return
0
os
.
makedirs
(
FLUTTER_PREBUILTS_DIR
,
exist_ok
=
True
)
...
...
@@ -172,14 +210,20 @@ def Main():
# Dart SDK version.
version
=
utils
.
ReadVersionFile
()
if
version
==
None
:
eprint
(
'Failed to read the Dart VERSION file.'
)
return
fail_loudly
channel
=
version
.
channel
if
verbose
:
print
(
'Dart SDK channel = "%s".'
%
channel
)
# A short Dart SDK version string used in the download url.
if
channel
==
'be'
:
dart_git_rev
=
utils
.
GetGitRevision
()
semantic_version
=
'hash/{}'
.
format
(
dart_git_rev
)
semantic_version
=
utils
.
GetSemanticSDKVersion
()
else
:
semantic_version
=
utils
.
GetSemanticSDKVersion
()
if
verbose
:
print
(
'Semantic Dart SDK version = "%s".'
%
semantic_version
)
os_name
=
GuessOS
()
if
os_name
==
None
:
...
...
@@ -191,7 +235,7 @@ def Main():
# Download and extract variants in parallel
pool
=
multiprocessing
.
Pool
()
tasks
=
[(
channel
,
semantic_version
,
os_name
,
arch
)
for
arch
in
architectures
]
tasks
=
[(
channel
,
semantic_version
,
os_name
,
arch
,
verbose
)
for
arch
in
architectures
]
async_results
=
[
pool
.
apply_async
(
DownloadAndExtract
,
t
)
for
t
in
tasks
]
success
=
True
for
async_result
in
async_results
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录