aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
AgeCommit message (Collapse)AuthorFilesLines
2022-03-31allow RunTarget to skip wrapping due to envEli Schwartz1-1/+3
Forcing serialization on when writing out the build rule makes very little sense. It was always "forced" on because we mandated a couple of environment variables due to legacy reasons. Add an attribute to RunTarget to say that a given target doesn't *need* those environment variables, and let ninja optimize them away and run the command directly if set.
2022-03-29Target: Stop passing environment in method argsXavier Claessens1-55/+55
2022-03-29Replace backend.get_option_for_target() with target.get_option()Xavier Claessens1-16/+21
That method had nothing specific to the backend, it's purely a Target method. This allows to cache the OptionOverrideProxy object on the Target instance instead of creating a new one for each option lookup.
2022-03-29Pass environment down to base Target classXavier Claessens1-6/+8
2022-03-24build.py: Simplify uses_rust()Xavier Claessens1-19/+1
There is no need to check all source files again, if there are .rs sources then rust compiler is in self.compilers already.
2022-03-24build.py: Simplify validate_sources()Xavier Claessens1-15/+3
There is no need to go through all sources again, we already did that to populate self.compilers. When cs or java compilers are in the list, then there must be only one compiler. The code was also not considering generate sources any way.
2022-03-24Make compilers list per subprojectXavier Claessens1-103/+98
Previously subprojects inherited languages already added by main project, or any previous subproject. This change to have a list of compilers per interpreters, which means that if a subproject does not add 'c' language it won't be able to compile .c files any more, even if main project added the 'c' language. This delays processing list of compilers until the interpreter adds the BuildTarget into its list of targets. That way the interpreter can add missing languages instead of duplicating that logic into BuildTarget for the cython case.
2022-03-23Make sure we support "<lang>_args" kwarg for all languagesXavier Claessens1-25/+8
2022-03-22backends: Stop separating base and compiler optionsXavier Claessens1-6/+5
Since OptionKey is used we can mix all options together in a single dictionary. That's already what we do in coredata.options.
2022-03-22Add ability to add resources to jarsTristan Partin1-2/+6
Previously Meson lacked the ability to add resources to jar files. Fixes #9945
2022-03-18structured_sources: fix subdir handlingDylan Baker1-9/+5
We currently don't handle subdirectories correctly in structured_sources, which is problematic. To make this easier to handle correctly, I've simply changed `structured_sources` to only use Files and not strings as an implementation detail.
2022-03-13Merge pull request #9339 from dcbaker/submit/structured_sourcesJussi Pakkanen1-19/+113
Structured Sources
2022-03-07treewide: string-quote the first argument to T.castEli Schwartz1-1/+1
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
2022-03-07Add support for rust proc-macro cratesDylan Baker1-2/+4
2022-03-07build: plumb structured sources into BuildTargetsDylan Baker1-17/+56
2022-03-07build: Add structured sourcesDylan Baker1-0/+55
2022-03-07build: fix typo in type aliasDylan Baker1-1/+1
The declaration is `EnvInitValueType`, but when it's used it's `EnvValueType`.
2022-03-07build: fix type annotation issueDylan Baker1-1/+1
I noticed by inspection
2022-03-07Merge pull request #10043 from dcbaker/submit/type-checking-for-subprojectJussi Pakkanen1-4/+4
Add typing for subproject()
2022-03-07Fix default install tag for shared lib symlinksXavier Claessens1-6/+8
Versioned shared libraries should have .so file in devel, .so.1 and .so.1.2.3 in runtime. Fixes: #9811
2022-03-03interpreter: annotate the find_program chainDylan Baker1-2/+2
2022-03-03build: Add a couple of type annotations for the Interpreter to useDylan Baker1-2/+2
2022-03-03add D features to InternalDependencyRemi Thebault1-4/+11
2022-03-01build: Add a `__bool__` dunder to ConfigurationDataDylan Baker1-0/+3
Which will be used by the `configure_file` method of the interpreter.
2022-02-28Allow setting method/separator in environment() and meson.add_devenv()Xavier Claessens1-2/+7
2022-02-28devenv: Add --dump optionXavier Claessens1-0/+3
It prints all envorinmente variables that have been modified. Can be used by shell scripts that wish to setup their environment themself.
2022-02-28Change jar() default install dirTristan Partin1-0/+3
The previous install dir seemed incorrect when looking at various Linux distributions.
2022-02-16flake8: fix various whitespace errors with badly aligned codeEli Schwartz1-8/+8
2022-02-16fix a couple misuses of textwrap.dedentEli Schwartz1-3/+3
A backslash-escape of the last newline before a run of whitespace leading to the indented string ending and function termination `)` does not actually escape the entire line and make it do nothing. In fact what it does is cause all that whitespace to be part of the preceding line, and get printed. Meanwhile the textwrap.dedent documentation states that lines with only whitespace get normalized. When you *don't* mess with that final line, dedent actually does the right thing and makes the output message end with a single newline after the important text.
2022-02-14shared module: Allow linking on AndroidNirbheek Chauhan1-3/+8
Android requires shared modules that use symbols from other shared modules to be linked before they can be dlopen()ed in the correct order. Not doing so leads to a missing symbol error: https://github.com/android/ndk/issues/201 We need to always allow linking for this. Also add a soname, although it's not confirmed that it's needed, and it doesn't really hurt if it isn't needed.
2022-02-14FeatureNew: add mypy type annotations for subproject argEli Schwartz1-2/+3
Use a derived type when passing `subproject` around, so that mypy knows it's actually a SubProject, not a str. This means that passing anything other than a handle to the interpreter state's subproject attribute becomes a type violation, specifically when the order of the *four* different str arguments is typoed.
2022-02-02Genericise TI compiler and add MSP430 supportWilliam Toohey1-2/+2
2022-01-28build: replace kwargs in CustomTarget initializerDylan Baker1-147/+67
Because we don't want to pass the Interpreter kwargs into the build layer. This turned out to be a mega commit, as there's really on elegant way to make this change in an incremental way. On the nice side, mypy made this change super easy, as nearly all of the calls to `CustomTarget` are fully type checked! It also turns out that we're not handling install_tags in custom_target correctly, since we're not converting the boolean values into Optional values!
2022-01-18build: Fix return types of a couple of methodsDylan Baker1-2/+2
These don't return `Target`, they return `BuildTarget | CustomTarget | CustomTargetIndex`
2022-01-18build: Fix annotations to RunTarget and AliasTargetDylan Baker1-2/+2
RunTargets and AliasTargets may depend on RunTargets, so annotate them that way. The Gnome module relies on this internally.
2022-01-18build: move configuration_data initial value handling to build.ConfigurationDataDylan Baker1-9/+8
It really belongs here, not in the interpreter
2022-01-10first pass at migrating to dataclassesEli Schwartz1-121/+108
In some cases, init variables that accept None as a sentinel and immediately overwrite with [], are migrated to dataclass field factories. \o/ Note: dataclasses by default cannot provide eq methods, as they then become unhashable. In the future we may wish to opt into declaring them frozen, instead/additionally.
2022-01-10Merge pull request #9739 from mathstuf/armclang-supportJussi Pakkanen1-2/+2
Armclang support
2021-12-22pkgconfig: Fix linking to a custom targetXavier Claessens1-8/+11
When generating pkgconfig file for a library that links to an uninstalled static library built by custom_target() Meson was crashing when trying to access some attributes that does not exist on that class. Also fix is_internal() implementation, it only really make sense on a CustomTargetIndex or if CustomTarget has only a single output.
2021-12-17Fix mypy errorsDaniel Mensinger1-1/+1
2021-12-16armclang: extend the prefix detection for Keil armclangBen Boeckel1-2/+2
This will avoid false positives with the ARM Ltd. `armclang` compiler.
2021-12-06interpreter: allow extract_objects to receive generated sourcesPaolo Bonzini1-12/+21
Fixes: #8333
2021-12-05clean up function signatures in preparation for dataclassesEli Schwartz1-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.
2021-12-01add install_symlink functionPablo Correa Gómez1-0/+16
Allows installing symlinks directly from meson, which can become useful in multiple scenarios. Current main use is to help moving forward #9557
2021-11-27Merge pull request #9531 from dcbaker/submit/interpreter-more-typingJussi Pakkanen1-1/+1
More use of typed_* in the interpreter module
2021-11-27Remove premature return in BuildTarget.check_module_linking()Mike Gilbert1-2/+1
We want to loop over all link_targets to update backwards_compat_want_soname if necessary. Fixes: ec9bdc6edb17d1d9da5df2d6525025242c119f3a
2021-11-24shared_module: Add soname when used as a link targetNirbheek Chauhan1-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
2021-11-24build|backend: Fix some type annotationsDylan Baker1-1/+1
These currently say the take `Target`, but the really take `BuildTarget | CustomTarget | CustomTargetIndex`.
2021-11-22build: TestSetup.exe_wrapper doesn't need to be optionalDylan Baker1-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.
2021-11-20convert more mlog.deprecation into FeatureDeprecatedEli Schwartz1-2/+3