Commit Graph

107 Commits

Author SHA1 Message Date
Nirbheek Chauhan 40319c9634 Don't make unactionable warnings fatal
Some warnings are out of the user's control, such as the RCC QT bug,
or the GNU windres bug, or our informational warning about
auto-disabling of options when -Db_bitcode is enabled.

Such warnings should not be fatal when --fatal-meson-warnings is
passed because there's no action that the user can take to fix it. The
only purpose it serves is to prevent people who use those features
from using --fatal-meson-warnings.
2020-07-05 16:13:00 +03:00
Jon Turney f107f9b396
Make colourize_console() a function
Currently, colourize_console is a constant, set at process
initialization.

To allow the actual stdout to be easily compared with the expected when
running tests, we want to allow colourization to be on for the test
driver, but not for the in-process configure done by run_configure,
which has stdout redirected from a tty to a pipe.

v2:
Cache _colorize_console per file object

v3:
Reset cache on setup_console()
2020-04-30 20:11:31 +01:00
Michael c53b637959 switch python2 %s for python3 .format 2020-04-21 00:16:21 +03:00
Jussi Pakkanen 9e5c881b06 Add property to disable compiler sanity checks during cross compilation. 2020-03-22 23:07:53 +02:00
Dylan Baker 1bb66d1568 fix conversion of hasattr to getattr
getattr() requires a default (return if missing) value or it raises an
AttributeError. In a few cases I changed hasattr to getattr and didn't
set a default value, so those cases could except. This corrects that.
2020-03-15 22:30:19 +02:00
Dylan Baker 1a82880730 mesonbuild/mesonlib: Add type annotations 2020-03-05 09:31:29 -08:00
Jussi Pakkanen 200738a3e6
Merge pull request #6692 from xclaesse/summary-warnings
Summary improvements
2020-03-01 19:30:10 +02:00
Jussi Pakkanen 25cbcb19a9
Merge pull request #6627 from jon-turney/cwd-relative-file-locations
Consistently report file locations relative to cwd
2020-03-01 18:17:41 +02:00
Dylan Baker 74452f2a1c mlog: fix remaining mypy errors and add to mypy check
There were two things mypy was warning about:
1) it doesn't understand hasattr()
2) It was possible for mlog.{error,warning,deprecation} to get passed
   multiple values for the once keyword argument.
2020-02-29 00:55:46 +02:00
Jon Turney c8f8d58273
Rename 'subdir' -> 'filename' in location objects 2020-02-28 11:54:08 +00:00
Jon Turney c3163040ae
Display filename cwd relative in warning location
Format the filename relative to cwd in a warning location.
2020-02-28 11:54:05 +00:00
Jon Turney 346b5c4be7
Store filename in node location
Warnings have a location node object (with subdir and lineno
attributes), which is passed as a location: kwarg to mlog.warning() and
formatted in _log_error().

Re-purpose the subdir attribute (path relative to the source root dir,
with an implied filename of 'meson.build'), which is stored into the
node by parser(), to contain a pathname.

(Properly I should rename 'subdir' -> 'file' everywhere, but that's a
lot of churn just to see if this works)

Notes:
The warning location node may also have a colno attribute, which is
currently ignored by _log_error().

We can't currently issue warnings with locations in meson_options.txt
because the filename isn't part of the location (as it's assumed to be
'meson.build).
2020-02-28 11:54:04 +00:00
Jon Turney 4895830c28
Fix typos in comments about type annotations 2020-02-28 11:54:03 +00:00
Jon Turney fa928e803b
Remove unused MesonException.get_msg_with_context()
After that, the only remaining user of get_error_location_string() is mlog,
so move that there.
2020-02-28 11:54:03 +00:00
Xavier Claessens 8101b0ddab summary: Add more info in Subprojects section
This adds a warnings counter for subprojects that passed. This is to
encourage developpers to check warnings in the logs and hopefully fix
them. Otherwise they could be hidden in hundreds lines of logs.

