@@ -6,19 +6,13 @@ import 'dart:async';
6
6
import 'dart:io' ;
7
7
8
8
import 'package:args/args.dart' ;
9
+
9
10
import 'package:crypto/crypto.dart' ;
10
11
11
12
import 'package:vm/kernel_front_end.dart'
12
13
show createCompilerArgParser, runCompiler, successExitCode;
13
14
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 ();
22
16
23
17
String _usage = '''
24
18
Usage: compiler [options] input.dart
@@ -28,27 +22,23 @@ ${_argParser.usage}
28
22
''' ;
29
23
30
24
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
+ }
32
38
39
+ ArgResults options;
33
40
try {
34
41
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
-
52
42
if (! options.rest.isNotEmpty) {
53
43
throw Exception ('Must specify input.dart' );
54
44
}
@@ -65,14 +55,16 @@ Future<void> main(List<String> args) async {
65
55
return ;
66
56
}
67
57
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' ];
73
64
74
- if (manifestFilename != null ) {
75
- await createManifest (manifestFilename, dataDir, output);
65
+ if (manifestFilename != null ) {
66
+ await createManifest (manifestFilename, dataDir, output);
67
+ }
76
68
}
77
69
}
78
70
0 commit comments