Commit Graph

8918 Commits

Author SHA1 Message Date
Dylan Baker b231ff36df Remove some uses of mesonlib.run_once
These are basically doing what mlog.log(..., once=True) does, so lets
just use that. The once argument to mlog is newer, so these probably
should have been changed already.
2020-03-05 09:31:29 -08:00
Dylan Baker e3beaf87a5 mesonlib: use mlog instead of print 2020-03-05 09:31:29 -08:00
Dylan Baker a8293dd59c mesonlib: Replace unholder argument to listify
listify shouldn't be unholdering, it's a function to turn scalar values
into lists, or flatten lists. Having a separate function is clearer,
easier to understand, and can be run recursively if necessary.
2020-03-05 09:31:29 -08:00
Dylan Baker 1a82880730 mesonbuild/mesonlib: Add type annotations 2020-03-05 09:31:29 -08:00
Dylan Baker a7407b8782 mesonlib: Fix File.__eq__ to return NotImplemented
The implementation assumes another File, but doesn't properly guard
that. Let's do that guarding.
2020-03-04 12:30:44 -08:00
Dylan Baker f79ac4cefa mesonlib: Use textwrap.dedent
This is mostly just to help folding editors like vim, which get confused
by the non-indented code. It also helps readability, IMHO.
2020-03-04 12:29:12 -08:00
Nirbheek Chauhan 7476961790 unit tests: Test the buildtype table in the docs 2020-03-05 00:37:57 +05:30
Nirbheek Chauhan 1cfa2c3aca unit tests: Rewrite documentation table parsing code
The old logic was completely broken, and didn't even assert that the
specified section was found at all. The CPU families test was broken
because of this. Luckily, the table didn't go out of sync with the
code.

