Commit Graph

187 Commits

Author SHA1 Message Date
Eli Schwartz 1913a4246c
pkgconfig module: fix incorrect Feature logging for uninstalled_variables
The utility function that processes this for both 'variables' and
'uninstalled_variables' accepts a kwarg for the name of the argument,
but then hardcodes 'variables' in the warning message. This is
misleading.
2022-01-27 22:11:47 -05:00
Eli Schwartz fa4f96427a remove incorrect deprecated feature for vcs_tag
In commit 06481666f4 this warning got
moved from build.py to the interpreter. Unfortunately it got added to
the wrong function... it is supposed to be part of custom_target and
even mentions this as the feature_name.

Since then, build_always became a KwargInfo and has the deprecated-since
attribute baked into it. But it didn't have the additional message which
it really should have.

Add that message at the same time we remove it from vcs_tag.
2022-01-27 13:01:48 -08:00
Eli Schwartz 7e0004d8cf move the version info for build_always* directly into the kwarginfo
Rather than pointlessly evolving it in the exactly one place which it is
used. It's not clear what the purpose for this was.
2022-01-27 13:01:48 -08:00
Eli Schwartz 3990dc6d64 flake8: fix indentation style 2022-01-27 10:48:01 -08:00
Eli Schwartz a0d28e850e properly error out when project version is an array other than files()
Due to the support for specifying version as files('VERSION'), we need
to internally accept an array, since that is what files() returns.
Before that, we didn't accept arrays, and after that, we don't intend to
accept generic arrays, only arrays as a side effect of files(). So
tighten the typechecking to ensure that that is what we actually get.
2022-01-24 19:46:51 +01:00
Dylan Baker 5074e2d3b5 interpreter: replace ConfigurationDataObject with ConfigurationDataHolder
This is much cleaner, and more in line with the way we handle
interpreter objects in modern meson practice
2022-01-18 17:53:29 -05:00
Øyvind Aarrestad Aakre 5b3094d43b subproject: fix version validation on lookup
Fixes a bug where the subproject version was not validated
when the subproject had already been processed.

The bug would cause inconsistent build results if the subproject was
referenced more than once (diamond) with conflicting version requirements.
2022-01-12 14:04:11 -05:00
Eli Schwartz d25a335503
restore additional info about the potential cause of find_program failing
Before commit f08eed37cb we also mentioned
that it might not be executable.
2021-12-20 16:03:43 -05:00
Eli Schwartz 71ae5ccb65
restore the ability in the backend to silently find a program
Broken in commit f08eed37cb which moved
the reporting and unconditionally added it.
2021-12-20 16:03:43 -05:00
Eli Schwartz 1e5d7f2122
custom_target: catch and reject input files that do not exist
Currently there is a try/except around the function that detects and
rejects this, which instead of rejecting it, spawns a warning and
continue.

This warning exists because of 'test cases/vala/9 gir/' which passes a
vala generated output that isn't a return value (!!!) using string
joining with the meson.current_build_dir() function (also !!!) because
we officially document this (!!! for a third time) as the only way to
make a vala shared library generate a typelib with a custom_command from
the automatically generated gir:
https://mesonbuild.com/Vala.html#gobject-introspection-and-language-bindings

In #3061 we converted strings to Files, but only if none of them were
this vala hack. Due to the precise implementation, we also failed to
convert strings to Files if any other error occurred, but since we only
want to ignore errors for generated vala outputs, tighten that check and
specifically call out generated files in the warning.

