mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add an option to link platform.dill into app kernel file (flutter/engine#4204)
This commit is contained in:
parent
cf981ae074
commit
df45191b54
@ -30,7 +30,14 @@ ArgParser _argParser = new ArgParser(allowTrailingOptions: true)
|
||||
..addOption('byte-store',
|
||||
help: 'Path to file byte store used to keep incremental compiler state.'
|
||||
' If omitted, then memory byte store is used.',
|
||||
defaultsTo: null);
|
||||
defaultsTo: null)
|
||||
..addFlag('link-platform',
|
||||
help: 'When in batch mode, link platform kernel file into result kernel file.'
|
||||
' Intended use is to satisfy different loading strategies implemented'
|
||||
' by gen_snapshot(which needs platform embedded) vs'
|
||||
' Flutter engine(which does not)',
|
||||
defaultsTo: true);
|
||||
|
||||
|
||||
String _usage = '''
|
||||
Usage: server [options] [input.dart]
|
||||
@ -156,11 +163,13 @@ class _FrontendCompiler implements CompilerInterface {
|
||||
final DeltaProgram deltaProgram = await _generator.computeDelta();
|
||||
program = deltaProgram.newProgram;
|
||||
} else {
|
||||
// TODO(aam): Remove linkedDependencies once platform is directly embedded
|
||||
// into VM snapshot and http://dartbug.com/30111 is fixed.
|
||||
compilerOptions.linkedDependencies = <Uri>[
|
||||
sdkRoot.resolve('platform.dill')
|
||||
];
|
||||
if (options['link-platform']) {
|
||||
// TODO(aam): Remove linkedDependencies once platform is directly embedded
|
||||
// into VM snapshot and http://dartbug.com/30111 is fixed.
|
||||
compilerOptions.linkedDependencies = <Uri>[
|
||||
sdkRoot.resolve('platform.dill')
|
||||
];
|
||||
}
|
||||
program = await kernelForProgram(Uri.base.resolve(_filename), compilerOptions);
|
||||
}
|
||||
if (program != null) {
|
||||
|
||||
@ -69,6 +69,27 @@ Future<int> main() async {
|
||||
expect(capturedArgs.single['sdk-root'], equals('sdkroot'));
|
||||
expect(capturedArgs.single['byte-store'], equals('path/to/bytestore'));
|
||||
});
|
||||
|
||||
test('compile from command line with link platform', () async {
|
||||
final List<String> args = <String>[
|
||||
'server.dart',
|
||||
'--sdk-root',
|
||||
'sdkroot',
|
||||
'--link-platform',
|
||||
];
|
||||
final int exitcode = await starter(args, compiler: compiler);
|
||||
expect(exitcode, equals(0));
|
||||
final List<ArgResults> capturedArgs =
|
||||
verify(
|
||||
compiler.compile(
|
||||
argThat(equals('server.dart')),
|
||||
captureAny,
|
||||
generator: any,
|
||||
)
|
||||
).captured;
|
||||
expect(capturedArgs.single['sdk-root'], equals('sdkroot'));
|
||||
expect(capturedArgs.single['link-platform'], equals(true));
|
||||
});
|
||||
});
|
||||
|
||||
group('interactive file store compile with mocked compiler', () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user