Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f2d33b0

Browse files
author
Kaushik Iska
committed
[dart] Account for compiler api change
There is likely no reason for component-name support here given this has moved to dart. Keeping it here until the Fuchsia roll settles.
1 parent f5ca58b commit f2d33b0

File tree

1 file changed

+25
-33
lines changed

1 file changed

+25
-33
lines changed

shell/platform/fuchsia/dart/compiler.dart

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@ import 'dart:async';
66
import 'dart:io';
77

88
import 'package:args/args.dart';
9+
910
import 'package:crypto/crypto.dart';
1011

1112
import 'package:vm/kernel_front_end.dart'
1213
show createCompilerArgParser, runCompiler, successExitCode;
1314

14-
final ArgParser _argParser = createCompilerArgParser()
15-
..addFlag('train',
16-
help: 'Run through sample command line to produce snapshot',
17-
negatable: false)
18-
..addOption('component-name', help: 'Name of the component')
19-
..addOption('data-dir',
20-
help: 'Name of the subdirectory of //data for output files')
21-
..addOption('manifest', help: 'Path to output Fuchsia package manifest');
15+
final ArgParser _argParser = createCompilerArgParser();
2216

2317
String _usage = '''
2418
Usage: compiler [options] input.dart
@@ -28,27 +22,23 @@ ${_argParser.usage}
2822
''';
2923

3024
Future<void> main(List<String> args) async {
31-
ArgResults options;
25+
// The kernel compiler now supports creating a manifest. We need
26+
// to still support the old version until the new compiler rolls
27+
// into Fuchsia.
28+
final shouldCreateManifest =
29+
!_argParser.options.containsKey('component-name');
30+
31+
if (shouldCreateManifest) {
32+
_argParser
33+
..addOption('component-name', help: 'Name of the component')
34+
..addOption('data-dir',
35+
help: 'Name of the subdirectory of //data for output files')
36+
..addOption('manifest', help: 'Path to output Fuchsia package manifest');
37+
}
3238

39+
ArgResults options;
3340
try {
3441
options = _argParser.parse(args);
35-
36-
if (options['train']) {
37-
final Directory temp =
38-
Directory.systemTemp.createTempSync('train_kernel_compiler');
39-
try {
40-
options = _argParser.parse(<String>[
41-
'--manifest=flutter',
42-
'--data-dir=${temp.absolute}',
43-
]);
44-
45-
await runCompiler(options, _usage);
46-
return;
47-
} finally {
48-
temp.deleteSync(recursive: true);
49-
}
50-
}
51-
5242
if (!options.rest.isNotEmpty) {
5343
throw Exception('Must specify input.dart');
5444
}
@@ -65,14 +55,16 @@ Future<void> main(List<String> args) async {
6555
return;
6656
}
6757

68-
final String output = options['output'];
69-
final String dataDir = options.options.contains('component-name')
70-
? options['component-name']
71-
: options['data-dir'];
72-
final String manifestFilename = options['manifest'];
58+
if (shouldCreateManifest) {
59+
final String output = options['output'];
60+
final String dataDir = options.options.contains('component-name')
61+
? options['component-name']
62+
: options['data-dir'];
63+
final String manifestFilename = options['manifest'];
7364

74-
if (manifestFilename != null) {
75-
await createManifest(manifestFilename, dataDir, output);
65+
if (manifestFilename != null) {
66+
await createManifest(manifestFilename, dataDir, output);
67+
}
7668
}
7769
}
7870

0 commit comments

Comments
 (0)