Fixes #8635
2021-12-07 19:47:12 -05:00
Dylan Baker e97f5a01c9 interpreter: use common DEPENDS_KW 2021-12-07 16:12:23 -05:00
Dylan Baker f49c9c67fd interpreter: move more custom_target keyword arguments to the type_checking module
These are going to be used in the gnome module.
2021-12-07 16:12:23 -05:00
Paolo Bonzini 18408f82d1 allow passing a CustomTargetIndex as argument to a test
Fixes: #7585
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-06 13:27:12 -08:00
Pablo Correa Gómez 4f882ff8ec add install_symlink function
Allows installing symlinks directly from meson, which can
become useful in multiple scenarios. Current main use is to
help moving forward #9557
2021-12-01 13:59:54 -05:00
Pablo Correa Gómez bb5a09de45 interpreter: reorder functions alphabetically 2021-12-01 13:59:54 -05:00
Dylan Baker 04a973726b interpreter: allow Compiler as a variadic positional argument
We allow this for the command (the first parameter), but not later
parameters, which is just odd. This also allows us to give better error
messages for the case of overridden programs.
2021-11-29 18:12:33 -08:00
Dylan Baker fcced46c99 interpreter: use typed_kwargs for run_command
This also cleans up a couple of internal callers of the internal impl
version that don't set the `check` argument, and therefore trigger a
warning about not setting the check argument.
2021-11-29 18:12:33 -08:00
Dylan Baker 3a168513bd interpreter: use typed_pos_args for run_command 2021-11-29 18:12:33 -08:00
Jussi Pakkanen bd509d11a5
Merge pull request #9531 from dcbaker/submit/interpreter-more-typing
More use of typed_* in the interpreter module
2021-11-27 21:44:41 +02:00
Paolo Bonzini 8581a2b122 interpreter: extract_objects provides a valid source
This ensures that there is no warnings when running meson on
test cases/common/22 object extraction.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-11-23 18:10:15 +05:30
Eli Schwartz 1c2461f5c7
simplify passing some nodes around
Every function has a copy of the node as a kwarg, and doesn't need to go
through the class's self.current_node.
2021-11-22 16:28:13 -05:00
Dylan Baker c167a7691f interpreter: use typed_kwargs for find_program 2021-11-22 11:28:43 -08:00
Dylan Baker 822b087f24 interpreter: use find_program_impl internally instead of func_find_program
Calling interpreter implementation methods is just a bad idea, apart
from the extra type checking that goes into it, we need to pass more
arguments than we need to calling the impl method.
2021-11-22 11:28:43 -08:00
Dylan Baker 5593352b87 interpreter: move disabler KwargInfo to the type_checking module 2021-11-22 11:28:43 -08:00
Dylan Baker f9478c573b interpreter: use typed_pos_args for find_program 2021-11-22 11:28:43 -08:00
Dylan Baker 38b4673a94 interpreter: add type annotations to find_program_impl 2021-11-22 11:28:43 -08:00
Dylan Baker d05a0fbf33 interpreter: use typed_* args for the summary function
This also includes a few type annotation cleans for the Summary object.

Getting the positional arguments exactly right is impossible, as this is
really a function with two different signatures:
```
summary(value: dictionary): void
summary(key: string, value: any): void
```
We can get close enough in the typed_pos_args by enforcing that there
are two parameters, one required and one optional, and that the first
must be either a dictionary or a string.
2021-11-22 11:28:43 -08:00
Dylan Baker 3295621706 interpreter: add typed_kwargs to subdir 2021-11-22 11:28:43 -08:00
Dylan Baker f34013fb08 interpreter: use typed_kwargs for project 2021-11-22 11:28:43 -08:00
Dylan Baker ab29126232 interpreter: use typed_kwargs for add_test_setup
This also sets a few missing "new kwarg" warnings, as they're quite easy
to set with typwed_kwargs
2021-11-22 11:28:43 -08:00
Eli Schwartz 32821be623
add location nodes to some Feature calls 2021-11-20 20:48:30 -05:00
Eli Schwartz 329783d80c
guard a complicated mlog.warning inside a Feature check
This is only relevant on certain versions of meson, so do not print it
when meson_version is too low.

The message itself is not precisely a deprecation warning, since
ostensibly it may be an unlikely coding mistake. It is probably an
attempt to implement `copy: true`, but it might not be, hence "warning"
instead of "deprecation". So although we could switch this to a
FeatureDeprecated, that is not being done at this time.
2021-11-20 20:48:29 -05:00
Jussi Pakkanen 5b08fd4b33
Merge pull request #9565 from bonzini/invalid-run-target
reject run_target in test or install script arguments
2021-11-15 22:00:21 +02:00
Paolo Bonzini 36c390e08e interpreter: disallow RunTarget in test
Fixes the following error in the testcase:

  File "/usr/lib/python3.10/site-packages/mesonbuild/backend/ninjabackend.py", line 548, in generate
    self.generate_tests()
  File "/usr/lib/python3.10/site-packages/mesonbuild/backend/ninjabackend.py", line 1093, in generate_tests
    self.serialize_tests()
  File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 567, in serialize_tests
    self.write_test_file(datafile)
  File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 943, in write_test_file
    self.write_test_serialisation(self.build.get_tests(), datafile)
  File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 1017, in write_test_serialisation
    pickle.dump(self.create_test_serialisation(tests), datafile)
  File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 1002, in create_test_serialisation
    cmd_args.append(self.construct_target_rel_path(a, t.workdir))
  File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 1021, in construct_target_rel_path
    return self.get_target_filename(a)
  File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 253, in get_target_filename
    assert(isinstance(t, build.BuildTarget))
