Unverified Commit 05dba60c authored by amirh's avatar amirh Committed by GitHub

keep recursing past directories with pubspec.yaml when gathering packages (#13573)

parent 6728d484
......@@ -361,15 +361,18 @@ class FlutterCommandRunner extends CommandRunner<Null> {
if (fs.isFileSync(fs.path.join(rootPath, '.dartignore')))
return <String>[];
if (fs.isFileSync(fs.path.join(rootPath, 'pubspec.yaml')))
return <String>[rootPath];
return fs.directory(rootPath)
final List<String> projectPaths = fs.directory(rootPath)
.listSync(followLinks: false)
.expand((FileSystemEntity entity) {
return entity is Directory ? _gatherProjectPaths(entity.path) : <String>[];
})
.toList();
if (fs.isFileSync(fs.path.join(rootPath, 'pubspec.yaml')))
projectPaths.add(rootPath);
return projectPaths;
}
void _checkFlutterCopy() {
......
......@@ -18,7 +18,7 @@ dependencies:
intl: 0.15.2
json_rpc_2: 2.0.4
json_schema: 1.0.6
linter: 0.1.40
linter: 0.1.41
meta: 1.1.1
mustache: 1.0.0
package_config: 1.0.3
......
......@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/version.dart';
import 'package:mockito/mockito.dart';
import 'package:test/test.dart';
......@@ -25,4 +29,31 @@ void main() {
expect(versionChecked, isTrue);
});
});
MemoryFileSystem fs;
setUp(() {
fs = new MemoryFileSystem();
});
testUsingContext('getRepoPackages', () {
final FlutterCommandRunner runner = new FlutterCommandRunner();
final String root = fs.path.absolute(Cache.flutterRoot);
fs.directory(fs.path.join(root, 'examples'))
.createSync(recursive: true);
fs.directory(fs.path.join(root, 'packages'))
.createSync(recursive: true);
fs.directory(fs.path.join(root, 'dev', 'tools', 'aatool'))
.createSync(recursive: true);
fs.file(fs.path.join(root, 'dev', 'tools', 'pubspec.yaml')).createSync();
fs.file(fs.path.join(root, 'dev', 'tools', 'aatool', 'pubspec.yaml')).createSync();
final List<String> packagePaths = runner.getRepoPackages()
.map((Directory d) => d.path).toList();
expect(packagePaths, <String>[
fs.directory(fs.path.join(root, 'dev', 'tools', 'aatool')).path,
fs.directory(fs.path.join(root, 'dev', 'tools')).path,
]);
}, overrides: <Type, Generator>{ FileSystem: () => fs } );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment