Commit Graph

79 Commits

Author SHA1 Message Date
Konstantin Shcheglov e7b51f7bd1 Issue 26426. Don't use SDK summarie when analyzing SDK itself.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/26426

Review URL: https://codereview.chromium.org/1963023002 .
2016-05-10 09:54:24 -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
Konstantin Shcheglov d7f14a639d Turn on using SDK summaries in the command line analyzer.
We pass all of the shared tests now.
We used to pass too, but there was a couple small regressions.
The regressions have been fixed, so if you don't see a reason not to
turn using summaries on, I think we could do this.

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

Review URL: https://codereview.chromium.org/1945013002 .
2016-05-03 15:15:52 -07:00
Paul Berry a8e665eaf5 Don't compute hashes in "--build-summary-exclude-informative" mode.
The hashes were being thrown away anyway; computing them just wastes
time.

Cuts the runtime of generating an AST-based summary of the analyzer
package (with a warm VM) by about 19%.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1910553002 .
2016-04-20 11:04:58 -07:00
Paul Berry 2d1dbd4d5b Sort build_mode.dart.
No functional change; just code motion.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1903053003 .
2016-04-20 10:55:24 -07:00
Paul Berry 48c8d84357 Clear analyzer caches after each persistent worker build step.
Without this, a persistent worker that runs too long will eventually
overflow memory.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1897973005 .
2016-04-19 13:41:53 -07:00
Brian Wilkerson 21a1b757c1 Clean up hints after a new hint was introduced
R=jwren@google.com

Review URL: https://codereview.chromium.org/1890973002 .
2016-04-14 13:15:34 -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
Paul Berry 2a5db6841b Turn off summaries in context when building summary from AST.
When building summaries from ASTs, we only use the context to read
source files; we don't need it to provide an element model.  Therefore,
we can save some time by turning off the context's use of summaries,
because this prevents it from trying to eagerly deserialize the
summaries of dart:async and dart:core.

Saves a significant amount of time when building a summary of a small
package using ASTs.  For example, saves ~37% of time when building a
strong mode summary of the "yaml" package.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1882263002 .
2016-04-14 05:59:01 -07:00
Konstantin Shcheglov bc54ea8c23 Disable computing errors for .pub-cache sources.
R=brianwilkerson@google.com, pquitslund@google.com
BUG=

Review URL: https://codereview.chromium.org/1888583002 .
2016-04-13 17:01:38 -07:00
Paul Berry 3b65dacd6c Modify build mode to use the linker when building summaries from ASTs.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1877133002 .
2016-04-11 17:04:10 -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 63efb288a7 allow --dart-sdk with --persisent_worker
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1859363003 .
2016-04-07 07:08:48 -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
Brian Wilkerson f819f9fb07 Add hooks for changing priorities of warnings to errors in strong mode
R=leafp@google.com

Review URL: https://codereview.chromium.org/1861363002 .
2016-04-06 13:06:29 -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
Konstantin Shcheglov daab52a191 Add the '--build-summary-only-ast' flag for generating summaries using only ASTs.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1838883002 .
2016-03-28 13:36:12 -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
Konstantin Shcheglov 58bde1b3b4 Add the --build-summary-exclude-informative flag.
It (in combination with --build-summary-only-diet) makes the
package:path summary is almost 3 times smaller, partially because of
skipping bodies, patially because of excluding documentation comments,
and partially because of making 'codeRange' fields informative.

We also remove MD5 hashes.

As I can see after changes in method bodies we generate the exactly
same file (or at least 'cmp -l' thinks so). Adding a new field results
in a file of different length.

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

Review URL: https://codereview.chromium.org/1828973002 .
2016-03-24 08:20:56 -07:00
Konstantin Shcheglov d067c70ce9 Add --build-summary-only-diet option.
R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1830733004 .
2016-03-23 20:37:26 -07:00
Konstantin Shcheglov f00f0168b6 Fix for build mode SDK options.
R=skybrian@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1830773004 .
2016-03-23 18:36:05 -07:00
Konstantin Shcheglov ef04426f17 Fix for analyze-cli and Dart SDK options.
Fix for one more problem with my analysisOptions change.
We should set it early and don't attempt to change it later.

Not sure how well it will work with Flutter and other non-standard SDKs.

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

Review URL: https://codereview.chromium.org/1828903002 .
2016-03-23 14:53:07 -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
Brian Slesinsky 802cf80812 Suppress warnings in analyzer_cli test data
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1806423002 .
2016-03-17 13:01:12 -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
Paul Berry c497c026fe Fix summary generation in "package-summary-only" mode.
If we aren't doing full analysis, then we can't use
`context.librarySources` to find out the set of library sources (because
it doesn't include sources that haven't been examined yet).  Instead, we
have to query each source to find out its type.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1770323003 .
2016-03-08 12:14:11 -08:00
Paul Berry 1f8ea5448e Add an analyzer_cli option to disable analysis (for faster summary generation)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1772923002 .
2016-03-08 09:25:20 -08:00
Paul Berry 8219e27009 Fix path handling when creating summaries.
The path passed to "--packageMode" must be converted to an absolute path
because it is used to normalize file paths (which are automatically
converted to absolute paths by the PhysicalResourceProvider.

We should not call `resourceProvider.pathContext.absolute()`.  This
seems (by its name) like it would convert its argument to an absolute
path.  But in fact it simply prepends the path with
`resourceProvider.pathContext.current`, which is `.`, and this causes
Source objects to be created referring to non-canonical paths.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1762363002 .
2016-03-04 14:15:48 -08:00
Paul Berry c6314577ff Move package summary reading code into analyzer.
This will allow it to be re-used by DDC.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1739923002 .
2016-02-25 13:13:52 -08:00
Paul Berry 8dc6261f10 Find SDK properly when analyzing files in package mode.
R=pquitslund@google.com

Review URL: https://codereview.chromium.org/1737773002 .
2016-02-25 10:32:45 -08:00
Konstantin Shcheglov 3b97d01634 Fix for using the strong mode SDK summary.
I think the fix does the change needed to configure SDK for using
the strong mode summary, but I was not able to verify this fully
because of the exception with LibraryElementHandle.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1734773003 .
2016-02-24 14:50:22 -08:00
Konstantin Shcheglov 8e9aac65ab Extract PackageBundleAssembler and use for SDK and package summary generation.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1722413002 .
2016-02-24 08:26:05 -08:00
Konstantin Shcheglov 918582490e Fix the 'Unused import' hint when using package summaries.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1722383002 .
2016-02-24 08:16:37 -08:00
Paul Berry 44f507bd05 Add file hashes to SdkBundle; rename to PackageBundle.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1725913002 .
2016-02-23 10:56:26 -08:00
Konstantin Shcheglov 36535e81c0 Use the 'analysisOption.strongMode' option in package analyzer.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1722343002 .
2016-02-23 10:52:02 -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
Konstantin Shcheglov 09672f09c6 CLI. Always fully parse given target files.
It seems that we have a bug - when we analyze a SDK library during
running shared tests, we still parse it dietly so we don't actually
validate that bodies are warning-free.

And when we attempt to use SDK summary, we again parse a library
dietly, but then attempt to apply the full summary using
DeclarationResolver, which fails because we fail to bind some elements
to not parsed nodes.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1689263004 .
2016-02-12 07:02:43 -08:00
pq 37767eff86 Hooks for injecting embedder resolver providers.
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1666573006 .
2016-02-04 11:03:43 -08:00
Brian Wilkerson 5b95009a6b Move ResolverProvider to analyzer so that it can be shared
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1658663002 .
2016-02-01 08:12:29 -08:00