Skip to content

Commit

Permalink
Remove dependency on quiver. (#82)
Browse files Browse the repository at this point in the history
The dart2js_info package is included in the Dart SDK. This reduces the dependencies on other third-party packages.
  • Loading branch information
lrhn authored Oct 1, 2020
1 parent 66a7193 commit 787aa97
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
31 changes: 16 additions & 15 deletions lib/deferred_library_check.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,18 @@
/// 'baz'.
library dart2js_info.deferred_library_check;

import 'package:quiver/collection.dart';

import 'info.dart';

List<ManifestComplianceFailure> checkDeferredLibraryManifest(
AllInfo info, Map manifest) {
var includedPackages = new Multimap<String, String>();
var excludedPackages = new Multimap<String, String>();
var includedPackages = new Map<String, Set<String>>();
var excludedPackages = new Map<String, Set<String>>();
for (var part in manifest.keys) {
for (var package in manifest[part]['include'] ?? []) {
includedPackages.add(part, package);
(includedPackages[part] ??= {}).add(package);
}
for (var package in manifest[part]['exclude'] ?? []) {
excludedPackages.add(part, package);
(excludedPackages[part] ??= {}).add(package);
}
}

Expand All @@ -77,10 +75,11 @@ List<ManifestComplianceFailure> checkDeferredLibraryManifest(
return partNameFailures;
}

var mentionedPackages = new Set()
..addAll(includedPackages.values)
..addAll(excludedPackages.values);
var actualIncludedPackages = new Multimap<String, String>();
var mentionedPackages = {
for (var values in includedPackages.values) ...values,
for (var values in excludedPackages.values) ...values
};
var actualIncludedPackages = new Map<String, Set<String>>();

var failures = <ManifestComplianceFailure>[];

Expand All @@ -97,7 +96,7 @@ List<ManifestComplianceFailure> checkDeferredLibraryManifest(
containingParts.addAll(info.outputUnit.imports);
}
for (var part in containingParts) {
actualIncludedPackages.add(part, packageName);
(actualIncludedPackages[part] ??= {}).add(packageName);
if (excludedPackages[part].contains(packageName)) {
failures
.add(new _PartContainedExcludedPackage(part, packageName, info));
Expand All @@ -109,10 +108,12 @@ List<ManifestComplianceFailure> checkDeferredLibraryManifest(
info.functions.forEach(checkInfo);
info.fields.forEach(checkInfo);

includedPackages.forEach((part, package) {
if (!actualIncludedPackages.containsKey(part) ||
!actualIncludedPackages[part].contains(package)) {
failures.add(new _PartDidNotContainPackage(part, package));
includedPackages.forEach((part, packages) {
for (var package in packages) {
if (!actualIncludedPackages.containsKey(part) ||
!actualIncludedPackages[part].contains(package)) {
failures.add(new _PartDidNotContainPackage(part, package));
}
}
});
return failures;
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ dependencies:
fixnum: ^0.10.5
path: ^1.3.6
protobuf: ^1.0.1
quiver: '>=0.29.0 <3.0.0'
shelf: ^0.7.3
shelf_static: ^0.2.4
yaml: ^2.1.0
Expand Down

0 comments on commit 787aa97

Please sign in to comment.