aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2021-06-02add a couple more type annotationsDylan Baker2-2/+2
2021-06-02build: Use ImmutableSetProtocol for lru_cache'd valueDylan Baker1-2/+2
To avoid mutation if possible.
2021-06-02build: use typing.Mapping for lru_cached dictsDylan Baker1-9/+9
Thankfully the typing module provides us an immutable protocol for mappings, so we don't have to write one ourselves.
2021-06-02use an immutable list for an lru_cached functionsDylan Baker8-21/+31
When mutable items are stored in an lru cache, changing the returned items changes the cached items as well. Therefore we want to ensure that we're not mutating them. Using the ImmutableListProtocol allows mypy to find mutations and reject them. This doesn't solve the problem of mutable values inside the values, so you could have to do things like: ```python ImmutableListProtocol[ImmutableListProtocol[str]] ``` or equally hacky. It can also be used for input types and acts a bit like C's const: ```python def foo(arg: ImmutableListProtocol[str]) -> T.List[str]: arg[1] = 'foo' # works while running, but mypy errors ```
2021-06-02adding a _typing moduleDylan Baker1-0/+114
this is a place that *must* only be imported inside a if typing.TYPE_CHECKING block. It is a mixture of smoothing over thinigs that moved from typing_extensions to typing in later python versions and useful but typing only code. This makes typing_extensions required for python versions older than 3.8 *when running mypy*. typing_extensions should *only* be imported inside an `if typing.TYPE_CHECKING` block (include the new _typing.py module) to ensure that it doesn't become a runtime dependency
2021-06-02Merge pull request #8812 from mensinda/cmakeToolchainJussi Pakkanen8-96/+203
CMake toolchain file improvements (fixes #8293)
2021-06-02Do not delete workdir in case scan-build fails.Jussi Pakkanen1-8/+13
2021-06-01typed_kwargs: Add since and deprecated annotationsXavier Claessens1-4/+15
2021-05-31interpreter: wrap access to Feature valuePaolo Bonzini1-4/+8
This will allow adding "forced-off" Feature objects in the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-31interpreter: add feature.allowed()Paolo Bonzini1-0/+6
This method simplifies the conversion of Feature objects to booleans. Often, one has to use the "not" operator in order to treat "auto" and "enabled" the same way. "allowed()" also works well in conjunction with the require method that is introduced in the next patch. For example, if get_option('foo').require(host_machine.system() == 'windows').allowed() then src += ['foo.c'] config.set10('HAVE_FOO', 1) endif can be used instead of if host_machine.system() != 'windows' if get_option('foo').enabled() error('...') endif endif if not get_option('foo').disabled() then src += ['foo.c'] config.set10('HAVE_FOO', 1) endif Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-30modules/fs: Use typed_kwargsDylan Baker1-7/+11
2021-05-30interpreterbase: Add a function for type checking keyword argumentsDylan Baker1-0/+130
2021-05-30cmake: select correct generator in toolchain.pyDaniel Mensinger4-16/+29
2021-05-30Don't use `os.path.relpath` in dist commandNaveen M K1-1/+1
This is problematic when we meson is installed in the different root(say C:) while building from another root(say D:). This is how it is done in mesonpep517 and causes problems because of that.
2021-05-30Only try to get RSP syntax if RSP is supported (#8804)Dylan Baker2-14/+24
2021-05-29cmake: exclude generated files from the buildsystem files listDaniel Mensinger1-0/+2
2021-05-29cmake: Fix CMakeToolchain (fixes #8293)Daniel Mensinger4-68/+128
Instead of guessing the internal compiler variables, Meson now runns CMake once to determine what they actually are.
2021-05-29cmake: CMakeTraceParser improvementsDaniel Mensinger2-13/+45
- handle cached CMake variables differently - associate variables with source files - better performance (str to Path and generator expressions)
2021-05-28vsenv: Recommend using "meson compile" wrapperXavier Claessens2-1/+12
When meson has setup the VS environment, running ninja to build won't work, user should use meson wrapper to compile.
2021-05-28unstable_external_project: Remove unused importsXavier Claessens1-2/+1
2021-05-28modules: Replace find_program_impl() by state.find_program()Xavier Claessens6-54/+47
2021-05-28modules: Add methods dict everywhereXavier Claessens20-19/+113
This fix calling random internal methods from meson.build as long as they were not prefixed by underscore.
2021-05-28modules: Stop using ModuleReturnValue where it's not neededXavier Claessens9-61/+45
It is only needed in functions that need to add targets to the interpreter.
2021-05-28modules: Stop using InterpreterObjectXavier Claessens7-70/+79
Custom objects returned by modules must be subclass of ModuleObject and have the state argument in its methods. Add MutableModuleObject base class for objects that needs to be deep copied on assignation.
2021-05-28modules: Remove snippet methodsXavier Claessens13-65/+38
The only advantage they have is they have the interpreter in arguments, but it's already available as self.interpreter. We should discourage usage of the interpreter API and rely on ModuleState object instead in the future. This also lift the restriction that a module method cannot add build targets, but that was not enforced for snippet methods anyway (and some modules were doing it) and it's really loose restriction as it should check for many other things if we wanted to make it consistent.
2021-05-28Remove `Microsoft.VisualStudio.Workload.WDExpress`Naveen M K1-1/+0
2021-05-28Find Visual Studio Build Tools 2019Naveen M K1-9/+19
Got the Idea from setuptools https://github.com/pypa/setuptools/blob/a5131f0b82e098da6c07a03a47f36f3a52f73fb6/setuptools/msvc.py#L176
2021-05-28Vala: Add missing FeatureNew() when C is missingXavier Claessens1-0/+1
It was previously an hard error, only permitted since 0.59.0.
2021-05-28Add a helper to simplify the usage of PerMachineDefaultableDylan Baker3-24/+29
2021-05-28build: Use a PerMachineDefaultable for (project|global)[_link]_argsDylan Baker1-4/+15
2021-05-28coredata: Use a PerMachineDefaultable for the deps cacheDylan Baker1-5/+9
2021-05-28build: Use a PerMachineDefaultable for dependency override cacheDylan Baker1-2/+8
This way if we're doing a host == build configuration then the build and host dependencies will be stored correctly.
2021-05-28mesonlib: Allow PerMachineDefaultable to take arguments at initializationDylan Baker1-2/+2
2021-05-28dependencies/zlib: System Dependency needs a clib_compiler on windowsDylan Baker1-3/+8
Otherwise it'll except when it tries to get an attribute from None that doesn't exist.
2021-05-28mesonlib: Fix return type of PerMachineDefaultable.default_missing()Dylan Baker1-1/+1
2021-05-28build: fix type annotation importDylan Baker1-1/+1
2021-05-28modules/gnome: Correctly handle generated sources for generate_girDylan Baker1-6/+12
We need to pass any generated sources down the CustomTarget inititalizers so that they will generate a dependency correctly, otherwise we get race conditions.
2021-05-27ninjabackend.py: Implement `link_whole:` for pre-VS2015Chun-wei Fan1-3/+20
...Update 2, to be exact, since the Visual Studio linker only gained the `/WHOLEARCHIVE:` feature since Visual Studio 2015 Update 2. This checks whether we have the corresponding `cl.exe` which is versioned at or after Visual Studio 2015 Update 2 before we try to apply the `/WHOLEARCHIVE:xxx` linker flag. If we aren't, use built-in methods in Meson to grab the object files of the dependent static lib's, along with the objects that were `link_whole:`'ed into them, and feed this list into the linker instead. This would make `link_whole:` work on Visual Studio 2015 Update 1 and earlier, including previous Visual Studio versions.
2021-05-23Also skip VS activation if gcc is found.Jussi Pakkanen1-0/+2
2021-05-23Fix double negative in 'No CMake binary not found'Jon Turney1-1/+1
2021-05-23Add swift executable support in Xcode.Jussi Pakkanen3-7/+14
2021-05-23Remove unnecessary hierarchical layer.Jussi Pakkanen1-10/+4
2021-05-23Remove top level sources entry as unnecessary.Jussi Pakkanen1-24/+6
2021-05-23Add meson.build files to pbxgroup.Jussi Pakkanen1-9/+31
2021-05-23Write project info in a tree structure rather than the current flat one.Jussi Pakkanen1-37/+97
2021-05-22Better detection of Visual Studio compilerJacob Nielsen1-0/+8
2021-05-19interpreter: Automatically add 'c' to languages when 'vala' is usedDylan Baker1-4/+3
This is so dumb, we can just insert C for you without you having to know that you're using C under the hood. This is nicer because: 1) Meson doesn't make the user add a language they're not explicitly using 2) If there was ever an implementaiton of Vala that didn't use C as it's assembly language, this wouldn't make any sense.
2021-05-19backends: use a set for processed targets instead of a dictDylan Baker2-4/+4
We're only interested in the keys, not in the value (which was always set to True), so a set is a better data structure anyway.
2021-05-19compilers: Add `get_debug_args` to base CompilerDylan Baker1-0/+4
This was missed, there should be an implementation in the base Compiler class, if for nothing else to help mypy
2021-05-19ninjabackend: Fix vala type annotationsDylan Baker1-24/+26