OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Defines the front-end API for converting source code to summaries. | 5 /// Defines the front-end API for converting source code to summaries. |
6 library front_end.summary_generator; | 6 library front_end.summary_generator; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'compiler_options.dart'; | 9 import 'compiler_options.dart'; |
10 | 10 |
| 11 import 'src/base/processed_options.dart'; |
| 12 import 'src/kernel_generator_impl.dart'; |
| 13 |
11 /// Creates a summary representation of the build unit whose source files are in | 14 /// Creates a summary representation of the build unit whose source files are in |
12 /// [sources]. | 15 /// [sources]. |
13 /// | 16 /// |
14 /// Intended to be a part of a modular compilation process. | 17 /// Intended to be a part of a modular compilation process. |
15 /// | 18 /// |
16 /// [sources] should be the complete set of source files for a build unit | 19 /// [sources] should be the complete set of source files for a build unit |
17 /// (including both library and part files). | 20 /// (including both library and part files). |
18 /// | 21 /// |
19 /// The summarization process is hermetic, meaning that the only files which | 22 /// By default, the compilation process is hermetic, meaning that the only files |
20 /// will be read are those listed in [sources], | 23 /// which will be read are those listed in [sources], |
21 /// [CompilerOptions.inputSummaries], and [CompilerOptions.sdkSummary]. If a | 24 /// [CompilerOptions.inputSummaries], and [CompilerOptions.sdkSummary]. If a |
22 /// source file attempts to refer to a file which is not obtainable from these | 25 /// source file attempts to refer to a file which is not obtainable from these |
23 /// paths, that will result in an error, even if the file exists on the | 26 /// URIs, that will result in an error, even if the file exists on the |
24 /// filesystem. | 27 /// filesystem. |
25 /// | 28 /// |
| 29 /// When [CompilerOptions.chaseDependencies] is true, this default behavior |
| 30 /// changes, and any dependency of [sources] that is not listed in |
| 31 /// [CompilerOptions.inputSummaries] and [CompilerOptions.sdkSummary] is treated |
| 32 /// as an additional source file for the build unit. |
| 33 /// |
26 /// Any `part` declarations found in [sources] must refer to part files which | 34 /// Any `part` declarations found in [sources] must refer to part files which |
27 /// are also listed in [sources], otherwise an error results. (It is not | 35 /// are also listed in the build unit sources, otherwise an error results. (It |
28 /// permitted to refer to a part file declared in another build unit). | 36 /// is not permitted to refer to a part file declared in another build unit). |
29 /// | 37 /// |
30 /// The return value is a list of bytes to write to the summary file. | 38 /// The return value is a list of bytes to write to the summary file. |
31 Future<List<int>> summaryFor(List<Uri> sources, CompilerOptions options) => | 39 Future<List<int>> summaryFor(List<Uri> sources, CompilerOptions options) async { |
32 throw new UnimplementedError(); | 40 return (await generateKernel(new ProcessedOptions(options, true, sources), |
| 41 buildSummary: true, buildProgram: false)) |
| 42 ?.summary; |
| 43 } |
OLD | NEW |