summaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
Commit message (Collapse)AuthorAgeFilesLines
* interpreter: allow extract_objects to receive generated sourcesPaolo Bonzini2021-12-061-12/+21
| | | | Fixes: #8333
* clean up function signatures in preparation for dataclassesEli Schwartz2021-12-051-12/+12
| | | | | | | | | | FeatureCheck always immediately sets extra_message to '' if it isn't explicitly passed, so there is really no point in using None as a sentinel that is never used. Names used in init functions are sometimes pointlessly different from the class instance attributes they are immediately assigned to. They would make more sense if defined properly.
* add install_symlink functionPablo Correa Gómez2021-12-011-0/+16
| | | | | | Allows installing symlinks directly from meson, which can become useful in multiple scenarios. Current main use is to help moving forward #9557
* Merge pull request #9531 from dcbaker/submit/interpreter-more-typingJussi Pakkanen2021-11-271-1/+1
|\ | | | | More use of typed_* in the interpreter module
| * build: TestSetup.exe_wrapper doesn't need to be optionalDylan Baker2021-11-221-1/+1
| | | | | | | | | | | | It works fine as-is with an empty list, and since that's easier to get using our typed_kwargs, and thus is what we're passing, go ahead and simplify the class to only take a list of strings.
* | Remove premature return in BuildTarget.check_module_linking()Mike Gilbert2021-11-271-2/+1
| | | | | | | | | | | | | | We want to loop over all link_targets to update backwards_compat_want_soname if necessary. Fixes: ec9bdc6edb17d1d9da5df2d6525025242c119f3a
* | shared_module: Add soname when used as a link targetNirbheek Chauhan2021-11-241-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Emit a detailed deprecation warning that explains what to do instead. Also add a unittest. ``` DEPRECATION: target prog links against shared module mymod, which is incorrect. This will be an error in the future, so please use shared_library() for mymod instead. If shared_module() was used for mymod because it has references to undefined symbols, use shared_libary() with `override_options: ['b_lundef=false']` instead. ``` Fixes https://github.com/mesonbuild/meson/issues/9492
* | build|backend: Fix some type annotationsDylan Baker2021-11-241-1/+1
|/ | | | | These currently say the take `Target`, but the really take `BuildTarget | CustomTarget | CustomTargetIndex`.
* convert more mlog.deprecation into FeatureDeprecatedEli Schwartz2021-11-201-2/+3
|
* fix custom_target with install: true and no install_dir, crashingEli Schwartz2021-11-021-1/+1
| | | | | | | | | It's supposed to emit an error message, but instead it did a traceback. It used to be, if no install_dir was specified then it was simply not in kwargs, but due to typed_kwargs it will now be there, but not have viable contents, so the dict membership check got skipped. Fixes #9522
* build: Add type annotations to BuildTarget.get_all_link_depsDylan Baker2021-11-011-1/+1
|
* build: Add annotations to CustomTarget.extra_dependsDylan Baker2021-11-011-2/+2
|
* build: Add a get_command method to ExecutableDylan Baker2021-11-011-0/+7
| | | | | Since Executable can be used in places where ExternalProgram is, simply having a wrapper that gives them the same API is pretty useful.
* build: IncludeDirs extend `to_string_list` method to handle builddirDylan Baker2021-11-011-2/+10
|
* build: Add type annotations for BuildTarget.include_dirsDylan Baker2021-11-011-4/+4
| | | | | The gnome module uses these, so to be able to fully type that we need this.
* Make environment objects hash deterministically.Jussi Pakkanen2021-10-291-0/+8
|
* Merge pull request #9375 from dcbaker/submit/windows-module-typingJussi Pakkanen2021-10-291-1/+1
|\ | | | | Typing for the Windows module
| * build: Add missing type annotationDylan Baker2021-10-091-1/+1
| |
* | fix various flake8 whitespace errorsEli Schwartz2021-10-271-3/+3
| |
* | Add --vsenv command line option and active VS only when neededXavier Claessens2021-10-101-0/+1
| |
* | Fix typos discovered by codespellChristian Clauss2021-10-101-1/+1
| |
* | Add support for module optionsXavier Claessens2021-10-081-0/+1
| |
* | add install_emptydir functionEli Schwartz2021-10-081-0/+14
|/ | | | | | | | | | | | | | | | | | | | 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
* backend/vs: Generate dependencies for CustomTargetIndex for a CustomTarget.Andres Freund2021-10-041-0/+2
| | | | Test & fix.
* Record build in BuildTarget.link_depends, not just output of targets.Andres Freund2021-10-041-7/+4
| | | | | | To be able to handle link_depends in backends that do not just operate on a file basis like ninja, information about the targets, not just their output is required.
* various python neatness cleanupsEli Schwartz2021-10-041-2/+2
| | | | | | | | | | | | | | | | All changes were created by running "pyupgrade --py3-only" and committing the results. Although this has been performed in the past, newer versions of pyupgrade can automatically catch more opportunities, notably list comprehensions can use generators instead, in the following cases: - unpacking into function arguments as function(*generator) - unpacking into assignments of the form x, y = generator - as the argument to some builtin functions such as min/max/sorted Also catch a few creeping cases of new code added using older styles.
* interpreter: Use typed_kwargs for func_custom_targetDylan Baker2021-09-301-12/+29
| | | | | | | | | | This does not convert the build side, or remove any of the checking it does. We still need that for other callers of custom target. What we'll do for those is add an internal interface that defaults things, then we'll be able to have those callers do their own validation, and the CustomTarget validation machinary can be removed. Fixes #9096
* build: Prepare CustomTarget.process_kwargs to co-existDylan Baker2021-09-301-19/+19
| | | | | We still need this to co-exist as long as there are interfaces for CustomTarget other than `func_custom_target`, this gets us there.
* build: Allow `Dict[OptionKey, str` in parse_overridesDylan Baker2021-09-301-1/+8
| | | | | We really want to move all of this option handling into the interpreter through the typed_kwargs, this is the first step to that
* build: Use isinstance(other, Target) instead of hasattrDylan Baker2021-09-301-4/+4
| | | | | | | | | | In the comparison methods of Target. There are several problems with the old implementation: 1. It's not idiomatic 2. It can match on things that It shouldn't (like a Compiler, which has a `get_id() -> str` method, but not one that we should compare with Targets 3. It confuses mypy, which doesn't handle hasattr
* build: Add type annotations to AliasTargetDylan Baker2021-09-301-1/+2
| | | | It's just a RunTarget with one default value overriden
* build: drop unnecissary method from RunTargetDylan Baker2021-09-301-3/+0
|
* build: Fully annotate RunTargetDylan Baker2021-09-301-5/+10
|
* build: Add full type annotations to CommandBaseDylan Baker2021-09-301-2/+3
|
* build: add forward delcarations to CommandBase classDylan Baker2021-09-301-0/+5
| | | | | | It would probably be better if CommandBase had an initializer so it could set the depend_files and dependencies attributes itself, but this will make mypy happier.
* build: Add a couple of obvious annotations to RunTargetDylan Baker2021-09-301-2/+2
|
* Make custom_target() name argument optionalXavier Claessens2021-09-301-0/+2
|
* Remove helpers.check_stringlist()Daniel Mensinger2021-09-251-0/+3
|
* compilers: Add default search path stdlib_only_link_flagsDylan Baker2021-09-251-2/+2
| | | | | | | | | This should be done in all cases of language_stdlib_only_link_flags, but I don't have access to all of the compilers to test it. This is required in cases where object files created by gfortran are linked using another compiler with a differen default search path, such as gfortran and clang together.
* Merge pull request #9167 from dcbaker/submit/meson-main-type-checkingJussi Pakkanen2021-09-241-7/+20
|\ | | | | Add type annotations and type checking to meson main
| * pylint: check for duplicate importsDylan Baker2021-09-241-2/+2
| | | | | | | | | | | | I ran into one of these from LGTM, and it would be nice if pylint could warn me as part of my local development process instead of waiting for the CI to tell me.
| * build: use an object rather than a dict for the dep_manifestDylan Baker2021-09-241-1/+14
| | | | | | | | | | | | | | | | This really is more of a struct than a dict, as the types are disjoint and they are internally handled, (ie, not from user input). This cleans some things up, in addition I spotted a bug in the ModuleState where the dict with the version and license is passed to a field that expects just the version string.
| * build: Add annotation to dist_Scripts and install_scriptsDylan Baker2021-09-241-2/+2
| |
| * build: add some missing type annotationsDylan Baker2021-09-241-3/+3
| | | | | | | | So that we can get interpreter/mesonmain.py type safe.
* | Add option to to transpile Cython to C++Dylan Baker2021-09-241-2/+34
|/ | | | | | | | | | | | | | | | This patch adds a new meson built-in option for cython, allowing it to target C++ instead of C as the intermediate language. This can, of course, be done on a per-target basis using the `override_options` keyword argument, or for the entire project in the project function. There are some things in this patch that are less than ideal. One of them is that we have to add compilers in the build layer, but there isn't a better place to do it because of per target override_options. There's also some design differences between Meson and setuptools, in that Meson only allows options on a per-target rather than a per-file granularity. Fixes #9015
* mintro: add installed_planFilipe Laíns2021-09-061-19/+22
| | | | Signed-off-by: Filipe Laíns <lains@riseup.net>
* fix repr for alias_targetEli Schwartz2021-09-011-0/+4
| | | | | | It has no command, so you cannot try printing it or it explodes with IndexError: list index out of range
* pylint: turn on superflous-parensDylan Baker2021-08-311-6/+6
| | | | | | | | We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
* build: add ability to set initial value of EnvironmentVariablesDylan Baker2021-08-301-1/+5
| | | | | Which is useful as we move the validation out of the the EnvironmentVariablesObject
* build: Fully annotate EnvironmentVariablesDylan Baker2021-08-301-6/+9
|