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