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 14 matching lines...) Expand all Loading... |
25 final subpackageRules = { | 25 final subpackageRules = { |
26 'lib': new SubpackageRules( | 26 'lib': new SubpackageRules( |
27 mayImportAnalyzer: true, | 27 mayImportAnalyzer: true, |
28 allowedDependencies: ['lib/src', 'lib/src/base']), | 28 allowedDependencies: ['lib/src', 'lib/src/base']), |
29 'lib/src': new SubpackageRules( | 29 'lib/src': new SubpackageRules( |
30 mayImportAnalyzer: true, | 30 mayImportAnalyzer: true, |
31 allowedDependencies: ['lib', 'lib/src/base', 'lib/src/scanner']), | 31 allowedDependencies: ['lib', 'lib/src/base', 'lib/src/scanner']), |
32 'lib/src/base': new SubpackageRules( | 32 'lib/src/base': new SubpackageRules( |
33 mayImportAnalyzer: true, allowedDependencies: ['lib']), | 33 mayImportAnalyzer: true, allowedDependencies: ['lib']), |
34 'lib/src/fasta': | 34 'lib/src/fasta': |
35 new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [ | 35 new SubpackageRules(mayImportAnalyzer: false, allowedDependencies: [ |
36 'lib/src/fasta/builder', | 36 'lib/src/fasta/builder', |
37 'lib/src/fasta/dill', | 37 'lib/src/fasta/dill', |
38 'lib/src/fasta/kernel', | 38 'lib/src/fasta/kernel', |
39 'lib/src/fasta/parser', | 39 'lib/src/fasta/parser', |
40 'lib/src/fasta/scanner', | 40 'lib/src/fasta/scanner', |
41 'lib/src/fasta/testing', | 41 'lib/src/fasta/testing', |
42 'lib/src/fasta/util', | 42 'lib/src/fasta/util', |
43 ]), | 43 ]), |
44 'lib/src/fasta/analyzer': | 44 'lib/src/fasta/analyzer': |
45 new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [ | 45 new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [ |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 'lib/src/fasta/util', | 82 'lib/src/fasta/util', |
83 ]), | 83 ]), |
84 'lib/src/fasta/scanner': | 84 'lib/src/fasta/scanner': |
85 new SubpackageRules(allowSubdirs: true, allowedDependencies: [ | 85 new SubpackageRules(allowSubdirs: true, allowedDependencies: [ |
86 'lib/src/fasta', | 86 'lib/src/fasta', |
87 'lib/src/fasta/parser', | 87 'lib/src/fasta/parser', |
88 'lib/src/fasta/util', | 88 'lib/src/fasta/util', |
89 ]), | 89 ]), |
90 'lib/src/fasta/source': new SubpackageRules(allowedDependencies: [ | 90 'lib/src/fasta/source': new SubpackageRules(allowedDependencies: [ |
91 'lib/src/fasta', | 91 'lib/src/fasta', |
92 'lib/src/fasta/analyzer', | |
93 'lib/src/fasta/builder', | 92 'lib/src/fasta/builder', |
94 'lib/src/fasta/dill', | 93 'lib/src/fasta/dill', |
95 'lib/src/fasta/kernel', | 94 'lib/src/fasta/kernel', |
96 'lib/src/fasta/parser', | 95 'lib/src/fasta/parser', |
97 'lib/src/fasta/scanner', | 96 'lib/src/fasta/scanner', |
98 'lib/src/fasta/util', | 97 'lib/src/fasta/util', |
99 ]), | 98 ]), |
100 'lib/src/fasta/testing': | 99 'lib/src/fasta/testing': |
101 new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [ | 100 new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [ |
102 'lib/src/fasta', | 101 'lib/src/fasta', |
103 'lib/src/fasta/dill', | 102 'lib/src/fasta/dill', |
104 'lib/src/fasta/kernel', | 103 'lib/src/fasta/kernel', |
| 104 'lib/src/fasta/analyzer', |
105 ]), | 105 ]), |
106 'lib/src/fasta/util': new SubpackageRules(), | 106 'lib/src/fasta/util': new SubpackageRules(), |
107 'lib/src/scanner': new SubpackageRules(allowedDependencies: [ | 107 'lib/src/scanner': new SubpackageRules(allowedDependencies: [ |
108 'lib/src/base', | 108 'lib/src/base', |
109 ]), | 109 ]), |
110 }; | 110 }; |
111 | 111 |
112 /// Rules for what a subpackage may depend directly on. | 112 /// Rules for what a subpackage may depend directly on. |
113 class SubpackageRules { | 113 class SubpackageRules { |
114 /// Indicates whether the subpackage may directly depend on analyzer. | 114 /// Indicates whether the subpackage may directly depend on analyzer. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 problem('Uri $src is inside package:front_end but is not in any known ' | 232 problem('Uri $src is inside package:front_end but is not in any known ' |
233 'subpackage'); | 233 'subpackage'); |
234 } else if (!subpackageRules[subpackage].allowSubdirs && | 234 } else if (!subpackageRules[subpackage].allowSubdirs && |
235 pathWithinSubpackage.contains('/')) { | 235 pathWithinSubpackage.contains('/')) { |
236 problem('Uri $src is in a subfolder of $subpackage, but that ' | 236 problem('Uri $src is in a subfolder of $subpackage, but that ' |
237 'subpackage does not allow dart files in subdirectories.'); | 237 'subpackage does not allow dart files in subdirectories.'); |
238 } | 238 } |
239 return subpackage; | 239 return subpackage; |
240 } | 240 } |
241 } | 241 } |
OLD | NEW |