| 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( |
| 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(mayImportAnalyzer: true, allowedDependencies: [ |
| 30 mayImportAnalyzer: true, | 30 'lib', |
| 31 allowedDependencies: ['lib', 'lib/src/base', 'lib/src/scanner']), | 31 'lib/src/base', |
| 32 'lib/src/fasta', |
| 33 'lib/src/fasta/source', |
| 34 ]), |
| 32 'lib/src/base': new SubpackageRules( | 35 'lib/src/base': new SubpackageRules( |
| 33 mayImportAnalyzer: true, allowedDependencies: ['lib']), | 36 mayImportAnalyzer: true, allowedDependencies: ['lib']), |
| 34 'lib/src/codegen': new SubpackageRules(), | 37 'lib/src/codegen': new SubpackageRules(), |
| 35 'lib/src/fasta': | 38 'lib/src/fasta': |
| 36 new SubpackageRules(mayImportAnalyzer: false, allowedDependencies: [ | 39 new SubpackageRules(mayImportAnalyzer: false, allowedDependencies: [ |
| 37 'lib/src/fasta/builder', | 40 'lib/src/fasta/builder', |
| 38 'lib/src/fasta/dill', | 41 'lib/src/fasta/dill', |
| 39 'lib/src/fasta/kernel', | 42 'lib/src/fasta/kernel', |
| 40 'lib/src/fasta/parser', | 43 'lib/src/fasta/parser', |
| 41 'lib/src/fasta/scanner', | 44 'lib/src/fasta/scanner', |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (subpackageRules[subpackage].allowSubdirs) { | 276 if (subpackageRules[subpackage].allowSubdirs) { |
| 274 subpackageRules[subpackage].actuallyHasSubdirs = true; | 277 subpackageRules[subpackage].actuallyHasSubdirs = true; |
| 275 } else { | 278 } else { |
| 276 problem('Uri $src is in a subfolder of $subpackage, but that ' | 279 problem('Uri $src is in a subfolder of $subpackage, but that ' |
| 277 'subpackage does not allow dart files in subdirectories.'); | 280 'subpackage does not allow dart files in subdirectories.'); |
| 278 } | 281 } |
| 279 } | 282 } |
| 280 return subpackage; | 283 return subpackage; |
| 281 } | 284 } |
| 282 } | 285 } |
| OLD | NEW |