Commit Graph

13731 Commits

Author SHA1 Message Date
Jussi Pakkanen 9e1dc30f1f Add CppNorth talk. 2023-06-25 16:27:42 +03:00
Xavier Claessens 543610468d coredata: Also clear compiler and run caches 2023-06-23 13:53:35 -04:00
Xavier Claessens 1d600b48cb mconf: Allow changing options and clearing cache at the same time
Setting options or clearing cache is also an error without a valid build
directory.
2023-06-23 13:53:35 -04:00
Xavier Claessens c16dd8d711 coredata: Malformed machine file is not a Meson bug
Fixes: #11899
2023-06-23 06:03:20 -04:00
Alyssa Ross ab17bd2393 rust: fix -C prefer-dynamic behavior
I noticed when building a project that uses a proc macro that Meson
passed -C prefer-dynamic for the executable, and not the proc macro,
while cargo passed -C prefer-dynamic for the proc macro, but not for
the executable.  Meson's behavior broke setting -C panic=abort on the
executable.

As far as we can tell, because we explicitly pass each library path to
rustc, the only thing -C prefer-dynamic affects in Meson is how the
standard libraries are linked.  Generally, one does not want the
standard libraries to be dynamically linked, because if the Rust
compiler is ever updated, anything linked against the old standard
libraries will likely break, due to the lack of a stable Rust ABI.
Therefore, I've reorganised Meson's behavior around the principle that
the standard libraries should only be dynamically linked when Rust
dynamic linking has already been opted into in some other way.  The
details of how this manifests are now explained in the documentation.
2023-06-21 18:05:16 -04:00
Paolo Borelli 548dd25c67 Clarify `environment` docs.
The object is not used only for tests, but also for `custom_target` etc.
2023-06-21 08:45:47 -04:00
Xavier Claessens 4c85a7af92 doc: Dictionaries are ordered since Meson 0.62.0
This is a side effect of requiring Python >= 3.7 which itself guarantees
dictionary order. This is now a Meson language guarantee as well which
is required for passing default_options as dict and is generally
expected by users.
2023-06-20 16:10:20 -07:00
Xavier Claessens 6f2956e76c interpreter: Accept more types in default_options dict values 2023-06-20 16:10:20 -07:00
Dylan Baker be20e0809f interpreter: allow default_options and override_options as a dict 2023-06-20 16:10:20 -07:00
Eli Schwartz d0cbda99a3
backends/vs: add sundry type annotations
We went from 192 mypy errors down to 144.
2023-06-20 16:24:46 -04:00
Eli Schwartz f38c653a75
backends/xcode: simplify an obviously too-complicated function
This function has a pretty unique name, and a simple grep shows that it
is only ever called as:
```
add_comment(PbxComment('...........'))
```

It doesn't need to include logic such as handling str. Moreover it looks
like that handling was broken anyway... it handled the case where
comment is type str, by constructing a new PbxComment(str) instead of
PbxComment(comment), a condition that cannot ever be valid (and crashed
due to other assertions).

Fixes:

