Commit Graph

1379 Commits

Author SHA1 Message Date
Ben Brown 20ac070fca Fix typo in comment 2022-04-14 14:43:50 -04:00
Eli Schwartz 8ae2bf5a9e
allow RunTarget to skip wrapping due to env
Forcing serialization on when writing out the build rule makes very
little sense. It was always "forced" on because we mandated a couple of
environment variables due to legacy reasons.

Add an attribute to RunTarget to say that a given target doesn't *need*
those environment variables, and let ninja optimize them away and run
the command directly if set.
2022-03-31 22:52:31 -04:00
Jussi Pakkanen a7356f6bf2 Handle same Framework multiple times in Xcode. 2022-03-31 21:30:16 -04:00
Jussi Pakkanen 6f24ab9407 Handle feed and capture in xcodebackend. 2022-03-31 21:30:16 -04:00
Jussi Pakkanen be63e77949 Fix typos in Xcode backend. 2022-03-30 22:32:55 +03:00
Xavier Claessens 05cfe756f1 Target: Stop passing environment in method args 2022-03-29 16:10:28 -04:00
Xavier Claessens 90310116ab Replace backend.get_option_for_target() with target.get_option()
That method had nothing specific to the backend, it's purely a Target
method. This allows to cache the OptionOverrideProxy object on the
Target instance instead of creating a new one for each option lookup.
2022-03-29 16:10:28 -04:00
Tristan Partin c65abc568c Add support for cython_args
cython_args was previoously ignored by Meson.
2022-03-23 15:44:01 -04:00
Eli Schwartz 7b78c6b41b ninja backend: do not fatally error on compdb failure
We print a warning if a compilation database isn't successfully
generated, which is good, because that gives some visibility in case the
user really wanted to use the compdb. But warnings default to being
fatal with --fatal-meson-warnings, which is not so good, because this
isn't a very important warning at all, and we'd rather not error out in
such cases when building works fine and a random bonus IDE feature
doesn't work.

Mark this particular warning as non-fatal.

Fixes side issue in https://github.com/mesonbuild/wrapdb/pull/343#issuecomment-1074545609
2022-03-23 15:46:01 +05:30
Xavier Claessens 34f442a365 OptionOverrideProxy: Handle per-subproject options 2022-03-22 17:20:48 -04:00
Xavier Claessens 86aaac8e42 backends: Stop separating base and compiler options
Since OptionKey is used we can mix all options together in a single
dictionary. That's already what we do in coredata.options.
2022-03-22 17:20:48 -04:00
Tristan Partin 39f1d52e4a Add ability to add resources to jars
Previously Meson lacked the ability to add resources to jar files.

Fixes #9945
2022-03-22 13:21:26 +02:00
Dylan Baker 9b83fc5ece ninja: fix handling of rust structured_sources in rare case
In the even that all of the inputs are generated, and they're all
generated into the same folder, and there are no subfolders, we would
fail to correctly handle all of the files after the main file. Let's fix
that.t
2022-03-21 11:26:52 -07:00
Dylan Baker f9445300b3 structured_sources: fix subdir handling
We currently don't handle subdirectories correctly in
structured_sources, which is problematic. To make this easier to handle
correctly, I've simply changed `structured_sources` to only use Files
and not strings as an implementation detail.
2022-03-18 19:46:24 -07:00
Eli Schwartz 4680c09aac mtest: fix logic bug that broke tests where the cmd is a Windows found program
In this case, the test fname might have an implicit extension and cannot
be found by `os.path.isfile()`.

We cannot use `shutil.which()` to handle platform differences, because
not all test fnames are executable -- for example Java jars.

The test representation does have an "is built" attribute which in
theory should work here, because all built targets definitely have their
full filename known to Meson, but it turns out to be misnamed. Rename it
correctly and add an actual "is built" attribute to check.

Tests which aren't built by Meson can be assumed to exist without
consulting their existence on the filesystem.

