Commit Graph

13500 Commits

Author SHA1 Message Date
Eli Schwartz cfc1abcfaf
project tests: add log of the setup command being run
Followup to commit 2acb6ee79e.
2023-03-20 17:22:50 -04:00
Eli Schwartz a024d75e15
backends: add a new "none" backend
It can only be used for projects that don't have any rules at all, i.e.
they are purely using Meson to:

- configure files
- run (script?) tests
- install files that exist by the end of the setup stage

This can be useful e.g. for Meson itself, a pure python project.
2023-03-20 17:22:50 -04:00
Eli Schwartz 2a0b80eb67
tests: fix regression that broke mtest_inprocess
In commit faf79f4539 we broke this utility
function by referencing a non-existent variable. Fortunately, the only
time we ever used said function was once, and that in a test case where
we tested that it raised a MesonException before the undefined variable
error could occur.
2023-03-20 16:58:16 -04:00
Eli Schwartz fccada6703
mtest: move the detection of rebuild compatibility out into the entry point
What we are mainly doing here is checking that the options make sense,
or fixing that up if they don't. And in the next commit we will want to
do that by also checking the build object.
2023-03-20 16:58:15 -04:00
Eli Schwartz b4c347674b
backends: simplify class setup 2023-03-20 16:58:15 -04:00
Volker Weißmann 46fe127503
Add restat = 1 to the fortran_COMPILER rule
gfortran does not update the modification time of *.mod files.

Fixes #11552
2023-03-20 15:02:58 -04:00
David Seifert 5feeb1c2ef CUDA: make "Ampere" equivalent to SM8.0+SM8.6 2023-03-19 08:31:28 -04:00
Volker Weißmann 193a12e366 Small fix on how cc.sizeof (and similar functions) use the 'prefix' kwarg 2023-03-18 09:47:05 -04:00
Volker Weißmann bb27341cd0 Better error message when custom_targets has duplicates in the output kwarg 2023-03-17 18:04:05 -04:00
Xavier Claessens 5c5d261845 Fix "meson subprojects checkout -b" regression
The argument position is wrong since
1c631ec8ab
2023-03-17 15:17:56 -04:00
Charles Brunet 91b88b1a76 fix meson compile with alias target
this fixes a bug introduced by #11528
2023-03-17 02:05:23 -04:00
Xavier Claessens 72cd2a395a coredata: Do not pickle it twice
Exclude coredata from build.dat because it gets pickled separately
already.
2023-03-16 21:02:23 -04:00
Daan De Meyer adb619db61 Stop using replace_if_different() for coredata pickle file
This was added in f774609 to only change the access time of the
coredata file if the coredata struct actually changed. However,
this doesn't work as pickle serializations aren't guaranteed to
be stable. Instead, let's manually check if options have changed
values and skip the save if they haven't changed.

We also extend the associated unit test to cover all the option
types and to ensure that configure does get executed if one of the
options changes value.
2023-03-16 17:18:30 -04:00
Corentin Noël e0792f4819 modules/i18n: fix typo in gettext decorator 2023-03-16 14:20:26 -04:00
Xavier Claessens 84c412a921 Disable codecov comment 2023-03-16 10:52:50 -04:00
Xavier Claessens 340aedc0d9 hotdoc: Install devhelp files at the right location
When devhelp is enabled, hotdoc generates a devhelp/ subdir that needs
to be installed to /usr/share/devhelp/. Otherwise, the html/ subdir
needs to be installed to /usr/share/doc/<project>/html/
2023-03-16 10:36:33 -04:00
Charles Brunet a5a7b29a66 prevent lib prefix warning from pkg-config 2023-03-16 08:27:06 -04:00
Charles Brunet ef5da765af add typename to AliasTarget
It will allow to distinguish AliasTarget from RunTarget in introspection
files (e.g. meson-info/intro-targets.json).
2023-03-14 22:03:46 -04:00
Charles Brunet 9792506536 rewriter: fix indentation of kwargs 2023-03-14 16:22:05 +02:00
Charles Brunet 7fcc9a95bd rewriter: add missing command aliases 2023-03-14 16:22:05 +02:00
Charles Brunet d4d118438d rewriter: activate vsenv 2023-03-14 16:22:05 +02:00
Charles Brunet 90b6d6dafb rewriter: fix warning about empty sources 2023-03-14 16:22:05 +02:00
David Robillard 535498d367 Fix warning_level=everything with GCC 8
This option was introduced with GCC 8.1.0 as in the original commit, but the
value wasn't right initially and was volatile during the 8 series.

