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

Unified Diff: pkg/analyzer/lib/src/summary/pub_summary.dart

Issue 2254893003: Add PubSummaryManager.computeUnlinkedForFolder() for Flutter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 | pkg/analyzer/pubspec.yaml » ('j') | pkg/analyzer/pubspec.yaml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/pub_summary.dart
diff --git a/pkg/analyzer/lib/src/summary/pub_summary.dart b/pkg/analyzer/lib/src/summary/pub_summary.dart
index 966adba5ee36dab858d3f8aa8bc05a44ffc5b9f3..14f5a994e48e81edb30e45c530fffe596516463b 100644
--- a/pkg/analyzer/lib/src/summary/pub_summary.dart
+++ b/pkg/analyzer/lib/src/summary/pub_summary.dart
@@ -28,6 +28,7 @@ import 'package:analyzer/src/summary/summarize_ast.dart'
import 'package:analyzer/src/summary/summarize_elements.dart'
show PackageBundleAssembler;
import 'package:analyzer/src/util/fast_uri.dart';
+import 'package:meta/meta.dart';
import 'package:path/path.dart' as pathos;
/**
@@ -230,6 +231,19 @@ class PubSummaryManager {
}
/**
+ * Complete when the unlinked bundles for the package with the given [name]
+ * and the [libFolder] are computed and written to the files.
+ *
+ * This method is intended to be used for generating unlinked bundles for
+ * the `Flutter` packages.
+ */
+ Future<Null> computeUnlinkedForFolder(String name, Folder libFolder) async {
+ PubPackage package = new PubPackage(name, libFolder);
+ _scheduleUnlinked(package);
+ await onUnlinkedComplete;
+ }
+
+ /**
* Return the list of linked [LinkedPubPackage]s that can be provided at this
* time for a subset of the packages used by the given [context]. If
* information about some of the used packages is not available yet, schedule
@@ -331,6 +345,7 @@ class PubSummaryManager {
* Return all available unlinked [PackageBundle]s for the given [context],
* maybe an empty map, but not `null`.
*/
+ @visibleForTesting
Map<PubPackage, PackageBundle> getUnlinkedBundles(AnalysisContext context) {
bool strong = context.analysisOptions.strongMode;
Map<PubPackage, PackageBundle> unlinkedBundles =
@@ -483,10 +498,7 @@ class PubSummaryManager {
// Schedule computation in the background, if in the pub cache.
if (isPathInPubCache(pathContext, package.folder.path)) {
if (seenPackages.add(package)) {
- if (packagesToComputeUnlinked.isEmpty) {
- _scheduleNextUnlinked();
- }
- packagesToComputeUnlinked.add(package);
+ _scheduleUnlinked(package);
}
}
// The bundle is for available.
@@ -551,6 +563,16 @@ class PubSummaryManager {
}
/**
+ * Schedule computing unlinked bundles for the given [package].
+ */
+ void _scheduleUnlinked(PubPackage package) {
+ if (packagesToComputeUnlinked.isEmpty) {
+ _scheduleNextUnlinked();
+ }
+ packagesToComputeUnlinked.add(package);
+ }
+
+ /**
* Atomically write the given [bytes] into the file in the [folder].
*/
void _writeAtomic(Folder folder, String fileName, List<int> bytes) {
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | pkg/analyzer/pubspec.yaml » ('J')

Powered by Google App Engine
This is Rietveld 408576698