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
b0864737
Unverified
Commit
b0864737
authored
Apr 11, 2022
by
Danny Tuppeny
Committed by
GitHub
Apr 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass multidex flag when using --machine mode (#101689)
parent
2302daa3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
17 deletions
+141
-17
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+11
-7
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+17
-10
run_test.dart
.../flutter_tools/test/commands.shard/hermetic/run_test.dart
+113
-0
No files found.
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
b0864737
...
...
@@ -157,12 +157,12 @@ class Daemon {
this
.
logToStdout
=
false
,
})
{
// Set up domains.
_
registerDomain
(
daemonDomain
=
DaemonDomain
(
this
));
_
registerDomain
(
appDomain
=
AppDomain
(
this
));
_
registerDomain
(
deviceDomain
=
DeviceDomain
(
this
));
_
registerDomain
(
emulatorDomain
=
EmulatorDomain
(
this
));
_
registerDomain
(
devToolsDomain
=
DevToolsDomain
(
this
));
_
registerDomain
(
proxyDomain
=
ProxyDomain
(
this
));
registerDomain
(
daemonDomain
=
DaemonDomain
(
this
));
registerDomain
(
appDomain
=
AppDomain
(
this
));
registerDomain
(
deviceDomain
=
DeviceDomain
(
this
));
registerDomain
(
emulatorDomain
=
EmulatorDomain
(
this
));
registerDomain
(
devToolsDomain
=
DevToolsDomain
(
this
));
registerDomain
(
proxyDomain
=
ProxyDomain
(
this
));
// Start listening.
_commandSubscription
=
connection
.
incomingCommands
.
listen
(
...
...
@@ -192,7 +192,8 @@ class Daemon {
final
Completer
<
int
>
_onExitCompleter
=
Completer
<
int
>();
final
Map
<
String
,
Domain
>
_domainMap
=
<
String
,
Domain
>{};
void
_registerDomain
(
Domain
domain
)
{
@visibleForTesting
void
registerDomain
(
Domain
domain
)
{
_domainMap
[
domain
.
name
]
=
domain
;
}
...
...
@@ -496,6 +497,7 @@ class AppDomain extends Domain {
String
packagesFilePath
,
String
dillOutputPath
,
bool
ipv6
=
false
,
bool
multidexEnabled
=
false
,
String
isolateFilter
,
bool
machine
=
true
,
})
async
{
...
...
@@ -544,6 +546,7 @@ class AppDomain extends Domain {
projectRootPath:
projectRootPath
,
dillOutputPath:
dillOutputPath
,
ipv6:
ipv6
,
multidexEnabled:
multidexEnabled
,
hostIsIde:
true
,
machine:
machine
,
);
...
...
@@ -554,6 +557,7 @@ class AppDomain extends Domain {
debuggingOptions:
options
,
applicationBinary:
applicationBinary
,
ipv6:
ipv6
,
multidexEnabled:
multidexEnabled
,
machine:
machine
,
);
}
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
b0864737
...
...
@@ -551,6 +551,21 @@ class RunCommand extends RunCommandBase {
);
}
@visibleForTesting
Daemon
createMachineDaemon
()
{
final
Daemon
daemon
=
Daemon
(
DaemonConnection
(
daemonStreams:
DaemonStreams
.
fromStdio
(
globals
.
stdio
,
logger:
globals
.
logger
),
logger:
globals
.
logger
,
),
notifyingLogger:
(
globals
.
logger
is
NotifyingLogger
)
?
globals
.
logger
as
NotifyingLogger
:
NotifyingLogger
(
verbose:
globals
.
logger
.
isVerbose
,
parent:
globals
.
logger
),
logToStdout:
true
,
);
return
daemon
;
}
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
// Enable hot mode by default if `--no-hot` was not passed and we are in
...
...
@@ -563,16 +578,7 @@ class RunCommand extends RunCommandBase {
if
(
devices
.
length
>
1
)
{
throwToolExit
(
'"--machine" does not support "-d all".'
);
}
final
Daemon
daemon
=
Daemon
(
DaemonConnection
(
daemonStreams:
DaemonStreams
.
fromStdio
(
globals
.
stdio
,
logger:
globals
.
logger
),
logger:
globals
.
logger
,
),
notifyingLogger:
(
globals
.
logger
is
NotifyingLogger
)
?
globals
.
logger
as
NotifyingLogger
:
NotifyingLogger
(
verbose:
globals
.
logger
.
isVerbose
,
parent:
globals
.
logger
),
logToStdout:
true
,
);
final
Daemon
daemon
=
createMachineDaemon
();
AppInstance
app
;
try
{
app
=
await
daemon
.
appDomain
.
startApp
(
...
...
@@ -586,6 +592,7 @@ class RunCommand extends RunCommandBase {
packagesFilePath:
globalResults
[
'packages'
]
as
String
,
dillOutputPath:
stringArg
(
'output-dill'
),
ipv6:
ipv6
,
multidexEnabled:
boolArg
(
'multidex'
),
);
}
on
Exception
catch
(
error
)
{
throwToolExit
(
error
.
toString
());
...
...
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
View file @
b0864737
...
...
@@ -26,6 +26,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import
'package:flutter_tools/src/base/user_messages.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/daemon.dart'
;
import
'package:flutter_tools/src/commands/run.dart'
;
import
'package:flutter_tools/src/devfs.dart'
;
import
'package:flutter_tools/src/device.dart'
;
...
...
@@ -405,6 +406,67 @@ void main() {
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Usage:
()
=>
usage
,
});
group
(
'--machine'
,
()
{
testUsingContext
(
'enables multidex by default'
,
()
async
{
final
DaemonCapturingRunCommand
command
=
DaemonCapturingRunCommand
();
final
FakeDevice
device
=
FakeDevice
();
mockDeviceManager
..
devices
=
<
Device
>[
device
]
..
targetDevices
=
<
Device
>[
device
];
await
expectLater
(
()
=>
createTestCommandRunner
(
command
).
run
(<
String
>[
'run'
,
'--no-pub'
,
'--machine'
,
'-d'
,
device
.
id
,
]),
throwsToolExit
(),
);
expect
(
command
.
appDomain
.
multidexEnabled
,
isTrue
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
artifacts
,
Cache:
()
=>
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()),
DeviceManager:
()
=>
mockDeviceManager
,
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Usage:
()
=>
usage
,
Stdio:
()
=>
FakeStdio
(),
Logger:
()
=>
AppRunLogger
(
parent:
BufferLogger
.
test
()),
});
testUsingContext
(
'can disable multidex with --no-multidex'
,
()
async
{
final
DaemonCapturingRunCommand
command
=
DaemonCapturingRunCommand
();
final
FakeDevice
device
=
FakeDevice
();
mockDeviceManager
..
devices
=
<
Device
>[
device
]
..
targetDevices
=
<
Device
>[
device
];
await
expectLater
(
()
=>
createTestCommandRunner
(
command
).
run
(<
String
>[
'run'
,
'--no-pub'
,
'--no-multidex'
,
'--machine'
,
'-d'
,
device
.
id
,
]),
throwsToolExit
(),
);
expect
(
command
.
appDomain
.
multidexEnabled
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
artifacts
,
Cache:
()
=>
Cache
.
test
(
processManager:
FakeProcessManager
.
any
()),
DeviceManager:
()
=>
mockDeviceManager
,
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Usage:
()
=>
usage
,
Stdio:
()
=>
FakeStdio
(),
Logger:
()
=>
AppRunLogger
(
parent:
BufferLogger
.
test
()),
});
});
});
group
(
'Fatal Logs'
,
()
{
...
...
@@ -687,6 +749,13 @@ class FakeDeviceManager extends Fake implements DeviceManager {
return
targetDevices
;
}
@override
List
<
DeviceDiscovery
>
get
deviceDiscoverers
{
final
FakePollingDeviceDiscovery
discoverer
=
FakePollingDeviceDiscovery
();
devices
.
forEach
(
discoverer
.
addDevice
);
return
<
DeviceDiscovery
>[
discoverer
];
}
@override
Future
<
List
<
Device
>>
getAllConnectedDevices
()
async
=>
devices
;
}
...
...
@@ -739,6 +808,9 @@ class FakeDevice extends Fake implements Device {
@override
bool
supportsHotReload
=
false
;
@override
bool
get
supportsHotRestart
=>
true
;
@override
bool
get
supportsFastStart
=>
false
;
...
...
@@ -858,3 +930,44 @@ class FakeResidentRunner extends Fake implements ResidentRunner {
return
0
;
}
}
class
DaemonCapturingRunCommand
extends
RunCommand
{
/*late*/
Daemon
daemon
;
/*late*/
CapturingAppDomain
appDomain
;
@override
Daemon
createMachineDaemon
()
{
daemon
=
super
.
createMachineDaemon
();
appDomain
=
daemon
.
appDomain
=
CapturingAppDomain
(
daemon
);
daemon
.
registerDomain
(
appDomain
);
return
daemon
;
}
}
class
CapturingAppDomain
extends
AppDomain
{
CapturingAppDomain
(
Daemon
daemon
)
:
super
(
daemon
);
bool
/*?*/
multidexEnabled
;
@override
Future
<
AppInstance
>
startApp
(
Device
device
,
String
projectDirectory
,
String
target
,
String
route
,
DebuggingOptions
options
,
bool
enableHotReload
,
{
File
applicationBinary
,
@required
bool
trackWidgetCreation
,
String
projectRootPath
,
String
packagesFilePath
,
String
dillOutputPath
,
bool
ipv6
=
false
,
bool
multidexEnabled
=
false
,
String
isolateFilter
,
bool
machine
=
true
,
})
async
{
this
.
multidexEnabled
=
multidexEnabled
;
throwToolExit
(
''
);
}
}
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