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.md file. | |
4 | |
5 library fletchc.verbs.compile_verb; | |
6 | |
7 import 'infrastructure.dart'; | |
8 | |
9 import '../worker/developer.dart' as developer; | |
10 | |
11 import 'documentation.dart' show | |
12 compileDocumentation; | |
13 | |
14 const Action compileAction = const Action( | |
15 compile, compileDocumentation, requiresSession: true, | |
16 requiredTarget: TargetKind.FILE); | |
17 | |
18 Future<int> compile(AnalyzedSentence sentence, VerbContext context) { | |
19 bool analyzeOnly = sentence.options.analyzeOnly; | |
20 bool fatalIncrementalFailures = sentence.options.fatalIncrementalFailures; | |
21 return context.performTaskInWorker( | |
22 new CompileTask(sentence.targetUri, sentence.base, analyzeOnly, | |
23 fatalIncrementalFailures)); | |
24 } | |
25 | |
26 class CompileTask extends SharedTask { | |
27 // Keep this class simple, see note in superclass. | |
28 | |
29 final Uri script; | |
30 | |
31 final Uri base; | |
32 | |
33 final bool analyzeOnly; | |
34 | |
35 final bool fatalIncrementalFailures; | |
36 | |
37 const CompileTask( | |
38 this.script, this.base, this.analyzeOnly, this.fatalIncrementalFailures); | |
39 | |
40 Future<int> call( | |
41 CommandSender commandSender, | |
42 StreamIterator<ClientCommand> commandIterator) { | |
43 return compileTask(script, base, analyzeOnly, fatalIncrementalFailures); | |
44 } | |
45 } | |
46 | |
47 Future<int> compileTask( | |
48 Uri script, Uri base, bool analyzeOnly, bool fatalIncrementalFailures) { | |
49 return developer.compile( | |
50 script, SessionState.current, base, analyzeOnly: analyzeOnly, | |
51 fatalIncrementalFailures: fatalIncrementalFailures); | |
52 } | |
OLD | NEW |