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
c219e6f3
Unverified
Commit
c219e6f3
authored
Jan 30, 2019
by
Jonah Williams
Committed by
GitHub
Jan 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inject KernelCompiler via KernelCompilerFactory (#27211)
parent
59dc909d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
5 deletions
+25
-5
build.dart
packages/flutter_tools/lib/src/base/build.dart
+1
-0
bundle.dart
packages/flutter_tools/lib/src/bundle.dart
+1
-0
compile.dart
packages/flutter_tools/lib/src/compile.dart
+12
-1
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+1
-1
compile_test.dart
packages/flutter_tools/test/compile_test.dart
+3
-2
flutter_tester_test.dart
packages/flutter_tools/test/tester/flutter_tester_test.dart
+7
-1
No files found.
packages/flutter_tools/lib/src/base/build.dart
View file @
c219e6f3
...
...
@@ -302,6 +302,7 @@ class AOTSnapshotter {
printTrace
(
'Extra front-end options:
$extraFrontEndOptions
'
);
final
String
depfilePath
=
fs
.
path
.
join
(
outputPath
,
'kernel_compile.d'
);
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
();
final
CompilerOutput
compilerOutput
=
await
kernelCompiler
.
compile
(
sdkRoot:
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
),
mainPath:
mainPath
,
...
...
packages/flutter_tools/lib/src/bundle.dart
View file @
c219e6f3
...
...
@@ -99,6 +99,7 @@ Future<void> build({
if
((
extraFrontEndOptions
!=
null
)
&&
extraFrontEndOptions
.
isNotEmpty
)
printTrace
(
'Extra front-end options:
$extraFrontEndOptions
'
);
ensureDirectoryExists
(
applicationKernelFilePath
);
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
();
final
CompilerOutput
compilerOutput
=
await
kernelCompiler
.
compile
(
sdkRoot:
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
),
incrementalCompilerByteStorePath:
compilationTraceFilePath
!=
null
?
null
:
...
...
packages/flutter_tools/lib/src/compile.dart
View file @
c219e6f3
...
...
@@ -20,10 +20,21 @@ import 'convert.dart';
import
'dart/package_map.dart'
;
import
'globals.dart'
;
KernelCompiler
get
kernelCompiler
=>
context
[
KernelCompiler
];
KernelCompiler
Factory
get
kernelCompilerFactory
=>
context
[
KernelCompilerFactory
];
typedef
CompilerMessageConsumer
=
void
Function
(
String
message
,
{
bool
emphasis
,
TerminalColor
color
});
/// Injectable factory to allow async construction of a [KernelCompiler].
class
KernelCompilerFactory
{
const
KernelCompilerFactory
();
/// Return the correct [KernelCompiler] instance for the given project
/// configuration.
FutureOr
<
KernelCompiler
>
create
()
async
{
return
const
KernelCompiler
();
}
}
/// The target model describes the set of core libraries that are availible within
/// the SDK.
class
TargetModel
{
...
...
packages/flutter_tools/lib/src/context_runner.dart
View file @
c219e6f3
...
...
@@ -81,7 +81,7 @@ Future<T> runInContext<T>(
IOSSimulatorUtils:
()
=>
IOSSimulatorUtils
(),
IOSWorkflow:
()
=>
const
IOSWorkflow
(),
IOSValidator:
()
=>
const
IOSValidator
(),
KernelCompiler
:
()
=>
const
KernelCompiler
(),
KernelCompiler
Factory:
()
=>
const
KernelCompilerFactory
(),
LinuxWorkflow:
()
=>
const
LinuxWorkflow
(),
Logger:
()
=>
platform
.
isWindows
?
WindowsStdoutLogger
()
:
StdoutLogger
(),
MacOSWorkflow:
()
=>
const
MacOSWorkflow
(),
...
...
packages/flutter_tools/test/compile_test.dart
View file @
c219e6f3
...
...
@@ -117,6 +117,7 @@ example:org-dartlang-app:///lib/
'result abc
\n
line1
\n
line2
\n
abc /path/to/main.dart.dill 0'
))
));
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
();
final
CompilerOutput
output
=
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
trackWidgetCreation:
false
,
...
...
@@ -140,7 +141,7 @@ example:org-dartlang-app:///lib/
'result abc
\n
line1
\n
line2
\n
abc'
))
));
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
();
final
CompilerOutput
output
=
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
trackWidgetCreation:
false
,
...
...
@@ -166,7 +167,7 @@ example:org-dartlang-app:///lib/
'result abc
\n
line1
\n
line2
\n
abc'
))
));
final
KernelCompiler
kernelCompiler
=
await
kernelCompilerFactory
.
create
();
final
CompilerOutput
output
=
await
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
...
...
packages/flutter_tools/test/tester/flutter_tester_test.dart
View file @
c219e6f3
...
...
@@ -102,6 +102,7 @@ void main() {
MockArtifacts
mockArtifacts
;
MockKernelCompiler
mockKernelCompiler
;
MockProcessManager
mockProcessManager
;
MockKernelCompilerFactory
mockKernelCompilerFactory
;
MockProcess
mockProcess
;
final
Map
<
Type
,
Generator
>
startOverrides
=
<
Type
,
Generator
>{
...
...
@@ -109,7 +110,7 @@ void main() {
FileSystem:
()
=>
fs
,
Cache:
()
=>
Cache
(
rootOverride:
fs
.
directory
(
flutterRoot
)),
ProcessManager:
()
=>
mockProcessManager
,
KernelCompiler
:
()
=>
mockKernelCompiler
,
KernelCompiler
Factory:
()
=>
mockKernelCompilerFactory
,
Artifacts:
()
=>
mockArtifacts
,
};
...
...
@@ -135,6 +136,10 @@ void main() {
when
(
mockArtifacts
.
getArtifactPath
(
any
)).
thenReturn
(
artifactPath
);
mockKernelCompiler
=
MockKernelCompiler
();
mockKernelCompilerFactory
=
MockKernelCompilerFactory
();
when
(
mockKernelCompilerFactory
.
create
()).
thenAnswer
((
Invocation
invocation
)
async
{
return
mockKernelCompiler
;
});
});
testUsingContext
(
'not debug'
,
()
async
{
...
...
@@ -194,3 +199,4 @@ Hello!
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockKernelCompiler
extends
Mock
implements
KernelCompiler
{}
class
MockKernelCompilerFactory
extends
Mock
implements
KernelCompilerFactory
{}
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