API - Deprecate the excludedPaths parameter in AnalysisContextCollection.
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>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
916afe3219
commit
0f9e6da044
@@ -598,7 +598,6 @@ class ContextManagerImpl implements ContextManager {
|
||||
var watchers = <ResourceWatcher>[];
|
||||
var collection = _collection = AnalysisContextCollectionImpl(
|
||||
includedPaths: includedPaths,
|
||||
excludedPaths: excludedPaths,
|
||||
byteStore: _byteStore,
|
||||
drainStreams: false,
|
||||
enableIndex: true,
|
||||
|
||||
@@ -62,7 +62,6 @@ void buildTests({
|
||||
|
||||
var collection = AnalysisContextCollection(
|
||||
includedPaths: <String>[packagePath],
|
||||
excludedPaths: excludedPaths,
|
||||
resourceProvider: provider,
|
||||
);
|
||||
for (var context in collection.contexts) {
|
||||
|
||||
@@ -1304,7 +1304,6 @@ class CodeShapeMetricsComputer {
|
||||
// Create a new collection to avoid consuming large quantities of memory.
|
||||
var collection = AnalysisContextCollection(
|
||||
includedPaths: root.includedPaths.toList(),
|
||||
excludedPaths: root.excludedPaths.toList(),
|
||||
resourceProvider: PhysicalResourceProvider.INSTANCE,
|
||||
);
|
||||
var context = collection.contexts[0];
|
||||
|
||||
@@ -52,7 +52,6 @@ abstract class CompletionMetricsComputer {
|
||||
// Create a new collection to avoid consuming large quantities of memory.
|
||||
var collection = AnalysisContextCollectionImpl(
|
||||
includedPaths: root.includedPaths.toList(),
|
||||
excludedPaths: root.excludedPaths.toList(),
|
||||
resourceProvider: provider,
|
||||
withFineDependencies: true,
|
||||
);
|
||||
@@ -129,9 +128,9 @@ abstract class CompletionMetricsComputer {
|
||||
}
|
||||
if (file_paths.isDart(pathContext, filePath)) {
|
||||
try {
|
||||
var result =
|
||||
await context.currentSession.getResolvedUnit(filePath)
|
||||
as ResolvedUnitResult;
|
||||
var result = await context.currentSession.getResolvedUnit(
|
||||
filePath,
|
||||
) as ResolvedUnitResult;
|
||||
|
||||
var analysisError = result.diagnostics.errors.firstOrNull;
|
||||
if (analysisError != null) {
|
||||
|
||||
@@ -189,7 +189,6 @@ class FlutterMetricsComputer {
|
||||
// Create a new collection to avoid consuming large quantities of memory.
|
||||
var collection = AnalysisContextCollection(
|
||||
includedPaths: root.includedPaths.toList(),
|
||||
excludedPaths: root.excludedPaths.toList(),
|
||||
resourceProvider: PhysicalResourceProvider.INSTANCE,
|
||||
);
|
||||
var context = collection.contexts[0];
|
||||
|
||||
@@ -173,7 +173,6 @@ class ImpliedTypeComputer {
|
||||
// Create a new collection to avoid consuming large quantities of memory.
|
||||
var collection = AnalysisContextCollection(
|
||||
includedPaths: root.includedPaths.toList(),
|
||||
excludedPaths: root.excludedPaths.toList(),
|
||||
resourceProvider: PhysicalResourceProvider.INSTANCE,
|
||||
);
|
||||
var context = collection.contexts[0];
|
||||
|
||||
@@ -2196,7 +2196,6 @@ class RelevanceMetricsComputer {
|
||||
// Create a new collection to avoid consuming large quantities of memory.
|
||||
var collection = AnalysisContextCollection(
|
||||
includedPaths: root.includedPaths.toList(),
|
||||
excludedPaths: root.excludedPaths.toList(),
|
||||
resourceProvider: PhysicalResourceProvider.INSTANCE,
|
||||
);
|
||||
var context = collection.contexts[0];
|
||||
|
||||
@@ -2429,7 +2429,6 @@ class RelevanceMetricsComputer {
|
||||
// Create a new collection to avoid consuming large quantities of memory.
|
||||
var collection = AnalysisContextCollection(
|
||||
includedPaths: root.includedPaths.toList(),
|
||||
excludedPaths: root.excludedPaths.toList(),
|
||||
resourceProvider: PhysicalResourceProvider.INSTANCE,
|
||||
);
|
||||
var context = collection.contexts[0];
|
||||
|
||||
@@ -723,7 +723,6 @@ class PluginServer {
|
||||
var contextCollection = AnalysisContextCollectionImpl(
|
||||
resourceProvider: _resourceProvider,
|
||||
includedPaths: parameters.included,
|
||||
excludedPaths: parameters.excluded,
|
||||
byteStore: _byteStore,
|
||||
sdkPath: _sdkPath,
|
||||
fileContentCache: FileContentCache(_resourceProvider),
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
* Deprecate `FormalParameterElement.formalParameters` and `typeParameters`. Use `FormalParameterElement.type` instead.
|
||||
* Added `isComplete` to `ConstructorDeclaration`, `FunctionDeclaration`, and `MethodDeclaration`.
|
||||
* Deprecated `MethodDeclaration.isAbstract`. Use `!isComplete` instead.
|
||||
* Deprecate the `excludedPaths` parameter in `AnalysisContextCollection`. Use `analysis_options.yaml` to configure excluded paths instead.
|
||||
|
||||
## 13.1.0
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ package:analyzer/dart/analysis/analysis_context.dart:
|
||||
getAnalysisOptionsForFile (method: AnalysisOptions Function(File))
|
||||
package:analyzer/dart/analysis/analysis_context_collection.dart:
|
||||
AnalysisContextCollection (class extends Object, abstract):
|
||||
new (constructor: AnalysisContextCollection Function({List<String>? excludedPaths, required List<String> includedPaths, ResourceProvider? resourceProvider, String? sdkPath}))
|
||||
new (constructor: AnalysisContextCollection Function({deprecated List<String>? excludedPaths, required List<String> includedPaths, ResourceProvider? resourceProvider, String? sdkPath}))
|
||||
contexts (getter: List<AnalysisContext>)
|
||||
contextFor (method: AnalysisContext Function(String))
|
||||
dispose (method: Future<void> Function())
|
||||
|
||||
@@ -24,13 +24,13 @@ abstract class AnalysisContextCollection {
|
||||
/// [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,
|
||||
excludedPaths: excludedPaths,
|
||||
resourceProvider: resourceProvider,
|
||||
sdkPath: sdkPath,
|
||||
);
|
||||
|
||||
@@ -42,6 +42,7 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
|
||||
bool drainStreams = true,
|
||||
bool enableIndex = false,
|
||||
required List<String> includedPaths,
|
||||
@Deprecated('Use analysis_options.yaml to exclude paths.')
|
||||
List<String>? excludedPaths,
|
||||
List<String>? librarySummaryPaths,
|
||||
String? optionsFile,
|
||||
|
||||
@@ -30,7 +30,6 @@ class VerifyTests {
|
||||
var collection = AnalysisContextCollection(
|
||||
resourceProvider: provider,
|
||||
includedPaths: <String>[testDirPath],
|
||||
excludedPaths: excludedPaths,
|
||||
);
|
||||
var singleAnalysisContext = collection.contexts
|
||||
.where(analysisContextPredicate ?? (_) => true)
|
||||
|
||||
Reference in New Issue
Block a user