OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'dart:io'; | |
6 import 'dart:async'; | |
7 | |
8 import 'package:immic/compiler.dart' as immic; | |
9 import 'package:args/args.dart'; | |
10 | |
11 main(List<String> arguments) async { | |
12 ArgParser parser = new ArgParser(); | |
13 parser.addOption('packages'); | |
14 parser.addOption('out', defaultsTo: "."); | |
15 ArgResults results = parser.parse(arguments); | |
16 String packagesFile = results['packages']; | |
17 String outputDirectory = results['out']; | |
18 if (!(new Directory(outputDirectory)).existsSync()) { | |
19 print("Output directory '$outputDirectory' does not exist."); | |
20 exit(1); | |
21 } | |
22 if (packagesFile == null && (new File('.packages')).existsSync()) { | |
23 packagesFile = '.packages'; | |
24 } | |
25 if (packagesFile != null && !(new File(packagesFile)).existsSync()) { | |
26 print("Packages file '$packagesFile' does not exist."); | |
27 exit(1); | |
28 } | |
29 if (results.rest.isEmpty) { | |
30 print("No input files."); | |
31 exit(1); | |
32 } | |
33 for (String path in results.rest) { | |
34 await immic.compile(path, outputDirectory, packagesFile); | |
35 } | |
36 } | |
OLD | NEW |