aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2023-06-26dependencies: defer importing a custom dependency until it is usedEli Schwartz5-86/+74
This lessens the amount of code imported at Meson startup by mapping each dependency to a dictionary entry and using a programmable import to dynamically return it. Minus 16 files and 6399 lines of code imported at startup.
2023-06-26dependencies: delay often-unused importsEli Schwartz1-4/+4
We expose detect.py as the mesonbuild.dependencies entrypoint and import it upfront everywhere. But unless the `dependency()` function is actually invoked, we don't need *any* of the private implementations for this. Avoid doing so until, as part of actual dependency lookup, we attempt that specific dependency method. This avoids importing big modules if `method:` is specified, and in most cases hopefully pkg-config works and we can avoid importing the cmake implementation particularly. Actually avoiding most of these imports requires more refactoring. But even so, the garden path no longer needs to import the dub dependency impl.
2023-06-26dependencies: Don't Repeat Yourself when it comes to lookup methodsEli Schwartz1-24/+17
We need to extend the candidates the same way per method, but we handle each method twice: once in explicit method checks, and once for auto. We can just handle auto as a special list of methods, though.
2023-06-26dependencies: move dub to a hidden package internal detailEli Schwartz2-6/+5
Do not import it and expose it at the package scope, it's never used elsewhere except inside the dub module.
2023-06-26tree-wide: reduce unneeded imports on specific Dependency implsEli Schwartz4-13/+12
We can check something's subtype using properties, without importing the module up front and doing isinstance checks on specific subclasses of the interface -- or worse, solving cyclic imports by doing the import inside the function. ;)
2023-06-26pkgconfig: move uninstalled devenv handling from setup to the module hookEli Schwartz2-5/+10
msetup.py doesn't need to know the gory details of PkgConfigDependency, or directly import it at program startup. It's also slightly wasteful to generate a devenv for the -uninstalled directory when a project doesn't even, in the end, use the pkgconfig module anyway.
2023-06-26add profiling startup import check and testcase to count itEli Schwartz1-15/+13
2023-06-25msetup: place profiling logs in the log directoryEli Schwartz1-3/+3
2023-06-25fully type mconf.pyEli Schwartz2-31/+38
2023-06-25fully type mdist.pyEli Schwartz1-21/+29
2023-06-25mdist: consolidate facts about the current dist using a dataclassEli Schwartz1-51/+67
And avoid passing variables around several functions just to finally get where they need to be. These function signatures were kind of ugly... Also the use of dataclasses makes a big chunk of this file now typed properly.
2023-06-25mdist: refactor lots of code into VCS-specific classesEli Schwartz1-153/+161
Most of the dist handling is either git-specific or hg-specific. Tangling it all together makes it much harder to analyze what is going on.
2023-06-23coredata: Also clear compiler and run cachesXavier Claessens2-2/+4
2023-06-23mconf: Allow changing options and clearing cache at the same timeXavier Claessens1-5/+6
Setting options or clearing cache is also an error without a valid build directory.
2023-06-23coredata: Malformed machine file is not a Meson bugXavier Claessens1-1/+4
Fixes: #11899
2023-06-21rust: fix -C prefer-dynamic behaviorAlyssa Ross1-9/+10
I noticed when building a project that uses a proc macro that Meson passed -C prefer-dynamic for the executable, and not the proc macro, while cargo passed -C prefer-dynamic for the proc macro, but not for the executable. Meson's behavior broke setting -C panic=abort on the executable. As far as we can tell, because we explicitly pass each library path to rustc, the only thing -C prefer-dynamic affects in Meson is how the standard libraries are linked. Generally, one does not want the standard libraries to be dynamically linked, because if the Rust compiler is ever updated, anything linked against the old standard libraries will likely break, due to the lack of a stable Rust ABI. Therefore, I've reorganised Meson's behavior around the principle that the standard libraries should only be dynamically linked when Rust dynamic linking has already been opted into in some other way. The details of how this manifests are now explained in the documentation.
2023-06-20interpreter: Accept more types in default_options dict valuesXavier Claessens2-12/+15
2023-06-20interpreter: allow default_options and override_options as a dictDylan Baker5-38/+47
2023-06-20backends/vs: add sundry type annotationsEli Schwartz1-25/+28
We went from 192 mypy errors down to 144.
2023-06-20backends/xcode: simplify an obviously too-complicated functionEli Schwartz1-6/+3
This function has a pretty unique name, and a simple grep shows that it is only ever called as: ``` add_comment(PbxComment('...........')) ``` It doesn't need to include logic such as handling str. Moreover it looks like that handling was broken anyway... it handled the case where comment is type str, by constructing a new PbxComment(str) instead of PbxComment(comment), a condition that cannot ever be valid (and crashed due to other assertions). Fixes: mesonbuild/backend/xcodebackend.py:148:42: error: Argument 1 to "PbxComment" has incompatible type "type[str]"; expected "str" [arg-type]
2023-06-20delete dead code that has never been referencedEli Schwartz1-5/+0
2023-06-20backends/xcode: various sundry low-effort typing fixesEli Schwartz1-36/+36
I slapped the obvious type annotations onto a bunch of places, and got the errors down from 668 to 112.
2023-06-20backends/ninja: add sundry typing improvementsEli Schwartz1-18/+20
2023-06-20use truncating division for code that explicitly needs an intEli Schwartz1-1/+1
We are going to truncate it down below with int() anyway, no need to carry extra precision. And mypy complains if the type changes between float and int.
2023-06-20ninja backend: simplify code by using dataclassesEli Schwartz1-2/+2
2023-06-20add str.splitlines methodMartin Dørum1-0/+7
The new splitlines method on str is intended to replace usage of fs.read('whatever').strip().split('\n'). The problem with the .strip().split() approach is that it doesn't have a way to represent empty lists (an empty string becomes a list with one empty string, not an empty list), and it doesn't handle Windows-style line endings.
2023-06-19compilers: don't recommend deprecated env varAlyssa Ross1-1/+1
RUST_LD was deprecated in Meson 0.54 in favor of RUSTC_LD.
2023-06-19Add kernel and subsystem properties to machine objects.Jussi Pakkanen4-4/+66
2023-06-19Alphabetize methods in MesonMain.Jussi Pakkanen1-21/+21
2023-06-15windows: Fix windres detection for Microsoft shipped ClangL. E. Segovia1-1/+2
Clang, clang-cl, and MSVC all rely on RC.EXE to build resource files. Fixes #11845
2023-06-15Interpreter: Using executable in run_command/configure_file is not aXavier Claessens1-1/+1
bug Fixes: #11382
2023-06-14remove unnecessary typing commentsEli Schwartz1-2/+2
Although they could be moved to annotations, the truth is that they are unneeded because they get inherited from the parent class.
2023-06-14convert some FeatureDeprecated for totally broken stuff, to FeatureBrokenEli Schwartz1-6/+6
We now warn everyone equally that totally ignored sources are bad and should not be used.
2023-06-14detect and warn on non-commutative int/bool operationsEli Schwartz1-7/+9
an int only accepts operations on other ints, just like other primitive types only accept operations on values of the same type. But due to using isinstance in baseobjects "operator_call", an int primitive allowed operations on a bool, even though reversing the operator and having a bool perform operations on an int, would fail with a type error. Really, we should fail with a type error in both directions. But for stability reasons, make this a loud warning and break --fatal-meson-warnings builds.
2023-06-14add new FeatureBroken check class for annotating features that are really brokenEli Schwartz3-2/+40
This is useful for totally terrible stuff that we really dislike, but for some reason we are afraid to just use `mlog.deprecation()` and unconditionally tell people so. Apparently this is because it is totally absolutely vital that, when telling people something is so broken they should never ever ever use it no matter what, ever... we can't actually tell them that unless they bump the minimum version of Meson, because that's our standard way of introducing a **version number** to tell them when we first started warning about this. Sigh. We really want to warn people if they are doing totally broken stuff no matter what version of Meson they support, because it's not like fixing the thing that never worked is going to suddenly break old versions of meson. So. Here's some new functionality that always warns you, but also tells you when we started warning.
2023-06-14compilers: fix detection of ifx compilerEli Schwartz1-1/+1
The version output scraping for identifying strings checked for "IFORT" in parentheses after the executable name, which is probably a mistake by Intel. Current versions of ifx have "IFX" in parentheses there. Detect both. Fixes #11873
2023-06-14compilers: add logging for non c_or_cpp language detectionEli Schwartz1-11/+11
2023-06-14WIP: refactor loggable popen calls for consistencyEli Schwartz6-45/+29
2023-06-13coredata: Fix wrong stable_version valueXavier Claessens1-1/+1
2023-06-13Allow targetting Meson 1.2.0 when version is 1.1.99Xavier Claessens2-1/+11
When a project targets a dev version of Meson (e.g. 1.1.99) for experimenting, this allows to use: project(..., meson_version: '>=1.2.0') It avoids getting warnings when using FeatureNew for features introduced in 1.2.0.
2023-06-12env2mfile: Take pkg-config properties from envXavier Claessens1-0/+10
2023-06-12env2mfile: Take binaries from env for cross file tooXavier Claessens1-0/+1
2023-06-12env2mfile: Not all compilers have env for flagsXavier Claessens1-1/+3
2023-06-11ninja backend: fix cleandead deleting files that meson implicitly createsEli Schwartz1-3/+13
Specifically, when those files can be created by a build rule with one version of meson.build, and created as e.g. a shared_library alias symlink in another version of meson.build, the cleandead command will delete important files just because they don't happen to be created by ninja itself. Work around this by making a dummy rule that exists solely to insert the files into the build graph to trick ninja into not deleting them. Closes #11861
2023-06-08dependencies/llvm: strip default include dirsKarol Herbst4-5/+29
Fixes an issue with rust.bindgen if a cmake LLVM dependency with the system include_type is getting used as a dependency.
2023-06-07cargo/interpreter: Implement an interpreter for Cargo TOMLDylan Baker1-0/+451
This converts a Cargo TOML file into Meson AST Co-Authored-By: Thibault Saunier <tsaunier@igalia.com>
2023-06-07cargo/cfg: Add a parser for the rust/cargo cfg() expressionsDylan Baker1-0/+276
This uses a recursive descent parser + lexer to create an IR from cfg() expressions, which it then converts into meson IR.
2023-06-07cargo/version: add a function to convert cargo versioning to mesonDylan Baker1-0/+96
2023-06-07cargo: Add a builder module to the cargo packageDylan Baker2-0/+284
This is a helper, currently only used by cargo. It could be moved later if there are other users.
2023-06-07cargo/manifest: Add a file with type definitions of the cargo manifest formatDylan Baker1-0/+227
Co-Authored-By: Thibault Saunier <tsaunier@igalia.com>