@@ -14,11 +14,7 @@ import 'package:vm/kernel_front_end.dart'
14
14
final ArgParser _argParser = createCompilerArgParser ()
15
15
..addFlag ('train' ,
16
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' );
17
+ negatable: false );
22
18
23
19
String _usage = '''
24
20
Usage: compiler [options] input.dart
@@ -28,8 +24,21 @@ ${_argParser.usage}
28
24
''' ;
29
25
30
26
Future <void > main (List <String > args) async {
31
- ArgResults options;
27
+ // The kernel compiler now supports creating a manifest. We need
28
+ // to still support the old version until the new compiler rolls
29
+ // into Fuchsia.
30
+ final bool shouldCreateManifest =
31
+ ! _argParser.options.containsKey ('component-name' );
32
+
33
+ if (shouldCreateManifest) {
34
+ _argParser
35
+ ..addOption ('component-name' , help: 'Name of the component' )
36
+ ..addOption ('data-dir' ,
37
+ help: 'Name of the subdirectory of //data for output files' )
38
+ ..addOption ('manifest' , help: 'Path to output Fuchsia package manifest' );
39
+ }
32
40
41
+ ArgResults options;
33
42
try {
34
43
options = _argParser.parse (args);
35
44
@@ -65,14 +74,16 @@ Future<void> main(List<String> args) async {
65
74
return ;
66
75
}
67
76
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' ];
77
+ if (shouldCreateManifest) {
78
+ final String output = options['output' ];
79
+ final String dataDir = options.options.contains ('component-name' )
80
+ ? options['component-name' ]
81
+ : options['data-dir' ];
82
+ final String manifestFilename = options['manifest' ];
73
83
74
- if (manifestFilename != null ) {
75
- await createManifest (manifestFilename, dataDir, output);
84
+ if (manifestFilename != null ) {
85
+ await createManifest (manifestFilename, dataDir, output);
86
+ }
76
87
}
77
88
}
78
89
0 commit comments