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
78e54dd4
Unverified
Commit
78e54dd4
authored
Sep 23, 2020
by
Jenn Magder
Committed by
GitHub
Sep 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "[flutter_tools] map file Uri to multi-root scheme if provided (#66151)" (#66403)
This reverts commit
af6ba867
.
parent
f1472e1f
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
103 additions
and
162 deletions
+103
-162
common.dart
...es/flutter_tools/lib/src/build_system/targets/common.dart
+0
-2
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+0
-1
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+0
-1
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+0
-1
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+0
-1
compile.dart
packages/flutter_tools/lib/src/compile.dart
+46
-46
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+7
-0
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+0
-5
test_compiler.dart
packages/flutter_tools/lib/src/test/test_compiler.dart
+0
-1
compile_batch_test.dart
.../flutter_tools/test/general.shard/compile_batch_test.dart
+49
-90
compile_expression_test.dart
...ter_tools/test/general.shard/compile_expression_test.dart
+0
-2
compile_incremental_test.dart
...er_tools/test/general.shard/compile_incremental_test.dart
+0
-2
compile_test.dart
packages/flutter_tools/test/general.shard/compile_test.dart
+0
-7
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+1
-3
No files found.
packages/flutter_tools/lib/src/build_system/targets/common.dart
View file @
78e54dd4
...
...
@@ -198,8 +198,6 @@ class KernelSnapshot extends Target {
logger:
environment
.
logger
,
processManager:
environment
.
processManager
,
artifacts:
environment
.
artifacts
,
fileSystemRoots:
<
String
>[],
fileSystemScheme:
null
,
);
if
(
environment
.
defines
[
kBuildMode
]
==
null
)
{
throw
MissingDefineException
(
kBuildMode
,
'kernel_snapshot'
);
...
...
packages/flutter_tools/lib/src/commands/attach.dart
View file @
78e54dd4
...
...
@@ -385,7 +385,6 @@ class AttachCommand extends FlutterCommand {
targetModel:
TargetModel
(
stringArg
(
'target-model'
)),
buildInfo:
getBuildInfo
(),
userIdentifier:
userIdentifier
,
platform:
globals
.
platform
,
);
flutterDevice
.
observatoryUris
=
observatoryUris
;
final
List
<
FlutterDevice
>
flutterDevices
=
<
FlutterDevice
>[
flutterDevice
];
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
78e54dd4
...
...
@@ -470,7 +470,6 @@ class AppDomain extends Domain {
flutterProject:
flutterProject
,
target:
target
,
buildInfo:
options
.
buildInfo
,
platform:
globals
.
platform
,
);
ResidentRunner
runner
;
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
78e54dd4
...
...
@@ -199,7 +199,6 @@ class DriveCommand extends RunCommandBase {
flutterProject:
flutterProject
,
target:
targetFile
,
buildInfo:
buildInfo
,
platform:
globals
.
platform
,
);
residentRunner
=
webRunnerFactory
.
createWebRunner
(
flutterDevice
,
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
78e54dd4
...
...
@@ -531,7 +531,6 @@ class RunCommand extends RunCommandBase {
target:
stringArg
(
'target'
),
buildInfo:
getBuildInfo
(),
userIdentifier:
userIdentifier
,
platform:
globals
.
platform
,
),
];
// Only support "web mode" with a single web device due to resident runner
...
...
packages/flutter_tools/lib/src/compile.dart
View file @
78e54dd4
...
...
@@ -11,13 +11,42 @@ import 'package:usage/uuid/uuid.dart';
import
'artifacts.dart'
;
import
'base/common.dart'
;
import
'base/context.dart'
;
import
'base/file_system.dart'
;
import
'base/io.dart'
;
import
'base/logger.dart'
;
import
'base/platform.dart'
;
import
'build_info.dart'
;
import
'convert.dart'
;
import
'globals.dart'
as
globals
;
import
'project.dart'
;
KernelCompilerFactory
get
kernelCompilerFactory
=>
context
.
get
<
KernelCompilerFactory
>();
class
KernelCompilerFactory
{
const
KernelCompilerFactory
({
@required
FileSystem
fileSystem
,
@required
Artifacts
artifacts
,
@required
ProcessManager
processManager
,
@required
Logger
logger
,
})
:
_fileSystem
=
fileSystem
,
_artifacts
=
artifacts
,
_processManager
=
processManager
,
_logger
=
logger
;
final
Logger
_logger
;
final
Artifacts
_artifacts
;
final
ProcessManager
_processManager
;
final
FileSystem
_fileSystem
;
Future
<
KernelCompiler
>
create
(
FlutterProject
flutterProject
)
async
{
return
KernelCompiler
(
logger:
_logger
,
artifacts:
_artifacts
,
fileSystem:
_fileSystem
,
processManager:
_processManager
,
);
}
}
/// The target model describes the set of core libraries that are available within
/// the SDK.
...
...
@@ -175,25 +204,19 @@ List<String> buildModeOptions(BuildMode mode) {
/// A compiler interface for producing single (non-incremental) kernel files.
class
KernelCompiler
{
KernelCompiler
({
@required
FileSystem
fileSystem
,
@required
Logger
logger
,
@required
ProcessManager
processManager
,
@required
Artifacts
artifacts
,
@required
List
<
String
>
fileSystemRoots
,
@required
String
fileSystemScheme
,
})
:
_logger
=
logger
,
_fileSystem
=
fileSystem
,
_artifacts
=
artifacts
,
_processManager
=
processManager
,
_fileSystemScheme
=
fileSystemScheme
,
_fileSystemRoots
=
fileSystemRoots
;
FileSystem
fileSystem
,
// TODO(jonahwilliams): migrate to @required after google3
Logger
logger
,
// TODO(jonahwilliams): migrate to @required after google3
ProcessManager
processManager
,
// TODO(jonahwilliams): migrate to @required after google3
Artifacts
artifacts
,
// TODO(jonahwilliams): migrate to @required after google3
})
:
_logger
=
logger
??
globals
.
logger
,
_fileSystem
=
fileSystem
??
globals
.
fs
,
_artifacts
=
artifacts
??
globals
.
artifacts
,
_processManager
=
processManager
??
globals
.
processManager
;
final
FileSystem
_fileSystem
;
final
Artifacts
_artifacts
;
final
ProcessManager
_processManager
;
final
Logger
_logger
;
final
String
_fileSystemScheme
;
final
List
<
String
>
_fileSystemRoots
;
Future
<
CompilerOutput
>
compile
({
String
sdkRoot
,
...
...
@@ -225,12 +248,10 @@ class KernelCompiler {
if
(!
_processManager
.
canRun
(
engineDartPath
))
{
throwToolExit
(
'Unable to find Dart binary at
$engineDartPath
'
);
}
String
mainUri
;
final
Uri
mainFileUri
=
_fileSystem
.
file
(
mainPath
).
uri
;
Uri
mainUri
;
if
(
packagesPath
!=
null
)
{
mainUri
=
packageConfig
.
toPackageUri
(
mainFileUri
)?.
toString
(
);
mainUri
=
packageConfig
.
toPackageUri
(
_fileSystem
.
file
(
mainPath
).
uri
);
}
mainUri
??=
toMultiRootPath
(
mainFileUri
,
_fileSystemScheme
,
_fileSystemRoots
,
_fileSystem
.
path
.
separator
==
r'\'
);
if
(
outputFilePath
!=
null
&&
!
_fileSystem
.
isFileSync
(
outputFilePath
))
{
_fileSystem
.
file
(
outputFilePath
).
createSync
(
recursive:
true
);
}
...
...
@@ -281,7 +302,7 @@ class KernelCompiler {
platformDill
,
],
...?
extraFrontEndOptions
,
mainUri
??
mainPath
,
mainUri
?.
toString
()
??
mainPath
,
];
_logger
.
printTrace
(
command
.
join
(
' '
));
...
...
@@ -415,7 +436,6 @@ abstract class ResidentCompiler {
String
platformDill
,
List
<
String
>
dartDefines
,
String
librariesSpec
,
@required
Platform
platform
,
// Deprecated
List
<
String
>
experimentalFlags
,
})
=
DefaultResidentCompiler
;
...
...
@@ -502,7 +522,6 @@ class DefaultResidentCompiler implements ResidentCompiler {
DefaultResidentCompiler
(
String
sdkRoot
,
{
@required
this
.
buildMode
,
@required
Platform
platform
,
Logger
logger
,
// TODO(jonahwilliams): migrate to @required after google3
ProcessManager
processManager
,
// TODO(jonahwilliams): migrate to @required after google3
Artifacts
artifacts
,
// TODO(jonahwilliams): migrate to @required after google3
...
...
@@ -524,7 +543,6 @@ class DefaultResidentCompiler implements ResidentCompiler {
_processManager
=
processManager
??
globals
.
processManager
,
_artifacts
=
artifacts
??
globals
.
artifacts
,
_stdoutHandler
=
StdoutHandler
(
logger:
logger
),
_platform
=
platform
,
dartDefines
=
dartDefines
??
const
<
String
>[],
// This is a URI, not a file path, so the forward slash is correct even on Windows.
sdkRoot
=
sdkRoot
.
endsWith
(
'/'
)
?
sdkRoot
:
'
$sdkRoot
/'
;
...
...
@@ -532,7 +550,6 @@ class DefaultResidentCompiler implements ResidentCompiler {
final
Logger
_logger
;
final
ProcessManager
_processManager
;
final
Artifacts
_artifacts
;
final
Platform
_platform
;
final
BuildMode
buildMode
;
final
bool
trackWidgetCreation
;
...
...
@@ -599,9 +616,8 @@ class DefaultResidentCompiler implements ResidentCompiler {
);
}
final
String
inputKey
=
Uuid
().
generateV4
();
final
String
mainUri
=
request
.
packageConfig
.
toPackageUri
(
request
.
mainUri
)?.
toString
()
??
toMultiRootPath
(
request
.
mainUri
,
fileSystemScheme
,
fileSystemRoots
,
_platform
.
isWindows
);
final
String
mainUri
=
request
.
packageConfig
.
toPackageUri
(
request
.
mainUri
)?.
toString
()
??
request
.
mainUri
.
toString
();
_server
.
stdin
.
writeln
(
'recompile
$mainUri
$inputKey
'
);
_logger
.
printTrace
(
'<- recompile
$mainUri
$inputKey
'
);
for
(
final
Uri
fileUri
in
request
.
invalidatedFiles
)
{
...
...
@@ -609,11 +625,11 @@ class DefaultResidentCompiler implements ResidentCompiler {
if
(
fileUri
.
scheme
==
'package'
)
{
message
=
fileUri
.
toString
();
}
else
{
message
=
request
.
packageConfig
.
toPackageUri
(
fileUri
)?.
toString
()
??
toMultiRootPath
(
request
.
mainUri
,
fileSystemScheme
,
fileSystemRoots
,
_platform
.
isWindows
);
message
=
request
.
packageConfig
.
toPackageUri
(
fileUri
)?.
toString
()
??
fileUri
.
toString
(
);
}
_server
.
stdin
.
writeln
(
message
);
_logger
.
printTrace
(
message
.
toString
()
);
_logger
.
printTrace
(
message
);
}
_server
.
stdin
.
writeln
(
inputKey
);
_logger
.
printTrace
(
'<-
$inputKey
'
);
...
...
@@ -873,19 +889,3 @@ class DefaultResidentCompiler implements ResidentCompiler {
return
_server
.
exitCode
;
}
}
/// Convert a file URI into a multiroot scheme URI if provided, otherwise
/// return unmodified.
@visibleForTesting
String
toMultiRootPath
(
Uri
fileUri
,
String
scheme
,
List
<
String
>
fileSystemRoots
,
bool
windows
)
{
if
(
scheme
==
null
||
fileSystemRoots
.
isEmpty
)
{
return
fileUri
.
toFilePath
(
windows:
windows
);
}
final
String
filePath
=
fileUri
.
toFilePath
(
windows:
windows
);
for
(
final
String
fileSystemRoot
in
fileSystemRoots
)
{
if
(
filePath
.
startsWith
(
fileSystemRoot
))
{
return
scheme
+
'://'
+
filePath
.
substring
(
fileSystemRoot
.
length
);
}
}
return
fileUri
.
toFilePath
(
windows:
windows
);
}
packages/flutter_tools/lib/src/context_runner.dart
View file @
78e54dd4
...
...
@@ -25,6 +25,7 @@ import 'base/user_messages.dart';
import
'build_info.dart'
;
import
'build_system/build_system.dart'
;
import
'cache.dart'
;
import
'compile.dart'
;
import
'dart/pub.dart'
;
import
'devfs.dart'
;
import
'device.dart'
;
...
...
@@ -180,6 +181,12 @@ Future<T> runInContext<T>(
xcode:
globals
.
xcode
,
platform:
globals
.
platform
,
),
KernelCompilerFactory:
()
=>
KernelCompilerFactory
(
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
artifacts:
globals
.
artifacts
,
fileSystem:
globals
.
fs
,
),
Logger:
()
=>
globals
.
platform
.
isWindows
?
WindowsStdoutLogger
(
terminal:
globals
.
terminal
,
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
78e54dd4
...
...
@@ -18,7 +18,6 @@ import 'base/context.dart';
import
'base/file_system.dart'
;
import
'base/io.dart'
as
io
;
import
'base/logger.dart'
;
import
'base/platform.dart'
;
import
'base/signals.dart'
;
import
'base/utils.dart'
;
import
'build_info.dart'
;
...
...
@@ -64,7 +63,6 @@ class FlutterDevice {
artifacts:
globals
.
artifacts
,
processManager:
globals
.
processManager
,
logger:
globals
.
logger
,
platform:
globals
.
platform
,
);
/// Create a [FlutterDevice] with optional code generation enabled.
...
...
@@ -73,7 +71,6 @@ class FlutterDevice {
@required
FlutterProject
flutterProject
,
@required
String
target
,
@required
BuildInfo
buildInfo
,
@required
Platform
platform
,
List
<
String
>
fileSystemRoots
,
String
fileSystemScheme
,
TargetModel
targetModel
=
TargetModel
.
flutter
,
...
...
@@ -132,7 +129,6 @@ class FlutterDevice {
artifacts:
globals
.
artifacts
,
processManager:
globals
.
processManager
,
logger:
globals
.
logger
,
platform:
platform
,
);
}
else
{
// The flutter-widget-cache feature only applies to run mode.
...
...
@@ -165,7 +161,6 @@ class FlutterDevice {
artifacts:
globals
.
artifacts
,
processManager:
globals
.
processManager
,
logger:
globals
.
logger
,
platform:
platform
,
);
}
...
...
packages/flutter_tools/lib/src/test/test_compiler.dart
View file @
78e54dd4
...
...
@@ -108,7 +108,6 @@ class TestCompiler {
dartDefines:
const
<
String
>[],
packagesPath:
globalPackagesPath
,
extraFrontEndOptions:
extraFrontEndOptions
,
platform:
globals
.
platform
,
);
return
residentCompiler
;
}
...
...
packages/flutter_tools/test/general.shard/compile_batch_test.dart
View file @
78e54dd4
...
...
@@ -4,10 +4,10 @@
import
'dart:async'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/terminal.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/compile.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
...
...
@@ -47,22 +47,14 @@ void main() {
when
(
mockFrontendServer
.
exitCode
).
thenAnswer
((
_
)
async
=>
0
);
});
test
Without
Context
(
'batch compile single dart successful compilation'
,
()
async
{
test
Using
Context
(
'batch compile single dart successful compilation'
,
()
async
{
when
(
mockFrontendServer
.
stdout
)
.
thenAnswer
((
Invocation
invocation
)
=>
Stream
<
List
<
int
>>.
fromFuture
(
Future
<
List
<
int
>>.
value
(
utf8
.
encode
(
'result abc
\n
line1
\n
line2
\n
abc
\n
abc /path/to/main.dart.dill 0'
))
));
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
KernelCompiler
kernelCompiler
=
KernelCompiler
(
artifacts:
Artifacts
.
test
(),
fileSystem:
MemoryFileSystem
.
test
(),
fileSystemRoots:
<
String
>[],
fileSystemScheme:
''
,
logger:
logger
,
processManager:
mockProcessManager
);
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
(
null
);
final
CompilerOutput
output
=
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
debug
,
...
...
@@ -73,29 +65,27 @@ void main() {
);
expect
(
mockFrontendServerStdIn
.
getAndClear
(),
isEmpty
);
expect
(
l
ogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
testL
ogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
final
VerificationResult
argVerification
=
verify
(
mockProcessManager
.
start
(
captureAny
));
expect
(
argVerification
.
captured
.
single
,
containsAll
(<
String
>[
'-Ddart.developer.causal_async_stacks=true'
,
]));
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
OutputPreferences:
()
=>
OutputPreferences
(
showColor:
false
),
Platform:
kNoColorTerminalPlatform
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
test
Without
Context
(
'passes correct AOT config to kernel compiler in aot/profile mode'
,
()
async
{
test
Using
Context
(
'passes correct AOT config to kernel compiler in aot/profile mode'
,
()
async
{
when
(
mockFrontendServer
.
stdout
)
.
thenAnswer
((
Invocation
invocation
)
=>
Stream
<
List
<
int
>>.
fromFuture
(
Future
<
List
<
int
>>.
value
(
utf8
.
encode
(
'result abc
\n
line1
\n
line2
\n
abc
\n
abc /path/to/main.dart.dill 0'
))
));
final
KernelCompiler
kernelCompiler
=
KernelCompiler
(
artifacts:
Artifacts
.
test
(),
fileSystem:
MemoryFileSystem
.
test
(),
fileSystemRoots:
<
String
>[],
fileSystemScheme:
''
,
logger:
BufferLogger
.
test
(),
processManager:
mockProcessManager
);
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
(
null
);
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
profile
,
...
...
@@ -116,23 +106,22 @@ void main() {
'--bytecode-options=source-positions'
,
'-Ddart.developer.causal_async_stacks=false'
,
]));
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
OutputPreferences:
()
=>
OutputPreferences
(
showColor:
false
),
Platform:
kNoColorTerminalPlatform
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
testWithoutContext
(
'passes correct AOT config to kernel compiler in aot/release mode'
,
()
async
{
testUsingContext
(
'passes correct AOT config to kernel compiler in aot/release mode'
,
()
async
{
when
(
mockFrontendServer
.
stdout
)
.
thenAnswer
((
Invocation
invocation
)
=>
Stream
<
List
<
int
>>.
fromFuture
(
Future
<
List
<
int
>>.
value
(
utf8
.
encode
(
'result abc
\n
line1
\n
line2
\n
abc
\n
abc /path/to/main.dart.dill 0'
))
));
final
KernelCompiler
kernelCompiler
=
KernelCompiler
(
artifacts:
Artifacts
.
test
(),
fileSystem:
MemoryFileSystem
.
test
(),
fileSystemRoots:
<
String
>[],
fileSystemScheme:
''
,
logger:
BufferLogger
.
test
(),
processManager:
mockProcessManager
);
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
(
null
);
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
release
,
...
...
@@ -153,24 +142,21 @@ void main() {
'--bytecode-options=source-positions'
,
'-Ddart.developer.causal_async_stacks=false'
,
]));
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
OutputPreferences:
()
=>
OutputPreferences
(
showColor:
false
),
Platform:
kNoColorTerminalPlatform
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
test
Without
Context
(
'batch compile single dart failed compilation'
,
()
async
{
test
Using
Context
(
'batch compile single dart failed compilation'
,
()
async
{
when
(
mockFrontendServer
.
stdout
)
.
thenAnswer
((
Invocation
invocation
)
=>
Stream
<
List
<
int
>>.
fromFuture
(
Future
<
List
<
int
>>.
value
(
utf8
.
encode
(
'result abc
\n
line1
\n
line2
\n
abc
\n
abc'
))
));
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
KernelCompiler
kernelCompiler
=
KernelCompiler
(
artifacts:
Artifacts
.
test
(),
fileSystem:
MemoryFileSystem
.
test
(),
fileSystemRoots:
<
String
>[],
fileSystemScheme:
''
,
logger:
logger
,
processManager:
mockProcessManager
);
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
(
null
);
final
CompilerOutput
output
=
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
debug
,
...
...
@@ -181,27 +167,25 @@ void main() {
);
expect
(
mockFrontendServerStdIn
.
getAndClear
(),
isEmpty
);
expect
(
l
ogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
testL
ogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
,
equals
(
null
));
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
OutputPreferences:
()
=>
OutputPreferences
(
showColor:
false
),
Platform:
kNoColorTerminalPlatform
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
test
Without
Context
(
'batch compile single dart abnormal compiler termination'
,
()
async
{
test
Using
Context
(
'batch compile single dart abnormal compiler termination'
,
()
async
{
when
(
mockFrontendServer
.
exitCode
).
thenAnswer
((
_
)
async
=>
255
);
when
(
mockFrontendServer
.
stdout
)
.
thenAnswer
((
Invocation
invocation
)
=>
Stream
<
List
<
int
>>.
fromFuture
(
Future
<
List
<
int
>>.
value
(
utf8
.
encode
(
'result abc
\n
line1
\n
line2
\n
abc
\n
abc'
))
));
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
KernelCompiler
kernelCompiler
=
KernelCompiler
(
artifacts:
Artifacts
.
test
(),
fileSystem:
MemoryFileSystem
.
test
(),
fileSystemRoots:
<
String
>[],
fileSystemScheme:
''
,
logger:
logger
,
processManager:
mockProcessManager
);
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
(
null
);
final
CompilerOutput
output
=
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
...
...
@@ -212,24 +196,22 @@ void main() {
packagesPath:
'.packages'
,
);
expect
(
mockFrontendServerStdIn
.
getAndClear
(),
isEmpty
);
expect
(
l
ogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
testL
ogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
,
equals
(
null
));
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
OutputPreferences:
()
=>
OutputPreferences
(
showColor:
false
),
Platform:
kNoColorTerminalPlatform
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
test
Without
Context
(
'passes dartDefines to the kernel compiler'
,
()
async
{
test
Using
Context
(
'passes dartDefines to the kernel compiler'
,
()
async
{
// Use unsuccessful result because it's easier to setup in test. We only care about arguments passed to the compiler.
when
(
mockFrontendServer
.
exitCode
).
thenAnswer
((
_
)
async
=>
255
);
when
(
mockFrontendServer
.
stdout
).
thenAnswer
((
Invocation
invocation
)
=>
Stream
<
List
<
int
>>.
fromFuture
(
Future
<
List
<
int
>>.
value
(<
int
>[])
));
final
KernelCompiler
kernelCompiler
=
KernelCompiler
(
artifacts:
Artifacts
.
test
(),
fileSystem:
MemoryFileSystem
.
test
(),
fileSystemRoots:
<
String
>[],
fileSystemScheme:
''
,
logger:
BufferLogger
.
test
(),
processManager:
mockProcessManager
);
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
(
null
);
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
debug
,
...
...
@@ -240,34 +222,11 @@ void main() {
);
expect
(
latestCommand
,
containsAllInOrder
(<
String
>[
'-DFOO=bar'
,
'-DBAZ=qux'
]));
});
testWithoutContext
(
'maps a file to a multiroot scheme if providfed'
,
()
async
{
// Use unsuccessful result because it's easier to setup in test. We only care about arguments passed to the compiler.
when
(
mockFrontendServer
.
exitCode
).
thenAnswer
((
_
)
async
=>
255
);
when
(
mockFrontendServer
.
stdout
).
thenAnswer
((
Invocation
invocation
)
=>
Stream
<
List
<
int
>>.
fromFuture
(
Future
<
List
<
int
>>.
value
(<
int
>[])
));
final
KernelCompiler
kernelCompiler
=
KernelCompiler
(
artifacts:
Artifacts
.
test
(),
fileSystem:
MemoryFileSystem
.
test
(),
fileSystemRoots:
<
String
>[
'/foo/bar/fizz'
,
],
fileSystemScheme:
'scheme'
,
logger:
BufferLogger
.
test
(),
processManager:
mockProcessManager
);
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/foo/bar/fizz/main.dart'
,
buildMode:
BuildMode
.
debug
,
trackWidgetCreation:
false
,
dartDefines:
const
<
String
>[],
packageConfig:
PackageConfig
.
empty
,
packagesPath:
'.packages'
,
);
expect
(
latestCommand
,
containsAll
(<
String
>[
'scheme:///main.dart'
]));
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
OutputPreferences:
()
=>
OutputPreferences
(
showColor:
false
),
Platform:
kNoColorTerminalPlatform
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
}
...
...
packages/flutter_tools/test/general.shard/compile_expression_test.dart
View file @
78e54dd4
...
...
@@ -8,7 +8,6 @@ import 'package:flutter_tools/src/artifacts.dart';
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/compile.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
...
...
@@ -41,7 +40,6 @@ void main() {
artifacts:
Artifacts
.
test
(),
processManager:
mockProcessManager
,
logger:
testLogger
,
platform:
FakePlatform
(
operatingSystem:
'linux'
),
);
when
(
mockFrontendServer
.
stdin
).
thenReturn
(
mockFrontendServerStdIn
);
...
...
packages/flutter_tools/test/general.shard/compile_incremental_test.dart
View file @
78e54dd4
...
...
@@ -8,7 +8,6 @@ import 'package:flutter_tools/src/artifacts.dart';
import
'package:flutter_tools/src/base/async_guard.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/compile.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
...
...
@@ -41,7 +40,6 @@ void main() {
logger:
testLogger
,
processManager:
mockProcessManager
,
artifacts:
Artifacts
.
test
(),
platform:
FakePlatform
(
operatingSystem:
'linux'
),
);
when
(
mockFrontendServer
.
stdin
).
thenReturn
(
mockFrontendServerStdIn
);
...
...
packages/flutter_tools/test/general.shard/compile_test.dart
View file @
78e54dd4
...
...
@@ -34,11 +34,4 @@ void main() {
expect
(()
=>
TargetModel
(
'foobar'
),
throwsAssertionError
);
});
testWithoutContext
(
'toMultiRootPath maps file paths'
,
()
async
{
expect
(
toMultiRootPath
(
Uri
.
parse
(
'file:///a/b/c'
),
'scheme'
,
<
String
>[
'/a/b'
],
false
),
'scheme:///c'
);
expect
(
toMultiRootPath
(
Uri
.
parse
(
'file:///d/b/c'
),
'scheme'
,
<
String
>[
'/a/b'
],
false
),
'/d/b/c'
);
expect
(
toMultiRootPath
(
Uri
.
parse
(
'file:///a/b/c'
),
'scheme'
,
<
String
>[
'/d/b'
,
'/a/b'
],
false
),
'scheme:///c'
);
expect
(
toMultiRootPath
(
Uri
.
parse
(
'file:///a/b/c'
),
null
,
<
String
>[],
false
),
'/a/b/c'
);
});
}
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
78e54dd4
...
...
@@ -2059,7 +2059,6 @@ void main() {
),
flutterProject:
FlutterProject
.
current
(),
target:
null
,
platform:
FakePlatform
(
operatingSystem:
'linux'
),
)).
generator
as
DefaultResidentCompiler
;
expect
(
residentCompiler
.
initializeFromDill
,
...
...
@@ -2094,7 +2093,6 @@ void main() {
),
flutterProject:
FlutterProject
.
current
(),
target:
null
,
platform:
FakePlatform
(
operatingSystem:
'linux'
),
)).
generator
as
DefaultResidentCompiler
;
expect
(
residentCompiler
.
initializeFromDill
,
...
...
@@ -2128,7 +2126,7 @@ void main() {
extraFrontEndOptions:
<
String
>[],
),
flutterProject:
FlutterProject
.
current
(),
target:
null
,
platform:
null
,
target:
null
,
)).
generator
as
DefaultResidentCompiler
;
expect
(
residentCompiler
.
extraFrontEndOptions
,
...
...
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