Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
80a1cac4
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,发现更多精彩内容 >>
未验证
提交
80a1cac4
编写于
8月 28, 2020
作者:
N
nturgut
提交者:
GitHub
8月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix debugging issue (#20841)
上级
c1134e2b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
9 deletion
+70
-9
lib/web_ui/dev/environment.dart
lib/web_ui/dev/environment.dart
+6
-0
lib/web_ui/dev/test_runner.dart
lib/web_ui/dev/test_runner.dart
+64
-9
未找到文件。
lib/web_ui/dev/environment.dart
浏览文件 @
80a1cac4
...
...
@@ -156,6 +156,12 @@ class Environment {
'test'
,
));
/// Path to the "lib" directory containing web engine code.
io
.
Directory
get
webUiLibDir
=>
io
.
Directory
(
pathlib
.
join
(
webUiRootDir
.
path
,
'lib'
,
));
/// Path to the clone of the flutter/goldens repository.
io
.
Directory
get
webUiGoldensRepositoryDirectory
=>
io
.
Directory
(
pathlib
.
join
(
webUiDartToolDir
.
path
,
...
...
lib/web_ui/dev/test_runner.dart
浏览文件 @
80a1cac4
...
...
@@ -253,11 +253,44 @@ class TestCommand extends Command<bool> with ArgUtils {
targets:
canvasKitTargets
,
forCanvasKit:
true
);
}
// Copy image files from test/ to build/test/.
// A side effect is this file copies all the images even when only one
// target test is asked to run.
_copyFilesFromTestToBuid
();
_copyFilesFromLibToBuid
();
stopwatch
.
stop
();
print
(
'The build took
${stopwatch.elapsedMilliseconds ~/ 1000}
seconds.'
);
_cleanupExtraFilesUnderTestDir
();
}
/// Copy image files from test/ to build/test/.
///
/// By copying all the files helps with the following:
/// - Tests using on an asset/image are able to reach these files.
/// - Source maps can locate test files.
///
/// A side effect is this file copies all the images even when only one
/// target test is asked to run.
void
_copyFilesFromTestToBuid
()
{
final
List
<
io
.
FileSystemEntity
>
contents
=
environment
.
webUiTestDir
.
listSync
(
recursive:
true
);
_copyFiles
(
contents
);
}
/// Copy contents of /lib under /build.
///
/// Since the source map are created to assume library files are under
/// `../../../../lib/src/`. Unless these files are copied under /build,
/// they are not visible during debug.
///
/// This operation was handled by `build_runner` before we started using
/// plain `dart2js`.
void
_copyFilesFromLibToBuid
()
{
final
List
<
io
.
FileSystemEntity
>
contents
=
environment
.
webUiLibDir
.
listSync
(
recursive:
true
);
_copyFiles
(
contents
);
}
void
_copyFiles
(
List
<
io
.
FileSystemEntity
>
contents
)
{
contents
.
whereType
<
io
.
File
>().
forEach
((
final
io
.
File
entity
)
{
final
String
directoryPath
=
path
.
relative
(
path
.
dirname
(
entity
.
path
),
from:
environment
.
webUiRootDir
.
path
);
...
...
@@ -271,9 +304,20 @@ class TestCommand extends Command<bool> with ArgUtils {
entity
.
copySync
(
path
.
join
(
environment
.
webUiBuildDir
.
path
,
pathRelativeToWebUi
));
});
}
stopwatch
.
stop
();
print
(
'The build took
${stopwatch.elapsedMilliseconds ~/ 1000}
seconds.'
);
/// Dart2js initially run under /test directory.
///
/// The following files are copied under /build directory after that.
///
void
_cleanupExtraFilesUnderTestDir
()
{
final
List
<
io
.
FileSystemEntity
>
contents
=
environment
.
webUiTestDir
.
listSync
(
recursive:
true
);
contents
.
whereType
<
io
.
File
>().
forEach
((
final
io
.
File
entity
)
{
if
(
path
.
basename
(
entity
.
path
).
contains
(
'.browser_test.dart.js'
))
{
entity
.
deleteSync
();
}
});
}
/// Whether to start the browser in debug mode.
...
...
@@ -533,10 +577,21 @@ class TestCommand extends Command<bool> with ArgUtils {
///
/// When building for CanvasKit we have to use extra argument
/// `DFLUTTER_WEB_USE_SKIA=true`.
///
/// Dart2js creates the following outputs:
/// - target.browser_test.dart.js
/// - target.browser_test.dart.js.deps
/// - target.browser_test.dart.js.maps
/// under the same directory with test file. If all these files are not in
/// the same directory, Chrome dev tools cannot load the source code during
/// debug.
///
/// All the files under test already copied from /test directory to /build
/// directory before test are build. See [_copyFilesFromTestToBuid].
///
/// Later the extra files will be deleted in [_cleanupExtraFilesUnderTestDir].
Future
<
bool
>
_buildTest
(
TestBuildInput
input
)
async
{
final
targetFileName
=
'
${input.path.relativeToWebUi}
.browser_test.dart.js'
;
final
String
targetPath
=
path
.
join
(
'build'
,
targetFileName
);
final
targetFileName
=
'
${input.path.relativeToWebUi}
.browser_test.dart.js'
;
final
io
.
Directory
directoryToTarget
=
io
.
Directory
(
path
.
join
(
environment
.
webUiBuildDir
.
path
,
...
...
@@ -555,7 +610,7 @@ class TestCommand extends Command<bool> with ArgUtils {
if
(
input
.
forCanvasKit
)
'-DFLUTTER_WEB_USE_SKIA=true'
,
'-O2'
,
'-o'
,
target
Path
,
// target path.
target
FileName
,
// target path.
'
${input.path.relativeToWebUi}
'
,
// current path.
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录