0f9e6da044
Path exclusions should ideally be defined inside a project's `analysis_options.yaml` file, rather than being added programatically. Plus, there's a bug with the constructor that causes this parameter to be completely ignored anyways, so it's been obsolete and non-functional for a while now. `getExcludedGlobs` in the `_ContextLocator` handles parsing and adding excluded paths from the analysis server already, so we should look into deprecating and removing this parameter. Change-Id: I6c023041c7bb5fa4cb9dedc629afa4ea6ecb63d7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511160 Commit-Queue: Kallen Tu <kallentu@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
50 lines
1.9 KiB
Dart
50 lines
1.9 KiB
Dart
// Copyright (c) 2018, 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 'package:analyzer/dart/analysis/analysis_context.dart';
|
|
import 'package:analyzer/file_system/file_system.dart';
|
|
import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart';
|
|
|
|
/// A collection of analysis contexts.
|
|
///
|
|
/// Clients may not extend, implement or mix-in this class.
|
|
abstract class AnalysisContextCollection {
|
|
/// Initialize a newly created collection of analysis contexts that can
|
|
/// analyze the files that are included by the list of [includedPaths].
|
|
///
|
|
/// All paths must be absolute and normalized.
|
|
///
|
|
/// If a [resourceProvider] is given, then it will be used to access the file
|
|
/// system, otherwise the default resource provider will be used.
|
|
///
|
|
/// If [sdkPath] is given, then Dart SDK at this path will be used, otherwise
|
|
/// the default Dart SDK will be used.
|
|
///
|
|
/// [dispose] must be invoked after collection is finished being used.
|
|
factory AnalysisContextCollection({
|
|
required List<String> includedPaths,
|
|
@Deprecated('Use analysis_options.yaml to exclude paths.')
|
|
List<String>? excludedPaths,
|
|
ResourceProvider? resourceProvider,
|
|
String? sdkPath,
|
|
}) {
|
|
return AnalysisContextCollectionImpl(
|
|
includedPaths: includedPaths,
|
|
resourceProvider: resourceProvider,
|
|
sdkPath: sdkPath,
|
|
);
|
|
}
|
|
|
|
/// Return all of the analysis contexts in this collection.
|
|
List<AnalysisContext> get contexts;
|
|
|
|
/// Return the existing analysis context that should be used to analyze the
|
|
/// given [path], or throw [StateError] if the [path] is not analyzed in any
|
|
/// of the created analysis contexts.
|
|
AnalysisContext contextFor(String path);
|
|
|
|
/// Stops associated processes, and free resources.
|
|
Future<void> dispose();
|
|
}
|