This also print the error message for subprojects that did not pass. The
error message is often enough to fix the issue (e.g. missing
dependency) and it's easier than searching in the logs why a subproject
failed.
2020-02-26 14:24:12 -05:00
Nirbheek Chauhan c05b725122 Split console colourization into a separate function
Use it instead of making a direct call to mlog._windows_ansi().
2020-02-16 00:26:08 +05:30
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Dylan Baker 614372aa55 mlog: Add a log_once function
There are a number of cases where we end up spamming users with the same
message over and over again, which is really annoying. This solves that.
2019-12-13 09:57:05 -05:00
Dylan Baker eb30c493f6 mlog: remove incorrect uses of global keyword
global is only needed to allow replacement of global values, they're
always in scope to read.
2019-12-13 09:57:05 -05:00
Daniel Mensinger 286b9f0921 lgtm: Fix Module imported with `import` and `import from` 2019-12-05 00:22:10 +02:00
Daniel Mensinger 9435f11b17
ci: Add CI command to include text files in the CI log 2019-11-19 15:21:13 +01:00
Daniel Mensinger e39d570d3a
mlog: add non bold version of colors 2019-11-14 17:05:18 +01:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Niklas Claesson b8fbbf5964 Make parser errors print relative path to meson.build file 2019-10-10 00:40:30 +03:00
Michael Hirsch, Ph.D cb7d236696 pythonic file checks 2019-07-11 22:37:25 +03:00
Daniel Mensinger 2b5831f94f
Fix flake8-bugbear warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger e75211d321
Fix builtin variable names 2019-04-29 12:17:40 +02:00
Dylan Baker 891136178d mlog: add type annotations 2019-04-22 13:49:50 -07:00
Daniel Mensinger 5d2f14fce7
rewriter: Quiet logging by default 2019-03-04 13:00:30 +01:00
Xavier Claessens 815f1205a8 do_subproject: Improve log messages and formatting 2019-01-16 11:16:46 -05:00
Daniel Mensinger c033af914a
Disable mlog and don't require build directory for environment 2018-12-29 23:55:45 +01:00
Xavier Claessens 60b58e056f Add 'meson subprojects update' command
This is inspired by gst-build's git-update script.
2018-12-02 08:37:32 -05:00
Nirbheek Chauhan a52cd31a6c Print dependencies being used for compiler checks
It is a common idiom to look for a function or a specific type or
a header in various locations/libraries, and it can be confusing to
see the (seemingly) identical compiler check being done multiple
times.

Now we print the dependencies being used when a compiler check is run

Before:
Checking for function "fbGetDisplay": NO
Checking for type "GLeglImageOES": YES
Checking for function "asinh": YES

After:
Checking for function "fbGetDisplay" with dependency egl: NO
Checking for type "GLeglImageOES" with dependencies glesv2, gl: YES
Checking for function "asinh" with dependency -lm: YES
2018-10-29 21:44:46 +02:00
Xavier Claessens ef231d3edd Add --fatal-meson-warnings command line option
This makes any warning message printed by meson raise an exception,
intended to be used by CI and developpers to easily catch deprecation
warnings and other potential issues.
2018-09-04 09:01:39 -04:00
Xavier Claessens bef8187e43 mlog.shutdown(): Return the log file path or None if not initialized 2018-08-22 15:15:54 -04:00
Nirbheek Chauhan 2093d45a4e Print a more usable message when a subproject fails to configure
Instead of just printing the message in the exception, if it's
a MesonException, also print the file and the line number. If it's an
unknown exception, print the entire traceback so that we can pin-point
what the Meson bug causing it is.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan 4fb00ee1d8 Add new method: mlog.deprecation()
Instead of constructing it manually, use a helper.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan e4417eb301 mlog: Log timestamps in profile-self mode
This makes it much clearer which statements are taking a long time,
and helps in interpreting the outputted profile itself.
2018-07-06 06:25:12 +00:00
Nirbheek Chauhan 1415cd2d07 mlog: Add built-in support for quoting bolded messages
This allows us to drop wonky sep='' hacks and manual addition of
spaces across the codebase.
2018-07-06 06:25:12 +00:00
Isabella Muerte 91c1cc6f9e Add VT100 ANSI escape sequences for Windows 10.
This change still relies on the older 'ANSICON' environment check as a
fallback, in the event we're on "not Windows 10". (Calling
`SetConsoleMode` with unsupported values results in a 0 being returned)
2018-05-01 20:17:14 +03:00
Xavier Claessens 10a9bdad96 interpreter: Verify permitted kwargs on all methods 2018-04-26 00:01:48 +03:00
Jon Turney cb597adb01 Indicate subproject depth in console output 2018-04-13 01:05:54 +00:00
Jukka Laurila 52c50da6c7 Refactor: Add log.error and log.exception to reduce code duplication. 2018-03-10 18:04:52 +02:00
Jon Turney 845dbfcbbc Handle a warning location which evaluates to False
As written in PR #2856, this code isn't quite right.

