summaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
Commit message (Collapse)AuthorAgeFilesLines
* shared_module: Add soname when used as a link targetNirbheek Chauhan2021-11-241-1/+1
| | | | | | | | | | | | | | 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
* valac dependencies: use the canonical list of vala source namesEli Schwartz2021-11-151-1/+1
| | | | | | | Don't hardcode one of the three possible source types, thus ignoring the needed vapis for dependencies using .gs or .vapi sources. Fixes #9544
* various manual conversion of percent-formatted strings to f-stringsEli Schwartz2021-11-011-1/+1
|
* coverage generator: obey the documentation and only generate supported outputsEli Schwartz2021-11-011-26/+34
| | | | | | | | | | | | | We say: > If version 4.2 or higher of the first is found, targets coverage-text, > coverage-xml, coverage-sonarqube and coverage-html are generated. But this is totally untrue. Make it true, by actually checking (and not generating broken coverage commands when older versions of gcovr are found). Fixes #9505
* Fix version requirement on Ninja feature.Jussi Pakkanen2021-10-291-1/+1
|
* fix various flake8 whitespace errorsEli Schwartz2021-10-271-6/+6
|
* Add --vsenv command line option and active VS only when neededXavier Claessens2021-10-101-2/+1
|
* ar linker: generate thin archives for uninstalled static librariesEli Schwartz2021-10-101-1/+1
| | | | | | | | | | | | | | Since they will never be used outside of the build directory, they do not need to literally contain the .o files, and references will be sufficient. This covers a major use of object libraries, which is that the static library would potentially take up a lot of space by including another copy of every .o file. Fixes #9292 Fixes #8057 Fixes #2129
* fix extra whitespaceEli Schwartz2021-10-041-2/+0
| | | | discovered via flake8 --select E303
* rust: dependencies need to cause a rebuild/relink not just reorderDylan Baker2021-10-011-1/+6
| | | | Otherwise changes to a dependency don't propogate
* Make custom_target() name argument optionalXavier Claessens2021-09-301-1/+2
|
* ninjabackend: Rust use Backend.generate_basic_compiler_argsDylan Baker2021-09-241-9/+1
| | | | | Instead of open coding it. This simplifies things, and fixes some missing functionality
* Add option to to transpile Cython to C++Dylan Baker2021-09-241-2/+4
| | | | | | | | | | | | | | | | This patch adds a new meson built-in option for cython, allowing it to target C++ instead of C as the intermediate language. This can, of course, be done on a per-target basis using the `override_options` keyword argument, or for the entire project in the project function. There are some things in this patch that are less than ideal. One of them is that we have to add compilers in the build layer, but there isn't a better place to do it because of per target override_options. There's also some design differences between Meson and setuptools, in that Meson only allows options on a per-target rather than a per-file granularity. Fixes #9015
* ninjabackend/vs: handle builddir on different drive from cwdRyan Kuester2021-09-201-1/+7
| | | | | | | | | When setup creates a Visual Studio environment, a message is logged which contains a path to the build directory. Typically, this path is converted to a relative path prior to printing. If the path cannot be converted to a relative path (e.g., because buildpath is on a different drive from the cwd), print out the full path instead of failing with an unhandled exception.
* backend/ninja: add generated sources to depscan order depsDylan Baker2021-09-201-2/+6
| | | | | | | | | Since we changed to using a json file to avoid over long command lines we created a situation where the generated files may not be ready when the depscan happens. To avoid that, we need to add all of the generated sources as order deps. Fixes: #9258
* apply flake8 fixes for unused imports and missing importsEli Schwartz2021-09-141-1/+1
|
* pyllint: enable consider-user-enumerateDylan Baker2021-08-311-2/+1
| | | | | | | | | | | | | | | | | | | | | | This caught a couple of cases of us doing: ```python for i in range(len(x)): v = x[i] ``` which are places to use enumerate instead. It also caught a couple of cases of: ```python assert len(x) == len(y) for i in range(len(x)): xv = x[i] yv = y[i] ``` Which should instead be using zip() ```python for xv, yv in zip(x, y): ... ```
* pylint: turn on superflous-parensDylan Baker2021-08-311-5/+5
| | | | | | | | We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
* Delete old outputs that are no longer in the Ninja file.Jussi Pakkanen2021-08-281-0/+1
|
* backends/xcode: remove unused compiler parameter from escape_extra_argsDylan Baker2021-08-201-2/+1
|
* backends: remove unused name parameter from as_meson_exe_cmdlineDylan Baker2021-08-201-4/+3
| | | | This parameter isn't used, at all, so just remove it
* ninjabackend: add missing type annotationDylan Baker2021-08-201-1/+1
| | | | | I needed to figure this out for the purposes of annotating CleanTrees anyway.
* backends: move method from ninjabackend to base classDylan Baker2021-08-201-5/+0
| | | | | | 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.
* backends/ninja: write depscan input files to jsonDylan Baker2021-08-181-9/+18
| | | | | | | | | | | | | | 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
* rust targets: lld-link is the same as link for static libsNirbheek Chauhan2021-08-171-3/+3
| | | | Without this, rustc will fail to find libfoo.a; same as with MSVC.
* Add install tagsXavier Claessens2021-08-171-0/+2
| | | | Fixes: #7007.
* Refresh Ninja cache files on regeneration.Jussi Pakkanen2021-08-151-0/+3
|
* Always generate Java rule, it is platform agnostic.Jussi Pakkanen2021-08-111-2/+1
|
* ninjabackend: use get_subdir() instead of subdir attribute for cythonDylan Baker2021-08-031-1/+1
| | | | | As this works correctly for CustomTarget, CustomTargetIndex, and GeneratedList, but .subdir doesn't work for CustomTargetIndex.
* Add support for gcovr --sonarqube reportWeston Schmidt2021-07-231-0/+7
| | | | | | | | 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>
* linkers: remove is_shared_module argument to get_soname_argsPaolo Bonzini2021-07-141-2/+1
| | | | The argument is now unused, drop it.
* do not add SONAME to shared modulesPaolo Bonzini2021-07-141-5/+6
| | | | | | | | | | | | | | | | | | 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>
* backends/ninja: only pass project specific arguments to scan-buildDylan Baker2021-07-021-1/+2
| | | | | | | | 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
* Add feed arg to custom_target()Simon Ser2021-06-291-0/+1
|
* fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger2021-06-291-5/+7
|
* holders: remove unholderDaniel Mensinger2021-06-181-2/+2
|
* Fix issue with generated Cython code in a subdirRalf Gommers2021-06-141-0/+2
| | | | | | | | | | | 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
* condense linesEli Schwartz2021-06-071-6/+3
|
* more f-strings everywhereEli Schwartz2021-06-071-27/+22
| | | | | pyupgrade didn't catch many .format() methods which were too complex (e.g. multiline or applied to templates rather than string literals)
* cython: Add an option for selecting python 3 vs python 2 outputDylan Baker2021-06-071-2/+13
|
* ninjabackend: generate cython compilation rulesDylan Baker2021-06-071-0/+61
|
* ninjabackend: cython doesn't use a linkerDylan Baker2021-06-071-4/+1
|
* add a couple more type annotationsDylan Baker2021-06-021-1/+1
|
* use an immutable list for an lru_cached functionsDylan Baker2021-06-021-6/+10
| | | | | | | | | | | | | | | | | | | | 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 ```
* Only try to get RSP syntax if RSP is supported (#8804)Dylan Baker2021-05-301-13/+23
|
* vsenv: Recommend using "meson compile" wrapperXavier Claessens2021-05-281-0/+8
| | | | | When meson has setup the VS environment, running ninja to build won't work, user should use meson wrapper to compile.
* ninjabackend.py: Implement `link_whole:` for pre-VS2015Chun-wei Fan2021-05-271-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.
* Add swift executable support in Xcode.Jussi Pakkanen2021-05-231-6/+0
|
* backends: use a set for processed targets instead of a dictDylan Baker2021-05-191-3/+3
| | | | | 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.
* ninjabackend: Fix vala type annotationsDylan Baker2021-05-191-24/+26
|