| Age | Commit message (Collapse) | Author |
|
Avoid extra method calls and repeating ourselves.
|
|
This replaces the long explanation of `external_library`s in the
`link_with` parameter to the simpler one used by declare_dependency.
Additionally, declare_dependency now checks that a target is linkable
when adding it. This just catches the problem before it goes down into
the build layer giving a better error message.
There is a bug in the declare_dependency annotations, in that they don't
mark Executable as acceptable. So I've fixed that.
|
|
What is basically impossible is to handle `SubprojectHolder`, because
it's not a true holder but an interpreter object. Well, impossible
without changing SubprojectHolder into a true holder, because it's
avoiding the circular import becomes extremely convoluted otherwise, and
refactoring is difficult because the held object is itself an
Interpreter. It's a rather complex problem to solve gracefully. I've
punted to avoid the complexity, it does mean that the error message is
somewhat less exact.
I don't think this is actually a huge problem because we've really
guided people away from using `subproject()` and to instead use
dependency fallbacks, which don't have this problem to begin with.
This removes validation from the build layer, and puts it in
interpreter. For code sharing reasons this means that
`internal_dependency` also gets more fine grained error messages.
The test case for this has been modified to use the `testcase
expect_error` construct, and thus has been moved to the common tests
directory. It's also been extended to cover both the library case, which
gives coverage for the `extra_types` in `KwargInfo`
|
|
Among other things it will say "expects X but only has Y", even if Y >
X.
|
|
Avoid getting a raw exception, instead use a (subclass of) MesonException
that is printed in the usual "FILE:LINE:COLUMN: MESSAGE" format.
Fixes: #15023
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
|
|
What's left requires the Environment, so it will have to be handled in
the interpreter implementation for now.
|
|
Place the build products in a directory of the specified name
somewhere within the build directory. This allows use of the target
that includes a specific directory name:
#include <subdir/configure.h>
This also allows creating targets with the same basename by using
different subdirectory names.
v2:
Move build_subdir to Target class.
Error if path separator in build_dir
v3:
Rename to 'build_subdir' to make it clear that the name is
appended to a meson-specific build directory, and does not
provide the user with a way to define the overall meson build
hierarchy.
Allow build_subdir to include path separators.
Support 'build_subdir' for configure_file.
build_subdir must not exist in the source directory and
must not contain '..'
Add documentation and tests
v4:
Rebase and prepare for version 1.9.1
Add failing test case when build_subdir is present in the
project.
Add release note snippet
v5:
Clarify wording on restrictions on the value of build_subdir. Use
the same wording in each place this restriction is described.
v6:
Move path validation to shared function, validate_build_subdir,
instead of duplicating the tests in two places.
v7:
Update version numbers to 1.10.0
Add TypedDict updates.
Remove spurious build_subdir instance variable
v8:
Oops, missed one version number update.
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
Fixes: #12519
|
|
|
|
This reverts commit 651aede977179c5fe382744e3dd91ca8e01d050c.
This was most certainly not acceptable.
|
|
We might run into an assertion failure down the road, if we don't fail
here. Specifically
project('proj')
executable('bin', 'header.h')
will throw during the ninja generation.
|
|
Meson was running into an key lookup failure when evaluating the
following:
project('proj', 'c')
executable('bin', link_language: 'cpp')
and since 41eb18d also if the executable contained exclusively header
sources.
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
To avoid raceconditions, where one instance of meson currently downloads
a subproject defined in a wrapfile, while another either
a. starts the download itself too
b. attemts to evaluate the partially downloaded subproject
wraplock introduces a lockfile, which should prevent simultaneous access
of subprojects by wrap between different instances of meson.
|
|
Fixes #14415
|
|
If the user specifies java sources as input to a non-jar build
target, raise an error with a message directing them to use the jar
target instead.
Fixes: https://github.com/mesonbuild/meson/issues/13870
|
|
The current approach of determining dub dependencies is by specifying
a name and, optionally, a version. Dub will then be called to generate
a json summary of the package and code in meson will parse that and
extract relevant information. This can be insufficient because dub
packages can provide multiple configurations for multiple use-cases,
examples include providing a configuration for an executable and a
configuration for a library. As a practical example, the dub package
itself provides an application configuration and multiple library
configurations, the json description of dub will, by default, be for
the application configuration which will make dub as a library
unusable in meson.
This can be solved without modifying the meson build interface by
having dub describe the entire local project and collecting
dependencies information from that. This way dub will generate
information based on the project's 'dub.json' file, which is free to
require dependencies in any way accepted by dub, by specifying
configurations, by modifying compilation flags etc. This is all
transparent to meson as dub's main purpose is to provide a path to the
library file generated by the dependency in addition to other
command-line arguments for the compiler.
This change will, however, require that projects that want to build
with meson also provided a 'dub.json' file in which dependency
information is recorded. Failure to do so will not break existing
projects that didn't use a 'dub.json', but they will be limited to
what the previous implementation offered. Projects that already have a
'dub.json' should be fine, so long as the file is valid and the
information in it matches the one in 'meson.build'. For example for a
'dependency()' call in 'meson.build' that dependency must exist in
'dub.json', otherwise the call will now fail when it worked
previously.
Using a 'dub.json' also has as a consequence that the version of the
dependencies that are found are the ones specified in
'dub.selections.json', which can be helpful for projects that already
provide a 'dub.json' in addition to 'meson.build' to de-duplicate code.
In terms of other code changes:
- multiple version requirements for a dub dependency now work, though
they can only be used when a 'dub.json' is present in which case the
version of dependencies is already pinned by 'dub.selections.json'
- the 'd/11 dub' test case has been changed to auto-generate the
'dub.json' config outside of the source directory, as the
auto-generated file triggers warning when parsed by dub, which upsets
the new code as the warnings interfere with the legitimate output.
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
|
|
It's not the first time I run into an issue with an intentionally missing
exe_wrapper during cross compilation. In pretty much all the cases the project
I tried to build already had code available to not need one in the first place.
Print out what command was actually the culprit to make debugging this easier.
|
|
This mitigates maintenance burden as CMake minimum version isn't
relevant for these tests. CMake >= 3.31 warns if CMake minimum version
is less than 3.10.
ref: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9875
|
|
If a user imports a module and invokes a method on it,
a raw Python exception is raised to the user. This commit
adds a check to ensure that in this case an appropriate
exception is raised instead.
A test has been added to ensure that this exception is
in fact raised on offending code.
Fixes: #11393, #5134
|
|
Although it's not especially common, there are certainly cases where it's
useful to pass the path to an external program to a test program.
Fixes: https://github.com/mesonbuild/meson/issues/3552
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
We have two ways of marking a test as skipped:
- raise MESON_SKIP_TEST
- declare that the tools it needs in test.json are unavailable
Doing the former requires performing the configure stage including e.g.
language setup.
In several cases we weren't even getting this far anyway since we used
both mechanisms (the cmake category has a category-wide skip for this,
in fact). In some case, we were missing test.json declaring it skippable;
add this.
|
|
This reverts commit 9f02d0a3e5a5ffc82256391c244b1af38e41ef78.
It turns out that this does introduce a behavioral change in existing
users of ConfigurationData, which it wasn't supposed to (it was supposed
to preserve behavior there, and add a new *warning* for
EnvironmentVariables).
This breaks projects such as pulseaudio, libvirt, and probably more.
Roll back the change and try again after 1.5.0 is released.
Fixes: #13372
|
|
Only Environment and ConfigurationData are mutable. However, only
ConfigurationData becomes immutable after first use which is
inconsistent.
This deprecates modification after first use of Environment object and
clarify documentation.
|
|
By adding the option name to UserOption object, it is now possible to
display the name of the affected option when the given option value is
not valid.
Fixes #12635
|
|
|
|
There is no reason to forbid empty variables, PkgConfigCLI.variable()
even has code specifically for handling that case.
|
|
Some text editors on Windows may use utf8bom encoding by default.
Prevent crash and properly report misencoded files.
Fixes #12766.
|
|
|
|
|
|
This issue was encounetered while working on a contribution to nixpkgs.
Nix allows the store to be installed on a separate, case-sensitive APFS
volume. When the store is on a case-sensitive volume, these tests fail
because they try to use `foundation` instead of `Foundation`.
|
|
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
|
|
The word "cannot" expresses inability to do something whereas "can not"
expresses the ability to refrain from doing something.
|
|
During evaluation of codeblocks, we start off with an iteration of
nodes, and then while evaluating them we may update the global
self.current_node context. When catching and formatting errors, we
didn't take into account that the node might be updated from the
original top-level iteration.
Switch to formatting errors using self.current_node instead, to ensure
we can point at the likely most-accurate actual cause of an error.
Also update the current node in a few more places, so that function
calls always see the function call as the current node, even if the most
recently parsed node was an argument to the function call.
Fixes #11643
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
This test case checks stdout and demands a `dependency()` lookup fail.
The resulting error message can be different depending on whether cmake
is installed, or not. For cmake-specific tests we would simply skip the
test if cmake is not installed, but here we can just fine-tune the
pattern matching we use to determine if the test failed "correctly".
Fixes #11320
|
|
We make use of allow_unknown=True here, which allows us to only look at
the common arguments in the main option parser, and then look at the
specific options in the dispatched parsers. This allows us to do more
specific checking on a per overload basis.
|
|
The code below this already handles being passed an Executable or
ExternalProgram, and it does it correctly, since it handles host
binaries that need an exe_wrapper correctly, while the code in the
generator paths doesn't.
The xcode backend is, like always, problematic, it doesn't handle things
the same way as the ninja and vscode backends, and generates a shell
script instead of using meson as a wrapper when needed (it seems likely
that just forcing the meson path for xcode would be better). I don't
have a working mac to develop a fix for, so I've left a todo comment
there.
Fixes: #11264
|
|
Found with codespell.
|
|
https://github.com/mesonbuild/meson/pull/9287 changed the `optimization=0`
to pass `-O0` to the compiler. This change is reasonable by itself
but unfortunately, it breaks `buildtype=plain`, which promises
that “no extra build flags are used”.
`buildtype=plain` is important for distros like NixOS,
which manage compiler flags for optimization and hardening
themselves.
Let’s introduce a new optimization level that does nothing
and set it as the default for `buildtype=plain`.
|
|
In the debug logs, always log if a dependency lookup raises a
DependencyException. In the `required: false` case, this information
would otherwise disappear forever, and we would just not even log that
we tried it -- it doesn't appear in "(tried x, y and z)".
In the `required: true` case, we would re-raise the first exception if
it failed to be detected. Update the raise message with the same
information we print to the debug logs, indicating which dependency and
which method was used in the failing attempt.
|
|
Compiled languages are Meson's bread and butter, but hardly required.
This is convenient, because many test caases specifically, do not care
about testing the compiler interactions.
In such cases, we can skip doing compiler lookups which aren't used, as
they only slow down test setup.
|
|
|
|
|