Move PackageConfigFileBuilder into the analyzer_testing public API and
deprecate the copy exposed from package:analyzer. The builder is only
used by test infrastructure, so keeping it in analyzer_testing makes the
ownership clearer and avoids exposing test-only utilities from analyzer.
Update the builder API to accept a rootFolder instead of a rootPath.
This lets callers pass the resource-provider folder directly, so the
generated rootUri is derived from the same file-system abstraction that
created the test files. This avoids accidentally passing POSIX paths
where resource provider paths are required, such as on Windows.
Update existing test utilities and callers to import the new library and
pass Folder objects. Remove the production analysis server dependency on
the builder by emitting the temporary plugin package config JSON
directly.
Change-Id: I46b14710626e0d6d5884afcdc5a05b23077acfc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499081
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
These extensions were previously in `pkg/analyzer_utilities`, which is
not published on `pub`. That meant they could not be used from within
the `lib` directory of any package that *is* published on
`pub`. Specifically, they could not be used from within
`pkg/analyzer_testing/lib`.
In a follow-up CL, I will modify the testing logic so that after
printing `To accept the current state, expect:`, it prints diagnostic
codes in their proper camelCase format.
Change-Id: I6a6a696432d7162906b2c235ea88310dc0aa1fa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480040
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This release is so we can publish a version of analysis_server_plugin,
and then start depending on that published version in DAS.
In addition, we get a highly requested fix out to analyzer_testing
users.
Change-Id: I694f47aeee59367c1fc066bc8f7a865406b09917
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476620
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Fixes https://github.com/dart-lang/sdk/issues/62234 by making the
'dart:ui' library discoverable in the same way that the real one is
discoverable: by the sky_engine _embedder.yaml file.
Coupled with this change is the motivation: the stubs are out-of-date,
with `double width` and `double height` parameters on the Preview
constructor. But this has been changed to use a `Size` object, and
`Size` is written in 'dart:ui'. So to write a test that uses `Size`, the
test now needs proper access to 'dart:ui', and we should not write
'package:ui/ui.dart' in our test cases. These changes are in
`.../lib/mock_packages/package_content/flutter/lib/src/widget_previews/widget_previews.dart`
and in `invalid_widget_preview_private_argument_test.dart`.
Change-Id: I6f608eb3e1f431ad576ba8f3572454e42a39f9f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Changes the behavior of the `analysisOptionsContent` function so that
unless `propagateLinterExceptions: false` is passed to it, it creates
an analysis options file that specifies a `true` value for
`propagate-linter-exceptions`.
This ensures that when tests that use `package:analyzer_testing` are
run, exceptions that occur while processing lint rules will cause the
test to fail. Previously, such exceptions would be silently swallowed
by the analyzer, and the test would pass.
Change-Id: I6a6a69643d76cf15d801eab5c4ce6a77c7dbac96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This changes the API of writing an analysis rule test. Instead of
overriding the `String get analysisRule` property, and registering the
rule in `setUp` (which requires importing a private type), the
developer can now just set the `AbstractAnalysisRule rule` field in
`setUp`. This both removes the requirement to manually register the
rule, and reduces the risk of typos, by removing the String API.
Fixes https://github.com/dart-lang/sdk/issues/61793
Change-Id: Ic7753d3157e06906ba5ccbccfea67aaa3179dcc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459340
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Work towards https://github.com/dart-lang/sdk/issues/61597
The analyzer_testing package's mock packages are "data" or "resource"
files which are notoriously hard to find on disk. No dart tooling I
know of can give me "the root directory of a package which is
referenced in a Dart program via "package:". Konstantin notes that
a program may be compiled ahead of time, and so the running VM itself
does not know where source files originally came from.
When users of the analyzer_testing package try to use
`addFlutterPackageDep` in a test, which attempts to locate the Dart
SDK's `pkg/` root directory, they get a StateError. This CL adds more
information and context to that error.
Change-Id: I3ae55cd580c8fa16ca86d66e6f7b655b8f9bcc42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452532
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This reverts commit 3923958595.
Reason for revert: Broke dart->flutter roll https://github.com/flutter/flutter/pull/176234 due to customer testing
Original change's description:
> [analyzer] Add experimental_member_use warning.
>
> Adds the implementation of the `experimental_member_use` warning
> (whose diagnostic code was introduced in
> https://dart-review.googlesource.com/c/sdk/+/451341).
>
> There is very little implementation logic, since the bulk of the
> implementation is shared with the existing `deprecated_member_use`
> warning. Unit tests are adapted from the `deprecated_member_use` unit
> tests.
>
> Since the tests in `non_const_argument_for_const_parameter_test.dart`
> use the annotation `@mustBeConst`, which is marked `@experimental`,
> they had to be modified to expect the new warning.
>
> Change-Id: I6a6a69645bb072b29166b7617b480a890b2bb5aa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450970
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>
Change-Id: I6a6a696447ed61b133e17ffc63ca6067fdbcc1ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452526
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Adds the implementation of the `experimental_member_use` warning
(whose diagnostic code was introduced in
https://dart-review.googlesource.com/c/sdk/+/451341).
There is very little implementation logic, since the bulk of the
implementation is shared with the existing `deprecated_member_use`
warning. Unit tests are adapted from the `deprecated_member_use` unit
tests.
Since the tests in `non_const_argument_for_const_parameter_test.dart`
use the annotation `@mustBeConst`, which is marked `@experimental`,
they had to be modified to expect the new warning.
Change-Id: I6a6a69645bb072b29166b7617b480a890b2bb5aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450970
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The Spelunker class is only used by analyzer_testing's
PubPackageResolutionTest class, and by a utility script. So I believe
the best place for this class is in analyzer_testing, for two reasons:
* Would we also move the utility script
(`pkg/linter/tool/spelunk.dart`)? This is a script that lets you see
a visual tree of the syntax nodes of a Dart script. It has been
helpful to people writing lint rules, as it helps you understand how
you need to walk up or down the tree to check conditions. Therefore,
it will be at least as helpful to people writing analysis rules in
analyzer plugins (the primary consumers of PubPackageResolutionTest).
It doesn't need to live in `bin` (though that's one possibility). It
can live in `analyzer_testing/tool`.
* Then if the utility script lives in analyzer_testing, and
PubPackageResolutionTest lives in analyzer_testing, and these are the
sole consumers of Spelunker, it makes sense to move it into
analyzer_testing. It does not need to be public API; just live in the
source code.
Change-Id: Id607091b35ab83c96b8cd73f0ece63923c934fb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444240
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>