To avoid this, this commit moves the warning to 9.1.0 (the next version we
generally care about), since we don't want to get too deep into the weeds of
point releases, and a warning not being used yet in some particular version of
GCC isn't a big deal.
2023-03-12 19:51:56 -04:00
Jussi Pakkanen 58e6fb40f6 Make generator exe more resilient. 2023-03-11 22:56:13 +02:00
Khem Raj 24ea1d3f19 detect.py: Be more precise about detecting xtensa gcc toolchains
clang --version can yield a string like below when its installed into
such a directory

clang version 14.0.0 (https://github.com/llvm/llvm-project 3f43d803382d57e3fc010ca19833077d1023e9c9)
Target: aarch64-yoe-linux
Thread model: posix
InstalledDir: /mnt/b/yoe/master/build/tmp/work/cortexa72-yoe-linux/gnome-text-editor/42.0-r0/recipe-sysroot-native/usr/bin/aarch64-yoe-linux

as you can see InstallDir has 'xt-' subtring and this trips the check to
guess gcc

if 'Free Software Foundation' in out or 'xt-' in out:

Therefore, check if compiler output starts with xt- then assume
it to be gcc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2023-03-09 21:38:13 -08:00
Eli Schwartz f8eba38801 tests: allow a long test to have more time to complete before timing out
This test is intended to test really long output, so it prints 100k
lines of stdout/stderr. It completes in two seconds on my machine, but
the default 30-second timeout is apparently too much for CI, because on
Windows we often get flaky tests due to this. e.g. we'll get within 200
lines of the end.

Bump the CI time by x2. We know this isn't particularly surprising
behavior, and allowing it to request another 30 seconds won't hang the
CI. But it will save us from some spurious failures and restarted jobs.
2023-03-09 21:36:33 -08:00
Eli Schwartz a410bbdf12 configure_file: emit FeatureNew when a cmake-formatted file has too many tokens
In commit 97a72a1c53 we started to allow
cmakedefine with 3 tokens, as cmake expects (unlike mesondefine). This
would silently start working even if the declared minimum version was
older than 0.54.1
2023-03-09 21:32:14 -08:00
Eli Schwartz 83b4f14fce emit FeatureNew warning for compiler.preprocess used multiple times
In commit c2a55bfe43 multiple bugs were
fixed, but a FeatureNew was only added for the one that was mentioned in
the commit message.

Make sure to warn users about the reliability of the one that wasn't
mentioned, too.
2023-03-09 22:04:38 -05:00
Eli Schwartz d897c300f1 compiler.preprocess should only update the private name per directory
We add a unique ID to each rule we create, to work around the use of
an entire build target with private directory named "preprocess" per use
of the preprocess() method.

But this ID doesn't need to increment every time it is used anywhere --
only when it is used in the same subdir as a previous time. That is the
only case where it could conflict.

By making the increment counter per-subdir, we can avoid potential
frivolous rebuilds when a new preprocess() is added in a different
directory, the build is reconfigured, and all uses in the entire project
tree suddenly get new output paths even if they haven't changed.
2023-03-09 22:04:38 -05:00
Eli Schwartz c91a6ad013 re-deduplicate feature warnings printed at the end of setup
In commit eaf365cb3e we explicitly sorted
them for neatness, with the rationale that we were restoring intentional
behavior and we only need a set for stylistic purposes.

This actually wasn't true, because we never sorted them to begin with
(we did sort the version numbers), but sorting them is fine. The bigger
issue is that we actually used a set to avoid printing the same feature
type multiple times. Now we do print them multiple times -- because each
registered feature includes the unique node.

Fix this by using both sorted and a set.

Fix tests that should in retrospect have flagged this as an issue, but
were added later on in the same series to check something else entirely,
happen to cover this too, and were presumably copied directly from
stdout as-is...
2023-03-09 22:04:38 -05:00
Dylan Baker 7c2ac4f8fe utils: fix annotation of pickle_load
It's actually Generic, and we should use Generic annotations to get the
correct result. This means that we don't have to assert or cast the
return type, because mypy just knowns
2023-03-09 19:03:44 -05:00
Eli Schwartz 62c269d088
dependencies: add pybind11 custom factory
This works with pkg-config and cmake without any special support. The
custom factory adds further support for config-tool, via
`pybind11-config`. This is useful because the config-tool will work out
of the box when pybind11 is installed, but the pkg-config and cmake
files are shoved into python's site-packages, which is an unfortunate
distribution model and makes it impossible to use in an out of the box
manner.

It's possible to manually set up the PKG_CONFIG_PATH to detect it
anyway, but in case that does not happen, having the config-tool
fallback is extremely useful.
2023-03-09 15:13:46 -05:00
Dylan Baker 162ac25beb build: fully type CompileTarget
Which is pretty trivial
2023-03-09 15:03:03 -05:00
Dylan Baker a769a0de35 build: Add some missing annotations to BuildTarget initializer 2023-03-09 15:03:03 -05:00
Dylan Baker 6dc96e7266 build: move all Target attributes to dataclass
We'll want to be able to pass all of these to the initializer, so make
them all available.
2023-03-09 15:03:03 -05:00
Dylan Baker 06453ed7a4 build: Add missing annotation to Target method 2023-03-09 15:03:03 -05:00
Dylan Baker 4cf5ad2463 build: make Target an abstract properties instead of doing hasattr
checks
2023-03-09 15:03:03 -05:00
Dylan Baker 853c16cbed interpreter: Add missing Union annotation 2023-03-09 15:03:03 -05:00
Eli Schwartz 43abd62ecc
hotdoc module: properly error out when configuring fails
We used to just abort during configure because we ran in-process and
hotdoc's argparse would leak into our own process space. Now we fail to
handle this case and succeed at configuring, only for building to fail
because the hotdoc config file doesn't exist.
2023-03-05 11:24:13 -05:00
Benoit Pierre 8da060706c msubprojects: fix potential error when resetting a git checkout
Untracked files need to be stashed too, or resetting may fail when
trying to (re-)apply a patch that adds one of those untracked files.
2023-03-04 20:35:30 -05:00
Xavier Claessens 93c11f2494 typed_kwargs: Remove feature_validator as it's not currently used 2023-03-04 14:19:27 -05:00
Xavier Claessens 0f67913dee typed_kwargs: Extend since_values and deprecated_values for types 2023-03-04 14:19:27 -05:00
Eli Schwartz 2d26c272c3
run_mypy: accept the path to an alternative mypy executable
mypy might be installed with a different python than the one run_mypy.py
is using.
2023-03-02 15:52:45 -05:00
Eli Schwartz 3946f1eb17
Revert "target python 3.10 as the mypy language version"
This reverts commit 0b7d935a84.

The issue is fixed in mypy 1.0.0 now.
2023-03-02 15:51:27 -05:00
Eli Schwartz 6c3b0973c4
run_mypy: passthrough unknown options to mypy itself
Useful for running as a thin wrapper in other contexts that expect the
ability to run mypy itself with arbitrary arguments.
2023-03-02 15:33:19 -05:00
Charles Brunet 47f3263165 doc: remove unexisting operators from grammar 2023-03-02 11:19:31 -05:00
Charles Brunet a0d0fb5492 mintro: redirect stdout to stderr 2023-03-02 10:10:03 -05:00
Eli Schwartz a3f4f6c88f
interpreter: report FeatureNew for kwargs to project()
We need to know the project minimum version before evaluating the rest
of the function. There's three basic approaches:
- try to set it inside KwargInfo
- just run a minimal version of func_project for this, then load
  everything after
- drop down to the AST and set it before anything else

In order to handle FeatureNew emitted by a FunctionNode evaluated
before project() due to being inlined, such as `version: run_command()`,
only option 3 suffices, the rest all happen way too late. Since we have
just added AST handling support for erroring out, we can do that to set
the version as well.
2023-03-01 23:37:55 -05:00
Eli Schwartz 314382d6ff
handle meson_version after parsing but before invalid project() kwargs
If we add new kwargs to a function invoked on the first line, we also
need to validate the meson_version before erroring out due to unknown
kwargs. Even if the AST was successfully built.

Amusingly, we also get to improve the error message a bit. By passing
the AST node instead of an interpreter node, we get not just line
numbers, but also column offsets of the issueful meson_version. That
broke the stdout of another failing test; adapt it.
2023-03-01 23:36:31 -05:00
Eli Schwartz 878c1604e6
handle meson_version even when the build file fails to parse
If the meson.build file is sufficiently "broken", even attempting to lex
and parse it will totally fail, and we error out without getting the
opportunity to evalaute the project() function. This can fairly easily
happen if we add new grammar to the syntax, which old versions of meson
cannot understand. Setting a minimum meson_version doesn't help, because
people with a too-old version of meson get parser errors instead of
advice about upgrading meson.

Examples of this include adding dict support to meson.

There are two general approaches to solving this issue, one of which
projects are empowered to do:

- refactor the project to place too-new syntax in a subdir() loaded
  build file, so the root file can be interpreted

- teach meson to catch errors in building the initial AST, and just load
  enough of the AST to check for meson_version advice

This implements the latter, allowing to future-proof the build
grammar.
2023-03-01 23:30:49 -05:00