Fixes #10027
2022-03-14 01:48:16 +02:00
Jussi Pakkanen 69ade4f4cf
Merge pull request #9339 from dcbaker/submit/structured_sources
Structured Sources
2022-03-13 01:01:55 +02:00
Xavier Claessens eafb8a8e10 install: Add --strip option 2022-03-09 10:38:28 -05:00
Eli Schwartz a009eacc65
treewide: string-quote the first argument to T.cast
Using future annotations, type annotations become strings at runtime and
don't impact performance. This is not possible to do with T.cast though,
because it is a function argument instead of an annotation.

Quote the type argument everywhere in order to have the same effect as
future annotations. This also allows linters to better detect in some
cases that a given import is typing-only.
2022-03-07 19:01:04 -05:00
Dylan Baker 0d0a4fa0fe backends/ninja: Add support for structured sources with rust 2022-03-07 12:33:33 -08:00
Dylan Baker da2cdacb28 backend/ninja: add rules to copy files to the build dir 2022-03-07 12:33:33 -08:00
Xavier Claessens 01e92dc543 Fix default install tag for shared lib symlinks
Versioned shared libraries should have .so file in devel, .so.1 and
.so.1.2.3 in runtime.

Fixes: #9811
2022-03-07 09:27:02 -05:00
Xavier Claessens ac4f8d0088 devenv: Do not prepend empty list to PATH and LD_LIBRARY_PATH 2022-02-28 09:03:27 -05:00
Xavier Claessens 904b47085f backends: Cache creation of install data
It is created twice for ninja and for introspection.
2022-02-28 09:03:27 -05:00
Eli Schwartz 9daaece785
flake8: fix various whitespace errors with badly aligned code 2022-02-16 23:00:31 -05:00
Eli Schwartz baecebda0e
flake8: fix typoed whitespace surrounding tokens 2022-02-16 18:19:13 -05:00
Nirbheek Chauhan 2d56ff135e shared module: Allow linking on Android
Android requires shared modules that use symbols from other shared
modules to be linked before they can be dlopen()ed in the correct
order. Not doing so leads to a missing symbol error:
https://github.com/android/ndk/issues/201

We need to always allow linking for this. Also add a soname, although
it's not confirmed that it's needed, and it doesn't really hurt if it
isn't needed.
2022-02-14 23:30:24 -05:00
Alyssa Ross 3596b6b19a ninjabackend: fix rust program names with dashes
This substitution matches the behaviour of rustc[1] when inferring
crate name based on file name.

[1]: 4e8fb743cc/compiler/rustc_session/src/output.rs (L88)
2022-02-10 15:05:37 -08:00
Jussi Pakkanen 9a1a5c2b74
Merge pull request #9834 from bonzini/test-verbose-kwarg
New keyword argument `verbose` for tests and benchmarks
2022-02-02 20:25:55 +02:00
Zach Reizner 6383eb2279 ninjabackend: treat link_whole_targets like link_targets for Rust targets
For static library crates that depend on other internal static library
crates, all link_with targets get promoted to link_whole targets. Due to
a bug, only link_with targets are considered when generating a Rust
target for the ninja backend. This made it impossible to link a Rust
static library with another internal Rust static library.

This change fixes that issue by chaining link_whole_targets with
link_targets, just like many other languages within the ninja backend.
2022-02-02 19:36:14 +02:00
Eli Schwartz a45446b6e5
minstall: stop running ldconfig for the user
This was a nice idea in theory, but in practice it had various problems:

- On the only platform where ldconfig is expected to be run, it is
  really slow, even when the user uses a non-default prefix and ldconfig
  doesn't even have permission to run, nor can do anything useful due to
  ld.so.conf state
- On FreeBSD, it bricked the system: #9592
- On cross builds, it should not be used and broke installing, because
  ldconfig may not be runnable without binfmt + qemu: #9707
