aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend
AgeCommit message (Collapse)AuthorFilesLines
2021-09-24Merge pull request #9167 from dcbaker/submit/meson-main-type-checkingJussi Pakkanen1-1/+2
Add type annotations and type checking to meson main
2021-09-24Add option to to transpile Cython to C++Dylan Baker1-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
2021-09-24build: use an object rather than a dict for the dep_manifestDylan Baker1-1/+2
This really is more of a struct than a dict, as the types are disjoint and they are internally handled, (ie, not from user input). This cleans some things up, in addition I spotted a bug in the ModuleState where the dict with the version and license is passed to a field that expects just the version string.
2021-09-22Merge pull request #9274 from anarazel/fix-vs-static-generatedJussi Pakkanen1-0/+3
backends/vs: Set ObjectFileName for generated sources.
2021-09-20ninjabackend/vs: handle builddir on different drive from cwdRyan Kuester1-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.
2021-09-20backends/vs: Set ObjectFileName for generated sources.Andres Freund1-0/+3
When a static library B to a static library A with generated sources, B directly references the object file corresponding to the generated source in A. For that reference in B object_filename_from_source() is used. But A did not specify the object file name, ending up with cl.exe's default. Fixes: #9235
2021-09-20backend/ninja: add generated sources to depscan order depsDylan Baker1-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
2021-09-16Fix ignored install_tag kwarg in install_subdir()Xavier Claessens1-1/+1
Fixes: #9263
2021-09-14apply flake8 fixes for unused imports and missing importsEli Schwartz1-1/+1
2021-09-14fix untested codepath? add:item() is surely a typo, not a real functionEli Schwartz1-1/+1
2021-09-14backends/vs: Do not emit dummy command for alias_command().Andres Freund1-11/+19
Alias commands did not work with the vs backend, due to trying to access target.command[0] with an empty command. Fix this by just not emitting a CustomBuild node for alias targets - the project references are enough to trigger the necessary actions. Fixes: #9247
2021-09-06mintro: add installed_planFilipe Laíns1-28/+48
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-09-01run_target: do not yield broken names with subdirsEli Schwartz1-1/+4
A run_target object created in a subdir/meson.build always has a ninja rule name of "name", not "subdir/name". Fixes #9175
2021-08-31pyllint: enable consider-user-enumerateDylan Baker3-10/+4
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): ... ```
2021-08-31pylint: turn on superflous-parensDylan Baker4-29/+29
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.
2021-08-31pylint: enable consider-iterating-dictionaryDylan Baker1-1/+1
This didn't actually catch what it's supposed to, which is cases of: ```python for x in dict.keys(): y = dict[x] ``` But it did catch one unnecessary use of keys(), and one case where we were doing something in an inefficient way. I've rewritten: ```python if name.value in [x.value for x in self.kwargs.keys() if isinstance(x, IdNode)]: ``` as ``python if any((isinstance(x, IdNode) and name.value == x.value) for x in self.kwargs): ``` Which avoids doing two iterations, one to build the list, and a second to do a search for name.value in said list, which does a single short circuiting walk, as any returns as soon as one check returns True.
2021-08-28Delete old outputs that are no longer in the Ninja file.Jussi Pakkanen1-0/+1
2021-08-21Fix duplicated frameworks in the Xcode backend.Jussi Pakkanen1-1/+7
2021-08-21Fix multiple generators in target in Xcode.Jussi Pakkanen1-2/+2
2021-08-21Path special casing for the Xcode backend.Jussi Pakkanen2-2/+10
2021-08-21Handle .C extension in Xcode.Jussi Pakkanen1-1/+4
2021-08-20backend/backends: use a TypedDict for introspection dataDylan Baker1-1/+11
Which is easier to reason about as a human, and narrower, allowing for more accurate type checking.
2021-08-20backend/backends: Add type annotations to BackendDylan Baker1-147/+223
2021-08-20backend/backends: Add verbose to ExecutableSerialisiation initializerDylan Baker1-1/+2
There are cases in the backend like this: ```python e = ExecutableSerialisation(...) e.verbose = v ``` setting it from the initializer is cleaner.
2021-08-20backend/backends: Add type annotations to ExecutableSerilalisationDylan Baker1-3/+12
2021-08-20backend/backends: Add type annotations to SubdirInstallDataDylan Baker1-1/+2
2021-08-20backend/backends: Add type annotations to TargetInstallDataDylan Baker1-3/+6
2021-08-20backend/backends: Add type annotations to CleanTreesDylan Baker1-1/+1
2021-08-20backend/backends: add type annotations to RegenInfoDylan Baker1-1/+1
2021-08-20backends/xcode: remove unused compiler parameter from escape_extra_argsDylan Baker1-2/+1
2021-08-20backends: remove unused name parameter from as_meson_exe_cmdlineDylan Baker4-10/+7
This parameter isn't used, at all, so just remove it
2021-08-20ninjabackend: add missing type annotationDylan Baker1-1/+1
I needed to figure this out for the purposes of annotating CleanTrees anyway.
2021-08-20backends: move method from ninjabackend to base classDylan Baker2-8/+8
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-20backends/vs: add a missing annotationDylan Baker1-1/+1
2021-08-18backends/ninja: write depscan input files to jsonDylan Baker1-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
2021-08-17rust targets: lld-link is the same as link for static libsNirbheek Chauhan1-3/+3
Without this, rustc will fail to find libfoo.a; same as with MSVC.
2021-08-17Add install tagsXavier Claessens2-20/+62
Fixes: #7007.
2021-08-15Refresh Ninja cache files on regeneration.Jussi Pakkanen1-0/+3
2021-08-15editorconfig: add setting to trim trailing whitespaceEli Schwartz1-15/+15
and clean up all outstanding issues Skip 'test cases/common/141 special characters/meson.build' since it intentionally uses trailing newlines.
2021-08-11Always generate Java rule, it is platform agnostic.Jussi Pakkanen1-2/+1
2021-08-09Fix native targets for vs backend cross compilationGustavoLCR1-10/+40
2021-08-03ninjabackend: use get_subdir() instead of subdir attribute for cythonDylan Baker1-1/+1
As this works correctly for CustomTarget, CustomTargetIndex, and GeneratedList, but .subdir doesn't work for CustomTargetIndex.
2021-07-23Add support for gcovr --sonarqube reportWeston Schmidt1-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>
2021-07-14linkers: remove is_shared_module argument to get_soname_argsPaolo Bonzini1-2/+1
The argument is now unused, drop it.
2021-07-14do not add SONAME to shared modulesPaolo Bonzini1-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>
2021-07-05more f-strings too complex to be caught by pyupgradeEli Schwartz1-1/+1
2021-07-02backends/ninja: only pass project specific arguments to scan-buildDylan Baker1-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
2021-06-29Add feed arg to custom_target()Simon Ser3-11/+23
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger3-9/+11
2021-06-28 build: fix object path for vs backendDenis Fortin1-1/+8