Commit Graph

892 Commits

Author SHA1 Message Date
Dylan Baker e81acbd606 Use a single coredata dictionary for options
This patches takes the options work to it's logical conclusion: A single
flat dictionary of OptionKey: UserOptions. This allows us to simplify a
large number of cases, as we don't need to check if an option is in this
dict or that one (or any of 5 or 6, actually).
2021-01-04 12:20:58 -08:00
Dylan Baker 71db6b04a3 use OptionKey for builtin and base options
I would have prefered to do these seperatately, but they are combined in
some cases, so it was much easier to convert them together.

this eliminates the builtins_per_machine dict, as it's duplicated with
the OptionKey's machine parameter.
2021-01-04 12:20:40 -08:00
Dylan Baker f9b19e73a5 move OptionKey to mesonlib
There's starting to be a lot of things including coredata that coredata
needs to itself include. putting it in mesonlib makes more sense
2021-01-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker e2ef6930ff use OptionKey for coredata.user_options 2021-01-04 12:15:41 -08:00
Dylan Baker b25a423a64 use the OptionKey type for command line and machine files 2021-01-04 12:15:41 -08:00
Dylan Baker fa9c1a7a72 run_unittests: Add fatal-warnings to test_command_line
Otherwise bugs like "option c_args is unknown" can slip through. that's
bad.
2021-01-04 12:15:41 -08:00
Dylan Baker 5db0d86b5c run_unittests: make another test inprocess safe 2021-01-04 12:15:41 -08:00
Dylan Baker 0574134bf8 run_unittests: Make test_command_line safe witn inprocess
This is pretty important to be able to debug the test, as it's huge and
really should be a test split into subtests.
2021-01-04 12:15:41 -08:00
Jussi Pakkanen 9f1ba40252
Merge pull request #8013 from mesonbuild/cppmodules
C++ module support
2020-12-14 15:00:04 +00:00
Oleg B b8052f9e50
Support native tests in crossbuild 2020-12-13 16:32:52 +02:00
Jussi Pakkanen 3df064484a Add unit test. 2020-12-13 14:03:22 +02:00
Dylan Baker b65168c558 unit tests: correctly skip c++20 checks if the compiler doesn't support
them

I can't find a supported version for AppleClang, and you need relatively
recent versions of GCC and Clang for -std=c++20 to work.
2020-12-11 17:46:11 +05:30
Jussi Pakkanen c21b04ba08 Add prelinking support for static libraries. 2020-12-03 22:58:07 +02:00
Jussi Pakkanen b53505a9dc
Merge pull request #7982 from dcbaker/submit/unittest-fixups
Unittest fixups
2020-11-24 00:02:22 +02:00
Dylan Baker f6672c7a19 use real pathlib module
We added the _pathlib module to work around defeciencies in python 3.5's
implementation, since we now rely on 3.6 lets drop this
2020-11-20 15:08:40 -08:00
Dylan Baker cef406b3a5 run_unittests: delete test for external syntax highlighting
It's a bit odd we have a test for an external project that's not even in
the meson organization. Regardless, the json file was recently replaced
by a cson file. There is an  coffee-script-notation parser in pypi,
but I couldn't get it to work. Just delete the test
2020-11-20 10:24:00 -08:00
Dylan Baker 460cb9af08 unittests: ignore nix rpaths
As a necessity nix adds a bunch of rpaths to files, this is unavoidable
do to the way nix package management works. Meson doesn't expect this
however, and fails all rpath tests. To correct this we just ignore any
rpath entries that start with `/nix`.
2020-11-18 14:44:07 -08:00
Dylan Baker 3e89c30bae unittests: Simplify and make test_templates more reliable
env.detect_<lang>_compiler only checks that there is a binary called
whatever that returns a version. There are several cases where the found
binary doesn't work:
 1) gcc for ojbc[pp], when support isn't compiled in.
 2) the compiler is broken (rust in appveyor somtimes)
Because of that we need to call compiler.sanity_check() as well, and if
we get an EnvironmentException from that skip the language

