diff --git a/bin/cache/.dartignore b/bin/cache/.dartignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/dev/benchmarks/complex_layout/lib/main.dart b/dev/benchmarks/complex_layout/lib/main.dart index 6c985b6fe6..9473429d73 100644 --- a/dev/benchmarks/complex_layout/lib/main.dart +++ b/dev/benchmarks/complex_layout/lib/main.dart @@ -457,7 +457,7 @@ class ItemGalleryBox extends StatelessWidget { child: new Column( children: [ new Flexible( - child: new TabBarView( + child: new TabBarView( children: tabNames.map((String tabName) { return new Container( key: new Key("Tab $index - $tabName"), diff --git a/dev/benchmarks/complex_layout/pubspec.yaml b/dev/benchmarks/complex_layout/pubspec.yaml index db5f9bf178..458fb2234b 100644 --- a/dev/benchmarks/complex_layout/pubspec.yaml +++ b/dev/benchmarks/complex_layout/pubspec.yaml @@ -1,8 +1,13 @@ name: complex_layout description: A new flutter project. + dependencies: flutter: path: ../../../packages/flutter flutter_driver: path: ../../../packages/flutter_driver - flutter_gallery_assets: '0.0.14' + flutter_gallery_assets: '0.0.15' + +dev_dependencies: + flutter_test: + path: ../../../packages/flutter_test diff --git a/dev/docs/.dartignore b/dev/docs/.dartignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/hello_android/app/src/flutter/lib/main.dart b/examples/hello_android/app/src/flutter/lib/main.dart index dc1dbe56fc..ef2fa82ec4 100644 --- a/examples/hello_android/app/src/flutter/lib/main.dart +++ b/examples/hello_android/app/src/flutter/lib/main.dart @@ -13,13 +13,13 @@ import 'package:flutter/widgets.dart'; final Random random = new Random(); Future handleGetRandom(String json) async { - Map message = JSON.decode(json); + Map message = JSON.decode(json); double min = message['min'].toDouble(); double max = message['max'].toDouble(); double value = (random.nextDouble() * (max - min)) + min; - Map reply = {'value': value}; + Map reply = {'value': value}; return JSON.encode(reply); } @@ -51,13 +51,13 @@ class _HelloAndroidState extends State { } void _getLocation() { - Map message = {'provider': 'network'}; + Map message = {'provider': 'network'}; HostMessages.sendToHost('getLocation', JSON.encode(message)) .then(_onReceivedLocation); } void _onReceivedLocation(String json) { - Map reply = JSON.decode(json); + Map reply = JSON.decode(json); setState(() { _latitude = reply['latitude']; _longitude = reply['longitude']; diff --git a/examples/hello_android/app/src/flutter/pubspec.yaml b/examples/hello_android/app/src/flutter/pubspec.yaml index 56699090ba..22acfdaf05 100644 --- a/examples/hello_android/app/src/flutter/pubspec.yaml +++ b/examples/hello_android/app/src/flutter/pubspec.yaml @@ -1,4 +1,9 @@ name: gradle + dependencies: flutter: path: ../../../../../packages/flutter + +dev_dependencies: + flutter_test: + path: ../../../../../packages/flutter_test diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart index bce3b086e4..04e37ad00c 100644 --- a/packages/flutter_tools/lib/src/commands/analyze.dart +++ b/packages/flutter_tools/lib/src/commands/analyze.dart @@ -89,18 +89,6 @@ void _addPackage(String directoryPath, List dartFiles, Set pubSp pubSpecDirectories.add(directoryPath); } -/// Adds all packages in [subPath], assuming a flat directory structure, i.e. -/// each direct child of [subPath] is a plain Dart package. -void _addFlatPackageList(String subPath, List dartFiles, Set pubSpecDirectories) { - Directory subdirectory = new Directory(path.join(ArtifactStore.flutterRoot, subPath)); - if (subdirectory.existsSync()) { - for (FileSystemEntity entry in subdirectory.listSync()) { - if (entry is Directory) - _addPackage(entry.path, dartFiles, pubSpecDirectories); - } - } -} - class FileChanged { } class AnalyzeCommand extends FlutterCommand { @@ -199,8 +187,8 @@ class AnalyzeCommand extends FlutterCommand { //dev/manual_tests/*/ as package //dev/manual_tests/*/ as files - _addFlatPackageList('packages', dartFiles, pubSpecDirectories); - _addFlatPackageList('examples', dartFiles, pubSpecDirectories); + for (Directory dir in runner.getRepoPackages()) + _addPackage(dir.path, dartFiles, pubSpecDirectories); Directory subdirectory; @@ -235,7 +223,6 @@ class AnalyzeCommand extends FlutterCommand { if (foundOne) pubSpecDirectories.add(subdirectory.path); } - } dartFiles = dartFiles.map((String directory) => path.normalize(path.absolute(directory))).toSet().toList(); @@ -453,12 +440,7 @@ class AnalyzeCommand extends FlutterCommand { List directories; if (argResults['flutter-repo']) { - String root = path.absolute(ArtifactStore.flutterRoot); - - directories = []; - directories.addAll(_gatherProjectPaths(path.join(root, 'examples'))); - directories.addAll(_gatherProjectPaths(path.join(root, 'packages'))); - directories.addAll(_gatherProjectPaths(path.join(root, 'dev'))); + directories = runner.getRepoPackages().map((Directory dir) => dir.path).toList(); printStatus('Analyzing Flutter repository (${directories.length} projects).'); for (String projectPath in directories) printTrace(' ${path.relative(projectPath)}'); @@ -551,17 +533,6 @@ class AnalyzeCommand extends FlutterCommand { return false; } - - List _gatherProjectPaths(String rootPath) { - if (FileSystemEntity.isFileSync(path.join(rootPath, 'pubspec.yaml'))) - return [rootPath]; - - return new Directory(rootPath) - .listSync(followLinks: false) - .expand((FileSystemEntity entity) { - return entity is Directory ? _gatherProjectPaths(entity.path) : []; - }); - } } class PackageDependency { diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart index 16c1000793..6a03f50abf 100644 --- a/packages/flutter_tools/lib/src/commands/update_packages.dart +++ b/packages/flutter_tools/lib/src/commands/update_packages.dart @@ -5,25 +5,10 @@ import 'dart:async'; import 'dart:io'; -import '../artifacts.dart'; import '../dart/pub.dart'; import '../globals.dart'; import '../runner/flutter_command.dart'; -/// Return the total number of projects run; throws the exit code on error. -Future _runPub(Directory directory, { bool upgrade: false }) async { - int updateCount = 0; - for (FileSystemEntity dir in directory.listSync()) { - if (dir is Directory && FileSystemEntity.isFileSync(dir.path + Platform.pathSeparator + 'pubspec.yaml')) { - updateCount++; - int code = await pubGet(directory: dir.path, upgrade: upgrade, checkLastModified: false); - if (code != 0) - throw code; - } - } - return updateCount; -} - class UpdatePackagesCommand extends FlutterCommand { UpdatePackagesCommand({ this.hidden: false }) { argParser.addFlag( @@ -52,10 +37,12 @@ class UpdatePackagesCommand extends FlutterCommand { int count = 0; bool upgrade = argResults['upgrade']; - count += await _runPub(new Directory("${ArtifactStore.flutterRoot}/packages"), upgrade: upgrade); - count += await _runPub(new Directory("${ArtifactStore.flutterRoot}/examples"), upgrade: upgrade); - count += await _runPub(new Directory("${ArtifactStore.flutterRoot}/dev"), upgrade: upgrade); - count += await _runPub(new Directory("${ArtifactStore.flutterRoot}/dev/benchmarks"), upgrade: upgrade); + for (Directory dir in runner.getRepoPackages()) { + int code = await pubGet(directory: dir.path, upgrade: upgrade, checkLastModified: false); + if (code != 0) + throw code; + count++; + } double seconds = timer.elapsedMilliseconds / 1000.0; printStatus('\nRan \'pub\' $count time${count == 1 ? "" : "s"} in ${seconds.toStringAsFixed(1)}s.'); diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart index f72d45a520..af9412f0d6 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart @@ -390,4 +390,25 @@ class FlutterCommandRunner extends CommandRunner { if (ArtifactStore.flutterRoot == null) ArtifactStore.flutterRoot = _defaultFlutterRoot; } + + /// Get all pub packages in the Flutter repo. + List getRepoPackages() { + return _gatherProjectPaths(path.absolute(ArtifactStore.flutterRoot)) + .map((String dir) => new Directory(dir)) + .toList(); + } + + static List _gatherProjectPaths(String rootPath) { + if (FileSystemEntity.isFileSync(path.join(rootPath, '.dartignore'))) + return []; + + if (FileSystemEntity.isFileSync(path.join(rootPath, 'pubspec.yaml'))) + return [rootPath]; + + return new Directory(rootPath) + .listSync(followLinks: false) + .expand((FileSystemEntity entity) { + return entity is Directory ? _gatherProjectPaths(entity.path) : []; + }); + } }