Commit Graph

1231 Commits

Author SHA1 Message Date
Jussi Pakkanen 3f380b8e1d Fix duplicated frameworks in the Xcode backend. 2021-08-21 22:33:47 +03:00
Jussi Pakkanen 85d102bc6e Fix multiple generators in target in Xcode. 2021-08-21 22:33:47 +03:00
Jussi Pakkanen 267d5385d4 Path special casing for the Xcode backend. 2021-08-21 22:33:47 +03:00
Jussi Pakkanen 12e7b3afcf Handle .C extension in Xcode. 2021-08-21 22:33:47 +03:00
Dylan Baker dffa93b853 backend/backends: use a TypedDict for introspection data
Which is easier to reason about as a human, and narrower, allowing for
more accurate type checking.
2021-08-20 18:57:19 +02:00
Dylan Baker f6f35aa906 backend/backends: Add type annotations to Backend 2021-08-20 18:57:19 +02:00
Dylan Baker 24284fd9d5 backend/backends: Add verbose to ExecutableSerialisiation initializer
There are cases in the backend like this:
```python
e = ExecutableSerialisation(...)
e.verbose = v
```
setting it from the initializer is cleaner.
2021-08-20 18:57:19 +02:00
Dylan Baker a5b6b35edb backend/backends: Add type annotations to ExecutableSerilalisation 2021-08-20 18:57:19 +02:00
Dylan Baker 6785504b53 backend/backends: Add type annotations to SubdirInstallData 2021-08-20 18:57:19 +02:00
Dylan Baker ccab6d9c84 backend/backends: Add type annotations to TargetInstallData 2021-08-20 18:57:19 +02:00
Dylan Baker 9fb19ed923 backend/backends: Add type annotations to CleanTrees 2021-08-20 18:57:19 +02:00
Dylan Baker 2664153d24 backend/backends: add type annotations to RegenInfo 2021-08-20 18:57:19 +02:00
Dylan Baker b2684a9887 backends/xcode: remove unused compiler parameter from escape_extra_args 2021-08-20 18:57:19 +02:00
Dylan Baker 0ca0e6116c backends: remove unused name parameter from as_meson_exe_cmdline
This parameter isn't used, at all, so just remove it
2021-08-20 18:57:19 +02:00
Dylan Baker 2a70c039bf ninjabackend: add missing type annotation
I needed to figure this out for the purposes of annotating CleanTrees
anyway.
2021-08-20 18:57:19 +02:00
Dylan Baker 0bc77c604f backends: move method from ninjabackend to base class
The baseclass has code that assumes said method exists, and it really
doesn't seem to do anything ninja specific, so move it to the generic
backend.
2021-08-20 18:57:19 +02:00
Dylan Baker adddb9af21 backends/vs: add a missing annotation 2021-08-20 18:57:19 +02:00
Dylan Baker 035df5369e backends/ninja: write depscan input files to json
Currently, we write each file to the command line, but this can result in
situations where the number of files passed exceeds OS imposed command
line limits. For compilers, we solve this with response files. For
depscan I've chosen to use a JSON list instead. JSON has several
advantages in that it's standardized, there's a built-in python module
for it, and it's familiar. I've also chosen to always use the JSON file
instead of having a heuristic to decide between JSON and not JSON,
while there may be a small performance trade off here, keeping the
implementation simple with only one path is wort it.

Fixes #9129
2021-08-18 11:58:45 -07:00
Nirbheek Chauhan d6243e3ebd rust targets: lld-link is the same as link for static libs
Without this, rustc will fail to find libfoo.a; same as with MSVC.
2021-08-17 19:58:23 -07:00
Xavier Claessens 8c5aa031b5 Add install tags
Fixes: #7007.
2021-08-17 15:19:18 -04:00
Jussi Pakkanen f0b16e4e83 Refresh Ninja cache files on regeneration. 2021-08-15 21:42:19 +03:00
Eli Schwartz 59d4f771d2
editorconfig: add setting to trim trailing whitespace
and clean up all outstanding issues

Skip 'test cases/common/141 special characters/meson.build' since it
intentionally uses trailing newlines.
2021-08-15 09:36:18 -04:00
Jussi Pakkanen f9d9cb174a Always generate Java rule, it is platform agnostic. 2021-08-11 21:54:54 +03:00
GustavoLCR 6a1157b2e5 Fix native targets for vs backend cross compilation 2021-08-09 11:27:10 -07:00
Dylan Baker 630a41eb81 ninjabackend: use get_subdir() instead of subdir attribute for cython
As this works correctly for CustomTarget, CustomTargetIndex, and
GeneratedList, but .subdir doesn't work for CustomTargetIndex.
2021-08-03 14:03:33 -07:00
Weston Schmidt 2e30b5a1e2 Add support for gcovr --sonarqube report
Sonarcloud.io only can read the sonarqube based report that gcovr can
produce.  This change enables support for this output in meson and
ninja.

Signed-off-by: Weston Schmidt <Weston_Schmidt@alumni.purdue.edu>
2021-07-23 22:15:00 +03:00
Paolo Bonzini 3efed376c3 linkers: remove is_shared_module argument to get_soname_args
The argument is now unused, drop it.
2021-07-14 22:53:04 +02:00
Paolo Bonzini d5535065bc do not add SONAME to shared modules
For an ELF targets, shared_module() builds a module with SONAME field
(using -Wl,-soname argument). This is wrong: only the shared_library()
needs SONAME, while shared_module() does not. Moreover, tools such as
debian's dpkg-shlibdeps use presence of SONAME field as an indicator
that this is shared library as opposed to shared module (e.g., for the
module it is okay to have unresolved symbols which are imported from
the executable which loads the module, while a library should have all
symbols resolved).

