| 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; |
| 11 | 11 |
| 12 main() async { | 12 main() async { |
| 13 exit(await new _SubpackageRelationshipsTest().run()); | 13 exit(await new _SubpackageRelationshipsTest().run()); |
| 14 } | 14 } |
| 15 | 15 |
| 16 /// Map from subpackage name to the rules for what the subpackage is allowed to | 16 /// Map from subpackage name to the rules for what the subpackage is allowed to |
| 17 /// depend directly on. | 17 /// depend directly on. |
| 18 /// | 18 /// |
| 19 /// Each listed directory is considered a subpackage. Each package contains all | 19 /// Each listed directory is considered a subpackage. Each package contains all |
| 20 /// of its descendant files that are not in a more deeply nested subpackage. | 20 /// of its descendant files that are not in a more deeply nested subpackage. |
| 21 /// | 21 /// |
| 22 /// TODO(paulberry): stuff in lib/src shouldn't depend on lib; lib should just | 22 /// TODO(paulberry): stuff in lib/src shouldn't depend on lib; lib should just |
| 23 /// re-export stuff in lib/src. | 23 /// re-export stuff in lib/src. |
| 24 /// TODO(paulberry): remove dependencies on analyzer. | 24 /// TODO(paulberry): remove dependencies on analyzer. |
| 25 final subpackageRules = { | 25 final subpackageRules = { |
| 26 'lib': new SubpackageRules( | 26 'lib': new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [ |
| 27 mayImportAnalyzer: true, | 27 'lib/src', |
| 28 allowedDependencies: ['lib/src', 'lib/src/base']), | 28 'lib/src/base', |
| 29 'lib/src/fasta', |
| 30 'lib/src/fasta/dill', |
| 31 'lib/src/fasta/kernel' |
| 32 ]), |
| 29 'lib/src': new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [ | 33 'lib/src': new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [ |
| 30 'lib', | 34 'lib', |
| 31 'lib/src/base', | 35 'lib/src/base', |
| 32 'lib/src/fasta', | 36 'lib/src/fasta', |
| 33 'lib/src/fasta/source', | 37 'lib/src/fasta/source', |
| 34 ]), | 38 ]), |
| 35 'lib/src/base': new SubpackageRules( | 39 'lib/src/base': new SubpackageRules( |
| 36 mayImportAnalyzer: true, allowedDependencies: ['lib']), | 40 mayImportAnalyzer: true, allowedDependencies: ['lib']), |
| 37 'lib/src/codegen': new SubpackageRules(), | 41 'lib/src/codegen': new SubpackageRules(), |
| 38 'lib/src/fasta': new SubpackageRules(allowedDependencies: [ | 42 'lib/src/fasta': new SubpackageRules(allowedDependencies: [ |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 if (subpackageRules[subpackage].allowSubdirs) { | 271 if (subpackageRules[subpackage].allowSubdirs) { |
| 268 subpackageRules[subpackage].actuallyHasSubdirs = true; | 272 subpackageRules[subpackage].actuallyHasSubdirs = true; |
| 269 } else { | 273 } else { |
| 270 problem('Uri $src is in a subfolder of $subpackage, but that ' | 274 problem('Uri $src is in a subfolder of $subpackage, but that ' |
| 271 'subpackage does not allow dart files in subdirectories.'); | 275 'subpackage does not allow dart files in subdirectories.'); |
| 272 } | 276 } |
| 273 } | 277 } |
| 274 return subpackage; | 278 return subpackage; |
| 275 } | 279 } |
| 276 } | 280 } |
| OLD | NEW |