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