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

Commit f8d2a7a

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 f8d2a7a

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

shell/platform/fuchsia/dart/compiler.dart

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ import 'package:vm/kernel_front_end.dart'
1414
final ArgParser _argParser = createCompilerArgParser()
1515
..addFlag('train',
1616
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);
2218

2319
String _usage = '''
2420
Usage: compiler [options] input.dart
@@ -28,8 +24,21 @@ ${_argParser.usage}
2824
''';
2925

3026
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+
}
3240

41+
ArgResults options;
3342
try {
3443
options = _argParser.parse(args);
3544

@@ -65,14 +74,16 @@ Future<void> main(List<String> args) async {
6574
return;
6675
}
6776

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'];
7383

74-
if (manifestFilename != null) {
75-
await createManifest(manifestFilename, dataDir, output);
84+
if (manifestFilename != null) {
85+
await createManifest(manifestFilename, dataDir, output);
86+
}
7687
}
7788
}
7889

0 commit comments

Comments
 (0)