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/fasta', | 44 'lib/src/incremental', |
45 'lib/src/fasta/dill', | |
46 'lib/src/fasta/kernel', | |
47 'lib/src/incremental' | |
48 ]), | 45 ]), |
49 'lib/src': new SubpackageRules(allowedDependencies: [ | 46 'lib/src': new SubpackageRules(allowedDependencies: [ |
50 'lib', | 47 'lib', |
51 'lib/src/base', | 48 'lib/src/base', |
52 'lib/src/fasta', | 49 'lib/src/fasta', |
53 "lib/src/fasta/dill", | 50 "lib/src/fasta/dill", |
54 "lib/src/fasta/kernel", | 51 "lib/src/fasta/kernel", |
55 'lib/src/fasta/source', | 52 'lib/src/fasta/source', |
56 'lib/src/incremental', | 53 'lib/src/incremental', |
57 ]), | 54 ]), |
58 'lib/src/base': new SubpackageRules(allowedDependencies: [ | 55 'lib/src/base': new SubpackageRules(allowedDependencies: [ |
59 'lib', | 56 'lib', |
60 'lib/src', | 57 'lib/src', |
61 'lib/src/fasta', | 58 'lib/src/fasta', |
62 'lib/src/incremental' | 59 'lib/src/incremental' |
63 ]), | 60 ]), |
64 'lib/src/codegen': new SubpackageRules(), | 61 'lib/src/codegen': new SubpackageRules(), |
65 'lib/src/fasta': new SubpackageRules(allowedDependencies: [ | 62 'lib/src/fasta': new SubpackageRules(allowedDependencies: [ |
66 'lib', | 63 'lib', |
| 64 'lib/src', |
67 'lib/src/fasta/builder', | 65 'lib/src/fasta/builder', |
68 'lib/src/fasta/dill', | 66 'lib/src/fasta/dill', |
69 'lib/src/fasta/kernel', | 67 'lib/src/fasta/kernel', |
70 'lib/src/fasta/parser', | 68 'lib/src/fasta/parser', |
71 'lib/src/fasta/scanner', | 69 'lib/src/fasta/scanner', |
72 'lib/src/fasta/testing', | 70 'lib/src/fasta/testing', |
73 'lib/src/fasta/util', | 71 'lib/src/fasta/util', |
74 'lib/src/scanner', | 72 'lib/src/scanner', |
75 ]), | 73 ]), |
76 'lib/src/fasta/builder': new SubpackageRules(allowedDependencies: [ | 74 'lib/src/fasta/builder': new SubpackageRules(allowedDependencies: [ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 'lib/src/base', | 113 'lib/src/base', |
116 'lib/src/fasta/builder', | 114 'lib/src/fasta/builder', |
117 'lib/src/fasta/dill', | 115 'lib/src/fasta/dill', |
118 'lib/src/fasta/kernel', | 116 'lib/src/fasta/kernel', |
119 'lib/src/fasta/parser', | 117 'lib/src/fasta/parser', |
120 'lib/src/fasta/type_inference', | 118 'lib/src/fasta/type_inference', |
121 'lib/src/fasta/util', | 119 'lib/src/fasta/util', |
122 'lib/src/scanner', | 120 'lib/src/scanner', |
123 ]), | 121 ]), |
124 'lib/src/fasta/testing': new SubpackageRules(allowedDependencies: [ | 122 'lib/src/fasta/testing': new SubpackageRules(allowedDependencies: [ |
| 123 'lib', |
125 'lib/src/fasta', | 124 'lib/src/fasta', |
126 'lib/src/base', | 125 'lib/src/base', |
127 'lib/src/fasta/kernel', | 126 'lib/src/fasta/kernel', |
128 'lib/src/fasta/scanner', | 127 'lib/src/fasta/scanner', |
129 'lib/src/scanner', | 128 'lib/src/scanner', |
130 ]), | 129 ]), |
131 'lib/src/fasta/type_inference': new SubpackageRules(allowedDependencies: [ | 130 'lib/src/fasta/type_inference': new SubpackageRules(allowedDependencies: [ |
132 'lib/src', | 131 'lib/src', |
133 'lib/src/base', | 132 'lib/src/base', |
134 'lib/src/fasta', | 133 'lib/src/fasta', |
(...skipping 11 matching lines...) Expand all Loading... |
146 ]), | 145 ]), |
147 'lib/src/scanner': new SubpackageRules(allowedDependencies: [ | 146 'lib/src/scanner': new SubpackageRules(allowedDependencies: [ |
148 'lib/src/base', | 147 'lib/src/base', |
149 // For error codes. | 148 // For error codes. |
150 'lib/src/fasta', | 149 'lib/src/fasta', |
151 // fasta scanner produces analyzer scanner tokens | 150 // fasta scanner produces analyzer scanner tokens |
152 'lib/src/fasta/scanner', | 151 'lib/src/fasta/scanner', |
153 ]), | 152 ]), |
154 'lib/src/testing': new SubpackageRules(allowedDependencies: [ | 153 'lib/src/testing': new SubpackageRules(allowedDependencies: [ |
155 'lib', | 154 'lib', |
| 155 'lib/src/fasta/testing', |
156 ]), | 156 ]), |
157 }; | 157 }; |
158 | 158 |
159 /// Rules for what a subpackage may depend directly on. | 159 /// Rules for what a subpackage may depend directly on. |
160 class SubpackageRules { | 160 class SubpackageRules { |
161 /// Indicates whether dart files may exist in subdirectories of this | 161 /// Indicates whether dart files may exist in subdirectories of this |
162 /// subpackage. | 162 /// subpackage. |
163 /// | 163 /// |
164 /// If `false`, any subdirectory of this subpackage must be a separate | 164 /// If `false`, any subdirectory of this subpackage must be a separate |
165 /// subpackage. | 165 /// subpackage. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 if (subpackageRules[subpackage].allowSubdirs) { | 314 if (subpackageRules[subpackage].allowSubdirs) { |
315 subpackageRules[subpackage].actuallyHasSubdirs = true; | 315 subpackageRules[subpackage].actuallyHasSubdirs = true; |
316 } else { | 316 } else { |
317 problem('Uri $src is in a subfolder of $subpackage, but that ' | 317 problem('Uri $src is in a subfolder of $subpackage, but that ' |
318 'subpackage does not allow dart files in subdirectories.'); | 318 'subpackage does not allow dart files in subdirectories.'); |
319 } | 319 } |
320 } | 320 } |
321 return subpackage; | 321 return subpackage; |
322 } | 322 } |
323 } | 323 } |
OLD | NEW |