This was in fact already the behavior on Darwin; extend it to ELF
targets as well.

Fixes: #8746
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-14 22:53:04 +02:00
Eli Schwartz dd31891c1f more f-strings too complex to be caught by pyupgrade 2021-07-05 17:55:04 +03:00
Dylan Baker 210065ffe8 backends/ninja: only pass project specific arguments to scan-build
Currently all arguments are being passed to scan-build as part of the
refactoring of how Meson internally handles arguments, but that's wrong,
only project specific arguments are supposed to be passed.

Fixes: #8818
2021-07-02 17:18:02 +03:00
Simon Ser 1f3adc4dbe Add feed arg to custom_target() 2021-06-29 20:54:13 +03:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Denis Fortin 7bc57d03a5 build: fix object path for vs backend 2021-06-28 23:15:30 +03:00
Daniel Mensinger 3f889606c7 Split compiler detection from Environment
This moves all the compiler detection logic into the new
compilers.detect module. This dramatically reduces the size
and complexity of Environment.
2021-06-25 19:34:48 +02:00
Jussi Pakkanen 6e0a0fd1da
Merge pull request #8884 from dcbaker/submit/type-and-annotate-install-functions
Add annotations for the various install_* functions
2021-06-23 01:00:59 +03:00
fanc999 edfe24178d
Add Visual Studio 2012/2013 backends (#8803)
* backends: Add a Visual Studio 2013 backend

This is more-or-less a quick port from the VS2015 backend, except that
we update the Visual Studio version strings and toolset versions
accordingly.  Also correct the generator string for Visual Studio 2015
in mesonbuild/cmake/common.py.

* backend: Add VS2012 backend

Similar to what we did for Visual Studio 2013, add a Visual Studio 2012
backend.

* vs2010backend.py: Implement `link_whole:` if needed

We actually need Visual Studio 2015 Update 2 to use `/WHOLEARCHIVE:`,
which is what we are currently using for `link_whole:` on Visual Studio.
For Visual Studio versions before that, we need to expand from the
static targets that were indicated by `link_whole:`, and any of the
sub-dependent targets that were pulled in via the dependent target's
`link_whole:`.  This wil ensure `link_whole:` would actually work in
such cases.

* vs2010backend.py: Handle objects from generated sources

Unforunately, we can't use backends.determine_ext_objs() reliably, as
the Visual Studio backends handle this differently.

* vs2010backend.py: Fix generating VS2010 projects

Visual Studio 2010 (at least the Express Edition) does not set the envvar
%VisualStudioVersion% in its command prompt, so fix generating VS2010
projects by taking account into this, so that we can determine the location
of vcvarsall.bat correctly.

* whole archive test: Disable on vs2012/2013 backends too

The Visual Studio 2012/2013 IDE has problems handling the items that would be
generated from this test case, so skip this test when using
--backend=vs[2012|2013].  This test does work for the Ninja backend when
VS2012 or VS2013 is used, though.

Consolidate this error message with XCode along with the vs2010 backend.

* docs: Add the new vs2012 and vs2013 backends

Let people know that we have backends for vs2012 and 2013.  Also let
people know that generating Visual Studio 2010 projects have been fixed
and the pre-vs2015 backends now handle the `link_whole:` project option.
2021-06-22 21:00:23 +03:00
Dylan Baker d636b92c1a install_*: FileMode doesn't need to be None
There's no reason to allow None into the backend, it already has code to
check that all of the values of the FileMode object are None, so let's
use that, which is much simpler all the way down.
2021-06-22 09:13:41 -07:00
Dylan Baker f2ad5e377e backend: Headers.install_subdir is allowed to be None
But we don't properly handle that.
2021-06-22 09:12:54 -07:00
Daniel Mensinger 34c28dc92c holders: remove unholder 2021-06-18 23:48:33 +02:00
Dylan Baker 9851c25895 backends: fix TestSerialisation.suite annotations
It's a `str[]` not `str`
2021-06-14 12:30:02 -07:00
Ralf Gommers bc6df45663 Fix issue with generated Cython code in a subdir
This is a follow-up to gh-8706, which contained the initial fix
to ninjabackend.py but somehow lost it. This re-applies the fix
and adds a test for it.

Without the fix, the error is:

  ninja: error: 'ct2.pyx', needed by 'libdir/ct2.cpython-39-x86_64-linux-gnu.so.p/ct2.pyx.c',
  missing and no known rule to make it
2021-06-14 09:36:28 -07:00
Eli Schwartz 48ebfa9a99
another pyupgrade pass 2021-06-07 16:51:47 -04: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 0bc18f26a2 cython: Add an option for selecting python 3 vs python 2 output 2021-06-07 09:25:32 -07:00
Dylan Baker ec4d8143df ninjabackend: generate cython compilation rules 2021-06-07 09:16:19 -07:00
Dylan Baker 80cdbe41bd ninjabackend: cython doesn't use a linker 2021-06-07 09:16:19 -07:00
Dylan Baker 201dc64226 add a couple more type annotations 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 c6ec13e6bf
Only try to get RSP syntax if RSP is supported (#8804) 2021-05-30 00:24:53 +03:00