It now also doesn't assume that each section has only one table. This
fixes the test now that we document the buildtype/optimization/debug
mapping in a second table inside the `Universal options` section.
2020-03-05 00:37:57 +05:30
Nirbheek Chauhan 5c14f98239 Document the details of optimization+debug vs buildtype [skip ci]
Otherwise you have to hunt through the source code. Specifically, this
is defined in `mesonbuild/coredata.py`: `set_buildtype_from_others()`
and `set_others_from_buildtype()`
2020-03-05 00:37:57 +05:30
Dylan Baker 1210a67f66 mesonbuild: Add mcompile command
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes #6670
2020-03-04 14:07:27 -05:00
Stéphane Cerveau a46f0a6202 interpreter: add 'name' method to BuildTargetHolder
As any child of BuildTargetHolder might need the name of the object,
provides a method to get object name.
This is useful in gst-build to display the plugin name and not
the filename.
2020-03-04 13:49:01 -05:00
Martin Storsjö 58db8d5e11 Set c_winlibs/cpp_winlibs for Clang in the same way as for GCC
clang-cl is handled as a separate case (ClangClCCompiler), which already
gets c_winlibs from VisualStudioLikeCCompilerMixin.
2020-03-03 21:49:42 +02:00
Michael Brockus 98ddd52ced
Cherry-picking - (rm python2 % add python3 .format) (#6725) 2020-03-03 21:45:43 +02:00
Stéphane Cerveau 21e543fea8 pkgconfig: Fix deprecation message (fixes #6720)
Deprecation warning was unable to display because of patch
c8f8d58273

fixes #6720
2020-03-03 08:25:25 -05:00
Michael 79d04cebf7 fix typo 2020-03-02 13:50:58 -05:00
Michael 2f080b1f2e add -C to meson init 2020-03-02 13:50:58 -05:00
Dylan Baker 6e865fc08d
Merge pull request #6316 from mensinda/typesAst
types: Annotations for ast, mparser.py, interpreterbase.py
2020-03-02 09:37:57 -08:00
Stephan Lachnit b190a20ad5 Users.md: add libratbag
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-03-02 19:10:19 +05:30
Stéphane Cerveau cc4e9e79be coredata: init_builtins should always call libdir_cross_fixup
As the interpreter reinitialize the coredate builtins, need to call
again libdir_cross_fixup
2020-03-02 19:09:31 +05:30
Daniel Mensinger d67888bf9b
types: Remove redundant __init__() -> None annotation 2020-03-02 10:52:59 +01:00
Daniel Mensinger 0302a697b8
types: Use import typing as T 2020-03-02 10:51:07 +01:00
Daniel Mensinger ab988198c7
review: Initial fixup 2020-03-02 10:47:20 +01:00
Daniel Mensinger ad5df1b9c3
types: Annotate ast/introspection.py 2020-03-02 10:44:01 +01:00
Daniel Mensinger 5a89a6f804
types: (partially) annotate interpreterbase.py
This commit annotates most of interpreterbase.py. However,
there are stil the @wraps missing, since I am unsure what
the types are supposed to be here.
2020-03-02 10:42:43 +01:00
Daniel Mensinger c48b0dea27
types: Annotate ast/interpreter.py 2020-03-02 10:34:55 +01:00
Daniel Mensinger a75255bc4c
types: Annotate the AST visitors 2020-03-02 10:34:55 +01:00
Daniel Mensinger c14aea2812
types: Annotate mparser.py
This also fixes that the keys in ArgumentNode.kwargs are
all of the type BaseNode now. Before this commit, it was
possible that both strings and Nodes where used as keys.
2020-03-02 10:34:55 +01:00
Jussi Pakkanen 200738a3e6
Merge pull request #6692 from xclaesse/summary-warnings
Summary improvements
2020-03-01 19:30:10 +02:00
Marcel Hollerbach 9e40a0125c meson: cache the results of can_compile
the check for which files can be compiled are called again and again on
the same files over and over again. Caching this here shaves off 11s of
the build time of efl (which has grown in the last 3 versions to over 40
sec. again)
2020-03-01 19:27:49 +02:00
Marcel Hollerbach 4524088d38 CompilerArgs: make lookup faster
in order to deduplicate arguments as much as possible, we need to check
if a argument is already part of the list. Which is quite slow because
we are checking 3 lists for that.

In smaller projects this might be not of interested. However, in efl
things are quite "heavy", alone generating the ninja file took 40 sec..
16 sec. are spent in __iadd__ of CompilerArgs.

What this patch does to speed this all up is:
1. We only check if a element is in post when we know that it must be in
   post same for pre.
2. the checks for if we already do contain a specific value are now done
   via a dict, and not via the list.

This overall brings the time from 16 sec. spent in __iadd__ to 9 sec. in
__iadd__.

Another possible solution for all this is to have a internal structure
of CompileArgs of trees, so you have the "basic" layer of arguments
where the position does not matter. Additionally, you have two stacks of
lists, the pre stack and the post stack, duplicates can then be checked
when itereting, which would safe another ~4s in terms of efl. However, i
do not have time for this undertaking right now.
2020-03-01 19:27:49 +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
Jussi Pakkanen 9823db5e2a
Merge pull request #6707 from jon-turney/bogus-failing-tests
Fix various failing-meson tests
2020-02-29 00:46:04 +02:00
ur4t 9787de59d4 Fixed linker detecting on windows. Added comments about linker detecting for further debugging and refactoring. 2020-02-29 00:43:00 +02:00
Jussi Pakkanen 7b050a9eeb
Merge pull request #6666 from mensinda/testRefactor
Refactor run_projectests.py
2020-02-29 00:41:52 +02:00
Dylan Baker 175f12ac89 environment: Strip 'el' from the end of mips architectures
Mips architectures may have `el` on the end, to differentiate the little
endian from the big endian variants. We don't encode endianness in the
cpu names, so ensure we've stripped that.

Fixes #6655
2020-02-29 00:37:17 +02:00
Jan Alexander Steffens (heftig) 2ba8fe6af0 environment: Fix construction of CudaLinker
The 0.53.2 test suite has a new failure:

    Traceback (most recent call last):
      File "run_project_tests.py", line 1024, in <module>
        detect_system_compiler()
      File "run_project_tests.py", line 964, in detect_system_compiler
        comp = env.compiler_from_language(lang, MachineChoice.HOST)
      File "/build/meson/src/meson-0.53.2/mesonbuild/environment.py", line 1565, in compiler_from_language
        comp = self.detect_cuda_compiler(for_machine)
      File "/build/meson/src/meson-0.53.2/mesonbuild/environment.py", line 1131, in detect_cuda_compiler
        linker = CudaLinker(compiler, for_machine, 'nvlink', CudaCompiler.LINKER_PREFIX, [], version=CudaLinker.parse_version())
      File "/build/meson/src/meson-0.53.2/mesonbuild/linkers.py", line 963, in __init__
        super().__init__('nvlink', *args, **kwargs)
    TypeError: __init__() takes 6 positional arguments but 7 positional arguments (and 1 keyword-only argument) were given

Fixes: c708c52ca2 ("linkers: Update the linker names to be more consistent")
2020-02-28 10:07:26 -08:00
Jon Turney 96f661e150
Add release note snippet 2020-02-28 11:54:09 +00:00
Jon Turney a8cd01af42
Extend unit test to cover cwd-relative warning location formatting 2020-02-28 11:54:08 +00:00
Jon Turney c8f8d58273
Rename 'subdir' -> 'filename' in location objects 2020-02-28 11:54:08 +00:00
Jon Turney 585bf2b867
Add unit test of cwd-relative error location formatting 2020-02-28 11:54:07 +00:00
Jon Turney c8e9142917
Add failing test of parser error in options file 2020-02-28 11:54:06 +00:00
Jon Turney 1666262289
Add failing test of parser error in subdir 2020-02-28 11:54:06 +00:00
Jon Turney d1bd4ccf6e
Update rewriter for filename in node location 2020-02-28 11:54:05 +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 534a974da7
Adjust all the other places MesonException file attribute is set
A MesonException has file, lineno and colno attributes, which get
formatted as a location in mlog.exception().

The file attribute got changed from a path relative to the root source
directory to a pathname (absolute or relative to cwd) in one place in
commit b8fbbf59.  Adjust all the other places the file attribute is set
to match.

Also:
Setting MesonException.file seems to be missing in the case where Parser
returned a non-CodeBlockNode object.  Fortunately, that looks like it's
unreachable, but add it just in case.
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
Jon Turney b89116a93c
Fix framework version failing test
This test was never testing what it claimed to test, simply failing with
"ERROR: No C-like compilers are available, cannot find the framework"
because a C-like language is missing from project().
2020-02-28 11:52:36 +00:00