Also, instead of having a long line of try: ... except: pass, roll all
of the checking up into a loop using getattr(), which is less code and
makes adding a new language easier
2020-11-16 10:19:15 -08:00
Dylan Baker 85550e8fce run_unittests: correctly handle users setting init.defaultBranch 2020-11-16 10:19:15 -08:00
Dylan Baker 6431a0f89d run_unittests: Don't assume things are in /usr/bin
This is generally a safe assumption, except for some of the more exotic
OSes/distros like nixos, where env is the only thing in /usr/bin
2020-11-16 09:47:54 -08:00
Paolo Bonzini fc9b0cbb7f stabilize sets that are converted to lists
The order of elements in sets cannot be relied upon, because the hash
values are randomized by Python.  Whenever sets are converted to lists
we need to keep their order stable, or random changes in the command line
cause ninja to rebuild a lot of files unnecessarily.  To stabilize them,
use either sort or OrderedSet.  Sorting is not always applicable, but it
can be faster because it's done in C and it can produce slightly nicer
output.
2020-11-15 14:21:31 +01:00
Dylan Baker 6ce3812762 environment: Fix detection of rust compilers, more 2020-11-13 09:00:35 -08:00
Dylan Baker 5c74cccbb9 run_unittests: use textwrap.dedent
So that editors that can fold code (vim, vscode, etc) can correctly fold
functions, instead of getting confused by code that doesn't follow the
current indention. Also, it makes the code easier to read.
2020-11-13 09:00:35 -08:00
Jussi Pakkanen 41a79a0757
Merge pull request #7965 from dcbaker/wip/2020-11/macos-github-actions
Migrate osx CI from travis to github actions
2020-11-12 20:36:27 +02:00
Haelwenn (lanodan) Monnier d2aac3d809 dependencies: Put pkgconfig options before operands
This fixes building with meson when the POSIX behavior of getopt is used, such as when GNU libc is used with POSIXLY_CORRECT=1 defined
2020-11-12 20:27:40 +02:00
Dylan Baker 220da39c7c actions: Add unittests for macos 2020-11-11 07:42:40 -08:00
Dylan Baker 11ece5dbf3 unittests: Don't try to set alternative linkers for apple-clang 2020-11-10 14:24:35 -08:00
Jussi Pakkanen 9d1e747d17 Condense test directory names again. 2020-11-03 21:05:20 +02:00
Dylan Baker 47d071a34f interpreter: store correct files for project regeneration
Right now sub-sub projects are not correctly registered, because we
don't have a way to pass up past the first level of subproject. This
patch changes that by making the build_Def_files as defined in the
Interpreter initializer accurate for translated dependencies, ie, cmake
dependencies won't define a dependency on a non-existent meson.build.
This means that it can always add the subi.build_def_files because they
are always accurate.
2020-11-01 19:26:31 +02:00
Jussi Pakkanen 0f4f0acaff Remove a status message that leaks to stdout. 2020-10-19 00:04:38 +03:00
Jussi Pakkanen 64f8479097 In text, betterer grammer usings. 2020-10-19 00:04:14 +03:00
Jussi Pakkanen ac6041e110 Add delays to test for timestamp issues on mac. 2020-10-19 00:03:37 +03:00
Xavier Claessens 0c95d92404 pkgconfig: InternalDependency's ext_deps should be private by default
This fixes a regression introduced by
https://github.com/mesonbuild/meson/pull/7488.

InternalDependency's ext_deps previously where simply ignored, but that
PR has effect to add many more public Requires in generated pc files.
2020-10-17 15:53:46 +03:00
Xavier Claessens ed70c6df52 Subprojects should not inherit parent override
This was the behaviour in 0.55.0, so this test was assuming a behaviour
change. Revert it to the behaviour we had in 0.55.0.
2020-10-16 17:42:24 -04:00
Xavier Claessens 7271b1e942 Machine file pkg_config_path overrides environment
This is consistent with c_args in machine file overriding CFLAGS from
env. This also spotted an issue where in a native build this resulted
in pkg_config_path being /bar instead of /foo:
`-Dpkg_config_path=/foo -Dbuild.pkg_config_path=/bar`

Fixes: #7573
2020-10-16 17:42:24 -04:00
Xavier Claessens bcf369ea3c Fix consistency in variables kwarg
Share common code to extract the `variables` kwarg in
declare_dependency() and pkg.generate().
2020-10-16 18:09:56 +03:00
Daniel Mensinger 7c377e5a5d intro: Add extra_files key to intro output (fixes #7310) 2020-10-15 01:56:59 +03:00
Xavier Claessens 3a01823786 wrap: Add 'redirect' type and use it when auto promote 2020-10-13 17:55:16 -04:00
Xavier Claessens 6333ee88c1 Merge wraps from subprojects into wraps from main project
wraps from subprojects are now merged into the list of wraps from main
project, so they can be used to download dependencies of dependencies
instead of having to promote wraps manually. If multiple projects
provides the same wrap file, the first one to be configured wins.

This also fix usage of sub-subproject that don't have wrap files. We can
now configure B when its source tree is at
`subprojects/A/subprojects/B/`. This has the implication that we cannot
assume that subproject "foo" is at `self.subproject_dir / 'foo'` any
more.
2020-10-13 17:55:16 -04:00
Daniel Mensinger 7e58f33376
cmake: Add cross compilation support 2020-10-13 17:04:19 +02:00
Xavier Claessens dccff1f2bc msubprojects: Handle wrap-file to wrap-git case 2020-10-13 11:12:49 +00:00
Dylan Baker 94ac51fdda options: Handle updates to choices in options
Currently if you change the `choices` field in the meson_options.txt
file, no update will be done until `meson setup --wipe` is called. Now
if the choices change then the options will be properly merged.

If the currently select value is still valid it is guaranteed to be
kept, if it is now invalid the new default value will be used and a
warning will be printed.

Fixes #7386
2020-10-05 23:10:35 +03:00
Bernd Busse c4fa876925 Never run clang-format / clang-tidy against directories
`pathlib.Path.glob()` also returns directories that match source
filenames (i.e. a directory named `test.h/`), but `clang-format` and
`clang-tidy` fail when handed a directory. We manually skip calling
`clang-format` and `clang-tidy` on those directories.
2020-10-05 23:07:20 +03:00
Dylan Baker 4b1c1d83c8 machinefiles: Allow keys to be stored case insensitive
This is required to make the various keys in the [user options] section
work the same as they do in the meson_options.txt file, where we don't
have any rules about case sensitivity.

There is some risk here. Someone may be relying on this lower by default
behavior, and this could break their machine files.

Fixes #7731
2020-10-05 08:59:45 -04:00
Daniel Mensinger 1dfaccfd91 pathlib: Fix resolve() by overriding it in Python 3.5 2020-10-04 10:45:48 +02:00
Dylan Baker 135f5d5838 compilers: make get_optimization_args abstract 2020-10-01 15:06:10 -07:00
Dylan Baker bb3fe3c451 compilers/mixins/clike: fix mypy issues 2020-09-24 12:14:13 -07:00
Dylan Baker 79d1ecd5bc compilers/compilers: Fully type annotate 2020-09-24 12:14:13 -07:00
Xavier Claessens 17f07a53d0 msubprojects: Fix unit tests on Windows 2020-09-18 03:01:15 +00:00