Commit graph

113 commits

Author SHA1 Message Date
danrubel 2c62510f5f move CommandLineParser into analyzer for reuse by DDC
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2578733002 .
2016-12-14 16:31:45 -05:00
danrubel 1417eec66e move extractDefinedVariables from analyzer cli to analyzer
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2571583007 .
2016-12-14 13:22:41 -05:00
Brian Wilkerson 0ea654a068 Remove the AnalysisOptionsProcessor
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2559523005 .
2016-12-07 10:51:33 -08:00
Dan Rubel aff6b796f3 update analyzer cli to support include directive in analysis options file
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2541933002 .
2016-11-30 15:16:55 -05:00
Brian Wilkerson e63105555b Remove uses of configuration data
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2522543007 .
2016-11-22 11:26:08 -08:00
Brian Wilkerson 3121296942 (TBR) Fix failing tests
Review URL: https://codereview.chromium.org/2426703002 .
2016-10-17 11:55:31 -07:00
Konstantin Shcheglov ec282eb726 Switch analyzer_cli to 'package:test'.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2395183002 .
2016-10-06 10:02:39 -07:00
Paul Berry 4b2bf4d6a0 Add an analysis option to disable cache flushing.
This improves the analysis speed of large projects by as much as 20%.
It also can be used to work around cache flushing bugs.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2383203003 .
2016-10-01 06:41:20 -07:00
Konstantin Shcheglov 92ee0b2488 Fix for the new hint in super_mixin_example.dart in analyzer_cli.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2364763002 .
2016-09-22 15:03:06 -07:00
Konstantin Shcheglov 5703f5adb1 Replace using reprecated 'package:analyzer/src/generated/error.dart'.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2364643002 .
2016-09-22 10:10:53 -07:00
Konstantin Shcheglov 1387e8ec5c Remove fallback mode and corresponding cli flag.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2356523002 .
2016-09-19 14:02:14 -07:00
Paul Berry f7a12f9c83 Allow input summaries to be specified when running analyzer_cli in non-build mode.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2347133004 .
2016-09-19 12:39:24 -07:00
Brian Wilkerson 5bd4de469e Clean up warnings and hints
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2324463006 .
2016-09-09 09:09:59 -07:00
Brian Wilkerson fe02411930 Remove several references to JavaFile
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2323173002 .
2016-09-09 07:45:40 -07:00
Brian Wilkerson c41427383b Deprecate DirectoryBasedDartSdk and transition existing uses to the new API
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2242853002 .
2016-08-12 09:18:12 -07:00
Brian Wilkerson b47d35d706 Clean up use of resource provider in cli
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2212813003 .
2016-08-04 12:31:10 -07:00
Brian Wilkerson f8d7925ff2 Mark analyzer_cli as strong-mode clean
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2196393003 .
2016-08-01 12:44:59 -07:00
Paul Berry a35c9415f5 Add option "--build-summary-output-semantic" to analyzer_cli.
This option has the same functionality as the flag
"--build-summary-exclude-informative", except it is an option rather
than a flag.  This makes it possible to get both a "full" summary and a
"semantic" summary by specifying both "--build-summary-output" and
"--build-summary-output-semantic".

The flag "--build-summary-exclude-informative" is kept around to ease in
transitioning tools, but it is deprecated.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2104003004 .
2016-06-29 10:25:50 -07:00
pq 43bbf11dd8 SDK ext test fix (add missing packages file).
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1988603003 .
2016-05-17 13:49:04 -07:00
pq fb99a26b21 Test exit code handling fix [TBR].
TBR in a quest for build greenness...

BUG=

