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

Unified Diff: pkg/dev_compiler/lib/src/analyzer/multi_package_resolver.dart

Issue 2527433002: remove unused DDC --package-paths options and MultiPackageResolver (Closed)
Patch Set: merge Created 4 years, 1 month 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 | « pkg/dev_compiler/lib/src/analyzer/context.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/src/analyzer/multi_package_resolver.dart
diff --git a/pkg/dev_compiler/lib/src/analyzer/multi_package_resolver.dart b/pkg/dev_compiler/lib/src/analyzer/multi_package_resolver.dart
deleted file mode 100644
index 66905eca920fb7b54801265e105d244a7fd2b67d..0000000000000000000000000000000000000000
--- a/pkg/dev_compiler/lib/src/analyzer/multi_package_resolver.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io';
-
-import 'package:analyzer/src/generated/java_io.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/source_io.dart';
-import 'package:path/path.dart' show join;
-
-/// A package resolver that supports a non-standard package layout, where
-/// packages with dotted names are expanded to a hierarchy of directories, and
-/// packages can be found on one or more locations.
-class MultiPackageResolver extends UriResolver {
- final List<String> searchPaths;
- MultiPackageResolver(this.searchPaths);
-
- @override
- Source resolveAbsolute(Uri uri, [Uri actualUri]) {
- var candidates = _expandPath(uri);
- if (candidates == null) return null;
-
- for (var path in candidates) {
- var resolvedPath = _resolve(path);
- if (resolvedPath != null) {
- return new FileBasedSource(
- new JavaFile(resolvedPath), actualUri != null ? actualUri : uri);
- }
- }
- return null;
- }
-
- /// Resolve [path] by looking at each prefix in [searchPaths] and returning
- /// the first location where `prefix + path` exists.
- String _resolve(String path) {
- for (var prefix in searchPaths) {
- var resolvedPath = join(prefix, path);
- if (new File(resolvedPath).existsSync()) return resolvedPath;
- }
- return null;
- }
-
- /// Expand `uri.path`, replacing dots in the package name with slashes.
- List<String> _expandPath(Uri uri) {
- if (uri.scheme != 'package') return null;
- var path = uri.path;
- var slashPos = path.indexOf('/');
- var packagePath = path.substring(0, slashPos).replaceAll(".", "/");
- var filePath = path.substring(slashPos + 1);
- return ['$packagePath/lib/$filePath', '$packagePath/$filePath'];
- }
-}
« no previous file with comments | « pkg/dev_compiler/lib/src/analyzer/context.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698