mesonbuild/backend/xcodebackend.py:148:42: error: Argument 1 to "PbxComment" has incompatible type "type[str]"; expected "str"  [arg-type]
2023-06-20 16:24:45 -04:00
Eli Schwartz 50921263bd
delete dead code that has never been referenced 2023-06-20 16:24:45 -04:00
Eli Schwartz a981433705
backends/xcode: various sundry low-effort typing fixes
I slapped the obvious type annotations onto a bunch of places, and got
the errors down from 668 to 112.
2023-06-20 16:24:45 -04:00
Eli Schwartz ba27c72861
backends/ninja: add sundry typing improvements 2023-06-20 16:24:45 -04:00
Eli Schwartz aa48cdcf60
use truncating division for code that explicitly needs an int
We are going to truncate it down below with int() anyway, no need to
carry extra precision. And mypy complains if the type changes between
float and int.
2023-06-20 16:24:45 -04:00
Eli Schwartz 85e0c0a5d7
ninja backend: simplify code by using dataclasses 2023-06-20 16:24:45 -04:00
Martin Dørum e869a09bc2 add str.splitlines method
The new splitlines method on str is intended to replace usage of
fs.read('whatever').strip().split('\n').
The problem with the .strip().split() approach is that it doesn't have a
way to represent empty lists (an empty string becomes a list with one
empty string, not an empty list), and it doesn't handle Windows-style
line endings.
2023-06-20 08:28:47 -04:00
Alyssa Ross 8c766f5b5b compilers: don't recommend deprecated env var
RUST_LD was deprecated in Meson 0.54 in favor of RUSTC_LD.
2023-06-19 15:19:41 -04:00
Jussi Pakkanen b0d2a92584 Add kernel and subsystem properties to machine objects. 2023-06-19 18:03:57 +03:00
Jussi Pakkanen 23efc1abea Alphabetize methods in MesonMain. 2023-06-19 18:03:57 +03:00
Charles Brunet 35291c9672
unittests: fix test_scripts_loaded_modules matching exactly our own modules
When meson is installed as editable, setuptools adds
`__editable___meson_1_0_99_finder` to the list. This contains the string
"meson" which isn't really accurate to what we want, which is modules
that are part of the `mesonbuild.*` namespace.
2023-06-16 02:11:02 -04:00
Charles Brunet 92592015bb
unittests: skip test using symlink if not available 2023-06-16 02:11:02 -04:00
Charles Brunet 64394fcbd6
unittests: ensure terminal has 80 chars width 2023-06-16 02:10:16 -04:00
L. E. Segovia 6b2427a031 windows: Fix windres detection for Microsoft shipped Clang
Clang, clang-cl, and MSVC all rely on RC.EXE to build resource files.

Fixes #11845
2023-06-15 11:56:21 -07:00
Xavier Claessens 5e2a47e768 Interpreter: Using executable in run_command/configure_file is not a
bug

Fixes: #11382
2023-06-15 14:45:24 -04:00
Eli Schwartz f1a58a3ee6
remove unnecessary typing comments
Although they could be moved to annotations, the truth is that they are
unneeded because they get inherited from the parent class.
2023-06-14 23:12:09 -04:00
Eli Schwartz 0ea28fa637
convert some FeatureDeprecated for totally broken stuff, to FeatureBroken
We now warn everyone equally that totally ignored sources are bad and
should not be used.
2023-06-14 23:12:09 -04:00
Eli Schwartz f93f443a53
detect and warn on non-commutative int/bool operations
an int only accepts operations on other ints, just like other primitive
types only accept operations on values of the same type.

But due to using isinstance in baseobjects "operator_call", an int
primitive allowed operations on a bool, even though reversing the
operator and having a bool perform operations on an int, would fail with
a type error.

Really, we should fail with a type error in both directions. But for
stability reasons, make this a loud warning and break --fatal-meson-warnings
builds.
2023-06-14 23:12:09 -04:00
Eli Schwartz d558291abe
add new FeatureBroken check class for annotating features that are really broken
This is useful for totally terrible stuff that we really dislike, but
for some reason we are afraid to just use `mlog.deprecation()` and
unconditionally tell people so.

Apparently this is because it is totally absolutely vital that, when
telling people something is so broken they should never ever ever use it
no matter what, ever... we can't actually tell them that unless they
bump the minimum version of Meson, because that's our standard way of
introducing a **version number** to tell them when we first started
warning about this.

Sigh. We really want to warn people if they are doing totally broken
stuff no matter what version of Meson they support, because it's not
like fixing the thing that never worked is going to suddenly break old
versions of meson.

So. Here's some new functionality that always warns you, but also tells
you when we started warning.
2023-06-14 22:53:50 -04:00
Eli Schwartz d87d912e5d
compilers: fix detection of ifx compiler
The version output scraping for identifying strings checked for "IFORT"
in parentheses after the executable name, which is probably a mistake by
Intel. Current versions of ifx have "IFX" in parentheses there.

Detect both.

