aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter
AgeCommit message (Collapse)AuthorFilesLines
2022-01-18interpreterobjects: consistently use dependency. for error messagesDylan Baker1-16/+16
We currently use a mixture of dependency, Dependency, and dep
2022-01-12subproject: fix version validation on lookupØyvind Aarrestad Aakre1-0/+5
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.
2021-12-30remove no longer needed validation routineEli Schwartz1-6/+4
We don't need to check when processing the script args, whether the correct types were passed. We check this upfront in typed_pos_args now.
2021-12-30add_*_script: fix incorrect typed_pos_args allowing built targetsEli Schwartz1-8/+8
In commit c239ce31f55579cfe1e29b769a8bda97deca2166 support was added to these functions to accept various non-string types. Despite the commit/PR documenting that only add_install_script is permitted to accept built files, the actual check parameter was set, for all three, to "True" (so the function was never invoked with False at all). This meant that actually attempting to use the allowed types would fail at postconf or dist, with python tracebacks in the former case and "Failed to run dist script" in the latter case. This was partially ameliorated in commit 6c5bfd4c241e94f5e0f4dea9ba7fb5d5090a4802 which added typed_pos_args, but unfortunately those typed_pos_args were all over the place. For postconf: - They banned external programs as additional args (which should be allowed) - They banned built executables (good) - They allowed custom targets as additional args (bad) For dist: - they allowed external programs (good) - they allowed built executables, but only as the first argument (bad, also ???) - they allowed custom targets, but only as additional arguments (bad, also ???) Fix this all to only allow the same argument types for both the script argument and the script-args arguments. That type is known at configure time and restricted to source files, configured files, and found programs.
2021-12-30add_*_script: fix missing FeatureNew for non-string argumentsEli Schwartz1-14/+10
In commit 2c0eaf5c4f4493146355eeb8521c17a3c2ef5acd support was added for install scripts to accept found programs, built executables, or custom targets. In commit c239ce31f55579cfe1e29b769a8bda97deca2166, this was extended to dist and postconf scripts too (although it was documented that those should not accept targets that are built by ninja). Despite the commit/PR claiming that all of these should always accept files and configured files, this was only true for arguments other than the first, until commit f808c955eab983b31feee130f0947c7cb254a94f. In amongst all this, FeatureNew checks were never registered for the first argument, only for additional arguments, until late in the game with the addition of FeatureNew checks for File objects. Fix this in part by moving the 3 different File checks into one, inside the function that processes the first script, and make that function check for FeatureNew on anything else too.
2021-12-20restore additional info about the potential cause of find_program failingEli Schwartz1-1/+1
Before commit f08eed37cb69ba0d793c0f1d086eaef7f25c2ea3 we also mentioned that it might not be executable.
2021-12-20restore the ability in the backend to silently find a programEli Schwartz1-2/+4
Broken in commit f08eed37cb69ba0d793c0f1d086eaef7f25c2ea3 which moved the reporting and unconditionally added it.
2021-12-17Fix mypy errorsDaniel Mensinger1-0/+1
2021-12-07custom_target: catch and reject input files that do not existEli Schwartz1-10/+14
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-07interpreter: use common DEPENDS_KWDylan Baker2-3/+3
2021-12-07interpreter: move more custom_target keyword arguments to the type_checking ↵Dylan Baker2-3/+8
module These are going to be used in the gnome module.
2021-12-06interpreter: use build.GeneratedTypesPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-06interpreter: allow extract_objects to receive generated sourcesPaolo Bonzini1-2/+2
Fixes: #8333
2021-12-06allow passing a CustomTargetIndex as argument to a testPaolo Bonzini1-1/+1
Fixes: #7585 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-01add install_symlink functionPablo Correa Gómez2-0/+25
Allows installing symlinks directly from meson, which can become useful in multiple scenarios. Current main use is to help moving forward #9557
2021-12-01interpreter: reorder functions alphabeticallyPablo Correa Gómez1-15/+15
2021-11-30fix broken FeatureNew checks that never printedEli Schwartz1-2/+2
They passed the arguments in the wrong order, so the version parsed as the message and the message parsed as a version. While we are at it, pass the location node in too.
2021-11-29interpreter: allow Compiler as a variadic positional argumentDylan Baker1-6/+15
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-29interpreter: use typed_kwargs for run_commandDylan Baker2-16/+22
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-29interpreter: use typed_pos_args for run_commandDylan Baker1-8/+18
2021-11-28make sure files arguments to compiler.compiles and friends, performs rebuildEli Schwartz1-0/+3
If the compiler check is updated as a string in meson.build, we force rebuild, which is a good thing since the outcome of that check changes the configuration context and can enable or disable parts of the build. If the compiler check came from a files() object then we didn't add a regen rule on those files. Fixes #1656
2021-11-27Merge pull request #9531 from dcbaker/submit/interpreter-more-typingJussi Pakkanen4-114/+193
More use of typed_* in the interpreter module
2021-11-25interpreter: fix `feature.require` handling of error messageBenoit Pierre1-1/+2
Don't show a blank error when no `error_message` was passed as argument.
2021-11-23interpreter: extract_objects provides a valid sourcePaolo Bonzini1-4/+5
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-22simplify passing some nodes aroundEli Schwartz1-2/+2
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-22interpreter: use typed_kwargs for find_programDylan Baker2-10/+20
2021-11-22interpreter: use find_program_impl internally instead of func_find_programDylan Baker2-4/+4
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-22interpreter: move disabler KwargInfo to the type_checking moduleDylan Baker2-1/+4
2021-11-22interpreter: use typed_pos_args for find_programDylan Baker1-8/+6
2021-11-22interpreter: add type annotations to find_program_implDylan Baker1-4/+8
2021-11-22interpreter: use typed_* args for the summary functionDylan Baker2-24/+28
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-22interpreter: add typed_kwargs to subdirDylan Baker2-7/+30
2021-11-22interpreter: use typed_kwargs for projectDylan Baker3-28/+62
2021-11-22interpreter: use typed_kwargs for add_test_setupDylan Baker2-32/+35
This also sets a few missing "new kwarg" warnings, as they're quite easy to set with typwed_kwargs
2021-11-20add location nodes to some Feature callsEli Schwartz1-2/+2
2021-11-20guard a complicated mlog.warning inside a Feature checkEli Schwartz1-4/+6
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-15Merge pull request #9565 from bonzini/invalid-run-targetJussi Pakkanen2-6/+6
reject run_target in test or install script arguments
2021-11-15interpreter: disallow RunTarget in meson.add_install_scriptPaolo Bonzini1-5/+5
Without this patch, the name of the RunTarget is passed to the install script; for the enclosed test, meson setup (incorrectly) succeeds, but installation fails.
2021-11-15interpreter: disallow RunTarget in testPaolo Bonzini1-1/+1
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-14interpreter: Fix a typoYasushi SHOJI1-1/+1
This is a trivial typo. Fix projeccts to projects. Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-11-04fix regression that broke string.format with list objectsEli Schwartz1-0/+2
String formatting should validly assume that printing a list means printing the list itself. Instead, something like this broke: 'one is: @0@ and two is: @1@'.format(['foo', 'bar'], ['baz']) which would evaluate as: 'one is: foo and two is: bar' or: 'the value of array option foobar is: @0@'.format(get_option('foobar')) which should evaluate with '-Dfoobar=[]' as 'the value of array option foobar is: []' But instead produced: meson.build:7:0: ERROR: Format placeholder @0@ out of range. Fixes #9530
2021-11-01various manual conversion of percent-formatted strings to f-stringsEli Schwartz3-30/+26
2021-11-01fix broken error message that printed formatter codesEli Schwartz1-1/+1
This was probably supposed to be percent-formatted but got typoed to a comma instead. Rewrite as an f-string.
2021-11-01interpreter/modules: ModuleReturnValue can hold ExecutableSerialisationDylan Baker1-1/+1
The code for this exists and works, but the type annotations don't allow it. This fixes the annotations
2021-11-01interpreter: add type annotations for program_from_overridesDylan Baker1-1/+2
2021-10-30Added warning if run_command is called without the check kwargVolker Weißmann1-1/+9
2021-10-30Typo fixes (CustomTaget -> CustomTarget)rusty-snake1-1/+1
2021-10-30Typo fixes (CustomTaget -> CustomTarget)rusty-snake1-1/+1
2021-10-29Merge pull request #9375 from dcbaker/submit/windows-module-typingJussi Pakkanen1-1/+8
Typing for the Windows module
2021-10-28configure_file: upgrade deprecation message to FeatureDeprecatedEli Schwartz1-2/+2
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.