From 8dc1634be53dd5a06770d0af38f2bc79d5113456 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Thu, 19 Jan 2017 09:11:41 -0800 Subject: [PATCH] Stop building unlinked summaries for packages. (#7538) Stop building (unused) unlinked summaries for packages. Improves update speed considerably (for `n` packages it saves us `n` needless calls to `pub get`). --- .../lib/src/commands/upgrade.dart | 3 - .../flutter_tools/lib/src/dart/summary.dart | 56 ------------------- 2 files changed, 59 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/upgrade.dart b/packages/flutter_tools/lib/src/commands/upgrade.dart index 21295fdfa7..ece07b76d6 100644 --- a/packages/flutter_tools/lib/src/commands/upgrade.dart +++ b/packages/flutter_tools/lib/src/commands/upgrade.dart @@ -9,7 +9,6 @@ import '../base/os.dart'; import '../base/process.dart'; import '../cache.dart'; import '../dart/pub.dart'; -import '../dart/summary.dart'; import '../doctor.dart'; import '../globals.dart'; import '../runner/flutter_command.dart'; @@ -51,8 +50,6 @@ class UpgradeCommand extends FlutterCommand { if (code != 0) throwToolExit(null, exitCode: code); - await buildUnlinkedForPackages(Cache.flutterRoot); - // Check for and download any engine and pkg/ updates. // We run the 'flutter' shell script re-entrantly here // so that it will download the updated Dart and so forth diff --git a/packages/flutter_tools/lib/src/dart/summary.dart b/packages/flutter_tools/lib/src/dart/summary.dart index 681c147736..6a3bc550bb 100644 --- a/packages/flutter_tools/lib/src/dart/summary.dart +++ b/packages/flutter_tools/lib/src/dart/summary.dart @@ -1,5 +1,3 @@ -import 'dart:async'; - import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; import 'package:analyzer/src/context/builder.dart'; // ignore: implementation_imports @@ -7,15 +5,11 @@ import 'package:analyzer/src/dart/sdk/sdk.dart'; // ignore: implementation_impor import 'package:analyzer/src/generated/engine.dart'; // ignore: implementation_imports import 'package:analyzer/src/generated/source.dart'; // ignore: implementation_imports import 'package:analyzer/src/summary/summary_file_builder.dart'; // ignore: implementation_imports -import 'package:analyzer/src/summary/pub_summary.dart'; // ignore: implementation_imports -import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/dart/pub.dart'; import 'package:flutter_tools/src/globals.dart'; import 'package:path/path.dart' as pathos; import 'package:yaml/src/yaml_node.dart'; // ignore: implementation_imports import '../base/file_system.dart' as file; -import '../base/io.dart'; /// Given the [skyEnginePath], locate corresponding `_embedder.yaml` and compose /// the full embedded Dart SDK, and build the [outBundleName] file with its @@ -50,53 +44,3 @@ void buildSkyEngineSdkSummary(String skyEnginePath, String outBundleName, bool s String outputPath = pathos.join(skyEnginePath, outBundleName); file.fs.file(outputPath).writeAsBytesSync(bytes); } - -Future buildUnlinkedForPackages(String flutterPath) async { - PhysicalResourceProvider provider = PhysicalResourceProvider.INSTANCE; - PubSummaryManager manager = - new PubSummaryManager(provider, '__unlinked_$pid.ds'); - - Folder flutterFolder = provider.getFolder(flutterPath); - - // Build in packages/. - Folder packagesFolder = flutterFolder.getChildAssumingFolder('packages'); - await _buildUnlinkedForDirectChildren(manager, packagesFolder); - - // Build in bin/cache/pkg/. - Folder pkgFolder = flutterFolder - .getChildAssumingFolder('bin') - .getChildAssumingFolder('cache') - .getChildAssumingFolder('pkg'); - await _buildUnlinkedForDirectChildren(manager, pkgFolder); -} - -Future _buildUnlinkedForDirectChildren( - PubSummaryManager manager, - Folder packagesFolder -) async { - for (Resource child in packagesFolder.getChildren()) { - if (child is Folder) - await _buildUnlinkedForPackage(manager, child); - } -} - -Future _buildUnlinkedForPackage( - PubSummaryManager manager, - Folder packageFolder -) async { - if (packageFolder.exists) { - String name = packageFolder.shortName; - File pubspecFile = packageFolder.getChildAssumingFile('pubspec.yaml'); - Folder libFolder = packageFolder.getChildAssumingFolder('lib'); - if (pubspecFile.exists && libFolder.exists) { - await pubGet(directory: packageFolder.path); - Status status = - logger.startProgress('Building unlinked bundles for $name...'); - try { - await manager.computeUnlinkedForFolder(name, libFolder); - } finally { - status.stop(); - } - } - } -}