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

Unified Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 1411833002: Remove obsolete flag to enable package support (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 94792f4a0025f90727127183aad2e026cfba1b80..a97ccd9a72f317933dd816886def31a805610e53 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -317,13 +317,6 @@ class ContextManagerImpl implements ContextManager {
static const String ANALYSIS_OPTIONS_FILE = '.analysis_options';
/**
- * Temporary flag to hide WIP .packages support (DEP 5).
- */
- static bool ENABLE_PACKAGESPEC_SUPPORT = serverOptions.isSet(
- 'ContextManagerImpl.ENABLE_PACKAGESPEC_SUPPORT',
- defaultValue: true);
-
- /**
* The name of the `lib` directory.
*/
static const String LIB_DIR_NAME = 'lib';
@@ -827,12 +820,10 @@ class ContextManagerImpl implements ContextManager {
PackageMapInfo packageMapInfo;
callbacks.beginComputePackageMap();
try {
- if (ENABLE_PACKAGESPEC_SUPPORT) {
- // Try .packages first.
- if (pathContext.basename(packagespecFile.path) == PACKAGE_SPEC_NAME) {
- Packages packages = _readPackagespec(packagespecFile);
- return new PackagesFileDisposition(packages);
- }
+ // Try .packages first.
+ if (pathContext.basename(packagespecFile.path) == PACKAGE_SPEC_NAME) {
+ Packages packages = _readPackagespec(packagespecFile);
+ return new PackagesFileDisposition(packages);
}
if (packageResolverProvider != null) {
UriResolver resolver = packageResolverProvider(folder);
@@ -993,10 +984,8 @@ class ContextManagerImpl implements ContextManager {
// so, create it.
File packageSpec;
- if (ENABLE_PACKAGESPEC_SUPPORT) {
- // Start by looking for .packages.
- packageSpec = folder.getChild(PACKAGE_SPEC_NAME);
- }
+ // Start by looking for .packages.
+ packageSpec = folder.getChild(PACKAGE_SPEC_NAME);
// Fall back to looking for a pubspec.
if (packageSpec == null || !packageSpec.exists) {
@@ -1070,42 +1059,32 @@ class ContextManagerImpl implements ContextManager {
Resource resource = resourceProvider.getResource(path);
- if (ENABLE_PACKAGESPEC_SUPPORT) {
- String directoryPath = pathContext.dirname(path);
-
- // Check to see if we need to create a new context.
- if (info.isTopLevel) {
- // Only create a new context if this is not the same directory
- // described by our info object.
- if (info.folder.path != directoryPath) {
- if (_isPubspec(path)) {
- // Check for a sibling .packages file.
- if (!resourceProvider
- .getFile(pathContext.join(directoryPath, PACKAGE_SPEC_NAME))
- .exists) {
- _extractContext(info, resource);
- return;
- }
+ String directoryPath = pathContext.dirname(path);
+
+ // Check to see if we need to create a new context.
+ if (info.isTopLevel) {
+ // Only create a new context if this is not the same directory
+ // described by our info object.
+ if (info.folder.path != directoryPath) {
+ if (_isPubspec(path)) {
+ // Check for a sibling .packages file.
+ if (!resourceProvider
+ .getFile(pathContext.join(directoryPath, PACKAGE_SPEC_NAME))
+ .exists) {
+ _extractContext(info, resource);
+ return;
}
- if (_isPackagespec(path)) {
- // Check for a sibling pubspec.yaml file.
- if (!resourceProvider
- .getFile(pathContext.join(directoryPath, PUBSPEC_NAME))
- .exists) {
- _extractContext(info, resource);
- return;
- }
+ }
+ if (_isPackagespec(path)) {
+ // Check for a sibling pubspec.yaml file.
+ if (!resourceProvider
+ .getFile(pathContext.join(directoryPath, PUBSPEC_NAME))
+ .exists) {
+ _extractContext(info, resource);
+ return;
}
}
}
- } else {
- // pubspec was added in a sub-folder, extract a new context
- if (_isPubspec(path) &&
- info.isTopLevel &&
- !info.isPathToPackageDescription(path)) {
- _extractContext(info, resource);
- return;
- }
}
// If the file went away and was replaced by a folder before we
@@ -1128,34 +1107,27 @@ class ContextManagerImpl implements ContextManager {
// Note that it's important to verify that there is NEITHER a .packages nor a
// lingering pubspec.yaml before merging.
if (!info.isTopLevel) {
- if (ENABLE_PACKAGESPEC_SUPPORT) {
- String directoryPath = pathContext.dirname(path);
-
- // Only merge if this is the same directory described by our info object.
- if (info.folder.path == directoryPath) {
- if (_isPubspec(path)) {
- // Check for a sibling .packages file.
- if (!resourceProvider
- .getFile(pathContext.join(directoryPath, PACKAGE_SPEC_NAME))
- .exists) {
- _mergeContext(info);
- return;
- }
- }
- if (_isPackagespec(path)) {
- // Check for a sibling pubspec.yaml file.
- if (!resourceProvider
- .getFile(pathContext.join(directoryPath, PUBSPEC_NAME))
- .exists) {
- _mergeContext(info);
- return;
- }
+ String directoryPath = pathContext.dirname(path);
+
+ // Only merge if this is the same directory described by our info object.
+ if (info.folder.path == directoryPath) {
+ if (_isPubspec(path)) {
+ // Check for a sibling .packages file.
+ if (!resourceProvider
+ .getFile(pathContext.join(directoryPath, PACKAGE_SPEC_NAME))
+ .exists) {
+ _mergeContext(info);
+ return;
}
}
- } else {
- if (info.isPathToPackageDescription(path)) {
- _mergeContext(info);
- return;
+ if (_isPackagespec(path)) {
+ // Check for a sibling pubspec.yaml file.
+ if (!resourceProvider
+ .getFile(pathContext.join(directoryPath, PUBSPEC_NAME))
+ .exists) {
+ _mergeContext(info);
+ return;
+ }
}
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698