Review URL: https://codereview.chromium.org/1984323004 .
2016-05-17 12:37:39 -07:00
pq 31a03ec31b Skip SDK summaries in the presence of SDK extenders (#26448).
Works around crash provoked by mojo: https://github.com/dart-lang/sdk/issues/26448.

The rub is that using SDK summaries in the presence of SDK extenders (and embedders) is unsafe.

Greater context: https://github.com/dart-lang/sdk/issues/26467.

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1990463002 .
2016-05-17 11:10:43 -07:00
pq 7937623063 Don't use SDK summaries with embedders (#26448).
Addresses the issue seen in https://github.com/dart-lang/sdk/issues/26448.

Ultimately we want a better story for summaries in the presence of embedded SDKs; in the short-term this simply disables them.

The trick (and reason for all of the changes here) is that there is *a lot* of temporal coupling in the initiailization of contexts, sdks, resolvers, etc.  With this change, embedder processing is pulled out to where it can be done before the SDK is configured.  Hopefully this even makes this a bit more clear as resolver setup is less complex.

Open question: I think the logic that calls `pub list-dirs` is dead and can safely be removed.  Comments there welcome.

Thanks!

BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1984733003 .
2016-05-16 14:13:40 -07:00
Brian Wilkerson 44836f8538 Support the name analysis_options.yaml for analysis options files
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1975963002 .
2016-05-13 07:33:06 -07:00
pq 7913968725 Fix CLI SDK option config timing (#26129).
Fixes: https://github.com/dart-lang/sdk/issues/26129

The issue was that we were creating the SDK and populating its options (notably `strong-mode`) *before* options processors were called.  The result was that client code analysis contexts and SDK contexts were getting configured differently causing confusion when client code was getting analyzed with a non-strong-mode SDK.

BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1962403002 .
2016-05-10 13:35:40 -07:00
Paul Berry baa7dac310 Allow zero analyzer args in build mode.
This simplifies the integration with build systems such as Bazel, in
which it is sometimes convenient to have a build unit which depends on
other build units but doesn't introduce any additional source files of
its own.

R=pquitslund@google.com

Review URL: https://codereview.chromium.org/1960263003 .
2016-05-09 12:39:06 -07:00
Brian Wilkerson 3084ceae83 Clean up flags for conditional directives
R=pquitslund@google.com

Review URL: https://codereview.chromium.org/1892523002 .
2016-04-14 11:47:28 -07:00
Jacob MacDonald d4197b759d close the input stream in build_mode tests so they dont hang
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1892483003 .
2016-04-14 10:54:18 -07:00
Jacob MacDonald d2e2241fc1 update to use bazel_worker package
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1885073002 .
2016-04-14 07:46:33 -07:00
Jacob MacDonald 09c6fcebc0 Use the provided dart sdk path in worker mode
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1882373003 .
2016-04-14 07:24:53 -07:00
pq 082edc9fa3 Suppress TODOs (#26215).
BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1870123002 .
2016-04-08 08:54:59 -07:00
Jacob MacDonald 92419d092b Update worker mode to use the bazel protos directly instead of json
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1868663002 .
2016-04-06 13:49:32 -07:00
P.Y. Laligand f2a8ee1ebc Added option to dartanalyzer to treat lints as errors.
Fixes #25977
2016-03-31 11:24:51 -07:00
Konstantin Shcheglov 6347b4cca7 Support --persistent_worker flag in --build-mode.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1848543002 .
2016-03-30 12:31:09 -07:00
Konstantin Shcheglov 2895d7501e Fix for analyzer_cli/test/package_prefix_test on Windows.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1844613002 .
2016-03-29 12:18:50 -07:00
Paul Berry ea189bd6dc Add a fallback mode for building summaries.
When summaries are built in fallback mode, the only information stored
in the package bundle is (a) which libraries appear in the bundle, and
(b) where the source files can be found on disk.  This is enough
information so that DDC will still be able to tell how libraries are
grouped into build units, but otherwise summary functionality is
disabled.

This is intended to be availadle as a temporary workaround so that if
a bug is found in the summary infrastructure, it won't prevent DDC
compilation from working (it will just make it slower).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1826353002 .
2016-03-24 13:47:37 -07:00
Paul Berry 014cfddea0 Clean up analyzer_cli build mode tests.
- Properly convert relative to absolute paths when the command-line
  arguments are of the form "$uri|$path".

- Test the behavior of "--build-suppress-exit-code".

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1825283006 .
2016-03-22 21:25:24 -07:00
Paul Berry c7e1de177a Change analyzer_cli's "package mode" into a "build mode".
Build mode differs from package mode in the following ways:

- The analyzer no longer guesses the relationship between paths and
  URIs based on directory structure.  Instead, each input file is
  specified in the form "$uri|$path".

- The analyzer does not read any files from disk that are not
  specified on the command line.

- There are no restrictions on the relationship between summaries and
  packages.  In particular: (a) multiple input summaries may summarize
  parts of the same package, and (b) part of a package may be
  specified with an input summary while an output summary is being
  generated for other parts of the same package.

- Output may be redirected to a file.

- The analyzer may be told to exit with success even in the event that
  an error is found during analysis.

This should ease the integration with Bazel, and provide a starting
point for integrating with other build systems.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1830463002 .
2016-03-22 20:38:30 -07:00
Paul Berry c39a890dd1 Respect machineFormat in package-mode.
Ensures that stats printing in package-mode respects the `machineFormat`
flag.  (That is, only displays stats if not in machine mode.)

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1820233003 .
2016-03-22 13:23:06 -07:00
Brian Slesinsky 9e21594c2a add --x-package-warnings-prefix option to dartanalyzer
This is similar to --package-warnings, except that diagnostics will
only be reported for Dart packages matching the given prefix.

Also added the number of source files analyzed and the number of
errors generated to performance report.

Cleanup: simplified code for triggering diet parsing.

BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1806263004 .
2016-03-21 11:37:49 -07:00
pq b6a1d75444 Analyzer directory recursing (tk 2) (#25129).
Take 2 with a fix that addresses a regression in batch-mode.

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1810103003 .
2016-03-18 09:19:35 -07:00
pq 3b520bc114 Revert "Directory support for the analyzer CLI (#25129)."
This reverts commit 0bd85a2435.

BUG=

Review URL: https://codereview.chromium.org/1811753002 .
2016-03-16 14:51:17 -07:00
pq 0bd85a2435 Directory support for the analyzer CLI (#25129).
Adds smarts to recurse through directories to assemble a list of dart files to analyze.

Addresses: https://github.com/dart-lang/sdk/issues/25129

Do note that all of these files are sharing the same analysis context (and options).  Once the the ContextManager re-work is complete this can get smarter (see: https://github.com/dart-lang/sdk/issues/24133).

BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1805533005 .
2016-03-16 13:56:13 -07:00
pq fb3eae598a CLI support for enableConditionalDirectives.
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1778683004 .
2016-03-09 10:04:41 -08:00
Konstantin Shcheglov 686b30e4cb Initial hermetic package analyzer.
When --package-mode is specified, this turns ON the single package
analysis mode. My initial idea was to accept a single path - the root
folder of the package and analyze the package completely as Dart
Analysis Server does. But later I decided to accept a list of files
to analyze, at least for now.

We still need the --package-mode-path option with the path to the root
folder of the package because we need to know which libraries are in
the 'lib' folder and write these libraries into the output summary.

The option --package-name is used to write the same URIs into
summary as the clients are going to use to refer the package
libraries, and also as the package references itself.

Multiple --package-summary-input=pkg,summary options can be specified,
one for each package. Every referenced package (except itself) must
be listed.

If --package-summary-output is specified, the output summary of
the package is written to the specified file. It is up to the client
to specify the correct X.spec.sum or X.strong.sum names.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1720963003 .
2016-02-22 17:19:27 -08:00
pq 9b1fa223a8 Embedded libs key rename to defuse server landmine.
1.13 stable builds of the SDK contain a version of server that fails catastrophically when analyzing source that imports packages that define embedded libraries. Since we can't pragmatically require more recent SDKs for flutter development we have been prevented from landing embedded libs in the flutter engine.  By renaming the key we use to identify contributed libraries, this change avoids the issue.  Old versions of server will simply ignore the new key and new ones will process it properly.  Win-win!

BUG=
R=danrubel@google.com

Review URL: https://codereview.chromium.org/1643023002 .
2016-01-29 09:52:04 -08:00
pq 3d3c9c5af4 CLI support for embedders (#25380).
Background here: https://github.com/dart-lang/sdk/issues/25380

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1631763007 .
2016-01-26 11:33:14 -08:00
pq 1dcec8c35f Bootloader cleanup.
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1570603004 .
2016-01-11 14:13:44 -08:00
Brian Slesinsky ba1b82b240 Add --x-perf-report flag to the dartanalyzer command
Also added a couple of performance tags to catch time spent in the driver.

BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/1524413002 .
2015-12-17 11:40:15 -08:00
pq 8887cd69f0 Fix analyzer_cli error overrides (#24452).
Brings `analyzer_cli` inline with server wrt processing errors configured in `.analysis_options`.

Note some added complexity due to interactions with flags that globally escalate warnings/hints to errors.

https://github.com/dart-lang/sdk/issues/24452

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1529243002 .
2015-12-16 12:44:38 -08:00
pq e4e61ee462 Disable temp-dir hosted tests pending fixes.
Background here: https://github.com/dart-lang/sdk/issues/25258

BUG=

Review URL: https://codereview.chromium.org/1526533003 .
2015-12-14 15:04:43 -08:00
pq fd0f649327 Driver failure mode fixes (and test cleanup).
* `printAndFail(msg)` doesn't exit in testing (so we need to return null).

R=keertip@google.com

Review URL: https://codereview.chromium.org/1530453002 .
2015-12-14 13:58:05 -08:00
pq 5a57d6e8dc CLI driver test re-enablement (#25001).
Another stab.  The rub, I *think*, to our failures are unexpected calls to `exit()` on the bots (that are not reproducing locally).  These fixes should address that (and fix error stream handling along the way).

* fixes test setup and teardown to ensure exit handling is properly managed.
* fixes driver source to use the `exitHandler` and `errorSink` consistently

BUG=
R=keertip@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1525623003 .
2015-12-14 13:08:47 -08:00
pq 1c3df7f4ec Revert "Make analyzer_cli tests bot-friendly (#25001)."
This reverts commit e67affe6b6.

R=keertip@google.com

Review URL: https://codereview.chromium.org/1524493002 .
2015-12-11 14:57:01 -08:00
pq e67affe6b6 Make analyzer_cli tests bot-friendly (#25001).
* re-enables a host of tests that were breaking on the bots due to path issues

Bug: https://github.com/dart-lang/sdk/issues/25001

R=keertip@google.com

Review URL: https://codereview.chromium.org/1516353003 .
2015-12-11 14:13:30 -08:00
pq 56650e6bfe More mock cleanup.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1520673002 .
2015-12-10 14:37:22 -08:00
pq ad7c566e04 Driver test fixes.
* Updates to use new CONFIGURED_ERROR_PROCESSORS (rather than defunct CONFIGURED_ERROR_FILTERS).

BUG=
R=keertip@google.com

Review URL: https://codereview.chromium.org/1520663002 .
2015-12-10 14:22:16 -08:00
Brian Wilkerson ea3ba0e31f Remove deprecated code
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1502213002 .
2015-12-07 10:24:36 -08:00
pq 8d613feaf9 Migrate mockito mocks to typed_mock (#24994).
BUG=24994
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1462393002 .
2015-11-20 13:57:56 -08:00
pq 7c15fa857c More bot-unfriendly test fixing [TBR].
Remove tests pending update.

Background: https://github.com/dart-lang/sdk/issues/25001

BUG=25001

Review URL: https://codereview.chromium.org/1463133002 .
2015-11-19 16:52:14 -08:00
pq c58e064b67 Remove bot-unfriendly tests (#25001).
Remove tests pending update.

Background: https://github.com/dart-lang/sdk/issues/25001

BUG=25001

Review URL: https://codereview.chromium.org/1459083005 .
2015-11-19 16:15:18 -08:00
pq 9ae1265ff5 analyzer_cli move to SDK.
Tracking bug: https://github.com/dart-lang/sdk/issues/24731

Note, dartium build changes are in a separate CL: https://codereview.chromium.org/1453413006/

Some tests had to be disabled for want of mockito in the SDK; tracking their reimplementation is here: https://github.com/dart-lang/sdk/issues/24994

BUG=24731
R=whesse@google.com

Review URL: https://codereview.chromium.org/1459683003 .
2015-11-19 14:52:54 -08:00
pq 5cc9a288bb Revert "Move analyzer_cli into the SDK."
This reverts commit a573ed31f1.

BUG=
R=whesse@google.com

Review URL: https://codereview.chromium.org/1462143002 .
2015-11-19 11:28:52 -08:00
pq a573ed31f1 Move analyzer_cli into the SDK.
Build changes to follow.

Tracking bug: https://github.com/dart-lang/sdk/issues/24731

BUG=24731
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1464553003 .
2015-11-19 11:11:17 -08:00