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
51d2d351
Unverified
Commit
51d2d351
authored
Jul 27, 2019
by
Jonah Williams
Committed by
GitHub
Jul 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose functionality to compile dart to kernel for the VM (#36598)
parent
de2a8592
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
43 deletions
+25
-43
codegen.dart
packages/flutter_tools/lib/src/codegen.dart
+1
-2
compile.dart
packages/flutter_tools/lib/src/compile.dart
+11
-40
dart_test.dart
...ls/test/general.shard/build_system/targets/dart_test.dart
+1
-0
compile_test.dart
packages/flutter_tools/test/general.shard/compile_test.dart
+12
-0
flutter_tester_test.dart
..._tools/test/general.shard/tester/flutter_tester_test.dart
+0
-1
No files found.
packages/flutter_tools/lib/src/codegen.dart
View file @
51d2d351
...
...
@@ -99,7 +99,6 @@ class CodeGeneratingKernelCompiler implements KernelCompiler {
bool
aot
=
false
,
bool
trackWidgetCreation
,
List
<
String
>
extraFrontEndOptions
,
String
incrementalCompilerByteStorePath
,
bool
targetProductVm
=
false
,
// These arguments are currently unused.
String
sdkRoot
,
...
...
@@ -109,6 +108,7 @@ class CodeGeneratingKernelCompiler implements KernelCompiler {
String
depFilePath
,
TargetModel
targetModel
=
TargetModel
.
flutter
,
String
initializeFromDill
,
String
platformDill
,
})
async
{
if
(
fileSystemRoots
!=
null
||
fileSystemScheme
!=
null
||
depFilePath
!=
null
||
targetModel
!=
null
||
sdkRoot
!=
null
||
packagesPath
!=
null
)
{
printTrace
(
'fileSystemRoots, fileSystemScheme, depFilePath, targetModel,'
...
...
@@ -135,7 +135,6 @@ class CodeGeneratingKernelCompiler implements KernelCompiler {
aot:
aot
,
trackWidgetCreation:
trackWidgetCreation
,
extraFrontEndOptions:
extraFrontEndOptions
,
incrementalCompilerByteStorePath:
incrementalCompilerByteStorePath
,
targetProductVm:
targetProductVm
,
sdkRoot:
sdkRoot
,
packagesPath:
PackageMap
.
globalGeneratedPackagesPath
,
...
...
packages/flutter_tools/lib/src/compile.dart
View file @
51d2d351
...
...
@@ -11,12 +11,10 @@ import 'artifacts.dart';
import
'base/common.dart'
;
import
'base/context.dart'
;
import
'base/file_system.dart'
;
import
'base/fingerprint.dart'
;
import
'base/io.dart'
;
import
'base/platform.dart'
;
import
'base/process_manager.dart'
;
import
'base/terminal.dart'
;
import
'cache.dart'
;
import
'codegen.dart'
;
import
'convert.dart'
;
import
'dart/package_map.dart'
;
...
...
@@ -51,6 +49,8 @@ class TargetModel {
return
flutter
;
case
'flutter_runner'
:
return
flutterRunner
;
case
'vm'
:
return
vm
;
}
assert
(
false
);
return
null
;
...
...
@@ -64,6 +64,9 @@ class TargetModel {
/// The fuchsia patched SDK.
static
const
TargetModel
flutterRunner
=
TargetModel
.
_
(
'flutter_runner'
);
/// The Dart vm.
static
const
TargetModel
vm
=
TargetModel
.
_
(
'vm'
);
final
String
_value
;
@override
...
...
@@ -218,49 +221,20 @@ class KernelCompiler {
bool
aot
=
false
,
@required
bool
trackWidgetCreation
,
List
<
String
>
extraFrontEndOptions
,
String
incrementalCompilerByteStorePath
,
String
packagesPath
,
List
<
String
>
fileSystemRoots
,
String
fileSystemScheme
,
bool
targetProductVm
=
false
,
String
initializeFromDill
,
String
platformDill
,
})
async
{
final
String
frontendServer
=
artifacts
.
getArtifactPath
(
Artifact
.
frontendServerSnapshotForEngineDartSdk
);
FlutterProject
flutterProject
;
if
(
fs
.
file
(
'pubspec.yaml'
).
existsSync
())
{
flutterProject
=
FlutterProject
.
current
();
}
// TODO(cbracken): eliminate pathFilter.
// Currently the compiler emits buildbot paths for the core libs in the
// depfile. None of these are available on the local host.
Fingerprinter
fingerprinter
;
if
(
depFilePath
!=
null
)
{
fingerprinter
=
Fingerprinter
(
fingerprintPath:
'
$depFilePath
.fingerprint'
,
paths:
<
String
>[
mainPath
],
properties:
<
String
,
String
>{
'entryPoint'
:
mainPath
,
'trackWidgetCreation'
:
trackWidgetCreation
.
toString
(),
'linkPlatformKernelIn'
:
linkPlatformKernelIn
.
toString
(),
'engineHash'
:
Cache
.
instance
.
engineRevision
,
'buildersUsed'
:
'
${flutterProject != null && flutterProject.hasBuilders}
'
,
},
depfilePaths:
<
String
>[
depFilePath
],
pathFilter:
(
String
path
)
=>
!
path
.
startsWith
(
'/b/build/slave/'
),
);
if
(
await
fingerprinter
.
doesFingerprintMatch
())
{
printTrace
(
'Skipping kernel compilation. Fingerprint match.'
);
return
CompilerOutput
(
outputFilePath
,
0
,
/* sources */
null
);
}
}
// This is a URI, not a file path, so the forward slash is correct even on Windows.
if
(!
sdkRoot
.
endsWith
(
'/'
))
if
(!
sdkRoot
.
endsWith
(
'/'
))
{
sdkRoot
=
'
$sdkRoot
/'
;
}
final
String
engineDartPath
=
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
);
if
(!
processManager
.
canRun
(
engineDartPath
))
{
throwToolExit
(
'Unable to find Dart binary at
$engineDartPath
'
);
...
...
@@ -288,9 +262,6 @@ class KernelCompiler {
}
else
if
(
aot
)
{
command
.
add
(
'-Ddart.vm.profile=true'
);
}
if
(
incrementalCompilerByteStorePath
!=
null
)
{
command
.
add
(
'--incremental'
);
}
Uri
mainUri
;
if
(
packagesPath
!=
null
)
{
command
.
addAll
(<
String
>[
'--packages'
,
packagesPath
]);
...
...
@@ -313,6 +284,9 @@ class KernelCompiler {
if
(
initializeFromDill
!=
null
)
{
command
.
addAll
(<
String
>[
'--initialize-from-dill'
,
initializeFromDill
]);
}
if
(
platformDill
!=
null
)
{
command
.
addAll
(<
String
>[
'--platform'
,
platformDill
]);
}
if
(
extraFrontEndOptions
!=
null
)
command
.
addAll
(
extraFrontEndOptions
);
...
...
@@ -337,9 +311,6 @@ class KernelCompiler {
.
listen
(
_stdoutHandler
.
handler
);
final
int
exitCode
=
await
server
.
exitCode
;
if
(
exitCode
==
0
)
{
if
(
fingerprinter
!=
null
)
{
await
fingerprinter
.
writeFingerprint
();
}
return
_stdoutHandler
.
compilerOutput
.
future
;
}
return
null
;
...
...
packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart
View file @
51d2d351
...
...
@@ -305,6 +305,7 @@ class FakeKernelCompiler implements KernelCompiler {
List
<
String
>
fileSystemRoots
,
String
fileSystemScheme
,
bool
targetProductVm
=
false
,
String
platformDill
,
String
initializeFromDill
})
async
{
fs
.
file
(
outputFilePath
).
createSync
(
recursive:
true
);
return
CompilerOutput
(
outputFilePath
,
0
,
null
);
...
...
packages/flutter_tools/test/general.shard/compile_test.dart
View file @
51d2d351
...
...
@@ -505,6 +505,18 @@ example:org-dartlang-app:/
Platform:
_kNoColorTerminalPlatform
,
});
});
test
(
'TargetModel values'
,
()
{
expect
(
TargetModel
(
'vm'
),
TargetModel
.
vm
);
expect
(
TargetModel
.
vm
.
toString
(),
'vm'
);
expect
(
TargetModel
(
'flutter'
),
TargetModel
.
flutter
);
expect
(
TargetModel
.
flutter
.
toString
(),
'flutter'
);
expect
(
TargetModel
(
'flutter_runner'
),
TargetModel
.
flutterRunner
);
expect
(
TargetModel
.
flutterRunner
.
toString
(),
'flutter_runner'
);
expect
(()
=>
TargetModel
(
'foobar'
),
throwsA
(
isInstanceOf
<
AssertionError
>()));
});
}
Future
<
void
>
_recompile
(
...
...
packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart
View file @
51d2d351
...
...
@@ -167,7 +167,6 @@ Hello!
when
(
mockKernelCompiler
.
compile
(
sdkRoot:
anyNamed
(
'sdkRoot'
),
incrementalCompilerByteStorePath:
anyNamed
(
'incrementalCompilerByteStorePath'
),
mainPath:
anyNamed
(
'mainPath'
),
outputFilePath:
anyNamed
(
'outputFilePath'
),
depFilePath:
anyNamed
(
'depFilePath'
),
...
...
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