aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
AgeCommit message (Collapse)AuthorFilesLines
2021-04-01interpreter: Move to its own folder and split itXavier Claessens1-5061/+0
2021-03-26Remove ConfigureFile and ConfigureFileHolderXavier Claessens1-16/+5
They are not used anywhere.
2021-03-24Use find_program also in add_*_script for consistency.Jussi Pakkanen1-18/+2
2021-03-24Use find_program also in custom_target for consistency.Jussi Pakkanen1-0/+3
2021-03-23interpreter: Fix spurious warning in include_directories()Xavier Claessens1-1/+3
When doing include_directories('.') at the root of the subproject we should not warn about sandboxing violation.
2021-03-23environment(): Allow stacking append() and prepend() (#8547)Xavier Claessens1-8/+6
* environment(): Allow stacking append() and prepend() * Update docs/markdown/Reference-manual.md Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
2021-03-23Merge pull request #7491 from xclaesse/callstackJussi Pakkanen1-7/+10
RFC: logs: Prepend current subproject name to all messages
2021-03-23Remove -pipe from default list of args. Closes #8508.Jussi Pakkanen1-3/+0
2021-03-22mlog: Do not print 'subproject|' for the message 'Executing subproject'Xavier Claessens1-7/+5
It already contains the full callstack and it's more visible when it's standing on its own line.
2021-03-22interpreter: Do not print "method meson"Xavier Claessens1-1/+5
2021-03-22logs: Prepend current subproject name to all messagesXavier Claessens1-6/+7
Meson used to prepend '|' for each nested subproject to distinguish in the logs where a subproject start and ends. It is more useful to print the current subproject name. Also print the call stack when starting a new subproject to better see which subproject chain leads to to.
2021-03-19Move OverrideProgram to programsDylan Baker1-5/+1
2021-03-19split program related classes and functions out of dependenciesDylan Baker1-17/+17
Dependencies is already a large and complicated package without adding programs to the list. This also allows us to untangle a bit of spaghetti that we have.
2021-03-18Allow add_dist_script() in subprojectsXavier Claessens1-1/+2
Fixes: #8440.
2021-03-18interpreter: Add varname as positional arg in dep.get_variable()Xavier Claessens1-2/+7
2021-03-17Warn when grabbing internals of subprojects with include_directories.Jussi Pakkanen1-2/+28
2021-03-16Add range() functionXavier Claessens1-2/+24
Fixes: #5026.
2021-03-16msetup: do not print bogus "Option ... is:" messagesPaolo Bonzini1-1/+6
get_non_matching_default_options is checking a string from project_default_options against a validated value from coredata.options. Passing the string to validate_value ensures that the comparison is sound; otherwise, "false" might be compared against False and a bogus difference is printed.
2021-03-16Add `meson devenv` command and meson.add_devenv()Xavier Claessens1-6/+13
2021-03-16EnvironmentVariables: Simplify and annotateXavier Claessens1-17/+27
2021-03-14Fix run_targets running scripts from different subdirs.Jussi Pakkanen1-0/+2
2021-03-12interpreter: Cache found dependency before converting for include_typeXavier Claessens1-7/+7
Fixes: #8516.
2021-03-06Refactor subdir visitation to track files instead of dirs.Jussi Pakkanen1-3/+4
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-44/+44
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04various python neatness cleanupsEli Schwartz1-10/+10
All changes were created by running "pyupgrade --py3-only --keep-percent-format" and committing the results. I have not touched string formatting for now. - use set literals - simplify .format() parameter naming - remove __future__ - remove default "r" mode for open() - use OSError rather than compatibility aliases - remove stray parentheses in function(generator) scopes
2021-03-04Simplify module APIXavier Claessens1-87/+31
- ModuleState is now a real class that will have methods in the future for actions modules needs, instead of using interpreter internal API. - New ModuleObject base class, similar to InterpreterObject, that should be used by all objects returned by modules. Its methods gets the ModuleState passed as first argument. It has a `methods` dictionary to define what is public API that can be called from build definition. - Method return value is not required to be a ModuleReturnValue any more, it can be any type that interpreter can holderify, including ModuleObject. - Legacy module API is maintained until we port all modules. In the future modules should be updated: - Use methods dict. - Remove snippets. - Custom objects returned by modules should all be subclass of ModuleObject to get the state iface in their methods. - Modules should never call into interpreter directly and instead state object should have wrapper API. - Stop using ModuleReturnValue in methods that just return simple objects like strings. Possibly remove ModuleReturnValue completely since all objects that needs to be processed by interpreter (e.g. CustomTarget) should be created through ModuleState API.
2021-03-04interpreter: Fix process_new_values()Xavier Claessens1-7/+3
It should recurse on lists and does not need to return a value.
2021-02-27install_man locale supportJason Woodward1-2/+7
Rather than having to manually build the locale aware man paths with `install_data('foo.fr.1', install_dir: join_paths(get_option('mandir'), 'fr', 'man1'), rename: 'foo.1')` Support doing `install_man('foo.fr.1', locale: 'fr')`
2021-02-26interpreter: Clean up and simplify/optimize get_(external|cross)_propertyDylan Baker1-39/+20
These are both way more compilcated than they needed to be, this is a much simpler implementation, and is shared between cross and external properies.
2021-02-26interpreter: correctly track whether a subproject is initializedDylan Baker1-1/+5
The way the tracking is currently done it works if no new subprojects are added to a configured build directory. For cases where we want to add a new subproject, it fails because we don't initialize builtins for that subproject. This corrects that by checking to see if the subproject already exists, and if it doesn't initializes the bultins for it. Fixes: #8421
2021-02-26Allow printing UserOptions in the summaryStephen Gregoratto1-0/+3
2021-02-26meson: add .has_external_property() methodsTim-Philipp Müller1-0/+10
Useful in case of boolean values to distinguish between a boolean value having been set in the native/cross file and not having been provided, which can't be achieved by passing a fallback parameter to .get_external_property().
2021-02-25deprecated `meson.get_cross_property`Dylan Baker1-0/+1
It's a pure subset of `get_external_property`, and has odd behavior in host == build configurations. `get_external_property` is clear, and uses the standard `native : bool` syntax to control host vs build properties
2021-02-25interpreter: stop using hasattr for held_objectDylan Baker1-10/+4
We have unholder or isinsatnce(ObjectHolder) for that
2021-02-25interpreter: Fix ObjectHolder usageDylan Baker1-48/+52
2021-02-25Support multiple args in error()Xavier Claessens1-23/+12
Seems it got forgotten when that was added to warnings() and message(). Fixes: #8414.
2021-02-22minstall: Add --skip-subprojects optionXavier Claessens1-8/+12
By default all subprojects are installed. If --skip-subprojects is given with no value only the main project is installed. If --skip-subprojects is given with a value, it should be a coma separated list of subprojects to skip and all others will be installed. Fixes: #2550.
2021-02-17Do not validate options when finding non-matchingDylan Baker1-5/+2
This is a) useless because it's only used to print which options are not default, and b) harmful because it can result in cases where things break, like in projects that set a standard that the chosen compiler doesn't support, but the project (or some subset) can be built with a different standard. Fixes: #8360
2021-02-07Merge pull request #8162 from dcbaker/wip/2021-01/rust-module-bindgenJussi Pakkanen1-4/+2
Add a wrapper to the rust module for bindgen
2021-02-07Merge pull request #8288 from bonzini/test-setup-exclude-suitesJussi Pakkanen1-2/+5
introduce add_test_setup(exclude suites: ...) keyword argument
2021-02-07Merge pull request #8305 from xclaesse/run-target-envJussi Pakkanen1-3/+4
run_target: Add env kwarg
2021-02-06interpreter: Add annotations for CustomTargetHolderDylan Baker1-1/+1
needed in the rust module
2021-02-06Add a method to IncludeDirs to convert to string listDylan Baker1-3/+1
I'm going to use this in the rust module as well, so having a single source of truth is useful.
2021-02-06interpreter: use noPosArgs and noKwargs instead of opencodingDylan Baker1-8/+6
2021-02-05run_target: Add env kwargXavier Claessens1-3/+4
Re-implement it in backend using the same code path as for custom_target(). This for example handle setting PATH on Windows when command is an executable.
2021-02-04Introduce `fs.read` to read a file as a stringLuke Drummond1-1/+1
Following #7890, this patch introduces the ability to read the contents of a file to the fs module. This patch introduces the ability to read files at configure time, but has some restrictions: - binary files are not supported (I don't think this will prove a problem, and if people are wanting to do something with binary files, they should probably be shelling out to their own script). - Only files outside the build directory allowed. This limitation should prevent build loops. Given that reading an arbitrary file at configure time can affect the configuration in almost arbitrary ways, meson should force a reconfigure when the given file changes. This is non-configurable, but this can easily be changed with a future keyword argument.
2021-02-02interpreter, mtest: introduce add_test_setup(exclude_suites: ...)Paolo Bonzini1-2/+5
This new keyword argument makes it possible to run specific test setups only on a subset of the tests. For example, to mark some tests as slow and avoid running them by default: add_test_setup('quick', exclude_suites: ['slow'], is_default: true) add_test_setup('slow') It will then be possible to run the slow tests with either `meson test --setup slow` or `meson test --suite slow`.
2021-01-30add_install_script: add skip_if_destdir kwargXavier Claessens1-1/+6
It is common, at least in GNOME projects, to have scripts that must be run only in the final destination, to update system icon cache, etc. Skipping them from Meson ensures we can properly log that they have not been run instead of relying on such scripts to to it (they don't always).
2021-01-30Fix executable as script on WindowsXavier Claessens1-9/+6
On Windows this would fail because of missing DLL: ``` mylib = library(...) exe = executable(..., link_with: mylib) meson.add_install_script(exe) ``` The reason is on Windows we cannot rely on rpath to find libraries from build directory, they are searched in $PATH. We already have all that mechanism in place for custom_target() using ExecutableSerialisation class, so reuse it for install/dist/postconf scripts too. This has bonus side effect to also use exe_wrapper for those scripts. Fixes: #8187
2021-01-29Can read project version from a file.Jussi Pakkanen1-4/+24