2021-11-15 11:32:59 +01:00
Yasushi SHOJI dbd1e154ab interpreter: Fix a typo
This is a trivial typo.  Fix projeccts to projects.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-11-14 15:16:54 -05:00
Eli Schwartz 038b31e72b
various manual conversion of percent-formatted strings to f-strings 2021-11-01 20:26:18 -04:00
Eli Schwartz bae0fdf64a
fix broken error message that printed formatter codes
This was probably supposed to be percent-formatted but got typoed to a
comma instead. Rewrite as an f-string.
2021-11-01 20:22:35 -04:00
Dylan Baker fec7b2c07f interpreter/modules: ModuleReturnValue can hold ExecutableSerialisation
The code for this exists and works, but the type annotations don't allow
it. This fixes the annotations
2021-11-01 12:24:25 -07:00
Dylan Baker 7f8961897a interpreter: add type annotations for program_from_overrides 2021-11-01 12:24:25 -07:00
Volker Weißmann 2c079d855e Added warning if run_command is called without the check kwarg 2021-10-30 22:26:28 -04:00
Eli Schwartz ec161fca4d configure_file: upgrade deprecation message to FeatureDeprecated
install: false was only available since 0.50, so we should not warn
people who support older versions to use something they cannot.
Fortunately, we can do FeatureDeprecated for this -- and then it even
gets summarized. Unfortunately, it's not well used, and certainly isn't
here.
2021-10-28 17:41:51 -04:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Xavier Claessens 6298e29070 message: Allow bool
It has always been working even if not documented and there is no reason
to not accept it. However, change "True/False" to "true/false" to be
consistent with meson language.

Fixes: #9436
2021-10-26 10:59:13 -04:00
Eli Schwartz f52a5a7cd3
wrap: move FeatureNew checks to a more natural place
Now, warnings are unconditionally raised when parsing the wrap file,
whether they are used or not. That being said, these warnings literally
just check for a couple of keys used in the .wrap ini file.

Moving these checks from the time of use to the time of loading, means
that we no longer report warnings only when originally downloading or
extracting the file or VCS repo.

It also means we no longer report warnings in one subproject, when a
wrap file is picked up from a different subproject because the first
subproject actually does a dependency lookup. This caused issues for the
WrapDB tooling, which uses patch_directory everywhere and the
superproject requires a suitable minimum version of meson for this...
but individual wraps might use a much lower version, and would then
raise a warning (in strict mode, converted to an error) when it resolved
a dependency from another WrapDB project.

Fixes #9118
2021-10-15 14:38:44 -04:00
Daniel Mensinger 220d5aa7ba interpreter: Fix missing holder entry (fixes #9389) 2021-10-12 12:44:33 -04:00
Xavier Claessens 928078982c Add --vsenv command line option and active VS only when needed 2021-10-10 23:15:18 +03:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Jussi Pakkanen 95d8b8787a Be more strict about target names with slashes. 2021-10-10 15:01:53 +03:00
Xavier Claessens 2628ce576c Add support for module options 2021-10-08 17:47:35 -04:00
Eli Schwartz 108bd996ee
add install_emptydir function
This replaces the absolute hack of using

```
install_subdir('nonexisting', install_dir: 'share')
```

which requires you to make sure you don't accidentally or deliberately
have a completely different directory with the same name in your source
tree that is full of files you don't want installed. It also avoids
splitting the name in two and listing them in the wrong order.

You can also set the install mode of each directory component by listing
them one at a time in order, and in fact create nested structures at
all.

Fixes #1604
Properly fixes #2904
2021-10-08 14:35:00 -04:00