OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:front_end/compiler_options.dart'; | 8 import 'package:front_end/compiler_options.dart'; |
9 import 'package:front_end/dependency_grapher.dart'; | 9 import 'package:front_end/dependency_grapher.dart'; |
10 import 'package:path/path.dart' as pathos; | 10 import 'package:path/path.dart' as pathos; |
(...skipping 23 matching lines...) Expand all Loading... |
34 /// | 34 /// |
35 /// Each listed directory is considered a subpackage. Each package contains all | 35 /// Each listed directory is considered a subpackage. Each package contains all |
36 /// of its descendant files that are not in a more deeply nested subpackage. | 36 /// of its descendant files that are not in a more deeply nested subpackage. |
37 /// | 37 /// |
38 /// TODO(paulberry): stuff in lib/src shouldn't depend on lib; lib should just | 38 /// TODO(paulberry): stuff in lib/src shouldn't depend on lib; lib should just |
39 /// re-export stuff in lib/src. | 39 /// re-export stuff in lib/src. |
40 final subpackageRules = { | 40 final subpackageRules = { |
41 'lib': new SubpackageRules(allowedDependencies: [ | 41 'lib': new SubpackageRules(allowedDependencies: [ |
42 'lib/src', | 42 'lib/src', |
43 'lib/src/base', | 43 'lib/src/base', |
44 'lib/src/incremental', | 44 'lib/src/fasta', |
| 45 'lib/src/fasta/dill', |
| 46 'lib/src/fasta/kernel', |
| 47 'lib/src/incremental' |
45 ]), | 48 ]), |
46 'lib/src': new SubpackageRules(allowedDependencies: [ | 49 'lib/src': new SubpackageRules(allowedDependencies: [ |
47 'lib', | 50 'lib', |
48 'lib/src/base', | 51 'lib/src/base', |
49 'lib/src/fasta', | 52 'lib/src/fasta', |
50 "lib/src/fasta/dill", | 53 "lib/src/fasta/dill", |
51 "lib/src/fasta/kernel", | 54 "lib/src/fasta/kernel", |
52 'lib/src/fasta/source', | 55 'lib/src/fasta/source', |
53 'lib/src/incremental', | 56 'lib/src/incremental', |
54 ]), | 57 ]), |
55 'lib/src/base': new SubpackageRules( | 58 'lib/src/base': new SubpackageRules(allowedDependencies: [ |
56 allowedDependencies: ['lib', 'lib/src/fasta', 'lib/src/incremental']), | 59 'lib', |
| 60 'lib/src', |
| 61 'lib/src/fasta', |
| 62 'lib/src/incremental' |
| 63 ]), |
57 'lib/src/codegen': new SubpackageRules(), | 64 'lib/src/codegen': new SubpackageRules(), |
58 'lib/src/fasta': new SubpackageRules(allowedDependencies: [ | 65 'lib/src/fasta': new SubpackageRules(allowedDependencies: [ |
59 'lib', | 66 'lib', |
60 'lib/src', | |
61 'lib/src/base', | |
62 'lib/src/fasta/builder', | 67 'lib/src/fasta/builder', |
63 'lib/src/fasta/dill', | 68 'lib/src/fasta/dill', |
64 'lib/src/fasta/kernel', | 69 'lib/src/fasta/kernel', |
65 'lib/src/fasta/parser', | 70 'lib/src/fasta/parser', |
66 'lib/src/fasta/scanner', | 71 'lib/src/fasta/scanner', |
67 'lib/src/fasta/testing', | 72 'lib/src/fasta/testing', |
68 'lib/src/fasta/util', | 73 'lib/src/fasta/util', |
69 'lib/src/scanner', | 74 'lib/src/scanner', |
70 ]), | 75 ]), |
71 'lib/src/fasta/builder': new SubpackageRules(allowedDependencies: [ | 76 'lib/src/fasta/builder': new SubpackageRules(allowedDependencies: [ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 'lib/src/base', | 114 'lib/src/base', |
110 'lib/src/fasta/builder', | 115 'lib/src/fasta/builder', |
111 'lib/src/fasta/dill', | 116 'lib/src/fasta/dill', |
112 'lib/src/fasta/kernel', | 117 'lib/src/fasta/kernel', |
113 'lib/src/fasta/parser', | 118 'lib/src/fasta/parser', |
114 'lib/src/fasta/type_inference', | 119 'lib/src/fasta/type_inference', |
115 'lib/src/fasta/util', | 120 'lib/src/fasta/util', |
116 'lib/src/scanner', | 121 'lib/src/scanner', |
117 ]), | 122 ]), |
118 'lib/src/fasta/testing': new SubpackageRules(allowedDependencies: [ | 123 'lib/src/fasta/testing': new SubpackageRules(allowedDependencies: [ |
119 'lib', | |
120 'lib/src/fasta', | 124 'lib/src/fasta', |
121 'lib/src/base', | 125 'lib/src/base', |
122 'lib/src/fasta/kernel', | 126 'lib/src/fasta/kernel', |
123 'lib/src/fasta/scanner', | 127 'lib/src/fasta/scanner', |
124 'lib/src/scanner', | 128 'lib/src/scanner', |
125 ]), | 129 ]), |
126 'lib/src/fasta/type_inference': new SubpackageRules(allowedDependencies: [ | 130 'lib/src/fasta/type_inference': new SubpackageRules(allowedDependencies: [ |
127 'lib/src', | 131 'lib/src', |
128 'lib/src/base', | 132 'lib/src/base', |
129 'lib/src/fasta', | 133 'lib/src/fasta', |
(...skipping 11 matching lines...) Expand all Loading... |
141 ]), | 145 ]), |
142 'lib/src/scanner': new SubpackageRules(allowedDependencies: [ | 146 'lib/src/scanner': new SubpackageRules(allowedDependencies: [ |
143 'lib/src/base', | 147 'lib/src/base', |
144 // For error codes. | 148 // For error codes. |
145 'lib/src/fasta', | 149 'lib/src/fasta', |
146 // fasta scanner produces analyzer scanner tokens | 150 // fasta scanner produces analyzer scanner tokens |
147 'lib/src/fasta/scanner', | 151 'lib/src/fasta/scanner', |
148 ]), | 152 ]), |
149 'lib/src/testing': new SubpackageRules(allowedDependencies: [ | 153 'lib/src/testing': new SubpackageRules(allowedDependencies: [ |
150 'lib', | 154 'lib', |
151 'lib/src/fasta/testing', | |
152 ]), | 155 ]), |
153 }; | 156 }; |
154 | 157 |
155 /// Rules for what a subpackage may depend directly on. | 158 /// Rules for what a subpackage may depend directly on. |
156 class SubpackageRules { | 159 class SubpackageRules { |
157 /// Indicates whether dart files may exist in subdirectories of this | 160 /// Indicates whether dart files may exist in subdirectories of this |
158 /// subpackage. | 161 /// subpackage. |
159 /// | 162 /// |
160 /// If `false`, any subdirectory of this subpackage must be a separate | 163 /// If `false`, any subdirectory of this subpackage must be a separate |
161 /// subpackage. | 164 /// subpackage. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 if (subpackageRules[subpackage].allowSubdirs) { | 313 if (subpackageRules[subpackage].allowSubdirs) { |
311 subpackageRules[subpackage].actuallyHasSubdirs = true; | 314 subpackageRules[subpackage].actuallyHasSubdirs = true; |
312 } else { | 315 } else { |
313 problem('Uri $src is in a subfolder of $subpackage, but that ' | 316 problem('Uri $src is in a subfolder of $subpackage, but that ' |
314 'subpackage does not allow dart files in subdirectories.'); | 317 'subpackage does not allow dart files in subdirectories.'); |
315 } | 318 } |
316 } | 319 } |
317 return subpackage; | 320 return subpackage; |
318 } | 321 } |
319 } | 322 } |
OLD | NEW |