Commit Graph

16 Commits

Author SHA1 Message Date
Dylan Baker 4a014d1724 Add support for meson.options as a replacement for meson_options.txt
We will still try to load `meson_options.txt` if `meson.options` doesn't
exist. Because there are some advantages to using `meson.options` even
with older versions of meson (such as better text editor handling)
we will not warn about the existence of a `meson.options` file if a
`meson_options.txt` file or symlink also exists.

The name `meson.options` was picked instead of alternative proposals,
such as `meson_options.build` for a couple of reasons:

  1. meson.options is shorter
  2. While the syntax is the same, only the `option()` function may be
     called in meson.options, while, it may not be called in meson.build
  3. While the two files share a syntax and elementary types (strings,
     arrays, etc), they have different purposes: `meson.build` declares
     build targets, `meson.options` declares options. This is similar to
     the difference between C's `.c` and `.h` extensions.

As an implementation detail `Interpreter.option_file` has been removed,
as it is used exactly once, in the `project()` call to read the options,
and we can just calculate it there and not store it.

Fixes: #11176
2023-03-28 15:01:10 +03:00
Dylan Baker 37663da83e tests: Add a test for a target with no sources
Since this was broken for a long time, we should have a test for it.
2022-09-09 19:13:46 -04:00
Dylan Baker a78992dd81 interpreter: move handling of module stability to interpreter
Thanks to `ModuleInfo`, all modules are just named `foo.py` instead of
`unstable_foo.py`, which simplifies the import method a bit. This also
allows for accurate FeatureNew/FeatureDeprecated use, as we know when
the module was added and if/when it was stabilized.
2022-08-17 16:25:36 -04:00
Zbigniew Jędrzejewski-Szmek 8afdecb039 Reword message in warning
"targetting" is verb-derived adjective, which sort-of-works here, but
makes the whole sentence awkward, because there's no verb. Let's just
use present simple.
2022-05-19 07:18:43 -04:00
Zbigniew Jędrzejewski-Szmek 087e7943d0 Reword misleading warning
"tried to use" implies that the attempt was not successful, i.e. that meson
ignored the feature. But that is not what happens, apart from the warning the
feature works just fine. The new message is also shorter ;)
2022-05-19 07:18:43 -04:00
Daniel Mensinger 2e2ca5a877 cmake: ci: Skip tests on Ubuntu Bionic where CMake is stuck on 3.10 2022-02-03 11:25:59 -05:00
Eli Schwartz d9f55d774c
add location data to various Feature checks 2022-01-27 22:11:48 -05:00
Eli Schwartz 8dbb0ee476
Feature kwargs decorator: automatically report the nodes which trigger an issue 2021-11-20 20:48:30 -05:00
Daniel Mensinger 2d8da3cb11 interpreter: Fix missing featuer check (fixes #9425) 2021-10-24 09:58:20 -04:00
Xavier Claessens b6d754a40c interpreter: Extract dependency() logic into its own helper class
The dependency lookup is a lot of complex code. This refactor it all
into a single file/class outside of interpreter main class. This new
design allows adding more fallbacks candidates in the future (e.g. using
cc.find_library()) but does not yet add any extra API.
2021-06-16 19:04:03 -04:00
Zbigniew Jędrzejewski-Szmek 3dea817a59 Only emit warning about "native:" on projects with minimum required version
'native:' keyword was only added in 0.54. For projects declaring
meson_version >= 0.54, warn, because those projects can and should set
the keyword. For older projects declaring support for older versions,
don't warn and use the default implicitly.

Fixes https://github.com/mesonbuild/meson/issues/6849.
2020-07-28 19:51:58 +02:00
Dylan Baker 4e9e35f3bd interpreterbase: Allow passing an extra message in feature/deprecation warnings
The intended use it to tell people the new thing to do.
2020-05-14 11:04:51 -07:00
Jon Turney 3cff11a75b
Add expected stdout for failing-meson and warning-meson tests
Initially produced using:

  for d in "test cases/failing/"* ; do rm -r _build ; ./meson.py setup "$d" _build | grep ERROR >"$d"/expected_stdout.txt; done

then converted to json with jq using:

  jq --raw-input --slurp 'split("\n") | {stdout: map({line: select(. != "")})}' expected_stdout.txt >test.json

or merged with existing json using:

  jq --slurp '.[0] + .[1]' test.json expected.json >test.json.new

v2:
Add some comments to explain the match when it isn't totally obvious

v3:
Add or adjust existing re: in expected output to handle '/' or '\' path
separators appearing in message, not location.

v4:
Put expected stdout in test.json, rather than a separate expected_stdout.txt file
Park comments in an unused 'comments' key, as JSON doesn't have a syntax for comments
2020-04-30 20:41:35 +01:00
Jon Turney 48e5c1234a
Add a test of new warning of omitted native: keyword 2020-02-12 13:37:44 +00:00
Michael Hirsch, Ph.D 83b4e981c4 Use strict function prototypes 2019-11-18 22:21:36 +02:00
Paolo Bonzini 7a02b76e70 interpreterbase: protect string division with FeatureNew
Meson is not warning if you join paths with / but you are requesting a
version older than 0.49.0; fix this before adding more features to the
division operator.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-03-18 10:51:44 -07:00