Commit Graph

479 Commits

Author SHA1 Message Date
Daniel Mensinger 7c757dff71 holders: Fix the remaining code to respect the holder changes 2021-06-18 23:48:33 +02:00
Daniel Mensinger 34c28dc92c holders: remove unholder 2021-06-18 23:48:33 +02:00
Daniel Mensinger 84a3e459a8 holders: Introduce BothLibraries 2021-06-18 23:48:33 +02:00
Daniel Mensinger 66b32a4591 holders: Introduce HoldableObject 2021-06-18 23:48:33 +02:00
Daniel Mensinger 850f64b9ab build: textwrap.dedent() some strings 2021-06-18 23:48:33 +02:00
Dylan Baker 6d52ddf3c7 build: add type annotations for the IncludeDirs object 2021-06-18 09:52:23 -07:00
Dylan Baker a65429d57b build: Fully annotate GeneratedList 2021-06-15 12:48:53 -07:00
Dylan Baker 4e7f59d70d build: Generator add missing annotations 2021-06-15 12:48:53 -07:00
Dylan Baker 0698a50c00 build: cleanup Generator.proccess_files a bit 2021-06-15 12:48:53 -07:00
Dylan Baker c422621317 interpreterobjects|build: use typed_kwargs for generator.process 2021-06-15 12:48:53 -07:00
Dylan Baker 5952dc9818 interpreter|build: use typed_pos_args and unholder in the interpreter
For generator.process_files. Just cleaner and nicer
2021-06-15 12:48:53 -07:00
Dylan Baker 2043461b87 build: Pass name of generator to initializer
It's really a property of the Generator what name to use, not something
that should be passed to each call to process files.
2021-06-15 12:48:53 -07:00
Dylan Baker 35bdaada1d interpreter|build: Do Generator keyword argument checking in the interpreter
For qt we already have all of the necissary checking in place. Now in
the interpreter we have the same, the intrperter does all of the
checking, then passed the arguments to the Generator initializer, which
just assigns the passed values. This is nice, neat, and clean and fixes
the layering violatino between build and interpreter.
2021-06-15 12:48:53 -07:00
Dylan Baker d2c1ab40a0 interpreter|build: Pass just the executable down to Generator
This requires that the interpreter has done the validation, which it now
does at all callsites. This simplifies the Generator initializer.
2021-06-15 12:48:53 -07:00
Dylan Baker 6eff0c3f8c build: fix type annotations fo project_*_args
These are Dict[str, Dict[str, List[str]]], unlike global arguments
because they must store the information per subproject
2021-06-08 11:00:55 +02:00
Eli Schwartz 3eb1da1fa2
condense lines 2021-06-07 16:51:47 -04:00
Eli Schwartz 2c71b63e77
more f-strings everywhere
pyupgrade didn't catch many .format() methods which were too complex
(e.g. multiline or applied to templates rather than string literals)
2021-06-07 16:51:47 -04:00
Dylan Baker b9f33c2380 Add C compiler when using Cython
Since cython transpiles to C.
2021-06-07 09:17:39 -07:00
Dylan Baker 4d1cbd1b8a compilers: Add cython file suffixes 2021-06-07 09:16:19 -07:00
Dylan Baker b6eb5c231c build: Add type annotations for Generator
They're not 100% complete, but it's mostly there.
2021-06-07 09:15:09 -07:00
Dylan Baker ff0fd7d44c build: Add a type annotation to CustomTarget 2021-06-04 20:10:05 -07:00
Dylan Baker 145d92aa27 build: Use ImmutableSetProtocol for lru_cache'd value
To avoid mutation if possible.
2021-06-02 15:53:17 -07:00
Dylan Baker cfb847a1f0 build: use typing.Mapping for lru_cached dicts
Thankfully the typing module provides us an immutable protocol for
mappings, so we don't have to write one ourselves.
2021-06-02 15:53:17 -07:00
Dylan Baker 113a159514 use an immutable list for an lru_cached functions
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-02 15:53:17 -07:00
Dylan Baker a5b43aa16c Add a helper to simplify the usage of PerMachineDefaultable 2021-05-28 09:26:38 -04:00
Dylan Baker d2e7bdccd7 build: Use a PerMachineDefaultable for (project|global)[_link]_args 2021-05-28 09:26:38 -04:00
Dylan Baker f9a9faba92 build: Use a PerMachineDefaultable for dependency override cache
This way if we're doing a host == build configuration then the build and
host dependencies will be stored correctly.
2021-05-28 09:26:38 -04:00
Dylan Baker 76768eaf20 build: fix type annotation import 2021-05-28 09:26:38 -04:00
Dylan Baker 189545c2a8 build: annotate can_compile_remove_sources 2021-05-19 23:28:17 +03:00
Dylan Baker 0fd907a8cc build: Simplify BuildTarget.process_sourcelist 2021-05-19 23:28:17 +03:00
Dylan Baker 7bd7d1cd73 interpreter: Pass unholdered sources into BuildTarget
The build level shouldn't be deal with interpreter objects, by the time
they leave the intpreter they should be in the Meson middle layer
representaiton
2021-05-19 23:28:17 +03:00
Xavier Claessens 3c64ecaf86 pkgconfig: Add support for CustomTarget objects in generator
Fixes: #8618.
2021-04-19 17:57:34 +03:00
Jussi Pakkanen 68dda2a241 Xcode: fix generators that take custom targets as inputs. 2021-04-18 19:19:29 +03:00
Jussi Pakkanen 86fb916d33 Xcode: Fix source generation. 2021-04-10 20:33:51 +03:00
Xavier Claessens 3fb9311d10 Remove ConfigureFile and ConfigureFileHolder
They are not used anywhere.
2021-03-26 23:39:01 +02:00
Xavier Claessens 1be13710ad
environment(): Allow stacking append() and prepend() (#8547)
* 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-23 17:48:17 +02:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
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-19 08:47:10 -04:00
Xavier Claessens 598e968993 Add `meson devenv` command and meson.add_devenv() 2021-03-16 09:00:50 -04:00
Xavier Claessens e0fcccc6e2 EnvironmentVariables: Simplify and annotate 2021-03-16 09:00:50 -04:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Eli Schwartz 4340bf34fa
various python neatness cleanups
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-04 17:11:26 -05:00
Xavier Claessens a2cae005ec build: Fix backend type 2021-03-04 11:33:22 -05:00
Jason Woodward 50af09de03 install_man locale support
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-27 14:35:23 +02:00
Matthias Klumpp 4e5efd3897
Allow custom target output to be processed by generators 2021-02-25 20:53:41 +02:00
Xavier Claessens 2fabd4c7dc minstall: Add --skip-subprojects option
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-22 23:03:55 +02:00
Jussi Pakkanen a855bcab1c
Merge pull request #8162 from dcbaker/wip/2021-01/rust-module-bindgen
Add a wrapper to the rust module for bindgen
2021-02-07 16:57:39 +00:00
Jussi Pakkanen 034b81a09f
Merge pull request #8288 from bonzini/test-setup-exclude-suites
introduce add_test_setup(exclude suites: ...) keyword argument
2021-02-07 12:03:10 +00:00
Dylan Baker 6a568fa9ad build: Add type annotations for CustomTarget constructor
which are needed in the rust module for bindgen support.
2021-02-06 10:27:04 -08:00
Dylan Baker 5f624657a0 Add a method to IncludeDirs to convert to string list
I'm going to use this in the rust module as well, so having a single
source of truth is useful.
2021-02-06 10:27:04 -08:00
Xavier Claessens 522392e755 run_target: Add env kwarg
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-05 17:53:09 -05:00