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
7066cd7b
Unverified
Commit
7066cd7b
authored
Mar 06, 2018
by
Keerti Parthasarathy
Committed by
GitHub
Mar 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Add to Artifacts, and add optional arguments to entry points for flut… (#15185)" (#15210)
This reverts commit
e0f6e626
.
parent
e0f6e626
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
108 deletions
+64
-108
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+0
-7
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+0
-3
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+0
-7
compile.dart
packages/flutter_tools/lib/src/compile.dart
+19
-8
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+1
-3
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+1
-4
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+2
-12
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+41
-64
No files found.
packages/flutter_tools/lib/src/artifacts.dart
View file @
7066cd7b
...
@@ -26,7 +26,6 @@ enum Artifact {
...
@@ -26,7 +26,6 @@ enum Artifact {
flutterPatchedSdkPath
,
flutterPatchedSdkPath
,
frontendServerSnapshotForEngineDartSdk
,
frontendServerSnapshotForEngineDartSdk
,
engineDartSdkPath
,
engineDartSdkPath
,
engineDartBinary
,
}
}
String
_artifactToFileName
(
Artifact
artifact
)
{
String
_artifactToFileName
(
Artifact
artifact
)
{
...
@@ -58,8 +57,6 @@ String _artifactToFileName(Artifact artifact) {
...
@@ -58,8 +57,6 @@ String _artifactToFileName(Artifact artifact) {
return
'dart-sdk'
;
return
'dart-sdk'
;
case
Artifact
.
frontendServerSnapshotForEngineDartSdk
:
case
Artifact
.
frontendServerSnapshotForEngineDartSdk
:
return
'frontend_server.dart.snapshot'
;
return
'frontend_server.dart.snapshot'
;
case
Artifact
.
engineDartBinary
:
return
'dart'
;
}
}
assert
(
false
,
'Invalid artifact
$artifact
.'
);
assert
(
false
,
'Invalid artifact
$artifact
.'
);
return
null
;
return
null
;
...
@@ -173,8 +170,6 @@ class CachedArtifacts extends Artifacts {
...
@@ -173,8 +170,6 @@ class CachedArtifacts extends Artifacts {
return
fs
.
path
.
join
(
engineArtifactsPath
,
platformDirName
,
_artifactToFileName
(
artifact
));
return
fs
.
path
.
join
(
engineArtifactsPath
,
platformDirName
,
_artifactToFileName
(
artifact
));
case
Artifact
.
engineDartSdkPath
:
case
Artifact
.
engineDartSdkPath
:
return
dartSdkPath
;
return
dartSdkPath
;
case
Artifact
.
engineDartBinary
:
return
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
platformKernelDill
:
case
Artifact
.
platformKernelDill
:
return
fs
.
path
.
join
(
_getFlutterPatchedSdkPath
(),
_artifactToFileName
(
artifact
));
return
fs
.
path
.
join
(
_getFlutterPatchedSdkPath
(),
_artifactToFileName
(
artifact
));
case
Artifact
.
platformLibrariesJson
:
case
Artifact
.
platformLibrariesJson
:
...
@@ -257,8 +252,6 @@ class LocalEngineArtifacts extends Artifacts {
...
@@ -257,8 +252,6 @@ class LocalEngineArtifacts extends Artifacts {
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'gen'
,
_artifactToFileName
(
artifact
));
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'gen'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
engineDartSdkPath
:
case
Artifact
.
engineDartSdkPath
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
);
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
);
case
Artifact
.
engineDartBinary
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
,
'bin'
,
_artifactToFileName
(
artifact
));
}
}
assert
(
false
,
'Invalid artifact
$artifact
.'
);
assert
(
false
,
'Invalid artifact
$artifact
.'
);
return
null
;
return
null
;
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
7066cd7b
...
@@ -357,7 +357,6 @@ class AppDomain extends Domain {
...
@@ -357,7 +357,6 @@ class AppDomain extends Domain {
@required
bool
trackWidgetCreation
,
@required
bool
trackWidgetCreation
,
String
projectRootPath
,
String
projectRootPath
,
String
packagesFilePath
,
String
packagesFilePath
,
String
dillOutputPath
,
bool
ipv6:
false
,
bool
ipv6:
false
,
})
async
{
})
async
{
if
(
await
device
.
isLocalEmulator
&&
!
options
.
buildInfo
.
supportsEmulator
)
{
if
(
await
device
.
isLocalEmulator
&&
!
options
.
buildInfo
.
supportsEmulator
)
{
...
@@ -372,7 +371,6 @@ class AppDomain extends Domain {
...
@@ -372,7 +371,6 @@ class AppDomain extends Domain {
device
,
device
,
previewDart2:
options
.
buildInfo
.
previewDart2
,
previewDart2:
options
.
buildInfo
.
previewDart2
,
trackWidgetCreation:
trackWidgetCreation
,
trackWidgetCreation:
trackWidgetCreation
,
dillOutputPath:
dillOutputPath
,
);
);
ResidentRunner
runner
;
ResidentRunner
runner
;
...
@@ -386,7 +384,6 @@ class AppDomain extends Domain {
...
@@ -386,7 +384,6 @@ class AppDomain extends Domain {
applicationBinary:
applicationBinary
,
applicationBinary:
applicationBinary
,
projectRootPath:
projectRootPath
,
projectRootPath:
projectRootPath
,
packagesFilePath:
packagesFilePath
,
packagesFilePath:
packagesFilePath
,
dillOutputPath:
dillOutputPath
,
ipv6:
ipv6
,
ipv6:
ipv6
,
hostIsIde:
true
,
hostIsIde:
true
,
);
);
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
7066cd7b
...
@@ -147,10 +147,6 @@ class RunCommand extends RunCommandBase {
...
@@ -147,10 +147,6 @@ class RunCommand extends RunCommandBase {
'results out to "refresh_benchmark.json", and exit. This flag is
\n
'
'results out to "refresh_benchmark.json", and exit. This flag is
\n
'
'intended for use in generating automated flutter benchmarks.'
);
'intended for use in generating automated flutter benchmarks.'
);
argParser
.
addOption
(
'output-dill'
,
hide:
!
verboseHelp
,
help:
'Specify the path to frontend server output kernel file.'
);
argParser
.
addOption
(
FlutterOptions
.
kExtraFrontEndOptions
,
hide:
true
);
argParser
.
addOption
(
FlutterOptions
.
kExtraFrontEndOptions
,
hide:
true
);
argParser
.
addOption
(
FlutterOptions
.
kExtraGenSnapshotOptions
,
hide:
true
);
argParser
.
addOption
(
FlutterOptions
.
kExtraGenSnapshotOptions
,
hide:
true
);
}
}
...
@@ -266,7 +262,6 @@ class RunCommand extends RunCommandBase {
...
@@ -266,7 +262,6 @@ class RunCommand extends RunCommandBase {
trackWidgetCreation:
argResults
[
'track-widget-creation'
],
trackWidgetCreation:
argResults
[
'track-widget-creation'
],
projectRootPath:
argResults
[
'project-root'
],
projectRootPath:
argResults
[
'project-root'
],
packagesFilePath:
globalResults
[
'packages'
],
packagesFilePath:
globalResults
[
'packages'
],
dillOutputPath:
argResults
[
'output-dill'
],
ipv6:
ipv6
,
ipv6:
ipv6
,
);
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -306,7 +301,6 @@ class RunCommand extends RunCommandBase {
...
@@ -306,7 +301,6 @@ class RunCommand extends RunCommandBase {
device
,
device
,
previewDart2:
argResults
[
'preview-dart-2'
],
previewDart2:
argResults
[
'preview-dart-2'
],
trackWidgetCreation:
argResults
[
'track-widget-creation'
],
trackWidgetCreation:
argResults
[
'track-widget-creation'
],
dillOutputPath:
argResults
[
'output-dill'
],
);
);
}).
toList
();
}).
toList
();
...
@@ -320,7 +314,6 @@ class RunCommand extends RunCommandBase {
...
@@ -320,7 +314,6 @@ class RunCommand extends RunCommandBase {
applicationBinary:
argResults
[
'use-application-binary'
],
applicationBinary:
argResults
[
'use-application-binary'
],
projectRootPath:
argResults
[
'project-root'
],
projectRootPath:
argResults
[
'project-root'
],
packagesFilePath:
globalResults
[
'packages'
],
packagesFilePath:
globalResults
[
'packages'
],
dillOutputPath:
argResults
[
'output-dill'
],
stayResident:
stayResident
,
stayResident:
stayResident
,
ipv6:
ipv6
,
ipv6:
ipv6
,
);
);
...
...
packages/flutter_tools/lib/src/compile.dart
View file @
7066cd7b
...
@@ -8,10 +8,24 @@ import 'dart:convert';
...
@@ -8,10 +8,24 @@ import 'dart:convert';
import
'package:usage/uuid/uuid.dart'
;
import
'package:usage/uuid/uuid.dart'
;
import
'artifacts.dart'
;
import
'artifacts.dart'
;
import
'base/common.dart'
;
import
'base/file_system.dart'
;
import
'base/io.dart'
;
import
'base/io.dart'
;
import
'base/process_manager.dart'
;
import
'base/process_manager.dart'
;
import
'globals.dart'
;
import
'globals.dart'
;
String
_dartExecutable
(
)
{
final
String
engineDartSdkPath
=
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
);
if
(!
fs
.
isDirectorySync
(
engineDartSdkPath
))
{
throwToolExit
(
'No dart sdk Flutter host engine build found at
$engineDartSdkPath
.
\n
'
'Note that corresponding host engine build is required even when targeting particular device platforms.'
,
exitCode:
2
);
}
return
fs
.
path
.
join
(
engineDartSdkPath
,
'bin'
,
'dart'
);
}
class
_StdoutHandler
{
class
_StdoutHandler
{
_StdoutHandler
()
{
_StdoutHandler
()
{
reset
();
reset
();
...
@@ -60,7 +74,7 @@ Future<String> compile(
...
@@ -60,7 +74,7 @@ Future<String> compile(
if
(!
sdkRoot
.
endsWith
(
'/'
))
if
(!
sdkRoot
.
endsWith
(
'/'
))
sdkRoot
=
'
$sdkRoot
/'
;
sdkRoot
=
'
$sdkRoot
/'
;
final
List
<
String
>
command
=
<
String
>[
final
List
<
String
>
command
=
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
_dartExecutable
(
),
frontendServer
,
frontendServer
,
'--sdk-root'
,
'--sdk-root'
,
sdkRoot
,
sdkRoot
,
...
@@ -140,13 +154,13 @@ class ResidentCompiler {
...
@@ -140,13 +154,13 @@ class ResidentCompiler {
/// Binary file name is returned if compilation was successful, otherwise
/// Binary file name is returned if compilation was successful, otherwise
/// null is returned.
/// null is returned.
Future
<
String
>
recompile
(
String
mainPath
,
List
<
String
>
invalidatedFiles
,
Future
<
String
>
recompile
(
String
mainPath
,
List
<
String
>
invalidatedFiles
,
{
String
outputPath
,
String
packagesFilePath
})
async
{
{
String
outputPath
})
async
{
stdoutHandler
.
reset
();
stdoutHandler
.
reset
();
// First time recompile is called we actually have to compile the app from
// First time recompile is called we actually have to compile the app from
// scratch ignoring list of invalidated files.
// scratch ignoring list of invalidated files.
if
(
_server
==
null
)
if
(
_server
==
null
)
return
_compile
(
mainPath
,
outputPath
,
packagesFilePath
);
return
_compile
(
mainPath
,
outputPath
);
final
String
inputKey
=
new
Uuid
().
generateV4
();
final
String
inputKey
=
new
Uuid
().
generateV4
();
_server
.
stdin
.
writeln
(
'recompile
${mainPath != null ? mainPath + " ": ""}$inputKey
'
);
_server
.
stdin
.
writeln
(
'recompile
${mainPath != null ? mainPath + " ": ""}$inputKey
'
);
...
@@ -156,12 +170,12 @@ class ResidentCompiler {
...
@@ -156,12 +170,12 @@ class ResidentCompiler {
return
stdoutHandler
.
outputFilename
.
future
;
return
stdoutHandler
.
outputFilename
.
future
;
}
}
Future
<
String
>
_compile
(
String
scriptFilename
,
String
outputPath
,
String
packagesFilePath
)
async
{
Future
<
String
>
_compile
(
String
scriptFilename
,
String
outputPath
)
async
{
final
String
frontendServer
=
artifacts
.
getArtifactPath
(
final
String
frontendServer
=
artifacts
.
getArtifactPath
(
Artifact
.
frontendServerSnapshotForEngineDartSdk
Artifact
.
frontendServerSnapshotForEngineDartSdk
);
);
final
List
<
String
>
args
=
<
String
>[
final
List
<
String
>
args
=
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
_dartExecutable
(
),
frontendServer
,
frontendServer
,
'--sdk-root'
,
'--sdk-root'
,
_sdkRoot
,
_sdkRoot
,
...
@@ -172,9 +186,6 @@ class ResidentCompiler {
...
@@ -172,9 +186,6 @@ class ResidentCompiler {
if
(
outputPath
!=
null
)
{
if
(
outputPath
!=
null
)
{
args
.
addAll
(<
String
>[
'--output-dill'
,
outputPath
]);
args
.
addAll
(<
String
>[
'--output-dill'
,
outputPath
]);
}
}
if
(
packagesFilePath
!=
null
)
{
args
.
addAll
(<
String
>[
'--packages'
,
packagesFilePath
]);
}
if
(
_trackWidgetCreation
)
{
if
(
_trackWidgetCreation
)
{
args
.
add
(
'--track-widget-creation'
);
args
.
add
(
'--track-widget-creation'
);
}
}
...
...
packages/flutter_tools/lib/src/devfs.dart
View file @
7066cd7b
...
@@ -407,7 +407,6 @@ class DevFS {
...
@@ -407,7 +407,6 @@ class DevFS {
bool
bundleDirty:
false
,
bool
bundleDirty:
false
,
Set
<
String
>
fileFilter
,
Set
<
String
>
fileFilter
,
ResidentCompiler
generator
,
ResidentCompiler
generator
,
String
dillOutputPath
,
bool
fullRestart:
false
,
bool
fullRestart:
false
,
})
async
{
})
async
{
// Mark all entries as possibly deleted.
// Mark all entries as possibly deleted.
...
@@ -501,8 +500,7 @@ class DevFS {
...
@@ -501,8 +500,7 @@ class DevFS {
}
}
final
String
compiledBinary
=
final
String
compiledBinary
=
await
generator
.
recompile
(
mainPath
,
invalidatedFiles
,
await
generator
.
recompile
(
mainPath
,
invalidatedFiles
,
outputPath:
dillOutputPath
??
fs
.
path
.
join
(
getBuildDirectory
(),
'app.dill'
),
outputPath:
fs
.
path
.
join
(
getBuildDirectory
(),
'app.dill'
));
packagesFilePath
:
_packagesFilePath
);
if
(
compiledBinary
!=
null
&&
compiledBinary
.
isNotEmpty
)
if
(
compiledBinary
!=
null
&&
compiledBinary
.
isNotEmpty
)
dirtyEntries
.
putIfAbsent
(
dirtyEntries
.
putIfAbsent
(
Uri
.
parse
(
target
+
'.dill'
),
Uri
.
parse
(
target
+
'.dill'
),
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
7066cd7b
...
@@ -35,14 +35,12 @@ class FlutterDevice {
...
@@ -35,14 +35,12 @@ class FlutterDevice {
DevFS
devFS
;
DevFS
devFS
;
ApplicationPackage
package
;
ApplicationPackage
package
;
ResidentCompiler
generator
;
ResidentCompiler
generator
;
String
dillOutputPath
;
StreamSubscription
<
String
>
_loggingSubscription
;
StreamSubscription
<
String
>
_loggingSubscription
;
FlutterDevice
(
this
.
device
,
{
FlutterDevice
(
this
.
device
,
{
@required
bool
previewDart2
,
@required
bool
previewDart2
,
@required
bool
trackWidgetCreation
,
@required
bool
trackWidgetCreation
,
this
.
dillOutputPath
,
})
{
})
{
if
(
previewDart2
)
{
if
(
previewDart2
)
{
generator
=
new
ResidentCompiler
(
generator
=
new
ResidentCompiler
(
...
@@ -388,8 +386,7 @@ class FlutterDevice {
...
@@ -388,8 +386,7 @@ class FlutterDevice {
bundleDirty:
bundleDirty
,
bundleDirty:
bundleDirty
,
fileFilter:
fileFilter
,
fileFilter:
fileFilter
,
generator:
generator
,
generator:
generator
,
fullRestart:
fullRestart
,
fullRestart:
fullRestart
dillOutputPath:
dillOutputPath
,
);
);
}
on
DevFSException
{
}
on
DevFSException
{
devFSStatus
.
cancel
();
devFSStatus
.
cancel
();
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
7066cd7b
...
@@ -42,7 +42,6 @@ class HotRunner extends ResidentRunner {
...
@@ -42,7 +42,6 @@ class HotRunner extends ResidentRunner {
this
.
hostIsIde
:
false
,
this
.
hostIsIde
:
false
,
String
projectRootPath
,
String
projectRootPath
,
String
packagesFilePath
,
String
packagesFilePath
,
this
.
dillOutputPath
,
bool
stayResident:
true
,
bool
stayResident:
true
,
bool
ipv6:
false
,
bool
ipv6:
false
,
})
:
super
(
devices
,
})
:
super
(
devices
,
...
@@ -58,7 +57,6 @@ class HotRunner extends ResidentRunner {
...
@@ -58,7 +57,6 @@ class HotRunner extends ResidentRunner {
final
String
applicationBinary
;
final
String
applicationBinary
;
final
bool
hostIsIde
;
final
bool
hostIsIde
;
Set
<
String
>
_dartDependencies
;
Set
<
String
>
_dartDependencies
;
final
String
dillOutputPath
;
final
Map
<
String
,
List
<
int
>>
benchmarkData
=
<
String
,
List
<
int
>>{};
final
Map
<
String
,
List
<
int
>>
benchmarkData
=
<
String
,
List
<
int
>>{};
// The initial launch is from a snapshot.
// The initial launch is from a snapshot.
...
@@ -336,12 +334,7 @@ class HotRunner extends ResidentRunner {
...
@@ -336,12 +334,7 @@ class HotRunner extends ResidentRunner {
for
(
FlutterDevice
device
in
flutterDevices
)
{
for
(
FlutterDevice
device
in
flutterDevices
)
{
final
Uri
deviceEntryUri
=
device
.
devFS
.
baseUri
.
resolveUri
(
final
Uri
deviceEntryUri
=
device
.
devFS
.
baseUri
.
resolveUri
(
fs
.
path
.
toUri
(
entryUri
));
fs
.
path
.
toUri
(
entryUri
));
Uri
devicePackagesUri
;
final
Uri
devicePackagesUri
=
device
.
devFS
.
baseUri
.
resolve
(
'.packages'
);
if
(
packagesFilePath
!=
null
)
{
devicePackagesUri
=
fs
.
path
.
toUri
(
packagesFilePath
);
}
else
{
devicePackagesUri
=
device
.
devFS
.
baseUri
.
resolve
(
'.packages'
);
}
final
Uri
deviceAssetsDirectoryUri
=
device
.
devFS
.
baseUri
.
resolveUri
(
final
Uri
deviceAssetsDirectoryUri
=
device
.
devFS
.
baseUri
.
resolveUri
(
fs
.
path
.
toUri
(
getAssetBuildDirectory
()));
fs
.
path
.
toUri
(
getAssetBuildDirectory
()));
await
_launchInView
(
device
,
await
_launchInView
(
device
,
...
@@ -396,10 +389,7 @@ class HotRunner extends ResidentRunner {
...
@@ -396,10 +389,7 @@ class HotRunner extends ResidentRunner {
}
}
// We are now running from source.
// We are now running from source.
_runningFromSnapshot
=
false
;
_runningFromSnapshot
=
false
;
final
String
launchPath
=
debuggingOptions
.
buildInfo
.
previewDart2
await
_launchFromDevFS
(
debuggingOptions
.
buildInfo
.
previewDart2
?
mainPath
+
'.dill'
:
mainPath
);
?
dillOutputPath
??
mainPath
+
'.dill'
:
mainPath
;
await
_launchFromDevFS
(
launchPath
);
restartTimer
.
stop
();
restartTimer
.
stop
();
printTrace
(
'Restart performed in '
printTrace
(
'Restart performed in '
'
${getElapsedAsMilliseconds(restartTimer.elapsed)}
.'
);
'
${getElapsedAsMilliseconds(restartTimer.elapsed)}
.'
);
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
7066cd7b
...
@@ -59,8 +59,6 @@ void installHook({
...
@@ -59,8 +59,6 @@ void installHook({
bool
machine:
false
,
bool
machine:
false
,
bool
startPaused:
false
,
bool
startPaused:
false
,
bool
previewDart2:
false
,
bool
previewDart2:
false
,
int
port:
0
,
String
dillFilePath
,
int
observatoryPort
,
int
observatoryPort
,
InternetAddressType
serverType:
InternetAddressType
.
IP_V4
,
InternetAddressType
serverType:
InternetAddressType
.
IP_V4
,
})
{
})
{
...
@@ -77,8 +75,6 @@ void installHook({
...
@@ -77,8 +75,6 @@ void installHook({
explicitObservatoryPort:
observatoryPort
,
explicitObservatoryPort:
observatoryPort
,
host:
_kHosts
[
serverType
],
host:
_kHosts
[
serverType
],
previewDart2:
previewDart2
,
previewDart2:
previewDart2
,
port:
port
,
dillFilePath:
dillFilePath
,
),
),
);
);
}
}
...
@@ -104,8 +100,6 @@ class _FlutterPlatform extends PlatformPlugin {
...
@@ -104,8 +100,6 @@ class _FlutterPlatform extends PlatformPlugin {
this
.
explicitObservatoryPort
,
this
.
explicitObservatoryPort
,
this
.
host
,
this
.
host
,
this
.
previewDart2
,
this
.
previewDart2
,
this
.
port
,
this
.
dillFilePath
,
})
:
assert
(
shellPath
!=
null
)
{
})
:
assert
(
shellPath
!=
null
)
{
compilerController
.
stream
.
listen
((
CompilationRequest
request
)
async
{
compilerController
.
stream
.
listen
((
CompilationRequest
request
)
async
{
final
bool
isEmpty
=
compilationQueue
.
isEmpty
;
final
bool
isEmpty
=
compilationQueue
.
isEmpty
;
...
@@ -139,8 +133,6 @@ class _FlutterPlatform extends PlatformPlugin {
...
@@ -139,8 +133,6 @@ class _FlutterPlatform extends PlatformPlugin {
final
int
explicitObservatoryPort
;
final
int
explicitObservatoryPort
;
final
InternetAddress
host
;
final
InternetAddress
host
;
final
bool
previewDart2
;
final
bool
previewDart2
;
final
int
port
;
final
String
dillFilePath
;
final
StreamController
<
CompilationRequest
>
compilerController
=
final
StreamController
<
CompilationRequest
>
compilerController
=
new
StreamController
<
CompilationRequest
>();
new
StreamController
<
CompilationRequest
>();
ResidentCompiler
compiler
=
ResidentCompiler
compiler
=
...
@@ -201,7 +193,7 @@ class _FlutterPlatform extends PlatformPlugin {
...
@@ -201,7 +193,7 @@ class _FlutterPlatform extends PlatformPlugin {
controller
.
sink
.
done
.
whenComplete
(()
{
controllerSinkClosed
=
true
;
});
// ignore: unawaited_futures
controller
.
sink
.
done
.
whenComplete
(()
{
controllerSinkClosed
=
true
;
});
// ignore: unawaited_futures
// Prepare our WebSocket server to talk to the engine subproces.
// Prepare our WebSocket server to talk to the engine subproces.
final
HttpServer
server
=
await
HttpServer
.
bind
(
host
,
port
);
final
HttpServer
server
=
await
HttpServer
.
bind
(
host
,
0
);
finalizers
.
add
(()
async
{
finalizers
.
add
(()
async
{
printTrace
(
'test
$ourTestCount
: shutting down test harness socket server'
);
printTrace
(
'test
$ourTestCount
: shutting down test harness socket server'
);
await
server
.
close
(
force:
true
);
await
server
.
close
(
force:
true
);
...
@@ -226,41 +218,33 @@ class _FlutterPlatform extends PlatformPlugin {
...
@@ -226,41 +218,33 @@ class _FlutterPlatform extends PlatformPlugin {
);
);
// Prepare a temporary directory to store the Dart file that will talk to us.
// Prepare a temporary directory to store the Dart file that will talk to us.
// If a kernel file is given, then use that to launch the test.
final
Directory
temporaryDirectory
=
fs
.
systemTempDirectory
.
createTempSync
(
'dart_test_listener'
);
File
listenerFile
;
if
(
dillFilePath
==
null
)
{
final
Directory
temporaryDirectory
=
fs
.
systemTempDirectory
.
createTempSync
(
'dart_test_listener'
);
finalizers
.
add
(()
async
{
finalizers
.
add
(()
async
{
printTrace
(
'test
$ourTestCount
: deleting temporary directory'
);
printTrace
(
'test
$ourTestCount
: deleting temporary directory'
);
temporaryDirectory
.
deleteSync
(
recursive:
true
);
temporaryDirectory
.
deleteSync
(
recursive:
true
);
});
});
// Prepare the Dart file that will talk to us and start the test.
// Prepare the Dart file that will talk to us and start the test.
listenerFile
=
fs
.
file
(
final
File
listenerFile
=
fs
.
file
(
'
${temporaryDirectory.path}
/listener.dart'
);
'
${temporaryDirectory.path}
/listener.dart'
);
listenerFile
.
createSync
();
listenerFile
.
createSync
();
listenerFile
.
writeAsStringSync
(
_generateTestMain
(
listenerFile
.
writeAsStringSync
(
_generateTestMain
(
testUrl:
fs
.
path
.
toUri
(
fs
.
path
.
absolute
(
testPath
)).
toString
(),
testUrl:
fs
.
path
.
toUri
(
fs
.
path
.
absolute
(
testPath
)).
toString
(),
encodedWebsocketUrl:
Uri
.
encodeComponent
(
_getWebSocketUrl
(
server
)),
encodedWebsocketUrl:
Uri
.
encodeComponent
(
_getWebSocketUrl
(
server
)),
));
));
}
// Start the engine subprocess.
// Start the engine subprocess.
printTrace
(
'test
$ourTestCount
: starting shell process
${previewDart2? " in preview-dart-2 mode":""}
'
);
printTrace
(
'test
$ourTestCount
: starting shell process
${previewDart2? " in preview-dart-2 mode":""}
'
);
String
mainDart
=
listenerFile
?.
path
??
testP
ath
;
String
mainDart
=
listenerFile
.
p
ath
;
String
bundlePath
;
String
bundlePath
;
if
(
previewDart2
)
{
if
(
previewDart2
)
{
if
(
dillFilePath
==
null
)
{
final
Completer
<
String
>
completer
=
new
Completer
<
String
>();
final
Completer
<
String
>
completer
=
new
Completer
<
String
>();
compilerController
.
add
(
compilerController
.
add
(
new
CompilationRequest
(
listenerFile
.
path
,
completer
));
new
CompilationRequest
(
listenerFile
.
path
,
completer
));
mainDart
=
await
completer
.
future
;
mainDart
=
await
completer
.
future
;
if
(
mainDart
==
null
)
{
if
(
mainDart
==
null
)
{
controller
.
sink
.
addError
(
controller
.
sink
.
addError
(
_getErrorMessage
(
'Compilation failed'
,
testPath
,
shellPath
));
_getErrorMessage
(
'Compilation failed'
,
testPath
,
shellPath
));
return
null
;
return
null
;
}
}
...
@@ -268,8 +252,7 @@ class _FlutterPlatform extends PlatformPlugin {
...
@@ -268,8 +252,7 @@ class _FlutterPlatform extends PlatformPlugin {
final
Directory
tempBundleDirectory
=
fs
.
systemTempDirectory
final
Directory
tempBundleDirectory
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_bundle_directory'
);
.
createTempSync
(
'flutter_bundle_directory'
);
finalizers
.
add
(()
async
{
finalizers
.
add
(()
async
{
printTrace
(
printTrace
(
'test
$ourTestCount
: deleting temporary bundle directory'
);
'test
$ourTestCount
: deleting temporary bundle directory'
);
tempBundleDirectory
.
deleteSync
(
recursive:
true
);
tempBundleDirectory
.
deleteSync
(
recursive:
true
);
});
});
...
@@ -278,19 +261,13 @@ class _FlutterPlatform extends PlatformPlugin {
...
@@ -278,19 +261,13 @@ class _FlutterPlatform extends PlatformPlugin {
artifacts
.
getArtifactPath
(
Artifact
.
platformKernelDill
),
artifacts
.
getArtifactPath
(
Artifact
.
platformKernelDill
),
);
);
final
File
platformDill
=
vmPlatformStrongDill
.
copySync
(
final
File
platformDill
=
vmPlatformStrongDill
.
copySync
(
tempBundleDirectory
tempBundleDirectory
.
childFile
(
'platform.dill'
).
path
,
.
childFile
(
'platform.dill'
)
.
path
,
);
);
if
(!
platformDill
.
existsSync
())
{
if
(!
platformDill
.
existsSync
())
{
printError
(
'unexpected error copying platform kernel file'
);
printError
(
'unexpected error copying platform kernel file'
);
}
}
bundlePath
=
tempBundleDirectory
.
path
;
bundlePath
=
tempBundleDirectory
.
path
;
}
else
{
mainDart
=
dillFilePath
;
bundlePath
=
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
);
}
}
}
final
Process
process
=
await
_startProcess
(
final
Process
process
=
await
_startProcess
(
...
...
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