mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:19:49 +00:00
[vm/kernel] Add options to generate Fuchsia manifest to gen_kernel tool
This change adds options --manifest --component-name --data-dir to gen_kernel tool. After that, gen_kernel becomes a drop-in replacement for Fuchsia's kernel compiler. Change-Id: I8370b4224d1fc1973c8a850ea1e46defdb2cbac4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150690 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
6e82beea2e
commit
2bd7cbb151
|
@ -123,6 +123,11 @@ void declareCompilerOptions(ArgParser args) {
|
|||
help:
|
||||
'Split resulting kernel file into multiple files (one per package).',
|
||||
defaultsTo: false);
|
||||
args.addOption('component-name',
|
||||
help: 'Name of the Fuchsia component', defaultsTo: null);
|
||||
args.addOption('data-dir',
|
||||
help: 'Name of the subdirectory of //data for output files');
|
||||
args.addOption('manifest', help: 'Path to output Fuchsia package manifest');
|
||||
args.addFlag('gen-bytecode', help: 'Generate bytecode', defaultsTo: false);
|
||||
args.addMultiOption('bytecode-options',
|
||||
help: 'Specify options for bytecode generation:',
|
||||
|
@ -181,6 +186,9 @@ Future<int> runCompiler(ArgResults options, String usage) async {
|
|||
final bool nullSafety = options['null-safety'];
|
||||
final bool useProtobufTreeShaker = options['protobuf-tree-shaker'];
|
||||
final bool splitOutputByPackages = options['split-output-by-packages'];
|
||||
final String manifestFilename = options['manifest'];
|
||||
final String dataDir = options['component-name'] ?? options['data-dir'];
|
||||
|
||||
final bool minimalKernel = options['minimal-kernel'];
|
||||
final bool treeShakeWriteOnlyFields = options['tree-shake-write-only-fields'];
|
||||
final List<String> experimentalFlags = options['enable-experiment'];
|
||||
|
@ -305,6 +313,10 @@ Future<int> runCompiler(ArgResults options, String usage) async {
|
|||
);
|
||||
}
|
||||
|
||||
if (manifestFilename != null) {
|
||||
await createFarManifest(outputFileName, dataDir, manifestFilename);
|
||||
}
|
||||
|
||||
return successExitCode;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ main() {
|
|||
});
|
||||
|
||||
String outputDill() => new File('${tempDir.path}/foo.dill').path;
|
||||
String outputManifest() => new File('${tempDir.path}/foo.manifest').path;
|
||||
|
||||
test('compile-simple', () async {
|
||||
await testCompile([
|
||||
|
@ -91,6 +92,10 @@ main() {
|
|||
'--output',
|
||||
outputDill(),
|
||||
'--split-output-by-packages',
|
||||
'--manifest',
|
||||
outputManifest(),
|
||||
'--component-name',
|
||||
'foo_component',
|
||||
'$sdkDir/$mainScript',
|
||||
]);
|
||||
}, timeout: Timeout.none);
|
||||
|
@ -120,6 +125,10 @@ main() {
|
|||
'--gen-bytecode',
|
||||
'--drop-ast',
|
||||
'--split-output-by-packages',
|
||||
'--manifest',
|
||||
outputManifest(),
|
||||
'--component-name',
|
||||
'foo_component',
|
||||
'$sdkDir/$mainScript',
|
||||
]);
|
||||
}, timeout: Timeout.none);
|
||||
|
|
Loading…
Reference in a new issue