aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-03-09build: Add missing annotation to Target methodDylan Baker1-1/+1
2023-03-09build: make Target an abstract properties instead of doing hasattrDylan Baker1-5/+10
checks
2023-03-09interpreter: Add missing Union annotationDylan Baker1-1/+1
2023-03-05hotdoc module: properly error out when configuring failsEli Schwartz1-1/+2
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-04msubprojects: fix potential error when resetting a git checkoutBenoit Pierre2-3/+17
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-04typed_kwargs: Remove feature_validator as it's not currently usedXavier Claessens1-9/+0
2023-03-04typed_kwargs: Extend since_values and deprecated_values for typesXavier Claessens7-37/+81
2023-03-02run_mypy: accept the path to an alternative mypy executableEli Schwartz1-4/+3
mypy might be installed with a different python than the one run_mypy.py is using.
2023-03-02Revert "target python 3.10 as the mypy language version"Eli Schwartz1-1/+1
This reverts commit 0b7d935a846b8f2aa33b4e0d19fd7b4423d35df4. The issue is fixed in mypy 1.0.0 now.
2023-03-02run_mypy: passthrough unknown options to mypy itselfEli Schwartz1-2/+1
Useful for running as a thin wrapper in other contexts that expect the ability to run mypy itself with arbitrary arguments.
2023-03-02doc: remove unexisting operators from grammarCharles Brunet1-1/+1
2023-03-02mintro: redirect stdout to stderrCharles Brunet2-8/+14
2023-03-01interpreter: report FeatureNew for kwargs to project()Eli Schwartz3-2/+10
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-01handle meson_version after parsing but before invalid project() kwargsEli Schwartz4-1/+12
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-01handle meson_version even when the build file fails to parseEli Schwartz4-7/+41
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-01mparser: Add partial AST to exceptionsEli Schwartz1-6/+17
Surprisingly enough we need to do this twice. In some cases (failing-meson/72 triggers this) we can error out after parsing the codeblock, but without getting the expected eof. We need to catch both exceptions as either one can interrupt the built codeblock object. Co-authored-by: Xavier Claessens <xavier.claessens@collabora.com>
2023-03-01mparser: use an inherited ParseException everywhereEli Schwartz1-3/+3
2023-03-01Revert "Exit meson with an error if an invalid escape sequence is found in a"Eli Schwartz1-13/+2
This reverts commit 348248f0a19bdc80e8a184befb2faaa1d5e66f40. The rules were relaxed in commit ccc4ce28cc9077d77a0bc9e72b1177eba1be7186 to permit this, so it's never possible to raise this exception anymore. But that commit was incomplete, and didn't remove the now-useless infrastructure for exception handling. The test needed to test this was always broken, and then removed in commit 465ef856ac9b978f13414db4aff649c66f2e6be5, and still this useless try/except persisted.
2023-03-01interpreter: Add testcase..endtestcase clause supportXavier Claessens8-1/+113
This is currently only enabled when running unit tests to facilitate writing failing unit tests. Fixes: #11394
2023-03-01docs: document default_options behaviourJohn Levon1-0/+5
As discussed in issue #8037, using `c_args` in `project()` leads to `CFLAGS` not being respected, which is a common mistake. Document this and suggest using `add_project_arguments()` instead. Signed-off-by: John Levon <levon@movementarian.org>
2023-03-01docs: fix a small typoJohn Levon1-1/+1
s/Accecpts/Accepts/ Signed-off-by: John Levon <levon@movementarian.org>
2023-03-01rust: Fix handling of proc-macros in rust-project.jsonSebastian DrΓΆge1-7/+9
The proc-macro code was not running at all because of a missing dash in the crate type, and the proc macro dylib path was not generated as a path but including the `-o ` commandline parameter prefix.
2023-03-01rust: Store absolute paths in rust-project.jsonSebastian DrΓΆge1-2/+6
As meson requires source_dir!=build_dir and stores the rust-project.json inside the build directory, while software like rust-analyzer expects it at the root of the source directory, manual steps are needed for making them work together. One option, as described in the documentation, is per project configuration. Another option, that works correctly with compile-commands.json and clangd, is to store a symlink to the file in the build directory at the root of the source directory. As currently rust-project.json stores paths relative to the location of the file itself and rust-analyzer does not resolve symlinks, this does not work. To solve this, store absolute paths in rust-project.json as is already done in compile_commands.json for the directory.
2023-03-01unittests: add test for source dir stripping from rpathsStefan Hajnoczi1-0/+42
This test checks that rpaths are stripped correctly when their prefix matches the source directory. This test fails without the previous commit: 1/4 visitation FAIL 0.01s exit status 127 >>> MALLOC_PERTURB_=150 meson/tmpy7c0joy5/patron ――――――――――――――――――――――――――――――――――――― βœ€ ――――――――――――――――――――――――――――――――――――― stderr: meson/tmpy7c0joy5/patron: error while loading shared libraries: libalexandria.so: cannot open shared object file: No such file or directory Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2023-03-01backends: fix source dir stripping from rpathsStefan Hajnoczi1-2/+9
Commit e88887be4a08 ("Only remove substring if it is part of string") removed the source dir from the rpath when the following check succeeds: if absdir.startswith(self.environment.get_source_dir()): rel_to_src = absdir[len(self.environment.get_source_dir()) + 1:] For example, absdir '/myproject/foo' starts with source dir '/myproject', so we want to generate the relative path 'foo'. This code doesn't work with absdir '/myproject-libs/foo' though, because we'll incorrectly turn it into a relative path 'libs/foo' after stripping away '/myproject-'. Use os.path.commonpath() instead of str.startswith() so path components are correctly handled. Cc: Niklas Claesson <niklas.claesson@cosylab.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2023-02-28refactor a few subsystem-relative imports that imported the wrong locationEli Schwartz2-2/+2
Inside of mesonbuild.ast.* we can and should import from .foobar, rather than importing from .__init__'s re-exported version of that object. Failing to do so results in an extremely brittle codebase where simply changing the order of lines in __init__.py can result in ImportError.
2023-02-28doc: Be more specific about warning_level optionXavier Claessens1-0/+17
Fixes: #11469
2023-02-28Add detection code for powerpc64le.Jussi Pakkanen1-1/+3
Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019413
2023-02-28Add a deb_ prefix to constants that are only used in Debian system detection.Jussi Pakkanen1-6/+6
2023-02-28Handle a cross compilation setup that only has a C compiler.Jussi Pakkanen1-1/+4
2023-02-28Add Debian platform autodetect to env2mfile.Jussi Pakkanen1-1/+1
2023-02-28msetup: clarify error message when wrong directories are specifiedEli Schwartz1-10/+13
This can happen from typos, which then confusingly claim that neither build directory has a meson.build file because the implicit . directory was not actually one of the directories. Instead a random command line argument was interpreted as a directory name. Fixes #11472
2023-02-27Use caching in Compiler.sizeof() and Compiler.alignment()Andres Freund4-30/+36
2023-02-27Add Compiler.cached_run()Andres Freund2-2/+33
Caching Compiler.run() seems likely to cause problems, but some users, like .sizeof(), we know enough about the program run to make it safe. This commit just adds the Compiler.cached_run(), a subsequent commit makes use of it.
2023-02-27interpreter: bolden result of compiler.alignment(), compiler.sizeof()Andres Freund1-2/+2
This is more in line with other tests. It also looks better when introducing caching, as a subsequent commit will.
2023-02-27Improve unity build documentationCharles Brunet1-1/+15
2023-02-27docs: add Criterionandy59951-0/+1
2023-02-27prevent unhandled exception for operations on NoneCharles Brunet1-9/+47
For instance, when writing `-subdir('a')` or `not subdir('a')`. Fixes #11225.
2023-02-27documentation: there is no unary + operatorCharles Brunet1-1/+1
2023-02-27python dependency: Fix typo in placeholder stringDaniele Nicolodi1-1/+1
2023-02-27minstall: Replace non-breakable space with plain space in commentDaniele Nicolodi1-1/+1
2023-02-27mintro: Add exclude_{files, dirs} to install_subdir install_planDaniele Nicolodi6-3/+30
These are necessary for projects outside Meson itself that want to extend the 'meson install' functionality as meson-python does to assemble Python package wheels from Meson projects. Fixes #11426.
2023-02-25Misleading comment mtribiere1-1/+1
Code moved to detect.py in recent version
2023-02-24docs: fix bad advice to use python module to find pythonEli Schwartz1-2/+2
2023-02-24test cases: use best practices method to find the python3 programEli Schwartz13-15/+18
We do not need the python module's find_installation() for this, as this does various things to set up building and installing python modules (pure python and C-API). This functionality is already tested in the python tests. Elsewhere, when we just need an interpreter capable of running python scripts in order to guarantee a useful scripting language for custom commands, it suffices to use find_program(), which does not run an introspection script or do module imports, and is thus faster and a bit cleaner. Either way, both methods are guaranteed to find the python3 interpreter, deferring to mesonlib.python_command for that guarantee. test "71 summary" can sometimes return the python command with the ".exe" part all uppercased for mysterious Windows reasons. Smooth this over with ExternalProgram.
2023-02-24work around circular imports in python probe scriptEli Schwartz1-3/+7
It seems this happens because at some point setuptools imports gettext, and we have a script by the same name. In general, this path injection by default is bad news for our use case. Python 3.11 introduced -P for this reason, but we cannot depend on that. Instead, check for it first, and delete it, before doing more imports.
2023-02-24mcompile: Do not exclude targets from subprojectsXavier Claessens1-5/+3
When giving full path to a target there is no reason to skip targets from subprojects, the path can start with `subprojects/`.
2023-02-23docs: add gcc to list of compilers with sanitize toolsandy59951-1/+1
2023-02-23Update Vs-External.mdValeri1-1/+1
Fix minor typo
2023-02-23clangformat: don't noisily print status messages for every checked fileEli Schwartz1-4/+8
The version lookup should be silent. While we're at it, the version lookup should not be happening more than once, which printing multiple messages indicated we were doing. Pass the version into the per-file function rather than looking it up fresh each time. Fixes https://github.com/mesonbuild/meson/pull/11054#issuecomment-1430169280