- it prints weird and confusing errors in the common "custom prefix"
  layout: #9241

Some of these problems can be or have been fixed. But it's a constant
source of footguns and complaints and for something that was originally
supposed to be just "it's the right thing to do anyway, so just do it
automatically" it is entirely too risky.

Ultimately I do not think there is justification for keeping this
feature in since it doesn't actually make everyone happy. Better for
users to decide whether they need this themselves.

This is anyways the case for cmake and autotools and generally any other
build system, so it should not be too intimidating...

Fixes #9721
2022-02-01 16:52:26 -05:00
Paolo Bonzini fc661c35a2 interpreter: support for forcibly verbose logging of some tests
Add a new keyword argument to test() and benchmark(), completing the
implementation of the feature.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-01 09:05:26 +01:00
Paolo Bonzini 3f3439522c mtest: support for forcibly verbose logging of some tests
Store in TestSerialisation whether a particular test must always be logged
verbosely.  This is particularly useful for long-running tests or when a
single Meson test() is wrapping an external test harness.  In this case,
TAP can be used by the external harness and Meson will log each subtest as
it runs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-01 09:05:26 +01:00
Eli Schwartz 5d932f31b9
backends/ninja: generate symlink aliases for rust/cs/swift libraries too
Basically the last thing we did during target processing was to generate
shlib symlinks for e.g. libfoo.so -> libfoo.so.1.

In some cases we would dispatch to another function and return early,
though, which meant we never got far enough to generate the symlinks.
This then led to breakage when people tried to compile against libfoo.so

This surely breaks -uninstalled.pc usage, and also caused problems in
https://github.com/rust-lang/rust/pull/90260
2022-02-01 01:45:55 -05:00
Nirbheek Chauhan 2512c25c0b ninja backend: Fix usage of same constants file for native and cross
For example:
```
meson builddir \
        --native-file vs2019-paths.txt \
        --native-file vs2019-win-x64.txt \
        --cross-file vs2019-paths.txt \
        --cross-file vs2019-win-arm64.txt
```
This was causing the error:

> ERROR: Multiple producers for Ninja target "/path/to/vs2019-paths.txt". Please rename your targets.

