Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
cd65903f
Unverified
Commit
cd65903f
authored
Sep 04, 2018
by
jensjoha
Committed by
GitHub
Sep 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initialize from dill on tests (#20414)
parent
23690876
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
7 deletions
+34
-7
compile.dart
packages/flutter_tools/lib/src/compile.dart
+8
-2
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+25
-5
runner.dart
packages/flutter_tools/lib/src/test/runner.dart
+1
-0
No files found.
packages/flutter_tools/lib/src/compile.dart
View file @
cd65903f
...
...
@@ -248,14 +248,16 @@ class _CompileExpressionRequest extends _CompilationRequest {
class
ResidentCompiler
{
ResidentCompiler
(
this
.
_sdkRoot
,
{
bool
trackWidgetCreation
=
false
,
String
packagesPath
,
List
<
String
>
fileSystemRoots
,
String
fileSystemScheme
,
CompilerMessageConsumer
compilerMessageConsumer
=
printError
})
CompilerMessageConsumer
compilerMessageConsumer
=
printError
,
String
initializeFromDill
})
:
assert
(
_sdkRoot
!=
null
),
_trackWidgetCreation
=
trackWidgetCreation
,
_packagesPath
=
packagesPath
,
_fileSystemRoots
=
fileSystemRoots
,
_fileSystemScheme
=
fileSystemScheme
,
_stdoutHandler
=
new
_StdoutHandler
(
consumer:
compilerMessageConsumer
),
_controller
=
new
StreamController
<
_CompilationRequest
>()
{
_controller
=
new
StreamController
<
_CompilationRequest
>(),
_initializeFromDill
=
initializeFromDill
{
// This is a URI, not a file path, so the forward slash is correct even on Windows.
if
(!
_sdkRoot
.
endsWith
(
'/'
))
_sdkRoot
=
'
$_sdkRoot
/'
;
...
...
@@ -268,6 +270,7 @@ class ResidentCompiler {
String
_sdkRoot
;
Process
_server
;
final
_StdoutHandler
_stdoutHandler
;
String
_initializeFromDill
;
final
StreamController
<
_CompilationRequest
>
_controller
;
...
...
@@ -362,6 +365,9 @@ class ResidentCompiler {
if
(
_fileSystemScheme
!=
null
)
{
command
.
addAll
(<
String
>[
'--filesystem-scheme'
,
_fileSystemScheme
]);
}
if
(
_initializeFromDill
!=
null
)
{
command
.
addAll
(<
String
>[
'--initialize-from-dill'
,
_initializeFromDill
]);
}
printTrace
(
command
.
join
(
' '
));
_server
=
await
processManager
.
start
(
command
);
_server
.
stdout
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
cd65903f
...
...
@@ -18,6 +18,7 @@ import '../base/common.dart';
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/process_manager.dart'
;
import
'../build_info.dart'
;
import
'../compile.dart'
;
import
'../dart/package_map.dart'
;
import
'../globals.dart'
;
...
...
@@ -74,6 +75,7 @@ void installHook({
bool
updateGoldens
=
false
,
int
observatoryPort
,
InternetAddressType
serverType
=
InternetAddressType
.
IPv4
,
Uri
projectRootDirectory
,
})
{
assert
(!
enableObservatory
||
(!
startPaused
&&
observatoryPort
==
null
));
hack
.
registerPlatformPlugin
(
...
...
@@ -91,6 +93,7 @@ void installHook({
precompiledDillPath:
precompiledDillPath
,
trackWidgetCreation:
trackWidgetCreation
,
updateGoldens:
updateGoldens
,
projectRootDirectory:
projectRootDirectory
,
),
);
}
...
...
@@ -198,7 +201,7 @@ class _CompilationRequest {
// This class is a wrapper around compiler that allows multiple isolates to
// enqueue compilation requests, but ensures only one compilation at a time.
class
_Compiler
{
_Compiler
(
bool
trackWidgetCreation
)
{
_Compiler
(
bool
trackWidgetCreation
,
Uri
projectRootDirectory
)
{
// Compiler maintains and updates single incremental dill file.
// Incremental compilation requests done for each test copy that file away
// for independent execution.
...
...
@@ -223,12 +226,15 @@ class _Compiler {
printError
(
'
$message
'
);
}
final
String
testFilePath
=
fs
.
path
.
join
(
fs
.
path
.
fromUri
(
projectRootDirectory
),
getBuildDirectory
(),
'testfile.dill'
);
ResidentCompiler
createCompiler
()
{
return
new
ResidentCompiler
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
),
packagesPath:
PackageMap
.
globalPackagesPath
,
trackWidgetCreation:
trackWidgetCreation
,
compilerMessageConsumer:
reportCompilerMessage
,
initializeFromDill:
testFilePath
);
}
...
...
@@ -244,7 +250,11 @@ class _Compiler {
final
_CompilationRequest
request
=
compilationQueue
.
first
;
printTrace
(
'Compiling
${request.path}
'
);
final
Stopwatch
compilerTime
=
new
Stopwatch
()..
start
();
compiler
??=
createCompiler
();
bool
firstCompile
=
false
;
if
(
compiler
==
null
)
{
compiler
=
createCompiler
();
firstCompile
=
true
;
}
suppressOutput
=
false
;
final
CompilerOutput
compilerOutput
=
await
handleTimeout
<
CompilerOutput
>(
compiler
.
recompile
(
...
...
@@ -262,8 +272,16 @@ class _Compiler {
request
.
result
.
complete
(
null
);
await
_shutdown
();
}
else
{
final
File
kernelReadyToRun
=
await
fs
.
file
(
outputPath
).
copy
(
'
${request.path}
.dill'
);
final
File
outputFile
=
fs
.
file
(
outputPath
);
final
File
kernelReadyToRun
=
await
outputFile
.
copy
(
'
${request.path}
.dill'
);
final
File
testCache
=
fs
.
file
(
testFilePath
);
if
(
firstCompile
||
!
testCache
.
existsSync
()
||
(
testCache
.
lengthSync
()
<
outputFile
.
lengthSync
()))
{
// The idea is to keep the cache file up-to-date and include as
// much as possible in an effort to re-use as many packages as
// possible.
ensureDirectoryExists
(
testFilePath
);
await
outputFile
.
copy
(
testFilePath
);
}
request
.
result
.
complete
(
kernelReadyToRun
.
path
);
compiler
.
accept
();
compiler
.
reset
();
...
...
@@ -326,6 +344,7 @@ class _FlutterPlatform extends PlatformPlugin {
this
.
precompiledDillPath
,
this
.
trackWidgetCreation
,
this
.
updateGoldens
,
this
.
projectRootDirectory
,
})
:
assert
(
shellPath
!=
null
);
final
String
shellPath
;
...
...
@@ -340,6 +359,7 @@ class _FlutterPlatform extends PlatformPlugin {
final
String
precompiledDillPath
;
final
bool
trackWidgetCreation
;
final
bool
updateGoldens
;
final
Uri
projectRootDirectory
;
Directory
fontsDirectory
;
_Compiler
compiler
;
...
...
@@ -437,7 +457,7 @@ class _FlutterPlatform extends PlatformPlugin {
if
(
previewDart2
&&
precompiledDillPath
==
null
)
{
// Lazily instantiate compiler so it is built only if it is actually used.
compiler
??=
new
_Compiler
(
trackWidgetCreation
);
compiler
??=
new
_Compiler
(
trackWidgetCreation
,
projectRootDirectory
);
mainDart
=
await
compiler
.
compile
(
mainDart
);
if
(
mainDart
==
null
)
{
...
...
packages/flutter_tools/lib/src/test/runner.dart
View file @
cd65903f
...
...
@@ -87,6 +87,7 @@ Future<int> runTests(
precompiledDillPath:
precompiledDillPath
,
trackWidgetCreation:
trackWidgetCreation
,
updateGoldens:
updateGoldens
,
projectRootDirectory:
fs
.
currentDirectory
.
uri
,
);
// Make the global packages path absolute.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment