Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1158)

Unified Diff: pkg/front_end/test/subpackage_relationships_test.dart

Issue 2627143004: Simplify finding of .dart files in subpackage_relationships_test. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/subpackage_relationships_test.dart
diff --git a/pkg/front_end/test/subpackage_relationships_test.dart b/pkg/front_end/test/subpackage_relationships_test.dart
index 3af7b72eae7923171907e99c98157daa07c42c41..9df8ff48a2c5af455b0028c66e4d5deeef945ead 100644
--- a/pkg/front_end/test/subpackage_relationships_test.dart
+++ b/pkg/front_end/test/subpackage_relationships_test.dart
@@ -50,8 +50,8 @@ class SubpackageRules {
}
class _SubpackageRelationshipsTest {
- /// File uri of the root of the front_end package.
- final frontEndRootUri = Platform.script.resolve('..');
+ /// File uri of the front_end package's "lib" directory.
+ final frontEndLibUri = Platform.script.resolve('../lib/');
/// Indicates whether any problems have been reported yet.
bool problemsReported = false;
@@ -88,18 +88,15 @@ class _SubpackageRelationshipsTest {
/// Finds all files in the front_end's "lib" directory and returns their Uris
/// (as "package:" URIs).
- Future<List<Uri>> findFrontEndUris() async {
+ List<Uri> findFrontEndUris() {
var frontEndUris = <Uri>[];
- var frontEndRootPath = pathos.fromUri(frontEndRootUri);
- await for (var entity in new Directory(frontEndRootPath)
- .list(recursive: true, followLinks: false)) {
+ var frontEndLibPath = pathos.fromUri(frontEndLibUri);
+ for (var entity in new Directory(frontEndLibPath)
+ .listSync(recursive: true, followLinks: false)) {
if (entity is File && entity.path.endsWith('.dart')) {
- var posixRelativePath = pathos
- .relative(entity.path, from: frontEndRootPath)
- .replaceAll(pathos.separator, '/');
- if (!posixRelativePath.startsWith('lib/')) continue;
- frontEndUris.add(Uri.parse(
- posixRelativePath.replaceFirst('lib/', 'package:front_end/')));
+ var posixRelativePath = pathos.url.joinAll(
+ pathos.split(pathos.relative(entity.path, from: frontEndLibPath)));
+ frontEndUris.add(Uri.parse('package:front_end/$posixRelativePath'));
}
}
return frontEndUris;
@@ -115,7 +112,7 @@ class _SubpackageRelationshipsTest {
/// appropriate exit code.
Future<int> run() async {
var frontEndUris = await findFrontEndUris();
- var packagesFileUri = frontEndRootUri.resolve('../../.packages');
+ var packagesFileUri = frontEndLibUri.resolve('../../../.packages');
var graph = await graphForProgram(
frontEndUris,
new CompilerOptions()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698