Fixes #11873
2023-06-14 01:04:55 -04:00
Eli Schwartz a6bf2c1e2c
compilers: add logging for non c_or_cpp language detection 2023-06-14 01:04:55 -04:00
Eli Schwartz aa13c46822
WIP: refactor loggable popen calls for consistency 2023-06-14 01:04:55 -04:00
Xavier Claessens c503c757f1 coredata: Fix wrong stable_version value 2023-06-13 21:14:34 -04:00
Xavier Claessens d8cb62bf2b Allow targetting Meson 1.2.0 when version is 1.1.99
When a project targets a dev version of Meson (e.g. 1.1.99) for
experimenting, this allows to use:

  project(..., meson_version: '>=1.2.0')

It avoids getting warnings when using FeatureNew for features introduced
in 1.2.0.
2023-06-13 10:32:48 -04:00
Xavier Claessens dbb857dd71
env2mfile: Take pkg-config properties from env 2023-06-12 15:08:30 -04:00
Xavier Claessens 62a5673b98
env2mfile: Take binaries from env for cross file too 2023-06-12 15:08:28 -04:00
Xavier Claessens 1ab7d3b28e
env2mfile: Not all compilers have env for flags 2023-06-12 15:08:26 -04:00
Eli Schwartz 82d0d1755d
ninja backend: fix cleandead deleting files that meson implicitly creates
Specifically, when those files can be created by a build rule with one
version of meson.build, and created as e.g. a shared_library alias
symlink in another version of meson.build, the cleandead command will
delete important files just because they don't happen to be created by
ninja itself.

Work around this by making a dummy rule that exists solely to insert the
files into the build graph to trick ninja into not deleting them.

Closes #11861
2023-06-11 18:56:54 -04:00
Sébastien Villemot f2f42318ed Fix name of boost_includedir property 2023-06-08 14:31:01 -04:00
Karol Herbst 8284be8139 dependencies/llvm: strip default include dirs
Fixes an issue with rust.bindgen if a cmake LLVM dependency with the
system include_type is getting used as a dependency.
2023-06-08 09:49:29 -07:00
Dylan Baker f02e26877d cargo/interpreter: Implement an interpreter for Cargo TOML
This converts a Cargo TOML file into Meson AST

Co-Authored-By: Thibault Saunier <tsaunier@igalia.com>
2023-06-07 19:20:30 -07:00
Dylan Baker 4017dab484 cargo/cfg: Add a parser for the rust/cargo cfg() expressions
This uses a recursive descent parser + lexer to create an IR from cfg()
expressions, which it then converts into meson IR.
2023-06-07 19:20:30 -07:00
Dylan Baker 5e59e5a9e4 cargo/version: add a function to convert cargo versioning to meson 2023-06-07 19:20:30 -07:00
Dylan Baker b01ae087f5 cargo: Add a builder module to the cargo package
This is a helper, currently only used by cargo. It could be moved later
if there are other users.
2023-06-07 19:20:30 -07:00
Dylan Baker 71325547aa cargo/manifest: Add a file with type definitions of the cargo manifest format
Co-Authored-By: Thibault Saunier <tsaunier@igalia.com>
2023-06-07 19:20:30 -07:00
Eli Schwartz d28d4ac4ed
azure pipelines: force python2 to be installed
Azure pipelines is removing python2 from the hostedtoolcache, see
https://github.com/actions/runner-images/issues/7401

We want to test that meson can still build modules for it, anyway.
2023-06-07 16:40:52 -04:00
Eli Schwartz df053848eb
unittests: fix incorrect calculation of bytecompile outputs
If py2 is not found *and* the compiler is MSVC, we didn't take into
account that py2 is not found. This also meant that we didn't take into
account the expected count when it *is* found, because the python module
has a better finder than just "is the binary on PATH".
2023-06-07 16:40:52 -04:00
Eli Schwartz 7126ca6e27
tests: remove unnecessary non-meson syntax from meson.build
We don't use parentheses for the if function, because it's not a
function.
2023-06-07 16:40:52 -04:00
Eli Schwartz e2e6fd2e61
tests: update llvm version exclusions for hopefully the last time
This is now fixed upstream and expected to be backported to the next
point release.
2023-06-07 16:40:52 -04:00
Eli Schwartz 95ee4d7d13
tests: be DRY in llvm framework test
It's a lot more readable to not repeat big arrays.
2023-06-07 16:40:52 -04:00