An ArgumentNode object can evaluate as False (if it's arguments attribute is
an empty sequence).

If that happens, we then try to hand the location kwarg down to print(),
rather than removing it, which causes an invalid keyword argument exception.

This failure can be seen e.g. when generating for gnome-twitch (See [1])

[1] https://travis-ci.org/jon-turney/meson-corpus-test/jobs/343017109
2018-02-21 19:10:56 +02:00
Jon Turney 6a1a56ab57 Report warning/error locations in a format IDEs may already know how to parse
Examples:

meson.build:2:0: ERROR: Dependency is both required and not-found
meson.build:4: WARNING: Keyword argument "link_with" defined multiple times.

These are already matched by the default compilation-error-regexp-alist in
emacs.

Also:
Don't start 'red' markup until after the \n before an error
Unabsorb full-stop at end of warning with location from mlog.warning()
Update warning_location test
2018-01-30 06:48:22 +11:00
Jon Turney 2ed875e1b4 Consolidate warning location formatting in mlog.warning()
Also use .format() rather than %
Also use build.environment rather than hardcoding 'meson.build'
2018-01-01 13:20:55 +00:00
Joergen Ibsen 1db319737d Enable ANSI colors on Windows when ANSICON is set
This enables colors with ConEmu.
2017-11-29 23:53:58 +02:00
Nirbheek Chauhan f04d141088 logging: Print location of log file on error
Similar to configure

Closes https://github.com/mesonbuild/meson/issues/2316
2017-09-14 18:29:30 +03:00
Jussi Pakkanen c2a5ac3981 Ensure log file gets closed. 2017-08-18 12:08:50 +03:00
Aaron Small 76c8491d77 Add an option to dependencies called 'method'. This can be used to
configure a detection method, for those types of dependencies that have
more than one means of detection.

The default detection methods are unchanged if 'method' is not
specified, and all dependencies support the method 'auto', which is the
same as not specifying a method.

The dependencies which do support multiple detection methods
additionally support other values, depending on the dependency.
2017-04-09 03:31:39 -04:00
Michal Sojka 1713aef364 Do not colorize output on dumb terminals
Dumb terminal is provided e.g. by Emacs for programs run within it.
2017-03-08 06:37:42 -05:00
Jussi Pakkanen a7609e76f6 Graceful fallback when printing messages with characters not understood by stdout. 2017-03-01 07:58:46 -05:00
Jussi Pakkanen a61e41b1d2 Force log file to UTF-8. 2017-02-27 07:33:23 -05:00
Mike Sinkovsky 969be1f679 cleanup: Remove redundant parentheses 2017-01-18 21:22:47 +02:00
Nirbheek Chauhan a2262103fb Implement mlog.warning and use it everywhere for warnings
Prepends the string with 'WARNING:' in ANSI yellow.

Closes https://github.com/mesonbuild/meson/issues/961
2016-11-08 17:43:24 -05:00
Jussi Pakkanen 436eab9b85 Print full mesonlog on failed tests when run under CI. 2016-06-23 00:03:59 +03:00
Jussi Pakkanen 23b98cd6e6 Renamed meson package to mesonbuild so that we can have a script named meson in the same toplevel dir. 2016-01-16 17:35:29 +02:00