Fix it by using a set() when generating the list of regen files, and
add a test for it too.
2022-01-30 02:13:42 +05:30
Eli Schwartz a28d546795 flake8: fix wonky comment style 2022-01-27 10:48:01 -08:00
Dylan Baker 214ce0dc8b build: Fix return types of a couple of methods
These don't return `Target`, they return `BuildTarget | CustomTarget |
CustomTargetIndex`
2022-01-18 21:58:24 -05:00
Declan Qian bc8c1f578f ninja backend: Fix custom_target() console: kwarg when using env
When a custom_target() uses an env, meson uses a wrapper
script to run the executable. This breaks the console: kwarg
because the wrapper script buffers the output. Fix it by setting
the verbose flag which will not buffer output.
2022-01-12 21:22:22 +05:30
Eli Schwartz 4b351aef26
first pass at migrating to dataclasses
In some cases, init variables that accept None as a sentinel and
immediately overwrite with [], are migrated to dataclass field
factories. \o/

Note: dataclasses by default cannot provide eq methods, as they then
become unhashable. In the future we may wish to opt into declaring them
frozen, instead/additionally.
2022-01-10 18:36:57 -05:00
Eli Schwartz 6f8008cd7d
clean up even more function signatures in preparation for dataclasses
Names used in init functions are sometimes pointlessly different from
the class instance attributes they are immediately assigned to. They
would make more sense if defined properly.
2022-01-10 18:36:56 -05:00
Nirbheek Chauhan 351aee8ace Don't wipe out RPATHs specified by dependencies
Since we scan all dependencies for build-only RPATHs now (which are
removed on install), we must take care not to add build-only RPATHs
pointing to directories that dependencies explicitly add -Wl,-rpath
link args for, otherwise the paths will get wiped on install.

Caught by LinuxlikeTests::test_usage_pkgconfig_prefixes
2021-12-22 12:12:11 +05:30
Nirbheek Chauhan 06b1132f82 Set RPATH for all non-system libs with absolute paths
If a pkg-config dependency has multiple libraries in it, which is the
most common case when it has a Requires: directive, or when it has
multiple -l args in Libs: (rare), then we don't add -Wl,-rpath
directives to it when linking.

The existing test wasn't catching it because it was linking to
a pkgconfig file with a single library in it. Update the test to
demonstrate this.

This function was originally added for shared libraries in the source
directory, which explains the name:
https://github.com/mesonbuild/meson/pull/2397

However, since now it is also used for linking to *all* non-system
shared libraries that we link to with absolute paths:
https://github.com/mesonbuild/meson/pull/3092

But that PR is incomplete / wrong, because only adding RPATHs for
dependencies that specify a single library, which is simply
inconsistent. Things will work for some dependencies and not work for
others, with no logical reason for it.

We should add RPATHs for *all* libraries. There are no special length
limits for RPATHs that I can find.

For ELF, DT_RPATH or DT_RUNPATH are used, which are just stored in
a string table (DT_STRTAB). The maximum length is only a problem when
editing pre-existing tags.

For Mach-O, each RPATH is stored in a separate LC_RPATH entry so there
are no length issues there either.

Fixes https://github.com/mesonbuild/meson/issues/9543

Fixes https://github.com/mesonbuild/meson/issues/4372
2021-12-22 12:12:11 +05:30
Dylan Baker 05d61b4c66 install: Don't run ldconfig on cross builds
Even if we install without a DESTDIR set, we should never update
ldconfig when cross compiling.

Fixes #9707
2021-12-11 21:31:59 +02:00
Paolo Bonzini 18408f82d1 allow passing a CustomTargetIndex as argument to a test
Fixes: #7585
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-06 13:27:12 -08:00
Paolo Bonzini 2ef06618e2 pass all outputs of a custom_target as arguments to a test
Meson was passing only the first output and warning about it.  To do this
easily, refactor construct_target_rel_path to return a list.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-06 13:27:12 -08:00
complexoctonion 798f5ef178 Fix performance regression in build file generation
Re-use any already determined rpaths for a target.

Fixes #9695
2021-12-06 09:27:02 -05:00
Eli Schwartz 5b7d4f8bd3
rename exe_runner to exe_wrapper everywhere
I don't understand the purpose of this confusing API naming split.
2021-12-05 11:39:20 -05:00
Pablo Correa Gómez 4f882ff8ec add install_symlink function
Allows installing symlinks directly from meson, which can
become useful in multiple scenarios. Current main use is to
help moving forward #9557
2021-12-01 13:59:54 -05:00
Eli Schwartz 99d809b59d
fix BSD ldconfig handling (#9631)
For libraries installed to libdir, it's not expected to have rpath
hooked up. But for non-default libdirs, the path might not get searched
by default. `ldconfig -m <libdir>` is convenient here, as it will
programmatically add a new directory to search for shared libraries, so
the resulting installed programs work out of the box.

Include the dragonfly BSD platform name, which doesn't match the 'bsd'
catch-all pattern.
2021-11-28 18:32:10 +02:00
Luke Elliott 26b102e817 Fix '# Visual Studio <>' comment in sln files with VS backend
such that Visual Studio Version Selector works.
2021-11-27 20:06:54 +02:00
Luke Elliott 39856daf9a Stop backend_startup_project from erasing the last project in a VS solution
if it is not the specified project.
2021-11-25 18:14:54 +02:00
Nirbheek Chauhan af5993fffd shared_module: Add soname when used as a link target
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
2021-11-24 23:18:53 +05:30
Dylan Baker 73bac14c8f backends/backends: recurse when looking for paths in bundled shared libraries
This previously worked because we were accidentally doing this via
mutation. However, doing this via mutation is not a good way to do it,
we should be explicit.

Fixes #9542
2021-11-24 02:23:57 +05:30
Dylan Baker f29b54dfe4 build|backend: Fix some type annotations
These currently say the take `Target`, but the really take
`BuildTarget | CustomTarget | CustomTargetIndex`.
2021-11-24 02:23:57 +05:30
Dylan Baker 2eafe9a25f backends/backends: fix typo in comment 2021-11-24 02:23:57 +05:30
Crend King 809792c223 Support Visual Studio 2022 backend 2021-11-21 08:08:11 -05:00
GustavoLCR 5924510188 Run pylint 2021-11-21 01:42:02 -05:00
GustavoLCR 2771e352bd Fix vs backend cross compilation regression 2021-11-21 01:42:02 -05:00
Eli Schwartz 680c6bb012 valac dependencies: use the canonical list of vala source names
Don't hardcode one of the three possible source types, thus ignoring the
needed vapis for dependencies using .gs or .vapi sources.

Fixes #9544
2021-11-15 15:43:43 +05:30
Moroz Oleg b72624171b Move language standard in separate method within vsbackend 2021-11-02 18:50:44 +02:00
Олег Мороз 387e846568 Fixes .vcxproj for vs2017 vs2019
fixes #6314

in case of backend is vs2017 or vs2019 place LanguageStandard tag with stdcpp version and LanguageStandard_C tag with stdc version in .vcxproj file
2021-11-02 18:50:44 +02:00
Eli Schwartz 038b31e72b
various manual conversion of percent-formatted strings to f-strings 2021-11-01 20:26:18 -04:00
Eli Schwartz ab1741659e
fix typoed vs backend token 2021-11-01 20:22:34 -04:00
Eli Schwartz 0f0b1f22d2
coverage generator: obey the documentation and only generate supported outputs
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
2021-11-01 18:57:14 -04:00
Jussi Pakkanen ff38803d58 Fix version requirement on Ninja feature. 2021-10-29 22:48:35 +03:00
Jussi Pakkanen c1b686e395 Make environment objects hash deterministically. 2021-10-29 22:47:06 +03:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Xavier Claessens 928078982c Add --vsenv command line option and active VS only when needed 2021-10-10 23:15:18 +03:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Eli Schwartz 0a3a9fa0c3
ar linker: generate thin archives for uninstalled static libraries
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
2021-10-10 13:32:22 -04:00
Jussi Pakkanen 046d088549
Merge pull request #9373 from anarazel/vs-build-speed
backend/vs: Parallelize compilation inside one project
2021-10-10 14:26:11 +03:00
Eli Schwartz 108bd996ee
add install_emptydir function
This replaces the absolute hack of using

```
install_subdir('nonexisting', install_dir: 'share')
```

which requires you to make sure you don't accidentally or deliberately
have a completely different directory with the same name in your source
tree that is full of files you don't want installed. It also avoids
splitting the name in two and listing them in the wrong order.

You can also set the install mode of each directory component by listing
them one at a time in order, and in fact create nested structures at
all.

Fixes #1604
Properly fixes #2904
2021-10-08 14:35:00 -04:00
Andres Freund 14096260c4 backend/vs: Parallelize compilation inside one project.
UseMultiToolTask allows parallelism inside a project, without requiring cl.exe
internal multi-threading (which meson generated projects currently can't use,
mainly due to specifying output filenames for each object).

TODO:
- think about making behaviour conditional on msbuild version / add comment
  why not
2021-10-08 10:10:19 -07:00
Andres Freund 1fb2818d42 backend/vs: Deduplicate basic project template.
Note that a few minor details of the output changed for some target types. I
think I called them out with XXXs in the code for now.
2021-10-08 10:09:20 -07:00
Andres Freund f2e4177c76 backend/vs: Name pch pdb files to avoid naming & lock conflicts. 2021-10-08 09:17:16 -07:00
Andres Freund 157f11dc9e backend/vs: Move Microsoft.Cpp.props to before ItemDefinitionGroup.
The main reason for this move is to make it easier to merge the copies of
project generation. But as far as I can tell, the Microsoft.Cpp.props import
also belongs before the ItemDefinitionGroup.

Originally the order seems to have been that way, but 431a9ea664 changed it in
the course of other changes.
2021-10-08 09:16:19 -07:00
Andres Freund a161873948 backend/vs: process link dependencies.
Partially-Fixes: #1799
2021-10-04 22:34:57 -04:00
Eli Schwartz 4ab70c5512
fix extra whitespace
discovered via flake8 --select E303
2021-10-04 16:29:31 -04:00
Eli Schwartz 5a8e066c56
remove useless variables that are no longer or were never used 2021-10-04 16:29:31 -04:00
Dylan Baker 73dd21036c rust: dependencies need to cause a rebuild/relink not just reorder
Otherwise changes to a dependency don't propogate
2021-10-01 12:21:31 -07:00
Xavier Claessens d2fa6d5080 Make custom_target() name argument optional 2021-09-30 12:26:19 -04:00
Dylan Baker 4f45b5937d ninjabackend: Rust use Backend.generate_basic_compiler_args
Instead of open coding it. This simplifies things, and fixes some
missing functionality
2021-09-24 18:48:48 -07:00
Jussi Pakkanen fee5cb697c
Merge pull request #9167 from dcbaker/submit/meson-main-type-checking
Add type annotations and type checking to meson main
2021-09-24 23:40:52 +03:00
Dylan Baker 68c23a6120 Add option to to transpile Cython to C++
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-24 22:56:46 +03:00
Dylan Baker d661a0cd96 build: use an object rather than a dict for the dep_manifest
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-24 10:36:05 -07:00
Jussi Pakkanen 524a95fa62
Merge pull request #9274 from anarazel/fix-vs-static-generated
backends/vs: Set ObjectFileName for generated sources.
2021-09-22 20:40:27 +03:00
Ryan Kuester 945f185146 ninjabackend/vs: handle builddir on different drive from cwd
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-20 12:14:06 -07:00
Andres Freund a8370e6d3f backends/vs: Set ObjectFileName for generated sources.
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-20 09:53:49 -07:00
Dylan Baker 40ff02268c backend/ninja: add generated sources to depscan order deps
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-20 01:25:21 -04:00
Xavier Claessens e006e2ee99 Fix ignored install_tag kwarg in install_subdir()
Fixes: #9263
2021-09-16 07:53:18 -04:00
Eli Schwartz 87e13af1c8
apply flake8 fixes for unused imports and missing imports 2021-09-14 15:55:07 -04:00
Eli Schwartz c43bad2369
fix untested codepath? add:item() is surely a typo, not a real function 2021-09-14 15:50:29 -04:00
Andres Freund fddf88ba08 backends/vs: Do not emit dummy command for alias_command().
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-14 13:38:04 -04:00
Filipe Laíns af8b55d49b mintro: add installed_plan
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-09-06 18:10:55 +02:00
Eli Schwartz 0b63dff3ba
run_target: do not yield broken names with subdirs
A run_target object created in a subdir/meson.build always has a ninja
rule name of "name", not "subdir/name".

Fixes #9175
2021-09-01 15:42:39 -04:00
Dylan Baker b60bd0e299 pyllint: enable consider-user-enumerate
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-31 16:28:54 -04:00
Dylan Baker 4d7031437c pylint: turn on superflous-parens
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-31 16:28:54 -04:00
Dylan Baker 278942a447 pylint: enable consider-iterating-dictionary
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-31 16:28:54 -04:00
Jussi Pakkanen e83ab50c06 Delete old outputs that are no longer in the Ninja file. 2021-08-28 12:42:58 +03:00
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